377 lines
12 KiB
XML
377 lines
12 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.FundSchemeMapper">
|
|
<resultMap id="BaseResultMap" type="com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO">
|
|
<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="fund_start_time" property="fundStartTime"/>
|
|
<result column="fund_end_time" property="fundEndTime"/>
|
|
<result column="fund_scheme_id" property="fundSchemeId"/>
|
|
<result column="fund_account" property="fundAccount"/>
|
|
<result column="supplement_fund_account" property="supplementFundAccount"/>
|
|
<result column="payment_organization" property="paymentOrganization"/>
|
|
<result column="under_take" property="underTake"/>
|
|
<result column="fund_payment_base_string" property="fundPaymentBaseString"/>
|
|
<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.fund_start_time
|
|
, t.fund_end_time
|
|
, t.fund_scheme_id
|
|
, t.fund_account
|
|
, t.supplement_fund_account
|
|
, t.payment_organization
|
|
, t.under_take
|
|
, t.fund_payment_base_string
|
|
, t.create_time
|
|
, t.update_time
|
|
, t.creator
|
|
, t.delete_type
|
|
, t.tenant_key
|
|
</sql>
|
|
|
|
|
|
<!-- 根据人员获取记录 -->
|
|
<select id="getFundByEmployeeId" resultMap="BaseResultMap" >
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_fund_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>
|
|
|
|
<!-- 根据人员id和个税扣缴人id获取记录 -->
|
|
<select id="getFundByEmployeeIdAndPayOrg" resultMap="BaseResultMap" >
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_fund_archives t
|
|
WHERE delete_type = 0
|
|
AND employee_id = #{param.employeeId}
|
|
AND payment_organization = #{param.paymentOrganization}
|
|
</select>
|
|
|
|
<!-- 根据id获取多条记录 -->
|
|
<select id="getFundById" resultMap="BaseResultMap" >
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_fund_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>
|
|
|
|
<!-- 根据id获取单条记录 -->
|
|
<select id="getOneById" resultMap="BaseResultMap" >
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_fund_archives t
|
|
WHERE delete_type = 0
|
|
AND id = #{id}
|
|
</select>
|
|
|
|
<!-- 批量删除 -->
|
|
<delete id="batchDeleteByEmployeeIds">
|
|
UPDATE hrsa_fund_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>
|
|
|
|
<delete id="deleteByIds">
|
|
UPDATE hrsa_fund_archives
|
|
SET delete_type = 1
|
|
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>
|
|
|
|
</delete>
|
|
|
|
<!-- 根据人员id和个税扣缴义务人删除档案 -->
|
|
<update id="deleteByEmployeeIdAndPayOrg" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO">
|
|
UPDATE hrsa_fund_archives
|
|
SET delete_type = 1
|
|
WHERE employee_id = #{param.employeeId}
|
|
AND payment_organization = #{param.paymentOrganization}
|
|
AND delete_type = 0
|
|
</update>
|
|
|
|
<!-- 批量保存 -->
|
|
<insert id="batchSave">
|
|
INSERT INTO hrsa_fund_archives(
|
|
fund_scheme_id,
|
|
fund_account,
|
|
fund_end_time,
|
|
fund_start_time,
|
|
fund_payment_base_string,
|
|
supplement_fund_account,
|
|
create_time,
|
|
creator,
|
|
non_payment,
|
|
delete_type,
|
|
tenant_key,
|
|
under_take,
|
|
payment_organization,
|
|
update_time,
|
|
welfare_type,
|
|
employee_id)
|
|
VALUES
|
|
<foreach collection="fundSchemePOS" item="item" separator=",">
|
|
(
|
|
#{item.fundSchemeId},
|
|
#{item.fundAccount},
|
|
#{item.fundEndTime},
|
|
#{item.fundStartTime},
|
|
#{item.fundPaymentBaseString},
|
|
#{item.supplementFundAccount},
|
|
#{item.createTime},
|
|
#{item.creator},
|
|
#{item.nonPayment},
|
|
#{item.deleteType},
|
|
#{item.tenantKey},
|
|
#{item.underTake},
|
|
#{item.paymentOrganization},
|
|
#{item.updateTime},
|
|
#{item.welfareType},
|
|
#{item.employeeId}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchSave" databaseId="oracle">
|
|
INSERT INTO hrsa_fund_archives(
|
|
fund_scheme_id,
|
|
fund_account,
|
|
fund_end_time,
|
|
fund_start_time,
|
|
fund_payment_base_string,
|
|
supplement_fund_account,
|
|
create_time,
|
|
creator,
|
|
non_payment,
|
|
delete_type,
|
|
tenant_key,
|
|
under_take,
|
|
payment_organization,
|
|
update_time,
|
|
welfare_type,
|
|
employee_id)
|
|
<foreach collection="fundSchemePOS" item="item" separator="union all">
|
|
select
|
|
#{item.fundSchemeId,jdbcType=DOUBLE},
|
|
#{item.fundAccount,jdbcType=VARCHAR},
|
|
#{item.fundEndTime,jdbcType=VARCHAR},
|
|
#{item.fundStartTime,jdbcType=VARCHAR},
|
|
#{item.fundPaymentBaseString,jdbcType=VARCHAR},
|
|
#{item.supplementFundAccount,jdbcType=VARCHAR},
|
|
#{item.createTime,jdbcType=DATE},
|
|
#{item.creator,jdbcType=DOUBLE},
|
|
#{item.nonPayment,jdbcType=INTEGER},
|
|
#{item.deleteType,jdbcType=INTEGER},
|
|
#{item.tenantKey,jdbcType=VARCHAR},
|
|
#{item.underTake,jdbcType=INTEGER},
|
|
#{item.paymentOrganization,jdbcType=DOUBLE},
|
|
#{item.updateTime,jdbcType=DATE},
|
|
#{item.welfareType,jdbcType=INTEGER},
|
|
#{item.employeeId,jdbcType=DOUBLE}
|
|
from dual
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchSave" databaseId="sqlserver">
|
|
<foreach collection="fundSchemePOS" item="item" separator=";">
|
|
INSERT INTO hrsa_fund_archives(
|
|
fund_scheme_id,
|
|
fund_account,
|
|
fund_end_time,
|
|
fund_start_time,
|
|
fund_payment_base_string,
|
|
supplement_fund_account,
|
|
create_time,
|
|
creator,
|
|
non_payment,
|
|
delete_type,
|
|
tenant_key,
|
|
under_take,
|
|
payment_organization,
|
|
update_time,
|
|
welfare_type,
|
|
employee_id)
|
|
VALUES
|
|
(
|
|
#{item.fundSchemeId},
|
|
#{item.fundAccount},
|
|
#{item.fundEndTime},
|
|
#{item.fundStartTime},
|
|
#{item.fundPaymentBaseString},
|
|
#{item.supplementFundAccount},
|
|
#{item.createTime},
|
|
#{item.creator},
|
|
#{item.nonPayment},
|
|
#{item.deleteType},
|
|
#{item.tenantKey},
|
|
#{item.underTake},
|
|
#{item.paymentOrganization},
|
|
#{item.updateTime},
|
|
#{item.welfareType},
|
|
#{item.employeeId}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
|
|
<select id="listAll" resultMap="BaseResultMap">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_fund_archives t
|
|
WHERE delete_type = 0
|
|
</select>
|
|
|
|
<update id="batchUpdate" parameterType="java.util.List">
|
|
update hrsa_fund_archives
|
|
<trim prefix="set" suffixOverrides=",">
|
|
<trim prefix="fund_payment_base_string =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.fundPaymentBaseString!=null">
|
|
when id=#{item.id} then #{item.fundPaymentBaseString}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<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>
|
|
</trim>
|
|
where
|
|
id in
|
|
<foreach collection="collection" item="item" index="index" separator="," open="(" close=")">
|
|
#{item.id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 批量更新最后缴纳月 -->
|
|
<update id="batchUpdateEndTime">
|
|
UPDATE hrsa_fund_archives
|
|
SET fund_end_time = #{endTime}
|
|
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>
|
|
</update>
|
|
|
|
<!-- 更新,更新全部字段 -->
|
|
<update id="updateById" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO">
|
|
UPDATE hrsa_fund_archives
|
|
<set>
|
|
welfare_type = #{welfareType},
|
|
fund_payment_base_string = #{fundPaymentBaseString},
|
|
fund_scheme_id = #{fundSchemeId},
|
|
fund_end_time = #{fundEndTime},
|
|
fund_start_time = #{fundStartTime},
|
|
non_payment = #{nonPayment},
|
|
tenant_key = #{tenantKey},
|
|
employee_id = #{employeeId},
|
|
update_time = #{updateTime},
|
|
under_take = #{underTake},
|
|
fund_account = #{fundAccount},
|
|
payment_organization = #{paymentOrganization},
|
|
supplement_fund_account = #{supplementFundAccount},
|
|
</set>
|
|
WHERE id = #{id} AND delete_type = 0
|
|
</update>
|
|
|
|
<!-- 批量更新最后缴纳月为null -->
|
|
<update id="batchUpdateEndTimeToNull">
|
|
UPDATE hrsa_fund_archives
|
|
SET fund_end_time = null
|
|
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>
|
|
</update>
|
|
<update id="updateEndTime">
|
|
UPDATE hrsa_fund_archives
|
|
SET fund_end_time = #{endTime}
|
|
WHERE delete_type = 0
|
|
AND id = #{id}
|
|
</update>
|
|
|
|
<insert id="insert" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO">
|
|
|
|
INSERT INTO hrsa_fund_archives(
|
|
fund_scheme_id,
|
|
fund_account,
|
|
fund_end_time,
|
|
fund_start_time,
|
|
fund_payment_base_string,
|
|
supplement_fund_account,
|
|
create_time,
|
|
creator,
|
|
non_payment,
|
|
delete_type,
|
|
tenant_key,
|
|
under_take,
|
|
payment_organization,
|
|
update_time,
|
|
welfare_type,
|
|
employee_id)
|
|
VALUES
|
|
(
|
|
#{fundSchemeId},
|
|
#{fundAccount},
|
|
#{fundEndTime},
|
|
#{fundStartTime},
|
|
#{fundPaymentBaseString},
|
|
#{supplementFundAccount},
|
|
#{createTime},
|
|
#{creator},
|
|
#{nonPayment},
|
|
#{deleteType},
|
|
#{tenantKey},
|
|
#{underTake},
|
|
#{paymentOrganization},
|
|
#{updateTime},
|
|
#{welfareType},
|
|
#{employeeId}
|
|
)
|
|
|
|
</insert>
|
|
</mapper> |