| | |
| | | <result property="deptId" column="dept_id"/> |
| | | <result property="delFlag" column="del_flag"/> |
| | | <result property="deptCode" column="dept_code"/> |
| | | <result property="deptName" column="dept_name"/> |
| | | <result property="deptType" column="dept_type"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | |
| | | create_time, |
| | | update_time, |
| | | dept_code, |
| | | dept_name, |
| | | dept_type |
| | | from sys_user_dept |
| | | </sql> |
| | |
| | | resultMap="SysUserDeptResult"> |
| | | <include refid="selectSysUserDeptVo"/> |
| | | <where> |
| | | del_flag=0 |
| | | <if test="userId != null "> |
| | | and user_id = #{userId} |
| | | </if> |
| | |
| | | </if> |
| | | <if test="updateTime != null "> |
| | | and update_time = #{updateTime} |
| | | </if> |
| | | <if test="deptType != null "> |
| | | and dept_type = #{deptType} |
| | | </if> |
| | | <if test="deptCode != null "> |
| | | and dept_code = #{deptCode} |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | <if test="deptCode != null "> |
| | | dept_code, |
| | | </if> |
| | | <if test="deptName != null "> |
| | | dept_name, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="userId != null">#{userId}, |
| | |
| | | </if> |
| | | <if test="deptCode != null "> |
| | | #{deptCode}, |
| | | </if> |
| | | <if test="deptName != null "> |
| | | #{deptName}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | |
| | | <if test="deptCode != null "> |
| | | dept_code = #{deptCode}, |
| | | </if> |
| | | <if test="deptName != null "> |
| | | dept_name = #{deptName}, |
| | | </if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | </update> |
| | | |
| | | <select id="selectDeptListByUserId" resultMap="deptResult"> |
| | | select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status |
| | | select d.dept_id, |
| | | d.dept_name, |
| | | d.parent_id, |
| | | d.ancestors, |
| | | d.dept_name, |
| | | d.order_num, |
| | | d.leader, |
| | | d.status as dept_status |
| | | from sys_dept d |
| | | left join sys_user_dept ud on d.dept_id = ud.dept_id |
| | | where ud.user_id = #{userId} |
| | |
| | | </update> |
| | | |
| | | |
| | | <update id="deleteSysUserDeptByCode" parameterType="String"> |
| | | update sys_user_dept |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | del_flag =1, |
| | | update_time = sysdate() |
| | | </trim> |
| | | where user_id =#{userId} and dept_code=#{deptCode} |
| | | </update> |
| | | |
| | | |
| | | </mapper> |