|
|
|
<?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.daqing.financial.hrms.dao.DeptDao">
|
|
|
|
|
|
|
|
<!-- 可根据自己的需求,是否要使用 -->
|
|
|
|
<resultMap type="com.daqing.framework.domain.hrms.DeptEntity" id="deptMap">
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
<result property="name" column="name"/>
|
|
|
|
<result property="parentId" column="parent_id"/>
|
|
|
|
<result property="level" column="level"/>
|
|
|
|
<result property="sort" column="sort"/>
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
<result property="motifyTime" column="motify_time"/>
|
|
|
|
</resultMap>
|
|
|
|
<!-- 部门树及各级部门下的员工 -->
|
|
|
|
<select id="getMaxSort" parameterType="java.lang.Long" resultType="java.lang.Integer">
|
|
|
|
SELECT MAX(sort) FROM hrms_dept WHERE parent_id = #{parentId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getEmpDeptCount" parameterType="java.lang.Long" resultType="java.lang.Integer">
|
|
|
|
SELECT count(1) FROM hrms_employee_dept WHERE dept_id = #{deptId}
|
|
|
|
</select>
|
|
|
|
<select id="getByPositionId" resultType="com.daqing.framework.domain.hrms.DeptEntity">
|
|
|
|
SELECT
|
|
|
|
d.*
|
|
|
|
FROM
|
|
|
|
hrms_dept d
|
|
|
|
INNER JOIN hrms_dept_position dp ON d.id = dp.dept_id
|
|
|
|
WHERE
|
|
|
|
dp.position_id = #{positionId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="listDepartment" resultType="com.daqing.framework.domain.hrms.DepartmentVO">
|
|
|
|
SELECT id,name,parent_id,sort
|
|
|
|
FROM hrms_dept
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getDepartmentByParentId" parameterType="long" resultType="com.daqing.framework.domain.hrms.DepartmentVO">
|
|
|
|
SELECT id,name,parent_id,sort
|
|
|
|
FROM hrms_dept WHERE parent_id = #{parentId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|