2022-03-10 17:57:46 +08:00
|
|
|
<?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.engine.salary.mapper.datacollection.EmployMapper">
|
|
|
|
|
<!-- 员工基本信息 -->
|
|
|
|
|
<select id="listEmployee" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
|
|
|
|
select e.ID as employeeId,
|
|
|
|
|
e.LASTNAME as username,
|
2022-06-01 19:13:20 +08:00
|
|
|
d.DEPARTMENTNAME as departmentName,
|
|
|
|
|
e.STATUS as status
|
2022-03-10 17:57:46 +08:00
|
|
|
from hrmresource e
|
|
|
|
|
left join hrmdepartment d on e.departmentid = d.id
|
2022-06-06 10:19:11 +08:00
|
|
|
where e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
|
2022-03-10 17:57:46 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getEmployeeByIds" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
2022-05-30 17:31:29 +08:00
|
|
|
select e.id as employeeId,
|
|
|
|
|
e.lastname as username,
|
|
|
|
|
e.status as status,
|
|
|
|
|
e.workcode as workcode,
|
|
|
|
|
e.companystartdate as companystartdate,
|
2022-05-31 09:59:32 +08:00
|
|
|
e.mobile as mobile
|
2022-03-10 17:57:46 +08:00
|
|
|
from hrmresource e
|
2022-06-06 10:19:11 +08:00
|
|
|
where e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
|
2022-03-10 17:57:46 +08:00
|
|
|
<if test="collection != null and collection.size()>0">
|
2022-03-11 13:44:47 +08:00
|
|
|
AND e.id IN
|
2022-03-10 17:57:46 +08:00
|
|
|
<foreach collection="collection" open="(" item="id" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
2022-03-15 17:39:19 +08:00
|
|
|
<select id="getEmployeeByIdsAll" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
|
|
|
|
select e.id as employeeId,
|
|
|
|
|
e.lastname as username,
|
2022-04-07 16:54:10 +08:00
|
|
|
e.status as status,
|
|
|
|
|
e.workcode as workcode,
|
2022-05-25 16:51:43 +08:00
|
|
|
e.certificatenum as idNo,
|
2022-03-15 17:39:19 +08:00
|
|
|
d.departmentname as departmentName,
|
2022-04-07 16:54:10 +08:00
|
|
|
d.id as departmentId,
|
2022-03-15 17:39:19 +08:00
|
|
|
c.jobtitlename as jobtitleName,
|
2022-04-29 14:17:31 +08:00
|
|
|
c.id as jobtitleId,
|
2022-03-15 17:39:19 +08:00
|
|
|
e.companystartdate as companystartdate,
|
|
|
|
|
e.mobile as mobile,
|
|
|
|
|
b.dismissdate as dismissdate
|
|
|
|
|
from hrmresource e
|
|
|
|
|
left join hrmdepartment d on e.departmentid = d.id
|
|
|
|
|
left join hrmjobtitles c on e.jobtitle = c.id
|
|
|
|
|
left join bill_hrmdismiss b on e.id = b.resource_n
|
2022-06-06 10:19:11 +08:00
|
|
|
where e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
|
2022-03-15 17:39:19 +08:00
|
|
|
<if test="collection != null and collection.size()>0">
|
|
|
|
|
AND e.id IN
|
|
|
|
|
<foreach collection="collection" open="(" item="id" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
2022-03-23 18:41:38 +08:00
|
|
|
<select id="listPositionInfo" resultType="com.engine.salary.entity.hrm.PositionInfo">
|
|
|
|
|
select t.id,
|
|
|
|
|
t.jobtitlename as name
|
|
|
|
|
from hrmjobtitles t
|
|
|
|
|
where 1=1
|
|
|
|
|
<if test="collection != null and collection.size()>0">
|
|
|
|
|
AND t.id IN
|
|
|
|
|
<foreach collection="collection" open="(" item="id" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-04-07 11:39:22 +08:00
|
|
|
<select id="getAdminEmployeeByIds" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
|
|
|
|
select e.id as employeeId,
|
|
|
|
|
e.lastname as username
|
|
|
|
|
from hrmresourcemanager e
|
|
|
|
|
where e.status not in (7)
|
|
|
|
|
<if test="collection != null and collection.size()>0">
|
|
|
|
|
AND e.id IN
|
|
|
|
|
<foreach collection="collection" open="(" item="id" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-04-07 16:54:10 +08:00
|
|
|
<select id="listByParams" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
2022-04-08 16:30:10 +08:00
|
|
|
select e.id as employeeId,
|
|
|
|
|
e.lastname as username,
|
|
|
|
|
e.status as status,
|
2022-05-25 16:51:43 +08:00
|
|
|
e.certificatenum as idNo,
|
2022-04-08 16:30:10 +08:00
|
|
|
e.workcode as workcode,
|
|
|
|
|
d.departmentname as departmentName,
|
|
|
|
|
d.id as departmentId,
|
|
|
|
|
c.jobtitlename as jobtitleName,
|
2022-04-29 14:17:31 +08:00
|
|
|
c.id as jobtitleId,
|
2022-04-08 16:30:10 +08:00
|
|
|
e.companystartdate as companystartdate,
|
|
|
|
|
e.mobile as mobile
|
2022-04-07 16:54:10 +08:00
|
|
|
from hrmresource e
|
|
|
|
|
left join hrmdepartment d on e.departmentid = d.id
|
|
|
|
|
left join hrmjobtitles c on e.jobtitle = c.id
|
2022-06-06 10:19:11 +08:00
|
|
|
WHERE e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
|
2022-04-07 16:54:10 +08:00
|
|
|
<if test="params != null and params.size() > 0">
|
|
|
|
|
AND ( 1=2
|
|
|
|
|
<foreach collection="params" item="param">
|
|
|
|
|
OR
|
|
|
|
|
(
|
|
|
|
|
<if test="param.targetType == 'EMPLOYEE'">
|
|
|
|
|
e.id IN
|
|
|
|
|
<foreach collection="param.targetIds" open="(" item="targetId" separator="," close=")">
|
|
|
|
|
#{targetId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="param.targetType == 'DEPT'">
|
|
|
|
|
d.id IN
|
|
|
|
|
<foreach collection="param.targetIds" open="(" item="targetId" separator="," close=")">
|
|
|
|
|
#{targetId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="param.targetType == 'POSITION'">
|
|
|
|
|
c.id IN
|
|
|
|
|
<foreach collection="param.targetIds" open="(" item="targetId" separator="," close=")">
|
|
|
|
|
#{targetId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="param.employeeStatus != null and param.employeeStatus.size() > 0">
|
|
|
|
|
AND e.status IN
|
|
|
|
|
<foreach collection="param.employeeStatus" open="(" item="status" separator="," close=")">
|
|
|
|
|
#{status}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2022-05-25 11:09:48 +08:00
|
|
|
<!-- -- 在职-->
|
|
|
|
|
<!-- <if test="param.employeeStatus != null and param.employeeStatus == 'normal'">-->
|
|
|
|
|
<!-- AND em.status in (0,1,2,3)-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- -- 离职-->
|
|
|
|
|
<!-- <if test="param.employeeStatus != null and param.employeeStatus == 'unavailable'">-->
|
|
|
|
|
<!-- AND em.status in (4,5,6)-->
|
|
|
|
|
<!-- </if>-->
|
2022-04-07 16:54:10 +08:00
|
|
|
)
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-03-23 18:41:38 +08:00
|
|
|
|
2022-04-08 19:08:59 +08:00
|
|
|
<select id="getEmployeeById" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
|
|
|
|
select e.id as employeeId,
|
|
|
|
|
e.lastname as username,
|
|
|
|
|
e.status as status,
|
2022-05-25 16:51:43 +08:00
|
|
|
e.certificatenum as idNo,
|
2022-04-08 19:08:59 +08:00
|
|
|
e.workcode as workcode,
|
|
|
|
|
d.departmentname as departmentName,
|
|
|
|
|
d.id as departmentId,
|
|
|
|
|
c.jobtitlename as jobtitleName,
|
2022-04-29 14:17:31 +08:00
|
|
|
c.id as jobtitleId,
|
2022-04-08 19:08:59 +08:00
|
|
|
e.companystartdate as companystartdate,
|
|
|
|
|
e.mobile as mobile,
|
|
|
|
|
b.dismissdate as dismissdate
|
|
|
|
|
from hrmresource e
|
|
|
|
|
left join hrmdepartment d on e.departmentid = d.id
|
|
|
|
|
left join hrmjobtitles c on e.jobtitle = c.id
|
|
|
|
|
left join bill_hrmdismiss b on e.id = b.resource_n
|
2022-06-06 10:19:11 +08:00
|
|
|
where e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
|
2022-04-08 19:08:59 +08:00
|
|
|
AND e.id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-04-12 19:29:19 +08:00
|
|
|
|
|
|
|
|
<sql id="paramSql">
|
|
|
|
|
<!-- 关键字(姓名、 -->
|
|
|
|
|
<if test="userName != null and userName != ''">
|
|
|
|
|
AND
|
|
|
|
|
(
|
|
|
|
|
a.lastname like CONCAT('%',#{userName},'%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
</sql>
|
|
|
|
|
<sql id="paramSql" databaseId="oracle">
|
|
|
|
|
<if test="userName != null and userName != ''">
|
|
|
|
|
AND
|
|
|
|
|
(
|
2022-05-24 09:14:26 +08:00
|
|
|
a.lastname like '%'||#{userName}||'%'
|
2022-04-12 19:29:19 +08:00
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
</sql>
|
|
|
|
|
<sql id="paramSql" databaseId="sqlserver">
|
|
|
|
|
<if test="userName != null and userName != ''">
|
|
|
|
|
AND
|
|
|
|
|
(
|
|
|
|
|
a.lastname like '%'+#{userName}+'%'
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="getEmployeeIdsByUserName" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
|
|
|
|
select
|
2022-05-24 09:14:26 +08:00
|
|
|
a.LASTNAME as username
|
2022-04-12 19:29:19 +08:00
|
|
|
from hrmresource a
|
|
|
|
|
where
|
2022-06-06 10:19:11 +08:00
|
|
|
e.status not in (7)
|
|
|
|
|
and (e.accounttype is null or e.accounttype = 0)
|
2022-04-12 19:29:19 +08:00
|
|
|
<include refid="paramSql"/>
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-05-18 09:19:50 +08:00
|
|
|
<select id="listAll" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
|
|
|
|
select e.id as employeeId,
|
|
|
|
|
e.lastname as username,
|
|
|
|
|
e.status as status,
|
|
|
|
|
e.workcode as workcode,
|
2022-05-25 16:51:43 +08:00
|
|
|
e.certificatenum as idNo,
|
2022-05-18 09:19:50 +08:00
|
|
|
d.departmentname as departmentName,
|
|
|
|
|
d.id as departmentId,
|
|
|
|
|
c.jobtitlename as jobtitleName,
|
|
|
|
|
c.id as jobtitleId,
|
|
|
|
|
e.companystartdate as companystartdate,
|
|
|
|
|
e.mobile as mobile,
|
|
|
|
|
b.dismissdate as dismissdate
|
|
|
|
|
from hrmresource e
|
|
|
|
|
left join hrmdepartment d on e.departmentid = d.id
|
|
|
|
|
left join hrmjobtitles c on e.jobtitle = c.id
|
|
|
|
|
left join bill_hrmdismiss b on e.id = b.resource_n
|
|
|
|
|
where e.status not in (7)
|
|
|
|
|
AND e.id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
2022-05-24 09:14:26 +08:00
|
|
|
<select id="getDeptInfoList" resultType="com.engine.salary.entity.hrm.DeptInfo">
|
|
|
|
|
select d.departmentname as name,
|
2022-05-25 16:51:43 +08:00
|
|
|
d.id as id
|
2022-05-24 09:14:26 +08:00
|
|
|
from hrmdepartment d
|
|
|
|
|
where 1=1
|
|
|
|
|
<if test="departmentIds != null and departmentIds.size()>0">
|
|
|
|
|
AND d.id IN
|
|
|
|
|
<foreach collection="departmentIds" open="(" item="departmentId" separator="," close=")">
|
|
|
|
|
#{departmentId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getSubCompanyInfoList" resultType="com.engine.salary.entity.hrm.SubCompanyInfo">
|
|
|
|
|
select d.subcompanyname as name,
|
2022-05-25 16:51:43 +08:00
|
|
|
d.id as id
|
2022-05-24 09:14:26 +08:00
|
|
|
from hrmsubcompany d
|
|
|
|
|
where 1=1
|
|
|
|
|
<if test="subDepartmentIds != null and subDepartmentIds.size()>0">
|
|
|
|
|
AND d.id IN
|
|
|
|
|
<foreach collection="subDepartmentIds" open="(" item="subDepartmentId" separator="," close=")">
|
|
|
|
|
#{subDepartmentId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
2022-03-10 17:57:46 +08:00
|
|
|
</mapper>
|