826 lines
31 KiB
XML
826 lines
31 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.OtherDeductionMapper">
|
|
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.OtherDeductionPO">
|
|
<result column="id" property="id"/>
|
|
<result column="employee_id" property="employeeId"/>
|
|
<result column="tax_agent_id" property="taxAgentId"/>
|
|
<result column="declare_month" property="declareMonth"/>
|
|
<result column="business_healthy_insurance" property="businessHealthyInsurance"/>
|
|
<result column="tax_delay_endowment_insurance" property="taxDelayEndowmentInsurance"/>
|
|
<result column="other_deduction" property="otherDeduction"/>
|
|
<result column="deduction_allowed_donation" property="deductionAllowedDonation"/>
|
|
<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"/>
|
|
<result column="private_pension" property="privatePension"/>
|
|
<result column="free_income" property="freeIncome"/>
|
|
<result column="derate_deduction" property="derateDeduction"/>
|
|
</resultMap>
|
|
|
|
<!-- 表字段 -->
|
|
<sql id="baseColumns">
|
|
t
|
|
.
|
|
id
|
|
, t.employee_id
|
|
, t.tax_agent_id
|
|
, t.declare_month
|
|
, t.business_healthy_insurance
|
|
, t.tax_delay_endowment_insurance
|
|
, t.other_deduction
|
|
, t.deduction_allowed_donation
|
|
, t.create_time
|
|
, t.update_time
|
|
, t.creator
|
|
, t.delete_type
|
|
, t.tenant_key
|
|
, t.private_pension
|
|
, t.free_income
|
|
, t.derate_deduction
|
|
</sql>
|
|
|
|
<!--批量删除-->
|
|
<update id="deleteData">
|
|
UPDATE hrsa_other_deduction
|
|
SET delete_type = 1
|
|
WHERE delete_type = 0
|
|
AND id IN
|
|
<foreach collection="collection" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<delete id="delete">
|
|
UPDATE hrsa_other_deduction
|
|
SET delete_type=1
|
|
WHERE id = #{id} AND delete_type = 0
|
|
</delete>
|
|
|
|
<select id="getByTaxAgentIdAndEmployeeIdAndDeclareMonth" resultMap="BaseResultMap">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_other_deduction t
|
|
WHERE delete_type = 0
|
|
AND tax_agent_id = #{taxAgentId}
|
|
AND employee_id = #{employeeId}
|
|
AND declare_month = #{declareMonth}
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 根据主键获取单条记录 -->
|
|
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_other_deduction t
|
|
WHERE id = #{id} AND delete_type = 0
|
|
</select>
|
|
|
|
|
|
<sql id="otherDeductionColumn">
|
|
t1
|
|
.
|
|
id
|
|
,
|
|
t1.declare_month,
|
|
t1.employee_id,
|
|
t2.id AS tax_agent_id,
|
|
t2.name AS tax_agent_name,
|
|
e.lastname as username,
|
|
e.certificatenum as idNo,
|
|
d.departmentname AS departmentName,
|
|
e.mobile,
|
|
e.workcode as job_num,
|
|
e.companystartdate as hiredate,
|
|
t1.business_healthy_insurance,
|
|
t1.tax_delay_endowment_insurance,
|
|
t1.other_deduction,
|
|
t1.deduction_allowed_donation,
|
|
t1.private_pension,
|
|
t1.free_income,
|
|
t1.derate_deduction
|
|
</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.employeeId != null">
|
|
AND t1.employee_id = #{param.employeeId}
|
|
</if>
|
|
<!-- 关键字(姓名、部门、工号 -->
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
AND
|
|
(
|
|
e.lastname like CONCAT('%',#{param.keyword},'%')
|
|
OR d.departmentname like CONCAT('%',#{param.keyword},'%')
|
|
OR e.workcode like CONCAT('%',#{param.keyword},'%')
|
|
)
|
|
</if>
|
|
<!-- 申报月份 -->
|
|
<if test="param.declareMonthDate != null">
|
|
<if test="param.declareMonthDate.size() == 1">
|
|
AND t1.declare_month = #{param.declareMonthDate[0]}
|
|
</if>
|
|
<if test="param.declareMonthDate.size() == 2">
|
|
AND (t1.declare_month BETWEEN #{param.declareMonthDate[0]} AND #{param.declareMonthDate[1]})
|
|
</if>
|
|
</if>
|
|
<!-- 姓名 -->
|
|
<if test="param.username != null and param.username != ''">
|
|
AND e.lastname like CONCAT('%',#{param.username},'%')
|
|
</if>
|
|
<!-- 个税扣缴义务人 -->
|
|
<if test="param.taxAgentId != null">
|
|
AND t1.tax_agent_id = #{param.taxAgentId}
|
|
</if>
|
|
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
|
|
AND t1.tax_agent_id IN
|
|
<foreach collection="param.taxAgentIds" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</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 != ''">
|
|
AND e.workcode like CONCAT('%',#{param.jobNum},'%')
|
|
</if>
|
|
<!-- 入职日期 -->
|
|
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
|
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
|
</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.employeeId != null">
|
|
AND t1.employee_id = #{param.employeeId}
|
|
</if>
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
AND
|
|
(
|
|
e.lastname like '%'||#{param.keyword}||'%'
|
|
OR d.departmentname like '%'||#{param.keyword}||'%'
|
|
OR e.workcode like '%'||#{param.keyword}||'%'
|
|
)
|
|
</if>
|
|
|
|
<if test="param.declareMonthDate != null">
|
|
<if test="param.declareMonthDate.size() == 1">
|
|
AND t1.declare_month = #{param.declareMonthDate[0]}
|
|
</if>
|
|
<if test="param.declareMonthDate.size() == 2">
|
|
AND (t1.declare_month BETWEEN #{param.declareMonthDate[0]} AND #{param.declareMonthDate[1]})
|
|
</if>
|
|
</if>
|
|
|
|
<if test="param.username != null and param.username != ''">
|
|
AND e.lastname like '%'||#{param.username}||'%'
|
|
</if>
|
|
|
|
<if test="param.taxAgentId != null">
|
|
AND t1.tax_agent_id = #{param.taxAgentId}
|
|
</if>
|
|
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
|
|
AND t1.tax_agent_id IN
|
|
<foreach collection="param.taxAgentIds" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</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 != ''">
|
|
AND e.workcode like '%'||#{param.jobNum}||'%'
|
|
</if>
|
|
|
|
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
|
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
|
</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.employeeId != null">
|
|
AND t1.employee_id = #{param.employeeId}
|
|
</if>
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
AND
|
|
(
|
|
e.lastname like '%'+#{param.keyword}+'%'
|
|
OR d.departmentname like '%'+#{param.keyword}+'%'
|
|
OR e.workcode like '%'+#{param.keyword}+'%'
|
|
)
|
|
</if>
|
|
|
|
<if test="param.declareMonthDate != null">
|
|
<if test="param.declareMonthDate.size() == 1">
|
|
AND t1.declare_month = #{param.declareMonthDate[0]}
|
|
</if>
|
|
<if test="param.declareMonthDate.size() == 2">
|
|
AND (t1.declare_month BETWEEN #{param.declareMonthDate[0]} AND #{param.declareMonthDate[1]})
|
|
</if>
|
|
</if>
|
|
|
|
<if test="param.username != null and param.username != ''">
|
|
AND e.lastname like '%'+#{param.username}+'%'
|
|
</if>
|
|
|
|
<if test="param.taxAgentId != null">
|
|
AND t1.tax_agent_id = #{param.taxAgentId}
|
|
</if>
|
|
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
|
|
AND t1.tax_agent_id IN
|
|
<foreach collection="param.taxAgentIds" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</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 != ''">
|
|
AND e.workcode like '%'+#{param.jobNum}+'%'
|
|
</if>
|
|
|
|
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
|
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
|
</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.OtherDeductionListDTO">
|
|
SELECT
|
|
<include refid="otherDeductionColumn"/>
|
|
FROM
|
|
hrsa_other_deduction t1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
|
|
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
WHERE
|
|
t1.delete_type = 0 AND t2.delete_type = 0
|
|
AND e.status not in (7)
|
|
|
|
<include refid="paramSql"/>
|
|
<!-- 排序 -->
|
|
<if test="param.orderRule != null">
|
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="recordList" resultType="com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO">
|
|
SELECT
|
|
<include refid="otherDeductionColumn"/>
|
|
FROM
|
|
hrsa_other_deduction t1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
|
|
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
|
WHERE
|
|
t1.delete_type = 0 AND t2.delete_type = 0
|
|
AND e.status not in (7)
|
|
|
|
<include refid="paramSql"/>
|
|
ORDER BY t1.declare_month DESC
|
|
</select>
|
|
|
|
<select id="listSome" resultMap="BaseResultMap">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_other_deduction t
|
|
WHERE delete_type = 0
|
|
<if test="param.declareMonth != null">
|
|
and declare_month = #{param.declareMonth}
|
|
</if>
|
|
<if test="param.employeeIds != null and param.employeeIds.size()>0">
|
|
AND t.employee_id IN
|
|
<foreach collection="param.employeeIds" open="(" item="employeeId" separator="," close=")">
|
|
#{employeeId}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
|
|
AND t.tax_agent_id IN
|
|
<foreach collection="param.taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
|
|
#{taxAgentId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<insert id="insertData">
|
|
INSERT INTO hrsa_other_deduction(
|
|
employee_id,
|
|
tax_agent_id,
|
|
declare_month,
|
|
business_healthy_insurance,
|
|
tax_delay_endowment_insurance,
|
|
other_deduction,
|
|
deduction_allowed_donation,
|
|
private_pension,
|
|
free_income,
|
|
derate_deduction,
|
|
create_time,
|
|
update_time,
|
|
creator,
|
|
tenant_key
|
|
)
|
|
VALUES
|
|
<foreach collection="collection" item="item" separator=",">
|
|
(
|
|
#{item.employeeId},
|
|
#{item.taxAgentId},
|
|
#{item.declareMonth},
|
|
#{item.businessHealthyInsurance},
|
|
#{item.taxDelayEndowmentInsurance},
|
|
#{item.otherDeduction},
|
|
#{item.deductionAllowedDonation},
|
|
#{item.privatePension},
|
|
#{item.freeIncome},
|
|
#{item.derateDeduction},
|
|
#{item.createTime},
|
|
#{item.updateTime},
|
|
#{item.creator},
|
|
#{item.tenantKey}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
<insert id="insertData" databaseId="oracle">
|
|
INSERT INTO hrsa_other_deduction(
|
|
employee_id,
|
|
tax_agent_id,
|
|
declare_month,
|
|
business_healthy_insurance,
|
|
tax_delay_endowment_insurance,
|
|
other_deduction,
|
|
deduction_allowed_donation,
|
|
private_pension,
|
|
free_income,
|
|
derate_deduction,
|
|
create_time,
|
|
update_time,
|
|
creator,
|
|
tenant_key
|
|
)
|
|
|
|
<foreach collection="collection" item="item" separator="union all">
|
|
select
|
|
#{item.employeeId,jdbcType=DOUBLE},
|
|
#{item.taxAgentId,jdbcType=DOUBLE},
|
|
#{item.declareMonth,jdbcType=DATE},
|
|
#{item.businessHealthyInsurance,jdbcType=VARCHAR},
|
|
#{item.taxDelayEndowmentInsurance,jdbcType=VARCHAR},
|
|
#{item.otherDeduction,jdbcType=VARCHAR},
|
|
#{item.deductionAllowedDonation,jdbcType=VARCHAR},
|
|
#{item.privatePension,jdbcType=VARCHAR},
|
|
#{item.freeIncome,jdbcType=VARCHAR},
|
|
#{item.derateDeduction,jdbcType=VARCHAR},
|
|
#{item.createTime,jdbcType=DATE},
|
|
#{item.updateTime,jdbcType=DATE},
|
|
#{item.creator,jdbcType=DOUBLE},
|
|
#{item.tenantKey,jdbcType=VARCHAR}
|
|
from dual
|
|
</foreach>
|
|
</insert>
|
|
<insert id="insertData" databaseId="sqlserver">
|
|
<foreach collection="collection" item="item" separator=";">
|
|
INSERT INTO hrsa_other_deduction(
|
|
employee_id,
|
|
tax_agent_id,
|
|
declare_month,
|
|
business_healthy_insurance,
|
|
tax_delay_endowment_insurance,
|
|
other_deduction,
|
|
deduction_allowed_donation,
|
|
private_pension,
|
|
free_income,
|
|
derate_deduction,
|
|
create_time,
|
|
update_time,
|
|
creator,
|
|
tenant_key
|
|
)
|
|
VALUES
|
|
(
|
|
#{item.employeeId},
|
|
#{item.taxAgentId},
|
|
#{item.declareMonth},
|
|
#{item.businessHealthyInsurance},
|
|
#{item.taxDelayEndowmentInsurance},
|
|
#{item.otherDeduction},
|
|
#{item.deductionAllowedDonation},
|
|
#{item.privatePension},
|
|
#{item.freeIncome},
|
|
#{item.derateDeduction},
|
|
#{item.createTime},
|
|
#{item.updateTime},
|
|
#{item.creator},
|
|
#{item.tenantKey}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="updateData" parameterType="java.util.List">
|
|
update hrsa_other_deduction
|
|
<trim prefix="set" suffixOverrides=",">
|
|
<trim prefix="business_healthy_insurance =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.businessHealthyInsurance!=null">
|
|
when id=#{item.id} then #{item.businessHealthyInsurance}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="tax_delay_endowment_insurance =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.taxDelayEndowmentInsurance!=null">
|
|
when id=#{item.id} then #{item.taxDelayEndowmentInsurance}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="other_deduction =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.otherDeduction!=null">
|
|
when id=#{item.id} then #{item.otherDeduction}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="deduction_allowed_donation =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.deductionAllowedDonation!=null">
|
|
when id=#{item.id} then #{item.deductionAllowedDonation}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="private_pension =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.privatePension!=null">
|
|
when id=#{item.id} then #{item.privatePension}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="free_income =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.freeIncome!=null">
|
|
when id=#{item.id} then #{item.freeIncome}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="derate_deduction =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.derateDeduction!=null">
|
|
when id=#{item.id} then #{item.derateDeduction}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="update_time =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.updateTime!=null">
|
|
when id=#{item.id} then #{item.updateTime}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
</trim>
|
|
where
|
|
id in
|
|
<foreach collection="collection" item="item" index="index" separator="," open="(" close=")">
|
|
#{item.id}
|
|
</foreach>
|
|
</update>
|
|
|
|
|
|
<!-- 插入不为NULL的字段 -->
|
|
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.OtherDeductionPO"
|
|
keyProperty="id" keyColumn="id" useGeneratedKeys="true">
|
|
INSERT INTO hrsa_other_deduction
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="businessHealthyInsurance != null">
|
|
business_healthy_insurance,
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time,
|
|
</if>
|
|
<if test="creator != null">
|
|
creator,
|
|
</if>
|
|
<if test="declareMonth != null">
|
|
declare_month,
|
|
</if>
|
|
<if test="deductionAllowedDonation != null">
|
|
deduction_allowed_donation,
|
|
</if>
|
|
<if test="deleteType != null">
|
|
delete_type,
|
|
</if>
|
|
<if test="derateDeduction != null">
|
|
derate_deduction,
|
|
</if>
|
|
<if test="employeeId != null">
|
|
employee_id,
|
|
</if>
|
|
<if test="freeIncome != null">
|
|
free_income,
|
|
</if>
|
|
<if test="otherDeduction != null">
|
|
other_deduction,
|
|
</if>
|
|
<if test="privatePension != null">
|
|
private_pension,
|
|
</if>
|
|
<if test="taxAgentId != null">
|
|
tax_agent_id,
|
|
</if>
|
|
<if test="taxDelayEndowmentInsurance != null">
|
|
tax_delay_endowment_insurance,
|
|
</if>
|
|
<if test="tenantKey != null">
|
|
tenant_key,
|
|
</if>
|
|
<if test="updateTime != null">
|
|
update_time,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
|
<if test="businessHealthyInsurance != null" >
|
|
#{businessHealthyInsurance},
|
|
</if>
|
|
<if test="createTime != null" >
|
|
#{createTime},
|
|
</if>
|
|
<if test="creator != null" >
|
|
#{creator},
|
|
</if>
|
|
<if test="declareMonth != null" >
|
|
#{declareMonth},
|
|
</if>
|
|
<if test="deductionAllowedDonation != null" >
|
|
#{deductionAllowedDonation},
|
|
</if>
|
|
<if test="deleteType != null" >
|
|
#{deleteType},
|
|
</if>
|
|
<if test="derateDeduction != null" >
|
|
#{derateDeduction},
|
|
</if>
|
|
<if test="employeeId != null" >
|
|
#{employeeId},
|
|
</if>
|
|
<if test="freeIncome != null" >
|
|
#{freeIncome},
|
|
</if>
|
|
<if test="otherDeduction != null" >
|
|
#{otherDeduction},
|
|
</if>
|
|
<if test="privatePension != null" >
|
|
#{privatePension},
|
|
</if>
|
|
<if test="taxAgentId != null" >
|
|
#{taxAgentId},
|
|
</if>
|
|
<if test="taxDelayEndowmentInsurance != null" >
|
|
#{taxDelayEndowmentInsurance},
|
|
</if>
|
|
<if test="tenantKey != null" >
|
|
#{tenantKey},
|
|
</if>
|
|
<if test="updateTime != null" >
|
|
#{updateTime},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.OtherDeductionPO" databaseId="oracle">
|
|
|
|
<selectKey keyProperty="id" resultType="long" order="AFTER">
|
|
select hrsa_other_deduction_id.currval from dual
|
|
</selectKey>
|
|
|
|
INSERT INTO hrsa_other_deduction
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="businessHealthyInsurance != null">
|
|
business_healthy_insurance,
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time,
|
|
</if>
|
|
<if test="creator != null">
|
|
creator,
|
|
</if>
|
|
<if test="declareMonth != null">
|
|
declare_month,
|
|
</if>
|
|
<if test="deductionAllowedDonation != null">
|
|
deduction_allowed_donation,
|
|
</if>
|
|
<if test="deleteType != null">
|
|
delete_type,
|
|
</if>
|
|
<if test="derateDeduction != null">
|
|
derate_deduction,
|
|
</if>
|
|
<if test="employeeId != null">
|
|
employee_id,
|
|
</if>
|
|
<if test="freeIncome != null">
|
|
free_income,
|
|
</if>
|
|
<if test="otherDeduction != null">
|
|
other_deduction,
|
|
</if>
|
|
<if test="privatePension != null">
|
|
private_pension,
|
|
</if>
|
|
<if test="taxAgentId != null">
|
|
tax_agent_id,
|
|
</if>
|
|
<if test="taxDelayEndowmentInsurance != null">
|
|
tax_delay_endowment_insurance,
|
|
</if>
|
|
<if test="tenantKey != null">
|
|
tenant_key,
|
|
</if>
|
|
<if test="updateTime != null">
|
|
update_time,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
|
<if test="businessHealthyInsurance != null" >
|
|
#{businessHealthyInsurance},
|
|
</if>
|
|
<if test="createTime != null" >
|
|
#{createTime},
|
|
</if>
|
|
<if test="creator != null" >
|
|
#{creator},
|
|
</if>
|
|
<if test="declareMonth != null" >
|
|
#{declareMonth},
|
|
</if>
|
|
<if test="deductionAllowedDonation != null" >
|
|
#{deductionAllowedDonation},
|
|
</if>
|
|
<if test="deleteType != null" >
|
|
#{deleteType},
|
|
</if>
|
|
<if test="derateDeduction != null" >
|
|
#{derateDeduction},
|
|
</if>
|
|
<if test="employeeId != null" >
|
|
#{employeeId},
|
|
</if>
|
|
<if test="freeIncome != null" >
|
|
#{freeIncome},
|
|
</if>
|
|
<if test="otherDeduction != null" >
|
|
#{otherDeduction},
|
|
</if>
|
|
<if test="privatePension != null" >
|
|
#{privatePension},
|
|
</if>
|
|
<if test="taxAgentId != null" >
|
|
#{taxAgentId},
|
|
</if>
|
|
<if test="taxDelayEndowmentInsurance != null" >
|
|
#{taxDelayEndowmentInsurance},
|
|
</if>
|
|
<if test="tenantKey != null" >
|
|
#{tenantKey},
|
|
</if>
|
|
<if test="updateTime != null" >
|
|
#{updateTime},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<resultMap id="listDetailsResultMap" type="com.engine.salary.entity.datacollection.po.OtherDeductionPO">
|
|
<result column="id" property="id"/>
|
|
<result column="employee_id" property="employeeId"/>
|
|
<result column="tax_agent_id" property="taxAgentId"/>
|
|
<result column="declare_month" property="declareMonth"/>
|
|
<result column="business_healthy_insurance" property="businessHealthyInsurance"/>
|
|
<result column="tax_delay_endowment_insurance" property="taxDelayEndowmentInsurance"/>
|
|
<result column="other_deduction" property="otherDeduction"/>
|
|
<result column="deduction_allowed_donation" property="deductionAllowedDonation"/>
|
|
<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"/>
|
|
<result column="private_pension" property="privatePension"/>
|
|
<result column="free_income" property="freeIncome"/>
|
|
<result column="derate_deduction" property="derateDeduction"/>
|
|
<collection property="freeIncomeList" ofType="com.engine.salary.entity.datacollection.po.FreeIncomePO">
|
|
<id property="id" column="free_id"/>
|
|
<result property="freeAmount" column="free_amount"></result>
|
|
</collection>
|
|
<collection property="derateDeductionList" ofType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
|
|
<id property="id" column="derate_id"/>
|
|
<result property="derateAmount" column="derate_amount"></result>
|
|
</collection>
|
|
<collection property="endowmentInsuranceList" ofType="com.engine.salary.entity.datacollection.po.EndowmentInsurancePO">
|
|
<id property="id" column="endowment_id"/>
|
|
<result property="currentDeduction" column="endowment_current_deduction"></result>
|
|
</collection>
|
|
<collection property="grantDonationList" ofType="com.engine.salary.entity.datacollection.po.GrantDonationPO">
|
|
<id property="id" column="grant_id"/>
|
|
<result property="actualDeduction" column="actual_deduction"></result>
|
|
</collection>
|
|
<collection property="healthInsuranceList" ofType="com.engine.salary.entity.datacollection.po.HealthInsurancePO">
|
|
<id property="id" column="health_id"/>
|
|
<result property="currentDeduction" column="health_current_deduction"></result>
|
|
</collection>
|
|
<collection property="otherDerateDeductionList" ofType="com.engine.salary.entity.datacollection.po.OtherDerateDeductionPO">
|
|
<id property="id" column="other_id"/>
|
|
<result property="otherDeduction" column="other_deduction"></result>
|
|
</collection>
|
|
<collection property="personalPensionList" ofType="com.engine.salary.entity.datacollection.po.PersonalPensionPO">
|
|
<id property="id" column="personal_id"/>
|
|
<result property="payAmount" column="pay_amount"></result>
|
|
</collection>
|
|
|
|
</resultMap>
|
|
|
|
<select id="listDetails" resultMap="listDetailsResultMap">
|
|
SELECT t.id
|
|
, t.employee_id
|
|
, t.tax_agent_id
|
|
, t.declare_month
|
|
, t.business_healthy_insurance
|
|
, t.tax_delay_endowment_insurance
|
|
, t.other_deduction
|
|
, t.deduction_allowed_donation
|
|
, t.create_time
|
|
, t.update_time
|
|
, t.creator
|
|
, t.delete_type
|
|
, t.tenant_key
|
|
, t.private_pension
|
|
, t.free_income
|
|
, t.derate_deduction
|
|
,a.id as free_id, a.free_amount
|
|
,b.id as derate_id, b.derate_amount
|
|
,c.id as endowment_id, c.current_deduction as endowment_current_deduction
|
|
,d.id as grant_id, d.actual_deduction
|
|
,e.id as health_id, e.current_deduction as health_current_deduction
|
|
,f.id as other_id, f.other_deduction
|
|
,g.id as personal_id, g.pay_amount
|
|
FROM hrsa_other_deduction t
|
|
left join hrsa_free_income a on t.id=a.main_id and a.delete_type=0 and a.income_category=#{param.incomeCategory}
|
|
left join hrsa_derate_deduction b on t.id=b.main_id and b.delete_type=0 and b.income_category=#{param.incomeCategory}
|
|
left join hrsa_endowment_insurance c on t.id=c.main_id and c.delete_type=0 and c.income_category=#{param.incomeCategory}
|
|
left join hrsa_grant_donation d on t.id=d.main_id and d.delete_type=0 and d.income_category=#{param.incomeCategory}
|
|
left join hrsa_health_insurance e on t.id=e.main_id and e.delete_type=0 and e.income_category=#{param.incomeCategory}
|
|
left join hrsa_other_derate_deduction f on t.id=f.main_id and f.delete_type=0 and f.income_category=#{param.incomeCategory}
|
|
left join hrsa_personal_pension g on t.id=g.main_id and g.delete_type=0 and g.income_category=#{param.incomeCategory}
|
|
where t.delete_type=0
|
|
and t.tax_agent_id = #{param.taxAgentId}
|
|
and t.declare_month = #{param.declareMonth}
|
|
<if test="param.employeeIds != null and param.employeeIds.size()>0">
|
|
AND t.employee_id IN
|
|
<foreach collection="param.employeeIds" open="(" item="employeeId" separator="," close=")">
|
|
#{employeeId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
</mapper> |