|
|
|
@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" /> |
|
|
|
|
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> |
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<resultMap id="deptResult" type="SysDept"> |
|
|
|
|
<id property="deptId" column="dept_id" /> |
|
|
|
|
<result property="parentId" column="parent_id" /> |
|
|
|
@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
<result property="leader" column="leader" /> |
|
|
|
|
<result property="status" column="dept_status" /> |
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<resultMap id="RoleResult" type="SysRole"> |
|
|
|
|
<id property="roleId" column="role_id" /> |
|
|
|
|
<result property="roleName" column="role_name" /> |
|
|
|
@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
<result property="dataScope" column="data_scope" /> |
|
|
|
|
<result property="status" column="role_status" /> |
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<sql id="selectUserVo"> |
|
|
|
|
select u.user_type, u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.organ_code, |
|
|
|
|
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, |
|
|
|
@ -59,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
left join sys_role r on r.role_id = ur.role_id |
|
|
|
|
left join ti_enterprise_info e on u.organ_code = e.organ_code |
|
|
|
|
</sql> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> |
|
|
|
|
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader,e.organ_name as organName from sys_user u |
|
|
|
|
left join sys_dept d on u.dept_id = d.dept_id |
|
|
|
@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
<!-- 数据范围过滤 --> |
|
|
|
|
${params.dataScope} |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> |
|
|
|
|
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time |
|
|
|
|
from sys_user u |
|
|
|
@ -109,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
<!-- 数据范围过滤 --> |
|
|
|
|
${params.dataScope} |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult"> |
|
|
|
|
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time |
|
|
|
|
from sys_user u |
|
|
|
@ -127,7 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
<!-- 数据范围过滤 --> |
|
|
|
|
${params.dataScope} |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult"> |
|
|
|
|
<include refid="selectUserVo"/> |
|
|
|
|
where u.user_name = #{userName} and u.del_flag = '0' |
|
|
|
@ -140,15 +140,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
<include refid="selectUserVo"/> |
|
|
|
|
where u.user_id = #{userId} |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult"> |
|
|
|
|
select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1 |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult"> |
|
|
|
|
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1 |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> |
|
|
|
|
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 |
|
|
|
|
</select> |
|
|
|
@ -197,7 +197,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
sysdate() |
|
|
|
|
) |
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="updateUser" parameterType="SysUser"> |
|
|
|
|
update sys_user |
|
|
|
|
<set> |
|
|
|
@ -218,11 +218,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
</set> |
|
|
|
|
where user_id = #{userId} |
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="updateUserStatus" parameterType="SysUser"> |
|
|
|
|
update sys_user set status = #{status} where user_id = #{userId} |
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="updateUserAvatar" parameterType="SysUser"> |
|
|
|
|
update sys_user set avatar = #{avatar} where user_name = #{userName} |
|
|
|
|
</update> |
|
|
|
@ -241,12 +241,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
<delete id="deleteUserById" parameterType="Long"> |
|
|
|
|
update sys_user set del_flag = '2' where user_id = #{userId} |
|
|
|
|
</delete> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<delete id="deleteUserByIds" parameterType="Long"> |
|
|
|
|
update sys_user set del_flag = '2' where user_id in |
|
|
|
|
<foreach collection="array" item="userId" open="(" separator="," close=")"> |
|
|
|
|
#{userId} |
|
|
|
|
</foreach> |
|
|
|
|
</foreach> |
|
|
|
|
</delete> |
|
|
|
|
|
|
|
|
|
<select id="selectUserCount" resultType="java.lang.Integer"> |
|
|
|
@ -282,11 +282,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
ELSE '未知' |
|
|
|
|
END |
|
|
|
|
as sex, |
|
|
|
|
t3.organ_name as company |
|
|
|
|
t3.organ_name as company, |
|
|
|
|
t5.role_name as roleName, |
|
|
|
|
t1.email as email |
|
|
|
|
from sys_user t1 |
|
|
|
|
LEFT JOIN sys_dept t2 on t1.dept_id = t2.dept_id |
|
|
|
|
LEFT JOIN ti_enterprise_info t3 on t1.organ_code=t3.organ_code |
|
|
|
|
LEFT JOIN sys_role_dept t4 on t1.dept_id=t4.dept_id |
|
|
|
|
LEFT JOIN sys_role t5 on t4.role_id=t5.role_id |
|
|
|
|
where t1.user_id = #{userId} |
|
|
|
|
and t1.del_flag !=2 |
|
|
|
|
</select> |
|
|
|
|
</mapper> |
|
|
|
|
</mapper> |
|
|
|
|