<?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.mindskip.xzs.repository.DepartmentExamineMapper">
|
|
<select id="pageInfo" resultType="com.mindskip.xzs.domain.vo.DepartmentExamineVO">
|
SELECT a.*,
|
GROUP_CONCAT(DISTINCT b.name) as departmentName,
|
GROUP_CONCAT(DISTINCT b2.name) as nowDepartmentName,
|
c.real_name as createUserName,
|
c2.real_name as userName
|
FROM t_department_examine a
|
LEFT JOIN t_department b ON FIND_IN_SET(b.id, a.department_ids)
|
LEFT JOIN t_department b2 ON FIND_IN_SET(b2.id, a.now_department_ids)
|
left join t_user c on a.create_user = c.id and c.deleted = 0
|
left join t_user c2 on a.user_id = c2.id and c2.deleted = 0
|
where a.deleted = 0
|
<if test="deptIds != null and deptIds.size() > 0">
|
and (
|
b.id in <foreach collection="deptIds" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
|
or b2.id in <foreach collection="deptIds" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
|
)
|
</if>
|
<if test="userName != null">
|
and c2.real_name like concat('%', #{userName}, '%')
|
</if>
|
<if test="departmentIds != null">
|
and FIND_IN_SET(#{departmentIds}, a.now_department_ids)
|
</if>
|
<if test="nowDepartmentIds != null">
|
and FIND_IN_SET(#{nowDepartmentIds}, a.now_department_ids)
|
</if>
|
GROUP BY a.id, a.create_time
|
order by a.create_time desc
|
</select>
|
</mapper>
|