weaver-hrm-salary/src/com/engine/salary/mapper/datacollection/EmployMapper.xml

184 lines
6.8 KiB
XML

<?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,
d.DEPARTMENTNAME as deparmentName
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
where e.status not in (7)
</select>
<select id="getEmployeeByIds" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.ID as employeeId,
e.LASTNAME as username
from hrmresource 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>
<select id="getEmployeeByIdsAll" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,
e.lastname as username,
e.status as status,
e.workcode as workcode,
d.departmentname as departmentName,
d.id as departmentId,
c.jobtitlename as jobtitleName,
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)
<if test="collection != null and collection.size()>0">
AND e.id IN
<foreach collection="collection" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<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>
<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>
<select id="listByParams" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,
e.lastname as username,
e.status as status,
e.workcode as workcode,
d.departmentname as departmentName,
d.id as departmentId,
c.jobtitlename as jobtitleName,
e.companystartdate as companystartdate,
e.mobile as mobile
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
left join hrmjobtitles c on e.jobtitle = c.id
WHERE e.status not in (7)
<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>
)
</foreach>
)
</if>
</select>
<select id="getEmployeeById" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,
e.lastname as username,
e.status as status,
e.workcode as workcode,
d.departmentname as departmentName,
d.id as departmentId,
c.jobtitlename as jobtitleName,
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>
<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
(
a.lastname like '%'||#{userName}||'%'
)
</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
a.LASTNAME as username
from hrmresource a
where
1 = 1
<include refid="paramSql"/>
</select>
</mapper>