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

723 lines
28 KiB
XML
Raw Normal View History

2022-03-03 13:50:03 +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.AddUpSituationMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.AddUpSituation">
<result column="add_up_accumulation_fund_total" property="addUpAccumulationFundTotal"/>
<result column="add_up_advance_tax" property="addUpAdvanceTax"/>
<result column="add_up_allowed_donation" property="addUpAllowedDonation"/>
<result column="add_up_child_education" property="addUpChildEducation"/>
<result column="add_up_continuing_education" property="addUpContinuingEducation"/>
<result column="add_up_enterprise_and_other" property="addUpEnterpriseAndOther"/>
<result column="add_up_housing_loan_interest" property="addUpHousingLoanInterest"/>
<result column="add_up_housing_rent" property="addUpHousingRent"/>
<result column="add_up_income" property="addUpIncome"/>
<result column="add_up_other_deduction" property="addUpOtherDeduction"/>
<result column="add_up_social_security_total" property="addUpSocialSecurityTotal"/>
<result column="add_up_subtraction" property="addUpSubtraction"/>
<result column="add_up_support_elderly" property="addUpSupportElderly"/>
<result column="add_up_tax_exempt_income" property="addUpTaxExemptIncome"/>
2022-05-20 14:41:42 +08:00
<result column="add_up_illness_medical" property="addUpIllnessMedical"/>
<result column="add_up_tax_savings" property="addUpTaxSavings"/>
<result column="add_up_infant_care" property="addUpInfantCare"/>
2022-03-03 13:50:03 +08:00
<result column="create_time" property="createTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="employee_id" property="employeeId"/>
<result column="id" property="id"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="tax_year_month" property="taxYearMonth"/>
<result column="tenant_key" property="tenantKey"/>
<result column="update_time" property="updateTime"/>
<result column="year" property="year"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
add_up_accumulation_fund_total
, t.add_up_advance_tax
, t.add_up_allowed_donation
, t.add_up_child_education
, t.add_up_continuing_education
, t.add_up_enterprise_and_other
, t.add_up_housing_loan_interest
, t.add_up_housing_rent
, t.add_up_income
, t.add_up_other_deduction
, t.add_up_social_security_total
, t.add_up_subtraction
, t.add_up_support_elderly
, t.add_up_tax_exempt_income
, t.create_time
, t.creator
, t.delete_type
, t.employee_id
, t.id
, t.tax_agent_id
, t.tax_year_month
, t.tenant_key
, t.update_time
, t.year
2022-05-20 14:41:42 +08:00
, t.add_up_illness_medical
, t.add_up_tax_savings
, t.add_up_infant_care
2022-03-03 13:50:03 +08:00
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_add_up_situation t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_add_up_situation t
WHERE id = #{id} AND delete_type = 0
</select>
2022-03-08 18:10:03 +08:00
<sql id="addUpSituationColumn">
2022-03-09 18:58:30 +08:00
t1
.
id
,
2022-03-08 18:10:03 +08:00
t1.tax_year_month,
t1.employee_id,
e.lastname as username,
d.departmentName AS departmentName,
e.mobile,
e.workcode as job_num,
e.companystartdate as hiredate,
t2.name AS tax_agent_name,
t1.add_up_income,
t1.add_up_subtraction,
t1.add_up_social_security_total,
t1.add_up_accumulation_fund_total,
t1.add_up_child_education,
t1.add_up_continuing_education,
t1.add_up_housing_loan_interest,
t1.add_up_housing_rent,
t1.add_up_support_elderly,
2022-05-20 14:41:42 +08:00
t1.add_up_illness_medical,
t1.add_up_infant_care,
2022-03-08 18:10:03 +08:00
t1.add_up_enterprise_and_other,
t1.add_up_other_deduction,
t1.add_up_tax_exempt_income,
t1.add_up_allowed_donation,
2022-05-20 14:41:42 +08:00
t1.add_up_tax_savings,
2022-03-08 18:10:03 +08:00
t1.add_up_advance_tax
</sql>
<sql id="paramSql">
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.year != null">
AND t1.year = #{param.year}
</if>
<if test="param.employeeId != null">
AND t1.employee_id = #{param.employeeId}
</if>
<!-- 关键字(姓名、部门、工号 -->
<if test="param.keyword != null and param.keyword != ''">
AND
(
2022-03-10 17:57:46 +08:00
e.lastname like CONCAT('%',#{param.keyword},'%')
OR d.departmentname like CONCAT('%',#{param.keyword},'%')
OR e.workcode like CONCAT('%',#{param.keyword},'%')
2022-03-08 18:10:03 +08:00
)
</if>
<!-- 税款所属期 -->
<if test="param.taxYearMonth != null">
<if test="param.taxYearMonth.size() == 1">
AND t1.tax_year_month = #{param.taxYearMonth[0]}
</if>
<if test="param.taxYearMonth.size() == 2">
AND (t1.tax_year_month BETWEEN #{param.taxYearMonth[0]} AND #{param.taxYearMonth[1]})
</if>
</if>
<!-- 姓名 -->
<if test="param.username != null and param.username != ''">
2022-03-10 17:57:46 +08:00
AND e.lastname like CONCAT('%',#{param.username},'%')
2022-03-08 18:10:03 +08:00
</if>
<if test="param.taxAgentId != null">
AND t1.tax_agent_id = #{param.taxAgentId}
</if>
<!-- 部门 -->
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<!-- 工号 -->
<if test="param.jobNum != null and param.jobNum != ''">
2022-03-10 17:57:46 +08:00
AND e.workcode like CONCAT('%',#{param.jobNum},'%')
2022-03-08 18:10:03 +08:00
</if>
<!-- 入职日期 -->
<if test="param.hiredate != null and param.hiredate.size() == 2">
2022-03-10 17:57:46 +08:00
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
2022-03-08 18:10:03 +08:00
</if>
<!-- 手机号 -->
<if test="param.mobile != null and param.mobile != ''">
AND e.mobile like CONCAT('%',#{param.mobile},'%')
</if>
</sql>
<sql id="paramSql" databaseId="oracle">
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.year != null">
AND t1.year = #{param.year}
</if>
<if test="param.employeeId != null">
AND t1.employee_id = #{param.employeeId}
</if>
<if test="param.keyword != null and param.keyword != ''">
AND
(
2022-03-10 17:57:46 +08:00
e.lastname like '%'||#{param.keyword}||'%'
OR d.departmentname like '%'||#{param.keyword}||'%'
OR e.workcode like '%'||#{param.keyword}||'%'
2022-03-08 18:10:03 +08:00
)
</if>
<if test="param.taxYearMonth != null">
<if test="param.taxYearMonth.size() == 1">
AND t1.tax_year_month = #{param.taxYearMonth[0]}
</if>
<if test="param.taxYearMonth.size() == 2">
AND (t1.tax_year_month BETWEEN #{param.taxYearMonth[0]} AND #{param.taxYearMonth[1]})
</if>
</if>
<if test="param.username != null and param.username != ''">
2022-03-10 17:57:46 +08:00
AND e.lastname like '%'||#{param.username}||'%'
2022-03-08 18:10:03 +08:00
</if>
<if test="param.taxAgentId != null">
AND t1.tax_agent_id = #{param.taxAgentId}
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.jobNum != null and param.jobNum != ''">
2022-03-10 17:57:46 +08:00
AND e.workcode like '%'||#{param.jobNum}||'%'
2022-03-08 18:10:03 +08:00
</if>
<if test="param.hiredate != null and param.hiredate.size() == 2">
2022-03-10 17:57:46 +08:00
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
2022-03-08 18:10:03 +08:00
</if>
<if test="param.mobile != null and param.mobile != ''">
AND e.mobile like '%'||#{param.mobile}||'%'
</if>
</sql>
<sql id="paramSql" databaseId="sqlserver">
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.year != null">
AND t1.year = #{param.year}
</if>
<if test="param.employeeId != null">
AND t1.employee_id = #{param.employeeId}
</if>
<if test="param.keyword != null and param.keyword != ''">
AND
(
2022-03-10 17:57:46 +08:00
e.lastname like '%'+#{param.keyword}+'%'
OR d.departmentname like '%'+#{param.keyword}+'%'
OR e.workcode like '%'+#{param.keyword}+'%'
2022-03-08 18:10:03 +08:00
)
</if>
<if test="param.taxYearMonth != null">
<if test="param.taxYearMonth.size() == 1">
AND t1.tax_year_month = #{param.taxYearMonth[0]}
</if>
<if test="param.taxYearMonth.size() == 2">
AND (t1.tax_year_month BETWEEN #{param.taxYearMonth[0]} AND #{param.taxYearMonth[1]})
</if>
</if>
<if test="param.username != null and param.username != ''">
2022-03-10 17:57:46 +08:00
AND e.lastname like '%'+#{param.username}+'%'
2022-03-08 18:10:03 +08:00
</if>
<if test="param.taxAgentId != null">
AND t1.tax_agent_id = #{param.taxAgentId}
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.jobNum != null and param.jobNum != ''">
2022-03-10 17:57:46 +08:00
AND e.workcode like '%'+#{param.jobNum}+'%'
2022-03-08 18:10:03 +08:00
</if>
<if test="param.hiredate != null and param.hiredate.size() == 2">
2022-03-10 17:57:46 +08:00
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
2022-03-08 18:10:03 +08:00
</if>
<if test="param.mobile != null and param.mobile != ''">
AND e.mobile like '%'+#{param.mobile}+'%'
</if>
</sql>
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.AddUpSituationDTO">
SELECT
<include refid="addUpSituationColumn"/>
FROM
hrsa_add_up_situation t1
INNER JOIN
(SELECT employee_id, MAX(tax_year_month) tax_year_month FROM hrsa_add_up_situation GROUP BY employee_id) t ON
t.employee_id = t1.employee_id AND t.tax_year_month = t1.tax_year_month
2022-03-09 16:40:14 +08:00
LEFT JOIN hrmresource e ON e.id = t1.employee_id
2022-03-10 11:09:08 +08:00
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
2022-03-08 18:10:03 +08:00
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
WHERE
t1.delete_type = 0
AND t2.delete_type = 0
AND e.status not in (7)
<include refid="paramSql"/>
ORDER BY t1.id DESC
</select>
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.AddUpSituationDTO"
databaseId="oracle">
SELECT
<include refid="addUpSituationColumn"/>
FROM
hrsa_add_up_situation t1
INNER JOIN
(SELECT employee_id, MAX(tax_year_month) tax_year_month FROM hrsa_add_up_situation GROUP BY employee_id) t ON
t.employee_id = t1.employee_id AND t.tax_year_month = t1.tax_year_month
LEFT JOIN hrmresource e ON e.id = t1.employee_id
2022-03-10 11:09:08 +08:00
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
2022-03-08 18:10:03 +08:00
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
WHERE
t1.delete_type = 0
AND t2.delete_type = 0
AND e.status not in (7)
<include refid="paramSql"/>
ORDER BY t1.id DESC
</select>
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.AddUpSituationDTO"
databaseId="sqlserver">
SELECT
<include refid="addUpSituationColumn"/>
FROM
hrsa_add_up_situation t1
INNER JOIN
(SELECT employee_id, MAX(tax_year_month) tax_year_month FROM hrsa_add_up_situation GROUP BY employee_id) t ON
t.employee_id = t1.employee_id AND t.tax_year_month = t1.tax_year_month
2022-03-09 16:40:14 +08:00
LEFT JOIN hrmresource e ON e.id = t1.employee_id
2022-03-10 11:09:08 +08:00
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
2022-03-08 18:10:03 +08:00
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
WHERE
t1.delete_type = 0
AND t2.delete_type = 0
AND e.status not in (7)
<include refid="paramSql"/>
ORDER BY t1.id DESC
</select>
2022-03-03 13:50:03 +08:00
2022-03-09 16:40:14 +08:00
<select id="recordList" resultType="com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO">
SELECT
<include refid="addUpSituationColumn"/>
FROM
hrsa_add_up_situation t1
LEFT JOIN hrmresource e ON e.id = t1.employee_id
2022-03-10 11:09:08 +08:00
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
2022-03-09 16:40:14 +08:00
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
WHERE
t1.delete_type = 0
AND t2.delete_type = 0
AND e.status not in (7)
<include refid="paramSql"/>
ORDER BY t1.tax_year_month DESC
</select>
2022-03-09 18:58:30 +08:00
<insert id="insertData">
INSERT INTO hrsa_add_up_situation(
employee_id,
tax_agent_id,
tax_year_month,
year,
add_up_income,
add_up_subtraction,
add_up_social_security_total,
add_up_accumulation_fund_total,
add_up_child_education,
add_up_continuing_education,
add_up_housing_loan_interest,
add_up_housing_rent,
add_up_support_elderly,
add_up_enterprise_and_other,
add_up_other_deduction,
add_up_tax_exempt_income,
add_up_allowed_donation,
add_up_advance_tax,
create_time,
update_time,
creator,
2022-05-20 14:41:42 +08:00
tenant_key,
add_up_tax_savings,
add_up_illness_medical,
add_up_infant_care
2022-03-09 18:58:30 +08:00
)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.employeeId},
#{item.taxAgentId},
#{item.taxYearMonth},
#{item.year},
#{item.addUpIncome},
#{item.addUpSubtraction},
#{item.addUpSocialSecurityTotal},
#{item.addUpAccumulationFundTotal},
#{item.addUpChildEducation},
#{item.addUpContinuingEducation},
#{item.addUpHousingLoanInterest},
#{item.addUpHousingRent},
#{item.addUpSupportElderly},
#{item.addUpEnterpriseAndOther},
#{item.addUpOtherDeduction},
#{item.addUpTaxExemptIncome},
#{item.addUpAllowedDonation},
#{item.addUpAdvanceTax},
#{item.createTime},
#{item.updateTime},
#{item.creator},
2022-05-20 14:41:42 +08:00
#{item.tenantKey},
#{item.addUpTaxSavings},
#{item.addUpIllnessMedical},
#{item.addUpInfantCare}
2022-03-09 18:58:30 +08:00
)
</foreach>
</insert>
<insert id="insertData" databaseId="oracle">
INSERT INTO hrsa_add_up_situation(
employee_id,
tax_agent_id,
tax_year_month,
year,
add_up_income,
add_up_subtraction,
add_up_social_security_total,
add_up_accumulation_fund_total,
add_up_child_education,
add_up_continuing_education,
add_up_housing_loan_interest,
add_up_housing_rent,
add_up_support_elderly,
add_up_enterprise_and_other,
add_up_other_deduction,
add_up_tax_exempt_income,
add_up_allowed_donation,
add_up_advance_tax,
create_time,
update_time,
creator,
2022-05-20 14:41:42 +08:00
tenant_key,
add_up_tax_savings,
add_up_illness_medical,
add_up_infant_care
2022-03-09 18:58:30 +08:00
)
<foreach collection="collection" item="item" separator="union all">
select
#{item.employeeId},
#{item.taxAgentId},
#{item.taxYearMonth},
#{item.year},
#{item.addUpIncome},
#{item.addUpSubtraction},
#{item.addUpSocialSecurityTotal},
#{item.addUpAccumulationFundTotal},
#{item.addUpChildEducation},
#{item.addUpContinuingEducation},
#{item.addUpHousingLoanInterest},
#{item.addUpHousingRent},
#{item.addUpSupportElderly},
#{item.addUpEnterpriseAndOther},
#{item.addUpOtherDeduction},
#{item.addUpTaxExemptIncome},
#{item.addUpAllowedDonation},
#{item.addUpAdvanceTax},
#{item.createTime},
#{item.updateTime},
#{item.creator},
2022-05-20 14:41:42 +08:00
#{item.tenantKey},
#{item.addUpTaxSavings},
#{item.addUpIllnessMedical},
#{item.addUpInfantCare}
2022-03-09 18:58:30 +08:00
from dual
</foreach>
</insert>
<insert id="insertData" databaseId="sqlserver">
2022-04-22 18:00:35 +08:00
<foreach collection="collection" item="item" separator=";">
2022-05-20 14:41:42 +08:00
INSERT INTO hrsa_add_up_situation(
employee_id,
tax_agent_id,
tax_year_month,
year,
add_up_income,
add_up_subtraction,
add_up_social_security_total,
add_up_accumulation_fund_total,
add_up_child_education,
add_up_continuing_education,
add_up_housing_loan_interest,
add_up_housing_rent,
add_up_support_elderly,
add_up_enterprise_and_other,
add_up_other_deduction,
add_up_tax_exempt_income,
add_up_allowed_donation,
add_up_advance_tax,
create_time,
update_time,
creator,
tenant_key,
add_up_tax_savings,
add_up_illness_medical,
add_up_infant_care
)
VALUES
2022-03-09 18:58:30 +08:00
(
#{item.employeeId},
#{item.taxAgentId},
#{item.taxYearMonth},
#{item.year},
#{item.addUpIncome},
#{item.addUpSubtraction},
#{item.addUpSocialSecurityTotal},
#{item.addUpAccumulationFundTotal},
#{item.addUpChildEducation},
#{item.addUpContinuingEducation},
#{item.addUpHousingLoanInterest},
#{item.addUpHousingRent},
#{item.addUpSupportElderly},
#{item.addUpEnterpriseAndOther},
#{item.addUpOtherDeduction},
#{item.addUpTaxExemptIncome},
#{item.addUpAllowedDonation},
#{item.addUpAdvanceTax},
#{item.createTime},
#{item.updateTime},
#{item.creator},
2022-05-20 14:41:42 +08:00
#{item.tenantKey},
#{item.addUpTaxSavings},
#{item.addUpIllnessMedical},
#{item.addUpInfantCare}
2022-03-09 18:58:30 +08:00
)
</foreach>
</insert>
<update id="updateData" parameterType="java.util.List">
update hrsa_add_up_situation
<trim prefix="set" suffixOverrides=",">
<trim prefix="add_up_income =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpIncome!=null">
when id=#{item.id} then #{item.addUpIncome}
</if>
</foreach>
</trim>
<trim prefix="add_up_subtraction =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpSubtraction!=null">
when id=#{item.id} then #{item.addUpSubtraction}
</if>
</foreach>
</trim>
<trim prefix="add_up_social_security_total =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpSocialSecurityTotal!=null">
when id=#{item.id} then #{item.addUpSocialSecurityTotal}
</if>
</foreach>
</trim>
<trim prefix="add_up_accumulation_fund_total =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpAccumulationFundTotal!=null">
when id=#{item.id} then #{item.addUpAccumulationFundTotal}
</if>
</foreach>
</trim>
<trim prefix="add_up_child_education =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpChildEducation!=null">
when id=#{item.id} then #{item.addUpChildEducation}
</if>
</foreach>
</trim>
<trim prefix="add_up_continuing_education =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpContinuingEducation!=null">
when id=#{item.id} then #{item.addUpContinuingEducation}
</if>
</foreach>
</trim>
<trim prefix="add_up_housing_loan_interest =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpHousingLoanInterest!=null">
when id=#{item.id} then #{item.addUpHousingLoanInterest}
</if>
</foreach>
</trim>
<trim prefix="add_up_housing_rent =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpHousingRent!=null">
when id=#{item.id} then #{item.addUpHousingRent}
</if>
</foreach>
</trim>
<trim prefix="add_up_support_elderly =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpSupportElderly!=null">
when id=#{item.id} then #{item.addUpSupportElderly}
</if>
</foreach>
</trim>
<trim prefix="add_up_enterprise_and_other =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpEnterpriseAndOther!=null">
when id=#{item.id} then #{item.addUpEnterpriseAndOther}
</if>
</foreach>
</trim>
<trim prefix="add_up_other_deduction =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpOtherDeduction!=null">
when id=#{item.id} then #{item.addUpOtherDeduction}
</if>
</foreach>
</trim>
<trim prefix="add_up_tax_exempt_income =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpTaxExemptIncome!=null">
when id=#{item.id} then #{item.addUpTaxExemptIncome}
</if>
</foreach>
</trim>
<trim prefix="add_up_allowed_donation =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpAllowedDonation!=null">
when id=#{item.id} then #{item.addUpAllowedDonation}
</if>
</foreach>
</trim>
<trim prefix="add_up_advance_tax =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpAdvanceTax!=null">
when id=#{item.id} then #{item.addUpAdvanceTax}
</if>
</foreach>
</trim>
2022-05-20 14:41:42 +08:00
<trim prefix="add_up_tax_savings =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpTaxSavings!=null">
when id=#{item.id} then #{item.addUpTaxSavings}
</if>
</foreach>
</trim>
<trim prefix="add_up_illness_medical =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpIllnessMedical!=null">
when id=#{item.id} then #{item.addUpIllnessMedical}
</if>
</foreach>
</trim>
<trim prefix="add_up_infant_care =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.addUpInfantCare!=null">
when id=#{item.id} then #{item.addUpInfantCare}
</if>
</foreach>
</trim>
2022-03-09 18:58:30 +08:00
</trim>
where
id in
<foreach collection="collection" item="item" index="index" separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
<select id="listSome" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_add_up_situation t
WHERE delete_type = 0
<if test="param.taxYearMonth != null">
2022-05-20 14:41:42 +08:00
and tax_year_month = #{param.taxYearMonth}
2022-03-09 18:58:30 +08:00
</if>
2022-04-11 20:17:47 +08:00
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND employee_id IN
<foreach collection="param.employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
2022-04-21 14:15:56 +08:00
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
AND tax_agent_id IN
<foreach collection="param.taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</if>
2022-03-09 18:58:30 +08:00
</select>
2022-04-11 20:17:47 +08:00
<delete id="deleteSome">
UPDATE hrsa_add_up_situation
SET delete_type=1
2022-05-09 17:47:19 +08:00
WHERE delete_type = 0
2022-04-11 20:17:47 +08:00
AND tax_year_month = #{param.taxYearMonth}
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND employee_id IN
<foreach collection="param.employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</delete>
2022-03-09 18:58:30 +08:00
2022-05-09 17:47:19 +08:00
<delete id="deleteByTaxYearMonthAndTaxAgentIds">
UPDATE hrsa_add_up_situation
SET delete_type=1
WHERE delete_type = 0
AND tax_year_month = #{param.taxYearMonth}
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
AND tax_agent_id IN
<foreach collection="param.taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</if>
</delete>
2022-03-03 13:50:03 +08:00
</mapper>