2022-03-15 17:39:19 +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" >
2022-03-16 17:04:21 +08:00
<mapper namespace= "com.engine.salary.mapper.siarchives.SocialSchemeMapper" >
2022-03-15 17:39:19 +08:00
<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>
2022-03-18 18:00:51 +08:00
<!-- 根据人员id获取记录 -->
2022-03-15 17:39:19 +08:00
<select id= "getSocialByEmployeeId" resultMap= "BaseResultMap" >
SELECT
<include refid= "baseColumns" />
FROM hrsa_social_archives t
2022-03-18 18:00:51 +08:00
WHERE delete_type = 0
2022-04-19 17:46:24 +08:00
<if test= "employeeIds != null and employeeIds.size()>0" >
AND employee_id IN
<foreach collection= "employeeIds" open= "(" item= "employeeId" separator= "," close= ")" >
#{employeeId}
</foreach>
</if>
2022-03-15 17:39:19 +08:00
</select>
2022-10-26 18:51:36 +08:00
<!-- 根据人员id和个税扣缴人id获取记录 -->
<select id= "getSocialByEmployeeIdAndPayOrg" resultMap= "BaseResultMap" >
SELECT
<include refid= "baseColumns" />
FROM hrsa_social_archives t
WHERE delete_type = 0
AND employee_id = #{param.employeeId}
AND payment_organization = #{param.paymentOrganization}
</select>
2022-10-14 14:31:09 +08:00
<!-- 根据id获取记录 -->
<select id= "getSocialById" resultMap= "BaseResultMap" >
SELECT
<include refid= "baseColumns" />
FROM hrsa_social_archives t
WHERE delete_type = 0
<if test= "ids != null and ids.size()>0" >
AND id IN
<foreach collection= "ids" open= "(" item= "id" separator= "," close= ")" >
#{id}
</foreach>
</if>
</select>
2022-03-17 15:26:33 +08:00
<!-- 批量删除 -->
<delete id= "batchDeleteByEmployeeIds" >
UPDATE hrsa_social_archives
SET delete_type = 1
WHERE delete_type = 0
2022-04-19 17:46:24 +08:00
<if test= "employeeIds != null and employeeIds.size()>0" >
AND employee_id IN
<foreach collection= "employeeIds" open= "(" item= "employeeId" separator= "," close= ")" >
#{employeeId}
</foreach>
</if>
2022-03-17 15:26:33 +08:00
</delete>
2022-03-15 17:39:19 +08:00
2022-10-26 15:08:17 +08:00
<!-- 根据人员id和个税扣缴义务人删除档案 -->
<update id= "deleteByEmployeeIdAndPayOrg" parameterType= "com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO" >
UPDATE hrsa_social_archives
SET delete_type = 1
WHERE employee_id = #{param.employeeId}
AND payment_organization = #{param.paymentOrganization}
AND delete_type = 0
</update>
2022-03-17 15:26:33 +08:00
<!-- 批量保存 -->
<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},
2022-04-21 14:08:18 +08:00
#{item.socialEndTime},
#{item.socialStartTime},
#{item.creator},
#{item.nonPayment},
#{item.tenantKey},
#{item.employeeId},
#{item.updateTime},
#{item.underTake},
#{item.socialAccount},
2022-03-17 15:26:33 +08:00
#{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
2022-08-17 13:28:33 +08:00
#{item.welfareType,jdbcType=INTEGER},
#{item.deleteType,jdbcType=INTEGER},
#{item.socialPaymentBaseString,jdbcType=VARCHAR},
#{item.socialSchemeId,jdbcType=DOUBLE},
#{item.createTime,jdbcType=DATE},
#{item.socialEndTime,jdbcType=VARCHAR},
#{item.socialStartTime,jdbcType=VARCHAR},
#{item.creator,jdbcType=DOUBLE},
#{item.nonPayment,jdbcType=INTEGER},
#{item.tenantKey,jdbcType=VARCHAR},
#{item.employeeId,jdbcType=DOUBLE},
#{item.updateTime,jdbcType=DATE},
#{item.underTake,jdbcType=INTEGER},
#{item.socialAccount,jdbcType=VARCHAR},
#{item.paymentOrganization,jdbcType=DOUBLE}
2022-03-17 15:26:33 +08:00
from dual
</foreach>
</insert>
<insert id= "batchSave" databaseId= "sqlserver" >
2022-04-22 18:00:35 +08:00
<foreach collection= "socialSchemePOS" item= "item" separator= ";" >
2022-03-17 15:26:33 +08:00
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
(
#{item.welfareType},
#{item.deleteType},
#{item.socialPaymentBaseString},
#{item.socialSchemeId},
#{item.createTime},
2022-04-21 14:08:18 +08:00
#{item.socialEndTime},
#{item.socialStartTime},
#{item.creator},
#{item.nonPayment},
#{item.tenantKey},
#{item.employeeId},
#{item.updateTime},
#{item.underTake},
#{item.socialAccount},
2022-03-17 15:26:33 +08:00
#{item.paymentOrganization}
)
</foreach>
</insert>
2022-03-15 17:39:19 +08:00
2022-03-18 18:00:51 +08:00
<!-- 人员档案信息 -->
<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>
2022-03-15 17:39:19 +08:00
2022-03-16 18:26:49 +08:00
2022-03-18 18:00:51 +08:00
<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
2022-06-06 10:19:11 +08:00
a.status not in (7)
and (a.accounttype is null or a.accounttype = 0)
2022-03-18 18:00:51 +08:00
<include refid= "paramSql" />
<include refid= "paramSqlCommon" />
ORDER BY a.id asc
</select>
2022-03-16 18:26:49 +08:00
2022-03-22 19:47:46 +08:00
<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>
2022-04-19 17:46:24 +08:00
<select id= "queryEmployeeList" resultType= "com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO" >
2022-10-14 16:34:10 +08:00
SELECT base.id AS baseInfoId, e.ID AS employeeId, e.lastname AS userName, e.departmentid AS departmentId, e.workcode AS jobNum, e.MOBILE AS telephone,
2022-09-26 18:51:17 +08:00
d.departmentname AS departmentName, e.jobtitle AS position, e.STATUS AS userStatus,e.companystartdate AS hiredate,
e.enddate as dimissionDate,
2022-04-19 17:46:24 +08:00
social.siSchemeId,
2022-10-10 09:36:34 +08:00
base.payment_organization AS paymentOrganization,
2022-04-19 17:46:24 +08:00
fund.fundSchemeId,
2022-10-26 18:51:36 +08:00
other.otherSchemeId,
social.id AS socialId,
fund.id AS fundId,
other.id AS otherId
2022-10-09 15:12:54 +08:00
FROM hrsa_insurance_base_info base
LEFT JOIN hrmresource e ON base.employee_id = e.id
2022-04-19 17:46:24 +08:00
LEFT JOIN hrmdepartment d ON e.departmentid = d.ID
2022-09-26 18:51:17 +08:00
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
2022-10-26 18:51:36 +08:00
LEFT JOIN( SELECT social.id, social.employee_id, social.social_scheme_id AS siSchemeId, social.payment_organization FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON e.id = social.employee_id AND base.payment_organization = social.payment_organization
LEFT JOIN( SELECT fund.id, fund.employee_id, fund.fund_scheme_id AS fundSchemeId, fund.payment_organization FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON e.id = fund.employee_id AND base.payment_organization = fund.payment_organization
LEFT JOIN( SELECT other.id, other.employee_id, other.other_scheme_id AS otherSchemeId, other.payment_organization FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON e.id = other.employee_id AND base.payment_organization = other.payment_organization
2022-04-19 17:46:24 +08:00
WHERE
1=1
2022-10-09 15:12:54 +08:00
AND base.delete_type = 0
2022-04-19 17:46:24 +08:00
<include refid= "condition" > </include>
2022-09-26 18:51:17 +08:00
<if test= "param.orderRule != null" >
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
</if>
2022-04-19 17:46:24 +08:00
</select>
<!-- ]]> -->
2022-06-01 14:53:16 +08:00
2022-04-19 17:46:24 +08:00
<sql id= "condition" >
2022-06-28 10:35:30 +08:00
<if test= "param.keyword != null and param.keyword != ''" >
AND
(
2022-09-26 18:51:17 +08:00
e.lastname like CONCAT('%',#{param.keyword},'%')
2022-06-28 10:35:30 +08:00
)
</if>
<if test= "param.userName != null and param.userName != ''" >
2022-09-26 18:51:17 +08:00
AND e.lastname like CONCAT('%',#{param.userName},'%')
2022-06-28 10:35:30 +08:00
</if>
<if test= "param.jobNum != null and param.jobNum != ''" >
2022-09-30 14:14:39 +08:00
AND e.workcode like CONCAT('%',#{param.jobNum},'%')
2022-06-28 10:35:30 +08:00
</if>
<if test= "param.departmentIds != null and param.departmentIds.size()>0" >
2022-09-26 18:51:17 +08:00
AND e.departmentid IN
2022-06-28 10:35:30 +08:00
<foreach collection= "param.departmentIds" open= "(" item= "departmentId" separator= "," close= ")" >
#{departmentId}
</foreach>
</if>
2022-10-31 16:00:46 +08:00
<if test= "param.subcompanyIds != null and param.subcompanyIds.size()>0" >
AND e.subcompanyid1 IN
<foreach collection= "param.subcompanyIds" open= "(" item= "subcompanyId" separator= "," close= ")" >
#{subcompanyId}
</foreach>
</if>
2022-06-28 10:35:30 +08:00
<if test= "param.statuses != null and param.statuses.size()>0" >
2022-09-26 18:51:17 +08:00
AND e.STATUS IN
2022-06-28 10:35:30 +08:00
<foreach collection= "param.statuses" open= "(" item= "userStatus" separator= "," close= ")" >
#{userStatus}
</foreach>
</if>
<if test= "param.positions != null and param.positions.size()>0" >
2022-09-26 18:51:17 +08:00
AND e.jobtitle IN
2022-06-28 10:35:30 +08:00
<foreach collection= "param.positions" open= "(" item= "position" separator= "," close= ")" >
#{position}
</foreach>
</if>
<if test= "param.hiredateStart != null" >
2022-09-26 18:51:17 +08:00
AND e.companystartdate > #{param.hiredateStart}
2022-06-28 10:35:30 +08:00
</if>
<if test= "param.hiredateEnd != null" >
2022-09-26 18:51:17 +08:00
AND e.companystartdate < #{param.hiredateEnd}
2022-06-28 10:35:30 +08:00
</if>
<if test= "param.dimissionDateStart != null" >
2022-09-26 18:51:17 +08:00
AND e.enddate > #{param.dimissionDateStart}
2022-06-28 10:35:30 +08:00
</if>
<if test= "param.dimissionDateEnd != null" >
2022-09-26 18:51:17 +08:00
AND e.enddate < #{param.dimissionDateEnd}
2022-06-28 10:35:30 +08:00
</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>
2022-10-10 16:58:43 +08:00
<if test= "param.runStatuses != null and param.runStatuses.size()>0" >
AND base.run_status IN
<foreach collection= "param.runStatuses" open= "(" item= "runStatus" separator= "," close= ")" >
2022-10-11 14:49:54 +08:00
#{runStatus}
2022-10-10 16:58:43 +08:00
</foreach>
2022-10-09 15:12:54 +08:00
</if>
2022-10-10 16:58:43 +08:00
2022-06-28 10:35:30 +08:00
<if test= "param.employeeIds != null and param.employeeIds.size() > 0" >
2022-09-26 18:51:17 +08:00
AND e.ID IN
2022-06-28 10:35:30 +08:00
<foreach collection= "param.employeeIds" open= "(" separator= "," item= "item" close= ")" >
#{item}
</foreach>
</if>
2022-10-31 16:30:59 +08:00
<if test= "param.ids != null and param.ids.size() > 0" >
AND base.id IN
<foreach collection= "param.ids" open= "(" separator= "," item= "item" close= ")" >
#{item}
</foreach>
</if>
2022-06-28 10:35:30 +08:00
</sql>
<sql id= "condition" databaseId= "sqlserver" >
2022-04-19 17:46:24 +08:00
<if test= "param.keyword != null and param.keyword != ''" >
AND
(
2022-09-26 18:51:17 +08:00
e.lastname like '%'+#{param.keyword}+'%'
2022-05-30 13:43:28 +08:00
)
</if>
<if test= "param.userName != null and param.userName != ''" >
2022-09-26 18:51:17 +08:00
AND e.lastname like '%'+#{param.userName}+'%'
2022-05-30 13:43:28 +08:00
</if>
<if test= "param.jobNum != null and param.jobNum != ''" >
2022-09-30 14:14:39 +08:00
AND e.workcode like '%'+#{param.jobNum}+'%'
2022-05-30 13:43:28 +08:00
</if>
<if test= "param.departmentIds != null and param.departmentIds.size()>0" >
2022-09-26 18:51:17 +08:00
AND e.departmentid IN
2022-05-30 13:43:28 +08:00
<foreach collection= "param.departmentIds" open= "(" item= "departmentId" separator= "," close= ")" >
#{departmentId}
</foreach>
</if>
2022-10-31 16:00:46 +08:00
<if test= "param.subcompanyIds != null and param.subcompanyIds.size()>0" >
AND e.subcompanyid1 IN
<foreach collection= "param.subcompanyIds" open= "(" item= "subcompanyId" separator= "," close= ")" >
#{subcompanyId}
</foreach>
</if>
2022-05-30 13:43:28 +08:00
<if test= "param.statuses != null and param.statuses.size()>0" >
2022-09-26 18:51:17 +08:00
AND e.STATUS IN
2022-05-30 13:43:28 +08:00
<foreach collection= "param.statuses" open= "(" item= "userStatus" separator= "," close= ")" >
#{userStatus}
</foreach>
</if>
<if test= "param.positions != null and param.positions.size()>0" >
2022-09-26 18:51:17 +08:00
AND e.jobtitle IN
2022-05-30 13:43:28 +08:00
<foreach collection= "param.positions" open= "(" item= "position" separator= "," close= ")" >
#{position}
</foreach>
</if>
<if test= "param.hiredateStart != null" >
2022-09-26 18:51:17 +08:00
AND e.companystartdate > #{param.hiredateStart}
2022-05-30 13:43:28 +08:00
</if>
<if test= "param.hiredateEnd != null" >
2022-09-26 18:51:17 +08:00
AND e.companystartdate < #{param.hiredateEnd}
2022-05-30 13:43:28 +08:00
</if>
<if test= "param.dimissionDateStart != null" >
2022-09-26 18:51:17 +08:00
AND e.enddate > #{param.dimissionDateStart}
2022-05-30 13:43:28 +08:00
</if>
<if test= "param.dimissionDateEnd != null" >
2022-09-26 18:51:17 +08:00
AND e.enddate < #{param.dimissionDateEnd}
2022-05-30 13:43:28 +08:00
</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>
2022-10-10 16:58:43 +08:00
<if test= "param.runStatuses != null and param.runStatuses.size()>0" >
AND base.run_status IN
<foreach collection= "param.runStatuses" open= "(" item= "runStatus" separator= "," close= ")" >
#{runStatus}
</foreach>
2022-10-09 15:12:54 +08:00
</if>
2022-05-30 13:43:28 +08:00
<if test= "param.employeeIds != null and param.employeeIds.size() > 0" >
2022-09-26 18:51:17 +08:00
AND e.ID IN
2022-05-30 13:43:28 +08:00
<foreach collection= "param.employeeIds" open= "(" separator= "," item= "item" close= ")" >
#{item}
</foreach>
</if>
2022-10-31 16:30:59 +08:00
<if test= "param.ids != null and param.ids.size() > 0" >
AND base.id IN
<foreach collection= "param.ids" open= "(" separator= "," item= "item" close= ")" >
#{item}
</foreach>
</if>
2022-05-30 13:43:28 +08:00
</sql>
2022-06-28 10:35:30 +08:00
2022-05-30 13:43:28 +08:00
<sql id= "condition" databaseId= "oracle" >
<if test= "param.keyword != null and param.keyword != ''" >
AND
(
2022-09-26 18:51:17 +08:00
e.lastname like '%'||#{param.keyword}||'%'
2022-04-19 17:46:24 +08:00
)
</if>
<if test= "param.userName != null and param.userName != ''" >
2022-09-26 18:51:17 +08:00
AND e.lastname like '%'||#{param.userName}||'%'
2022-04-19 17:46:24 +08:00
</if>
<if test= "param.jobNum != null and param.jobNum != ''" >
2022-09-30 14:14:39 +08:00
AND e.workcode like '%'||#{param.jobNum}||'%'
2022-04-19 17:46:24 +08:00
</if>
<if test= "param.departmentIds != null and param.departmentIds.size()>0" >
2022-09-26 18:51:17 +08:00
AND e.departmentid IN
2022-04-19 17:46:24 +08:00
<foreach collection= "param.departmentIds" open= "(" item= "departmentId" separator= "," close= ")" >
#{departmentId}
</foreach>
</if>
2022-10-31 16:00:46 +08:00
<if test= "param.subcompanyIds != null and param.subcompanyIds.size()>0" >
AND e.subcompanyid1 IN
<foreach collection= "param.subcompanyIds" open= "(" item= "subcompanyId" separator= "," close= ")" >
#{subcompanyId}
</foreach>
</if>
2022-04-19 17:46:24 +08:00
<if test= "param.statuses != null and param.statuses.size()>0" >
2022-09-26 18:51:17 +08:00
AND e.STATUS IN
2022-04-19 17:46:24 +08:00
<foreach collection= "param.statuses" open= "(" item= "userStatus" separator= "," close= ")" >
#{userStatus}
</foreach>
</if>
<if test= "param.positions != null and param.positions.size()>0" >
2022-09-26 18:51:17 +08:00
AND e.jobtitle IN
2022-04-19 17:46:24 +08:00
<foreach collection= "param.positions" open= "(" item= "position" separator= "," close= ")" >
#{position}
</foreach>
</if>
<if test= "param.hiredateStart != null" >
2022-09-26 18:51:17 +08:00
AND e.companystartdate > #{param.hiredateStart}
2022-04-19 17:46:24 +08:00
</if>
<if test= "param.hiredateEnd != null" >
2022-09-26 18:51:17 +08:00
AND e.companystartdate < #{param.hiredateEnd}
2022-04-19 17:46:24 +08:00
</if>
<if test= "param.dimissionDateStart != null" >
2022-09-26 18:51:17 +08:00
AND e.enddate > #{param.dimissionDateStart}
2022-04-19 17:46:24 +08:00
</if>
<if test= "param.dimissionDateEnd != null" >
2022-09-26 18:51:17 +08:00
AND e.enddate < #{param.dimissionDateEnd}
2022-04-19 17:46:24 +08:00
</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>
2022-10-10 16:58:43 +08:00
<if test= "param.runStatuses != null and param.runStatuses.size()>0" >
AND base.run_status IN
<foreach collection= "param.runStatuses" open= "(" item= "runStatus" separator= "," close= ")" >
2022-10-11 14:49:54 +08:00
#{runStatus}
2022-10-10 16:58:43 +08:00
</foreach>
2022-10-09 15:12:54 +08:00
</if>
2022-04-19 17:46:24 +08:00
<if test= "param.employeeIds != null and param.employeeIds.size() > 0" >
2022-09-26 18:51:17 +08:00
AND e.ID IN
2022-04-19 17:46:24 +08:00
<foreach collection= "param.employeeIds" open= "(" separator= "," item= "item" close= ")" >
#{item}
</foreach>
</if>
2022-10-31 16:30:59 +08:00
<if test= "param.ids != null and param.ids.size() > 0" >
AND base.id IN
<foreach collection= "param.ids" open= "(" separator= "," item= "item" close= ")" >
#{item}
</foreach>
</if>
2022-04-19 17:46:24 +08:00
</sql>
2022-09-23 11:37:56 +08:00
<!-- 根据社保缴纳组织id获取记录 -->
<select id= "getSocialByPaymentOrganization" resultMap= "BaseResultMap" >
SELECT
<include refid= "baseColumns" />
FROM hrsa_social_archives t
WHERE delete_type = 0
AND payment_organization = #{paymentOrganization}
</select>
2022-06-01 14:53:16 +08:00
2022-10-10 09:43:57 +08:00
<select id= "listAll" resultMap= "BaseResultMap" >
SELECT
<include refid= "baseColumns" />
FROM hrsa_social_archives t
WHERE delete_type = 0
</select>
<update id= "batchUpdate" parameterType= "java.util.List" >
update hrsa_social_archives
<trim prefix= "set" suffixOverrides= "," >
<trim prefix= "social_payment_base_string =case" suffix= "end," >
<foreach collection= "collection" item= "item" index= "index" >
<if test= "item.socialPaymentBaseString!=null" >
when id=#{item.id} then #{item.socialPaymentBaseString}
</if>
</foreach>
</trim>
2022-10-10 14:55:36 +08:00
<trim prefix= "delete_type =case" suffix= "end," >
<foreach collection= "collection" item= "item" index= "index" >
<if test= "item.deleteType!=null" >
when id=#{item.id} then #{item.deleteType}
</if>
</foreach>
</trim>
2022-10-10 09:43:57 +08:00
</trim>
where
id in
<foreach collection= "collection" item= "item" index= "index" separator= "," open= "(" close= ")" >
#{item.id}
</foreach>
</update>
2022-10-13 14:45:18 +08:00
<!-- 批量更新最后缴纳月 -->
<update id= "batchUpdateEndTime" >
UPDATE hrsa_social_archives
SET social_end_time = #{endTime}
WHERE delete_type = 0
2022-10-13 16:04:54 +08:00
<if test= "ids != null and ids.size()>0" >
AND id IN
<foreach collection= "ids" open= "(" item= "id" separator= "," close= ")" >
#{id}
2022-10-13 14:45:18 +08:00
</foreach>
</if>
</update>
2022-10-18 15:33:27 +08:00
<!-- 更新,更新全部字段 -->
<update id= "updateById" parameterType= "com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO" >
UPDATE hrsa_social_archives
<set >
welfare_type = #{welfareType},
social_payment_base_string = #{socialPaymentBaseString},
social_scheme_id = #{socialSchemeId},
social_end_time = #{socialEndTime},
social_start_time = #{socialStartTime},
non_payment = #{nonPayment},
tenant_key = #{tenantKey},
employee_id = #{employeeId},
update_time = #{updateTime},
under_take = #{underTake},
social_account = #{socialAccount},
payment_organization = #{paymentOrganization},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
2022-03-15 17:39:19 +08:00
</mapper>