<?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.qianwen.smartman.modules.smis.mapper.OrganizationMapper">
|
|
<select id="selectOrganizationList" resultType="com.qianwen.smartman.modules.smis.dto.OrganizationDTO">
|
SELECT a.id,a.code,a.name,a.parent_id,
|
count(d.id) peopleNum,b.name parentName,a.status status
|
FROM blade_common_group a
|
LEFT JOIN blade_common_group b on b.id = a.parent_id and b.is_deleted = 0
|
AND a.group_type =b.group_type and a.group_category =b.group_category
|
LEFT JOIN blade_common_group_of_item c on c.group_id = a.id
|
LEFT JOIN blade_employee d on d.id = c.item_id and d.is_deleted = 0
|
<where>
|
a.is_deleted = 0
|
<if test="query.name != null and query.name != ''">
|
and a.name LIKE concat(#{query.name},'%')
|
</if>
|
<if test="query.status != null">
|
and a.status = #{query.status}
|
</if>
|
and a.group_type = #{query.groupType}
|
and a.group_category = #{query.groupCategory}
|
</where>
|
group by a.id,a.code,a.name,a.parent_id,b.name,a.sort,a.status
|
order by a.id desc
|
</select>
|
|
<select id="getOneEmployeeByOrganizationIdList" resultType="com.qianwen.smartman.modules.smis.entity.Employee">
|
select b.id
|
from blade_common_group_of_item a
|
join blade_employee b on b.id = a.item_id and b.is_deleted=0
|
<where>
|
<if test="organizationIdList != null and organizationIdList.size() > 0">
|
AND a.group_id IN
|
<foreach collection="organizationIdList" item="organizationId" open="(" separator="," close=")">
|
#{organizationId}
|
</foreach>
|
</if>
|
</where>
|
LIMIT 1
|
</select>
|
</mapper>
|