|
|
|
<?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.PositionDao">
|
|
|
|
|
|
|
|
<!-- 可根据自己的需求,是否要使用 -->
|
|
|
|
<resultMap type="com.daqing.framework.domain.hrms.PositionEntity" id="positionMap">
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
<result property="name" column="name"/>
|
|
|
|
<result property="introduction" column="introduction"/>
|
|
|
|
<result property="sort" column="sort"/>
|
|
|
|
<result property="createUser" column="create_user"/>
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
<result property="motifyTime" column="motify_time"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<resultMap type="com.daqing.framework.domain.hrms.ext.PositionVO" id="positionVOMap">
|
|
|
|
<result property="id" column="position_id"/>
|
|
|
|
<result property="name" column="position_name"/>
|
|
|
|
<result property="deptNames" column="dept_name"/>
|
|
|
|
<result property="createUserName" column="crate_user_name"/>
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<select id="pageByCondition" resultMap="positionVOMap">
|
|
|
|
SELECT
|
|
|
|
p.`id`, position_id,
|
|
|
|
p.`name` position_name,
|
|
|
|
GROUP_CONCAT(d.`name` SEPARATOR '/') dept_name,
|
|
|
|
e.`name` crate_user_name,
|
|
|
|
p.create_time
|
|
|
|
FROM
|
|
|
|
hrms_position p
|
|
|
|
INNER JOIN hrms_dept_position dp ON p.id = dp.position_id
|
|
|
|
INNER JOIN hrms_dept d ON dp.dept_id = d.id
|
|
|
|
INNER JOIN hrms_employee e ON p.create_user = e.id
|
|
|
|
INNER JOIN hrms_user u ON e.user_id = u.id
|
|
|
|
<if test="queryMsg != null and queryMsg != ''">
|
|
|
|
WHERE
|
|
|
|
(
|
|
|
|
d.`name` LIKE CONCAT('%',#{queryMsg},'%')
|
|
|
|
OR p.`name` LIKE CONCAT('%',#{queryMsg},'%')
|
|
|
|
)
|
|
|
|
</if>
|
|
|
|
AND u.del_or_not = 0
|
|
|
|
GROUP BY
|
|
|
|
p.id
|
|
|
|
ORDER BY
|
|
|
|
p.create_time
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getCountByNameAndDeptId" resultType="java.lang.Integer">
|
|
|
|
SELECT
|
|
|
|
COUNT(1)
|
|
|
|
FROM
|
|
|
|
hrms_position p
|
|
|
|
INNER JOIN
|
|
|
|
hrms_dept_position dp
|
|
|
|
ON
|
|
|
|
p.id = dp.position_id
|
|
|
|
WHERE
|
|
|
|
dp.dept_id = #{deptId}
|
|
|
|
AND
|
|
|
|
p.name = #{name}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getCountByNameAndDeptIdAndId" resultType="java.lang.Integer">
|
|
|
|
SELECT
|
|
|
|
COUNT(1)
|
|
|
|
FROM
|
|
|
|
hrms_position p
|
|
|
|
INNER JOIN
|
|
|
|
hrms_dept_position dp
|
|
|
|
ON
|
|
|
|
p.id = dp.position_id
|
|
|
|
WHERE
|
|
|
|
dp.dept_id = #{deptId}
|
|
|
|
AND
|
|
|
|
p.name = #{name}
|
|
|
|
AND
|
|
|
|
p.id != #{id}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|