修改完善CRUD

This commit is contained in:
longbinbin
2024-11-29 11:39:42 +08:00
parent abf7bf9bda
commit 33b7cd630c
7 changed files with 38 additions and 56 deletions

View File

@ -4,19 +4,17 @@
<insert id="add" parameterType="com.ycwl.basic.model.pc.adminUser.req.AddOrUpdateAdminUserReqVO">
insert into admin_user(`id`,
`role_id`,
`staff_id`,
`account`,
`password`)
values (#{id},
#{roleId},
#{staffId},
#{account},
#{password})
</insert>
<update id="delete">
update
admin_user
set is_remove=1
set status=0
where id = #{id}
</update>
@ -29,59 +27,41 @@
<update id="update" parameterType="com.ycwl.basic.model.pc.adminUser.req.AddOrUpdateAdminUserReqVO">
update admin_user
set `role_id` =#{roleId},
`staff_id` =#{staffId}
set `role_id` =#{roleId}
where id = #{id}
</update>
<update id="updatePassword">
update
admin_user
set password=#{newPwd}
where staff_id = #{id}
and is_remove = 0
where id = #{id}
and status = 1
</update>
<select id="list" parameterType="com.ycwl.basic.model.pc.adminUser.req.AdminUserListReqVO"
resultType="com.ycwl.basic.model.pc.adminUser.resp.AdminUserListRespVO">
select
s.id as staffId,
au.id,
s.phone,
s.name as staffName,
s.job_no,
c.name as companyName,
s.company_id,
au.phone,
au.name,
r.id as roleId,
r.name as roleName
from admin_user au,
staff s,
company c,
role r
where au.staff_id = s.id
and au.is_remove=0
where au.status=1
and au.role_id = r.id
and s.company_id = c.id
and s.is_remove=0
<if test="name!=null and name!=''">
and
locate(#{name},s.`name`) > 0
locate(#{name},au.`name`) > 0
</if>
<if test="phone!=null and phone!=''">
and
locate(#{phone},s.`phone`) > 0
</if>
<if test="jobNo!=null and jobNo!=''">
and
locate(#{jobNo},s.`job_no`) > 0
locate(#{phone},au.`phone`) > 0
</if>
<if test="roleId!=null and roleId!=''">
and
r.id=#{roleId}
</if>
<if test="companyId!=null and companyId!=''">
and
s.company_id=#{companyId}
</if>
</select>
<select id="login" resultType="com.ycwl.basic.model.pc.adminUser.entity.LoginEntity">
@ -91,13 +71,13 @@
au.role_id
from admin_user au
where account = #{account}
and au.is_remove = 0
and au.status = 1
</select>
<select id="getPasswordByAccount" resultType="java.lang.String">
select `password`
from admin_user
where staff_id = #{id}
and is_remove = 0
where id = #{id}
and status = 1
</select>
</mapper>

View File

@ -2,8 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycwl.basic.mapper.pc.RoleMapper">
<insert id="add" parameterType="com.ycwl.basic.model.pc.role.req.AddOrUpdateRoleReqVO">
insert into role(`id`, `name`, `type`)
values (#{id}, #{name}, #{type})
insert into role(`id`, `name`)
values (#{id}, #{name})
</insert>
<update id="delete">
@ -30,8 +30,6 @@
role
where
is_remove=0
and
`type`=#{type}
<if test="name!=null and name!=''">
and
locate(#{name},`name`) > 0