|
@@ -4,20 +4,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.ruoyi.system.mapper.SysUserMapper">
|
|
|
|
|
|
- <resultMap type="SysUser" id="SysUserResult">
|
|
|
- <id 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="sex" column="sex" />
|
|
|
- <result property="avatar" column="avatar" />
|
|
|
- <result property="password" column="password" />
|
|
|
- <result property="status" column="status" />
|
|
|
- <result property="delFlag" column="del_flag" />
|
|
|
- <result property="loginIp" column="login_ip" />
|
|
|
- <result property="loginDate" column="login_date" />
|
|
|
+ <resultMap type="SysUser" id="SysUserResult">
|
|
|
+ <id 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="sex" column="sex"/>
|
|
|
+ <result property="avatar" column="avatar"/>
|
|
|
+ <result property="password" column="password"/>
|
|
|
+ <result property="status" column="status"/>
|
|
|
+ <result property="delFlag" column="del_flag"/>
|
|
|
+ <result property="loginIp" column="login_ip"/>
|
|
|
+ <result property="loginDate" column="login_date"/>
|
|
|
<result property="createBy" column="create_by" />
|
|
|
<result property="createTime" column="create_time" />
|
|
|
<result property="updateBy" column="update_by" />
|
|
@@ -189,73 +189,104 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
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 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 user_id, email
|
|
|
+ from sys_user
|
|
|
+ where email = #{email}
|
|
|
+ and del_flag = '0'
|
|
|
+ limit 1
|
|
|
</select>
|
|
|
<select id="getListByPostId" resultType="com.ruoyi.common.core.domain.entity.SysUser">
|
|
|
- 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,
|
|
|
- u.tenant_id
|
|
|
- from sys_user_post sup
|
|
|
- inner join sys_user u on sup.user_id = u.id
|
|
|
- where sup.post_id = #{postId}
|
|
|
- </select>
|
|
|
+ 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,
|
|
|
+ u.tenant_id
|
|
|
+ from sys_user_post sup
|
|
|
+ inner join sys_user u on sup.user_id = u.user_id
|
|
|
+ where sup.post_id = #{postId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getListByRoleId" resultType="com.ruoyi.common.core.domain.entity.SysUser">
|
|
|
+ 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,
|
|
|
+ u.tenant_id
|
|
|
+ from sys_user_role sur
|
|
|
+ inner join sys_user u on sur.user_id = u.user_id
|
|
|
+ where sur.role_id = #{roleId}
|
|
|
+ </select>
|
|
|
|
|
|
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
|
|
- insert into sys_user(
|
|
|
- <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="sex != null and sex != ''">sex,</if>
|
|
|
- <if test="password != null and password != ''">password,</if>
|
|
|
- <if test="status != null and status != ''">status,</if>
|
|
|
- <if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
- <if test="remark != null and remark != ''">remark,</if>
|
|
|
- <if test="tenantId != null and tenantId != ''">tenant_id,</if>
|
|
|
- <if test="userType != null and userType != ''">user_type,</if>
|
|
|
- <if test="jobNumber != null and jobNumber != ''">job_number,</if>
|
|
|
- create_time
|
|
|
- )values(
|
|
|
- <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="sex != null and sex != ''">#{sex},</if>
|
|
|
- <if test="password != null and password != ''">#{password},</if>
|
|
|
- <if test="status != null and status != ''">#{status},</if>
|
|
|
- <if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
- <if test="remark != null and remark != ''">#{remark},</if>
|
|
|
- <if test="tenantId != null and tenantId != ''">#{tenantId},</if>
|
|
|
- <if test="userType != null and userType != ''">#{userType},</if>
|
|
|
- <if test="jobNumber != null and jobNumber != ''">#{jobNumber},</if>
|
|
|
- sysdate()
|
|
|
- )
|
|
|
+ insert into sys_user(
|
|
|
+ <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="sex != null and sex != ''">sex,</if>
|
|
|
+ <if test="password != null and password != ''">password,</if>
|
|
|
+ <if test="status != null and status != ''">status,</if>
|
|
|
+ <if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
+ <if test="remark != null and remark != ''">remark,</if>
|
|
|
+ <if test="tenantId != null and tenantId != ''">tenant_id,</if>
|
|
|
+ <if test="userType != null and userType != ''">user_type,</if>
|
|
|
+ <if test="jobNumber != null and jobNumber != ''">job_number,</if>
|
|
|
+ create_time
|
|
|
+ )values(
|
|
|
+ <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="sex != null and sex != ''">#{sex},</if>
|
|
|
+ <if test="password != null and password != ''">#{password},</if>
|
|
|
+ <if test="status != null and status != ''">#{status},</if>
|
|
|
+ <if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
+ <if test="remark != null and remark != ''">#{remark},</if>
|
|
|
+ <if test="tenantId != null and tenantId != ''">#{tenantId},</if>
|
|
|
+ <if test="userType != null and userType != ''">#{userType},</if>
|
|
|
+ <if test="jobNumber != null and jobNumber != ''">#{jobNumber},</if>
|
|
|
+ sysdate()
|
|
|
+ )
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateUser" parameterType="SysUser">
|