434 lines
14 KiB
XML
434 lines
14 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.siarchives.SocialSchemeMapper">
|
|
<resultMap id="BaseResultMap" type="com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO">
|
|
<result column="id" property="id"/>
|
|
<result column="employee_id" property="employeeId"/>
|
|
<result column="non_payment" property="nonPayment"/>
|
|
<result column="welfare_type" property="welfareType"/>
|
|
<result column="social_start_time" property="socialStartTime"/>
|
|
<result column="social_end_time" property="socialEndTime"/>
|
|
<result column="social_scheme_id" property="socialSchemeId"/>
|
|
<result column="social_account" property="socialAccount"/>
|
|
<result column="payment_organization" property="paymentOrganization"/>
|
|
<result column="under_take" property="underTake"/>
|
|
<result column="social_payment_base_string" property="socialPaymentBaseString"/>
|
|
<result column="create_time" property="createTime"/>
|
|
<result column="update_time" property="updateTime"/>
|
|
<result column="creator" property="creator"/>
|
|
<result column="delete_type" property="deleteType"/>
|
|
<result column="tenant_key" property="tenantKey"/>
|
|
</resultMap>
|
|
|
|
<!-- 表字段 -->
|
|
<sql id="baseColumns">
|
|
t.id
|
|
, t.employee_id
|
|
, t.non_payment
|
|
, t.welfare_type
|
|
, t.social_start_time
|
|
, t.social_end_time
|
|
, t.social_scheme_id
|
|
, t.social_account
|
|
, t.payment_organization
|
|
, t.under_take
|
|
, t.social_payment_base_string
|
|
, t.create_time
|
|
, t.update_time
|
|
, t.creator
|
|
, t.delete_type
|
|
, t.tenant_key
|
|
</sql>
|
|
|
|
|
|
<!-- 根据人员id获取记录 -->
|
|
<select id="getSocialByEmployeeId" resultMap="BaseResultMap" >
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_social_archives t
|
|
WHERE delete_type = 0
|
|
<if test="employeeIds != null and employeeIds.size()>0">
|
|
AND employee_id IN
|
|
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
|
|
#{employeeId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 批量删除 -->
|
|
<delete id="batchDeleteByEmployeeIds">
|
|
UPDATE hrsa_social_archives
|
|
SET delete_type = 1
|
|
WHERE delete_type = 0
|
|
<if test="employeeIds != null and employeeIds.size()>0">
|
|
AND employee_id IN
|
|
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
|
|
#{employeeId}
|
|
</foreach>
|
|
</if>
|
|
</delete>
|
|
|
|
<!-- 批量保存 -->
|
|
<insert id="batchSave">
|
|
INSERT INTO hrsa_social_archives(
|
|
welfare_type,
|
|
delete_type,
|
|
social_payment_base_string,
|
|
social_scheme_id,
|
|
create_time,
|
|
social_end_time,
|
|
social_start_time,
|
|
creator,
|
|
non_payment,
|
|
tenant_key,
|
|
employee_id,
|
|
update_time,
|
|
under_take,
|
|
social_account,
|
|
payment_organization)
|
|
VALUES
|
|
<foreach collection="socialSchemePOS" item="item" separator=",">
|
|
(
|
|
#{item.welfareType},
|
|
#{item.deleteType},
|
|
#{item.socialPaymentBaseString},
|
|
#{item.socialSchemeId},
|
|
#{item.createTime},
|
|
#{item.socialEndTime}
|
|
#{item.socialStartTime}
|
|
#{item.creator}
|
|
#{item.nonPayment}
|
|
#{item.tenantKey}
|
|
#{item.employeeId}
|
|
#{item.updateTime}
|
|
#{item.underTake}
|
|
#{item.socialAccount}
|
|
#{item.paymentOrganization}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchSave" databaseId="oracle">
|
|
INSERT INTO hrsa_social_archives(
|
|
welfare_type,
|
|
delete_type,
|
|
social_payment_base_string,
|
|
social_scheme_id,
|
|
create_time,
|
|
social_end_time,
|
|
social_start_time,
|
|
creator,
|
|
non_payment,
|
|
tenant_key,
|
|
employee_id,
|
|
update_time,
|
|
under_take,
|
|
social_account,
|
|
payment_organization)
|
|
<foreach collection="socialSchemePOS" item="item" separator="union all">
|
|
select
|
|
#{item.welfareType},
|
|
#{item.deleteType},
|
|
#{item.socialPaymentBaseString},
|
|
#{item.socialSchemeId},
|
|
#{item.createTime},
|
|
#{item.socialEndTime}
|
|
#{item.socialStartTime}
|
|
#{item.creator}
|
|
#{item.nonPayment}
|
|
#{item.tenantKey}
|
|
#{item.employeeId}
|
|
#{item.updateTime}
|
|
#{item.underTake}
|
|
#{item.socialAccount}
|
|
#{item.paymentOrganization}
|
|
from dual
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchSave" databaseId="sqlserver">
|
|
INSERT INTO hrsa_social_archives(
|
|
welfare_type,
|
|
delete_type,
|
|
social_payment_base_string,
|
|
social_scheme_id,
|
|
create_time,
|
|
social_end_time,
|
|
social_start_time,
|
|
creator,
|
|
non_payment,
|
|
tenant_key,
|
|
employee_id,
|
|
update_time,
|
|
under_take,
|
|
social_account,
|
|
payment_organization)
|
|
VALUES
|
|
<foreach collection="socialSchemePOS" item="item" separator=",">
|
|
(
|
|
#{item.welfareType},
|
|
#{item.deleteType},
|
|
#{item.socialPaymentBaseString},
|
|
#{item.socialSchemeId},
|
|
#{item.createTime},
|
|
#{item.socialEndTime}
|
|
#{item.socialStartTime}
|
|
#{item.creator}
|
|
#{item.nonPayment}
|
|
#{item.tenantKey}
|
|
#{item.employeeId}
|
|
#{item.updateTime}
|
|
#{item.underTake}
|
|
#{item.socialAccount}
|
|
#{item.paymentOrganization}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
|
|
<!-- 人员档案信息 -->
|
|
|
|
<sql id="paramSql">
|
|
<!-- 关键字(姓名、工号 -->
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
AND
|
|
(
|
|
a.lastname like CONCAT('%',#{param.keyword},'%')
|
|
OR a.workcode like CONCAT('%',#{param.keyword},'%')
|
|
)
|
|
</if>
|
|
</sql>
|
|
<sql id="paramSql" databaseId="oracle">
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
AND
|
|
(
|
|
e.lastname like '%'||#{param.keyword}||'%'
|
|
OR e.workcode like '%'||#{param.keyword}||'%'
|
|
)
|
|
</if>
|
|
</sql>
|
|
<sql id="paramSql" databaseId="sqlserver">
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
AND
|
|
(
|
|
e.lastname like '%'+#{param.keyword}+'%'
|
|
OR e.workcode like '%'+#{param.keyword}+'%'
|
|
)
|
|
</if>
|
|
</sql>
|
|
|
|
<sql id="paramSqlCommon">
|
|
<!--部门 多选-->
|
|
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
|
AND a.departmentid IN
|
|
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
|
|
#{departmentId}
|
|
</foreach>
|
|
</if>
|
|
<!--状态 多选-->
|
|
<if test="param.statuses != null and param.statuses.size()>0">
|
|
AND a.status IN
|
|
<foreach collection="param.statuses" open="(" item="status" separator="," close=")">
|
|
#{status}
|
|
</foreach>
|
|
</if>
|
|
<!--岗位 多选-->
|
|
<if test="param.positions != null and param.positions.size()>0">
|
|
AND a.jobtitle IN
|
|
<foreach collection="param.positions" open="(" item="position" separator="," close=")">
|
|
#{position}
|
|
</foreach>
|
|
</if>
|
|
<!--入职日期-->
|
|
<if test="param.hiredateStart != null and param.hiredateEnd != null">
|
|
AND a.companystartdate between #{param.hiredateStart} and #{param.hiredateEnd}
|
|
</if>
|
|
<!--离职日期-->
|
|
<if test="param.dimissionDateStart != null and param.dimissionDateEnd != null">
|
|
AND f.dismissdate between #{param.dimissionDateStart} and #{param.dimissionDateEnd}
|
|
</if>
|
|
<!--方案主键-->
|
|
<if test ="param.siSchemeId != null">
|
|
AND c.social_scheme_id = #{param.siSchemeId}
|
|
</if>
|
|
<if test ="param.fundSchemeId != null">
|
|
AND d.fund_scheme_id = #{param.fundSchemeId}
|
|
</if>
|
|
<if test ="param.otherSchemeId != null">
|
|
AND e.other_scheme_id = #{param.otherSchemeId}
|
|
</if>
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="listPageEmployeePOS" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO">
|
|
SELECT
|
|
a.id as employeeId,
|
|
a.lastname as userName,
|
|
b.departmentname as departmentName,
|
|
a.mobile as telephone
|
|
FROM
|
|
hrmresource a
|
|
LEFT JOIN hrmdepartment b ON a.departmentid = b.id
|
|
LEFT JOIN hrsa_social_archives c ON a.id = c.employee_id
|
|
LEFT JOIN hrsa_fund_archives d ON a.id = d.employee_id
|
|
LEFT JOIN hrsa_other_archives e ON a.id = e.employee_id
|
|
LEFT JOIN bill_hrmdismiss f on a.id = f.resource_n
|
|
WHERE
|
|
1 = 1
|
|
<include refid="paramSql"/>
|
|
<include refid="paramSqlCommon"/>
|
|
ORDER BY a.id asc
|
|
</select>
|
|
|
|
|
|
<select id="tips" resultType="long">
|
|
SELECT
|
|
employee_id
|
|
FROM
|
|
hrsa_social_archives
|
|
WHERE
|
|
social_start_time is not null and social_end_time is null
|
|
</select>
|
|
|
|
|
|
<select id="queryEmployeeList" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO">
|
|
<!-- <![CDATA[-->
|
|
SELECT
|
|
a.employeeId,
|
|
a.userName,
|
|
a.departmentId,
|
|
a.jobNum,
|
|
a.telephone,
|
|
a.departmentName,
|
|
a.position,
|
|
a.userStatus,
|
|
a.hiredate,
|
|
l.dimissionDate,
|
|
social.siSchemeId,
|
|
fund.fundSchemeId,
|
|
other.otherSchemeId
|
|
FROM
|
|
(
|
|
SELECT
|
|
e.lastname AS userName,
|
|
e.jobtitle AS jobNum,
|
|
e.departmentid AS departmentId,
|
|
d.departmentname AS departmentName,
|
|
e.`STATUS` AS userStatus,
|
|
e.jobtitle AS position,
|
|
e.companystartdate AS hiredate,
|
|
e.ID AS employeeId,
|
|
e.MOBILE AS telephone
|
|
FROM
|
|
hrmresource e
|
|
LEFT JOIN hrmdepartment d ON e.departmentid = d.ID
|
|
)a
|
|
LEFT JOIN(
|
|
SELECT
|
|
t.*
|
|
FROM
|
|
(
|
|
SELECT
|
|
log.resource_n,
|
|
log.dismissdate AS dimissionDate
|
|
FROM
|
|
bill_hrmdismiss log
|
|
ORDER BY
|
|
log.dismissdate DESC
|
|
)t
|
|
GROUP BY
|
|
t.resource_n
|
|
)l ON a.employeeId = l.resource_n
|
|
LEFT JOIN(
|
|
SELECT
|
|
social.employee_id,
|
|
social.social_scheme_id AS siSchemeId
|
|
FROM
|
|
hrsa_social_archives social
|
|
WHERE social.delete_type = 0
|
|
)social ON a.employeeId = social.employee_id
|
|
LEFT JOIN(
|
|
SELECT
|
|
fund.employee_id,
|
|
fund.fund_scheme_id AS fundSchemeId
|
|
FROM
|
|
hrsa_fund_archives fund
|
|
WHERE fund.delete_type = 0
|
|
)fund ON a.employeeId = fund.employee_id
|
|
LEFT JOIN(
|
|
SELECT
|
|
other.employee_id,
|
|
other.other_scheme_id AS otherSchemeId
|
|
FROM
|
|
hrsa_other_archives other
|
|
WHERE other.delete_type = 0
|
|
)other ON a.employeeId = other.employee_id
|
|
WHERE
|
|
1=1
|
|
<include refid="condition"></include>
|
|
<if test="param.startNum != null and param.pageSize != null">
|
|
limit #{param.startNum},#{param.pageSize}
|
|
</if>
|
|
</select>
|
|
<!--]]>-->
|
|
<sql id="condition">
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
AND
|
|
(
|
|
userName like CONCAT('%',#{param.keyword},'%')
|
|
OR jobNum = #{param.keyword}
|
|
)
|
|
</if>
|
|
<if test="param.userName != null and param.userName != ''">
|
|
AND userName like CONCAT('%',#{param.userName},'%')
|
|
</if>
|
|
<if test="param.jobNum != null and param.jobNum != ''">
|
|
AND jobNum = #{param.jobNum}
|
|
</if>
|
|
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
|
AND departmentId IN
|
|
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
|
|
#{departmentId}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.statuses != null and param.statuses.size()>0">
|
|
AND userStatus IN
|
|
<foreach collection="param.statuses" open="(" item="userStatus" separator="," close=")">
|
|
#{userStatus}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.positions != null and param.positions.size()>0">
|
|
AND position IN
|
|
<foreach collection="param.positions" open="(" item="position" separator="," close=")">
|
|
#{position}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.hiredateStart != null">
|
|
AND hiredate > #{param.hiredateStart}
|
|
</if>
|
|
<if test="param.hiredateEnd != null">
|
|
AND hiredate < #{param.hiredateEnd}
|
|
</if>
|
|
<if test="param.dimissionDateStart != null">
|
|
AND dimissionDate > #{param.dimissionDateStart}
|
|
</if>
|
|
<if test="param.dimissionDateEnd != null">
|
|
AND dimissionDate < #{param.dimissionDateEnd}
|
|
</if>
|
|
<if test="param.siSchemeId != null and param.siSchemeId != 0">
|
|
AND siSchemeId = #{param.siSchemeId}
|
|
</if>
|
|
<if test="param.fundSchemeId != null and param.fundSchemeId != 0">
|
|
AND fundSchemeId = #{param.fundSchemeId}
|
|
</if>
|
|
<if test="param.otherSchemeId != null and param.otherSchemeId != 0">
|
|
AND otherSchemeId = #{param.otherSchemeId}
|
|
</if>
|
|
<if test="param.employeeIds != null and param.employeeIds.size() > 0">
|
|
AND employeeId IN
|
|
<foreach collection="param.employeeIds" open="(" separator="," item="item" close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</sql>
|
|
|
|
</mapper> |