| | |
| | | |
| | | <resultMap type="SysUser" id="SysUserResult"> |
| | | <id property="userId" column="id" /> |
| | | <result property="sort" column="sort" /> |
| | | <result property="deptId" column="dept_id" /> |
| | | <result property="userName" column="account" /> |
| | | <result property="nickName" column="name" /> |
| | |
| | | <result property="remark" column="remark" /> |
| | | <result property="nameEn" column="name_en" /> |
| | | <result property="signatureUrl" column="signature_url" /> |
| | | <result property="pictureUrl" column="picture_url" /> |
| | | <result property="company" column="company" /> |
| | | <result property="roleName" column="role_name" /> |
| | | <association property="dept" javaType="SysDept" resultMap="deptResult" /> |
| | | <collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> |
| | | </resultMap> |
| | |
| | | </sql> |
| | | |
| | | <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> |
| | | select u.id, u.dept_id, u.name, u.account, u.email, u.picture_url, u.phone, 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 user u |
| | | select u.id, |
| | | u.sort, |
| | | u.dept_id, |
| | | u.name, |
| | | u.account, |
| | | u.email, |
| | | u.picture_url, |
| | | u.phone, |
| | | 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, |
| | | GROUP_CONCAT(DISTINCT sr.role_name SEPARATOR ',') AS role_name |
| | | from user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | left join sys_user_role sur on sur.user_id = u.id |
| | | left join sys_role sr on sr.role_id = sur.role_id |
| | | where u.del_flag = '0' |
| | | <if test="userId != null and userId != 0"> |
| | | AND u.id = #{userId} |
| | |
| | | <if test="deptId != null and deptId != 0"> |
| | | AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )) |
| | | </if> |
| | | group by u.id |
| | | <!-- 数据范围过滤 --> |
| | | ${params.dataScope} |
| | | ORDER BY u.sort |
| | | </select> |
| | | |
| | | <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> |
| | |
| | | <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> |
| | | insert into user( |
| | | <if test="userId != null and userId != 0">id,</if> |
| | | <if test="sort != null and sort != ''">sort,</if> |
| | | <if test="deptId != null and deptId != 0">dept_id,</if> |
| | | <if test="userName != null and userName != ''">account,</if> |
| | | <if test="nickName != null and nickName != ''">`name`,</if> |
| | |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | | <if test="sort != null and sort != ''">#{sort},</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="remark != null">remark = #{remark},</if> |
| | | <if test="nameEn != null and nameEn != ''">name_en = #{nameEn},</if> |
| | | <if test="signatureUrl != null and signatureUrl != ''">signature_url = #{signatureUrl},</if> |
| | | <if test="pictureUrl != null and pictureUrl != ''">picture_url = #{pictureUrl},</if> |
| | | <if test="company != null and company != ''">company = #{company},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | |
| | | update user set password = #{password} where account = #{userName} |
| | | </update> |
| | | |
| | | <delete id="deleteUserById" parameterType="Long"> |
| | | <delete id="deleteUserById" parameterType="Long"> |
| | | update user set del_flag = '2' where id = #{userId} |
| | | </delete> |
| | | |