|
@@ -5,12 +5,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<mapper namespace="com.ozs.system.mapper.SysUserMapper">
|
|
|
|
|
|
<resultMap type="SysUser" id="SysUserResult">
|
|
|
- <id property="userId" column="user_id" />
|
|
|
+ <id property="id" column="id"/>
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
<result property="deptId" column="dept_id" />
|
|
|
<result property="userName" column="user_name" />
|
|
|
<result property="nickName" column="nick_name" />
|
|
|
<result property="email" column="email" />
|
|
|
- <result property="phonenumber" column="phonenumber" />
|
|
|
+ <result property="phoneNum" column="phoneNum" />
|
|
|
<result property="sex" column="sex" />
|
|
|
<result property="avatar" column="avatar" />
|
|
|
<result property="password" column="password" />
|
|
@@ -47,21 +48,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectUserVo">
|
|
|
- select 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,
|
|
|
+ select u.id,u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phone_num, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
|
|
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
|
|
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
|
|
from sys_user u
|
|
|
left join sys_dept d on u.dept_id = d.dept_id
|
|
|
- left join sys_user_role ur on u.user_id = ur.user_id
|
|
|
+ left join sys_user_role ur on u.id = ur.user_id
|
|
|
left join sys_role r on r.role_id = ur.role_id
|
|
|
</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 from sys_user u
|
|
|
+ select u.id,u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phone_num, 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 from sys_user u
|
|
|
left join sys_dept d on u.dept_id = d.dept_id
|
|
|
where u.del_flag = '0'
|
|
|
- <if test="userId != null and userId != 0">
|
|
|
- AND u.user_id = #{userId}
|
|
|
+ <if test="id != null and id != 0">
|
|
|
+ AND u.id = #{id}
|
|
|
</if>
|
|
|
<if test="userName != null and userName != ''">
|
|
|
AND (
|
|
@@ -72,8 +73,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="status != null and status != ''">
|
|
|
AND u.status = #{status}
|
|
|
</if>
|
|
|
- <if test="phonenumber != null and phonenumber != ''">
|
|
|
- AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
|
|
+ <if test="phoneNum != null and phoneNum != ''">
|
|
|
+ AND u.phone_num like concat('%', #{phoneNum}, '%')
|
|
|
</if>
|
|
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
|
|
AND date_format(u.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
|
@@ -89,35 +90,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</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
|
|
|
+ select distinct u.id, u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phone_num, u.status, u.create_time
|
|
|
from sys_user u
|
|
|
left join sys_dept d on u.dept_id = d.dept_id
|
|
|
- left join sys_user_role ur on u.user_id = ur.user_id
|
|
|
+ left join sys_user_role ur on u.id = ur.user_id
|
|
|
left join sys_role r on r.role_id = ur.role_id
|
|
|
where u.del_flag = '0' and r.role_id = #{roleId}
|
|
|
<if test="userName != null and userName != ''">
|
|
|
AND u.user_name like concat('%', #{userName}, '%')
|
|
|
</if>
|
|
|
- <if test="phonenumber != null and phonenumber != ''">
|
|
|
- AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
|
|
+ <if test="phoneNum != null and phoneNum != ''">
|
|
|
+ AND u.phone_num like concat('%', #{phoneNum}, '%')
|
|
|
</if>
|
|
|
<!-- 数据范围过滤 -->
|
|
|
${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
|
|
|
+ select distinct u.id,u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phone_num, u.status, u.create_time
|
|
|
from sys_user u
|
|
|
left join sys_dept d on u.dept_id = d.dept_id
|
|
|
- left join sys_user_role ur on u.user_id = ur.user_id
|
|
|
+ left join sys_user_role ur on u.id = ur.user_id
|
|
|
left join sys_role r on r.role_id = ur.role_id
|
|
|
where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL)
|
|
|
- and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and ur.role_id = #{roleId})
|
|
|
+ and u.id not in (select u.id from sys_user u inner join sys_user_role ur on u.id = ur.user_id and ur.role_id = #{roleId})
|
|
|
<if test="userName != null and userName != ''">
|
|
|
AND u.user_name like concat('%', #{userName}, '%')
|
|
|
</if>
|
|
|
- <if test="phonenumber != null and phonenumber != ''">
|
|
|
- AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
|
|
+ <if test="phoneNum != null and phoneNum != ''">
|
|
|
+ AND u.phone_num like concat('%', #{phoneNum}, '%')
|
|
|
</if>
|
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|
|
@@ -130,30 +131,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
|
|
<include refid="selectUserVo"/>
|
|
|
- where u.user_id = #{userId}
|
|
|
+ where u.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 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 id, phonenumber from sys_user where phone_num = #{phoneNum} 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 id, email from sys_user where email = #{email} and del_flag = '0' limit 1
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
|
|
insert into sys_user(
|
|
|
+ <if test="id != null and id != 0">id,</if>
|
|
|
<if test="userId != null and userId != 0">user_id,</if>
|
|
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
|
|
<if test="userName != null and userName != ''">user_name,</if>
|
|
|
<if test="nickName != null and nickName != ''">nick_name,</if>
|
|
|
<if test="email != null and email != ''">email,</if>
|
|
|
<if test="avatar != null and avatar != ''">avatar,</if>
|
|
|
- <if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
|
|
+ <if test="phoneNum != null and phoneNum != ''">phone_num,</if>
|
|
|
<if test="sex != null and sex != ''">sex,</if>
|
|
|
<if test="password != null and password != ''">password,</if>
|
|
|
<if test="status != null and status != ''">status,</if>
|
|
@@ -161,13 +163,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
|
create_time
|
|
|
)values(
|
|
|
+ <if test="id != null and id != ''">#{id},</if>
|
|
|
<if test="userId != null and userId != ''">#{userId},</if>
|
|
|
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
|
|
<if test="userName != null and userName != ''">#{userName},</if>
|
|
|
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
|
|
<if test="email != null and email != ''">#{email},</if>
|
|
|
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
|
|
- <if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
|
|
+ <if test="phoneNum != null and phoneNum != ''">#{phoneNum},</if>
|
|
|
<if test="sex != null and sex != ''">#{sex},</if>
|
|
|
<if test="password != null and password != ''">#{password},</if>
|
|
|
<if test="status != null and status != ''">#{status},</if>
|
|
@@ -184,7 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
|
|
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
|
|
<if test="email != null ">email = #{email},</if>
|
|
|
- <if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
|
|
+ <if test="phoneNum != null ">phone_num = #{phoneNum},</if>
|
|
|
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
|
|
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
|
|
<if test="password != null and password != ''">password = #{password},</if>
|
|
@@ -195,11 +198,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
update_time = sysdate()
|
|
|
</set>
|
|
|
- where user_id = #{userId}
|
|
|
+ where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateUserStatus" parameterType="SysUser">
|
|
|
- update sys_user set status = #{status} where user_id = #{userId}
|
|
|
+ update sys_user set status = #{status} where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateUserAvatar" parameterType="SysUser">
|
|
@@ -211,11 +214,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteUserById" parameterType="Long">
|
|
|
- update sys_user set del_flag = '2' where user_id = #{userId}
|
|
|
+ update sys_user set del_flag = '2' where id = #{id}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteUserByIds" parameterType="Long">
|
|
|
- update sys_user set del_flag = '2' where user_id in
|
|
|
+ update sys_user set del_flag = '2' where id in
|
|
|
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
|
|
#{userId}
|
|
|
</foreach>
|