93 lines
2.8 KiB
XML
93 lines
2.8 KiB
XML
<?xml version="1.0" encoding="UTF-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.AdminUserMapper">
|
|
<insert id="add" parameterType="com.ycwl.basic.model.pc.adminUser.req.AddOrUpdateAdminUserReqVO">
|
|
insert into admin_user(`id`,
|
|
`role_id`,
|
|
`account`,
|
|
`password`)
|
|
values (#{id},
|
|
#{roleId},
|
|
#{account},
|
|
#{password})
|
|
</insert>
|
|
<update id="delete">
|
|
update
|
|
admin_user
|
|
set status=0
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="resetPassword" parameterType="com.ycwl.basic.model.pc.adminUser.req.ResetPasswordReqVO">
|
|
update
|
|
admin_user
|
|
set password=#{password}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="update" parameterType="com.ycwl.basic.model.pc.adminUser.req.AddOrUpdateAdminUserReqVO">
|
|
update admin_user
|
|
set `role_id` =#{roleId}, `account`=#{account}, `name`=#{name}, `phone`=#{phone}
|
|
where id = #{id}
|
|
</update>
|
|
<update id="updatePassword">
|
|
update
|
|
admin_user
|
|
set password=#{newPwd}
|
|
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
|
|
au.id,
|
|
au.phone,
|
|
au.name,
|
|
au.account,
|
|
au.create_time,
|
|
au.status,
|
|
r.id as roleId,
|
|
r.name as roleName
|
|
from admin_user au,
|
|
role r
|
|
where au.status=1
|
|
and au.role_id = r.id
|
|
<if test="name!=null and name!=''">
|
|
and
|
|
locate(#{name},au.`name`) > 0
|
|
</if>
|
|
<if test="account!=null and account!=''">
|
|
and
|
|
locate(#{account},au.`account`) > 0
|
|
</if>
|
|
<if test="phone!=null and phone!=''">
|
|
and
|
|
locate(#{phone},au.`phone`) > 0
|
|
</if>
|
|
<if test="roleId!=null and roleId!=''">
|
|
and
|
|
r.id=#{roleId}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="login" resultType="com.ycwl.basic.model.pc.adminUser.entity.LoginEntity">
|
|
select
|
|
au.account,
|
|
au.name as staffName,
|
|
au.id as staffId,
|
|
au.password,
|
|
au.role_id
|
|
from admin_user au
|
|
where account = #{account}
|
|
and au.status = 1
|
|
</select>
|
|
|
|
<select id="getPasswordByAccount" resultType="java.lang.String">
|
|
select `password`
|
|
from admin_user
|
|
where id = #{id}
|
|
and status = 1
|
|
</select>
|
|
</mapper>
|