You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.9 KiB

3 years ago
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qs.serve.modules.sys.mapper.SysDeptMapper">
<resultMap id="sysDeptMap" type="com.qs.serve.modules.sys.entity.SysDept" >
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="code" column="code"/>
<result property="parentId" column="parent_id"/>
<result property="mgrUserId" column="mgr_user_id"/>
<result property="levelPath" column="level_path"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="mgrUserName" column="mgr_user_name"/>
</resultMap>
<sql id="sysDeptSql">
sys_dept.`id`,
sys_dept.`name`,
sys_dept.`code`,
sys_dept.`parent_id`,
sys_dept.`mgr_user_id`,
sys_dept.`level_path`,
sys_dept.`create_time`,
sys_dept.`create_by`,
sys_dept.`update_time`,
sys_dept.`update_by`
</sql>
<select id="listDept" resultType="com.qs.serve.modules.sys.entity.SysDept" resultMap="sysDeptMap">
SELECT
<include refid="sysDeptSql"/>,
sur.`name` as mgr_user_name
FROM sys_dept `sys_dept`
LEFT JOIN sys_user sur
ON sys_dept.`mgr_user_id` = sur.id
<where>
<if test="id != null and id != ''"> and id = #{id}</if>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
and `sys_dept`.`del_flag` = b'0'
</where>
</select>
</mapper>