<?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.EmployeeMapper">
|
|
<select id="selectEmployeePage" resultType="com.qianwen.smartman.modules.smis.dto.EmployeeDTO">
|
select a.id,a.code,a.name,
|
a.email,a.tel,a.hire_date,
|
a.job_number,a.pin_code,a.dept_id,
|
a.post_id,a.user_id,a.role_id,a.organization_id,a.avatar,
|
<if test="_databaseId == 'mysql' ">
|
group_concat(c.name) organizationName,
|
</if>
|
<if test="_databaseId == 'dm' ">
|
wm_concat(c.name) organizationName,
|
</if>
|
a.status
|
from blade_employee a
|
join blade_common_group_of_item b on b.item_id = a.id
|
left join blade_common_group c on c.id = b.group_id
|
<where>
|
and a.is_deleted=0
|
<if test="query.postId != null and query.postId != ''">
|
and a.post_id like concat(concat('%', #{query.postId}),'%')
|
</if>
|
<if test="query.keywords != null and query.keywords != ''">
|
and a.job_number LIKE concat(#{query.keywords},'%')
|
or a.name LIKE concat(#{query.keywords},'%')
|
</if>
|
<if test="query.status != null">
|
and a.status = #{query.status}
|
</if>
|
<if test="organizationIdList != null and organizationIdList.size() > 0">
|
AND b.group_id IN
|
<foreach collection="organizationIdList" item="organizationId" open="(" separator="," close=")">
|
#{organizationId}
|
</foreach>
|
</if>
|
</where>
|
group by a.id,a.code,a.name,
|
a.email,a.tel,a.hire_date,
|
a.job_number,a.pin_code,a.dept_id,
|
a.post_id,a.user_id,a.role_id,a.organization_id,a.status,a.create_time,a.avatar
|
order by a.create_time desc,a.id desc;
|
</select>
|
<select id="getUnbindEmployeeList" resultType="com.qianwen.smartman.modules.smis.vo.GroupTreeVO">
|
SELECT b.id,b.code,b.name,b.organization_id parentId,0 isGroup
|
FROM blade_employee b
|
LEFT JOIN blade_user a ON a.id = b.user_id and a.is_deleted = 0
|
WHERE b.is_deleted = 0 and b.status = 1
|
<choose>
|
<when test="employeeId != null and employeeId != ''">
|
and (b.user_id is null OR b.user_id = '' or b.id = #{employeeId})
|
</when>
|
<otherwise>
|
and (b.user_id is null OR b.user_id = '' or b.user_id = '')
|
</otherwise>
|
</choose>
|
order by b.create_time desc,b.job_number
|
</select>
|
<select id="selectEmployeeList" resultType="com.qianwen.smartman.modules.smis.dto.EmployeeDTO">
|
select a.id,a.code,a.name,
|
a.email,a.tel,a.hire_date,
|
a.job_number,a.pin_code,a.dept_id,
|
a.post_id,a.user_id,a.role_id,a.organization_id,a.avatar,
|
<if test="_databaseId == 'mysql' ">
|
group_concat(c.name) organizationName,
|
</if>
|
<if test="_databaseId == 'dm' ">
|
wm_concat(c.name) organizationName,
|
</if>
|
a.status
|
from blade_employee a
|
join blade_common_group_of_item b on b.item_id = a.id
|
left join blade_common_group c on c.id = b.group_id
|
<where>
|
and a.is_deleted=0
|
<if test="query.postId != null and query.postId != ''">
|
and a.post_id like concat(concat('%', #{query.postId}),'%')
|
</if>
|
<if test="query.keywords != null and query.keywords != ''">
|
and a.job_number LIKE concat(#{query.keywords},'%')
|
or a.name LIKE concat(#{query.keywords},'%')
|
</if>
|
<if test="query.status != null">
|
and a.status = #{query.status}
|
</if>
|
<if test="organizationIdList != null and organizationIdList.size() > 0">
|
AND b.group_id IN
|
<foreach collection="organizationIdList" item="organizationId" open="(" separator="," close=")">
|
#{organizationId}
|
</foreach>
|
</if>
|
</where>
|
group by a.id,a.code,a.name,
|
a.email,a.tel,a.hire_date,
|
a.job_number,a.pin_code,a.dept_id,
|
a.post_id,a.user_id,a.role_id,a.organization_id,a.status,a.create_time,a.avatar
|
order by a.create_time desc,a.job_number
|
</select>
|
|
|
</mapper>
|