281 lines
9.4 KiB
XML
281 lines
9.4 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.siaccount.InsuranceCompensationMapper">
|
|
|
|
<resultMap id="BaseResultMap" type="com.engine.salary.entity.siaccount.po.InsuranceCompensationPO">
|
|
<result column="id" property="id"/>
|
|
<result column="payment_agency" property="paymentAgency"/>
|
|
<result column="payment_organization" property="paymentOrganization"/>
|
|
<result column="employee_id" property="employeeId"/>
|
|
<result column="welfare_type" property="welfareType"/>
|
|
<result column="category_type" property="categoryType"/>
|
|
<result column="country_total" property="countryTotal"/>
|
|
<result column="company_total" property="companyTotal"/>
|
|
<result column="adjustment_total" property="adjustmentTotal"/>
|
|
<result column="adjust_to" property="adjustTo"/>
|
|
<result column="bill_month" property="billMonth"/>
|
|
<result column="creator" property="creator"/>
|
|
<result column="delete_type" property="deleteType"/>
|
|
<result column="create_time" property="createTime"/>
|
|
<result column="update_time" property="updateTime"/>
|
|
<result column="tenant_key" property="tenantKey"/>
|
|
</resultMap>
|
|
<!-- 表字段 -->
|
|
<sql id="baseColumns">
|
|
t.id
|
|
, t.payment_agency
|
|
, t.employee_id
|
|
, t.payment_organization
|
|
, t.welfare_type
|
|
, t.category_type
|
|
, t.country_total
|
|
, t.company_total
|
|
, t.adjustment_total
|
|
, t.adjust_to
|
|
, t.bill_month
|
|
, t.create_time
|
|
, t.update_time
|
|
, t.creator
|
|
, t.delete_type
|
|
, t.tenant_key
|
|
</sql>
|
|
|
|
<insert id="batchInsert">
|
|
INSERT INTO hrsa_compensation_log(
|
|
id,
|
|
employee_id,
|
|
payment_organization,
|
|
welfare_type,
|
|
category_type,
|
|
country_total,
|
|
company_total,
|
|
adjustment_total,
|
|
adjust_to,
|
|
bill_month,
|
|
create_time,
|
|
update_time,
|
|
creator,
|
|
delete_type,
|
|
tenant_key
|
|
)
|
|
VALUES
|
|
<foreach collection="collection" item="item" separator=",">
|
|
(
|
|
#{item.id},
|
|
#{item.employeeId},
|
|
#{item.paymentOrganization},
|
|
#{item.welfareType},
|
|
#{item.categoryType},
|
|
#{item.countryTotal},
|
|
#{item.companyTotal},
|
|
#{item.adjustmentTotal},
|
|
#{item.adjustTo},
|
|
#{item.billMonth},
|
|
#{item.createTime},
|
|
#{item.updateTime},
|
|
#{item.creator},
|
|
#{item.deleteType},
|
|
#{item.tenantKey}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchInsert" databaseId="oracle">
|
|
INSERT INTO hrsa_compensation_log(
|
|
id,
|
|
employee_id,
|
|
payment_organization,
|
|
welfare_type,
|
|
category_type,
|
|
country_total,
|
|
company_total,
|
|
adjustment_total,
|
|
adjust_to,
|
|
bill_month,
|
|
create_time,
|
|
update_time,
|
|
creator,
|
|
delete_type,
|
|
tenant_key
|
|
)
|
|
|
|
<foreach collection="collection" item="item" separator="union all">
|
|
select
|
|
#{item.id,jdbcType=DOUBLE},
|
|
#{item.employeeId,jdbcType=DOUBLE},
|
|
#{item.paymentOrganization,jdbcType=DOUBLE},
|
|
#{item.welfareType,jdbcType=INTEGER},
|
|
#{item.categoryType,jdbcType=VARCHAR},
|
|
#{item.countryTotal,jdbcType=VARCHAR},
|
|
#{item.companyTotal,jdbcType=VARCHAR},
|
|
#{item.adjustmentTotal,jdbcType=VARCHAR},
|
|
#{item.adjustTo,jdbcType=DOUBLE},
|
|
#{item.billMonth,jdbcType=VARCHAR},
|
|
#{item.createTime,jdbcType=DATE},
|
|
#{item.updateTime,jdbcType=DATE},
|
|
#{item.creator,jdbcType=DOUBLE},
|
|
#{item.deleteType,jdbcType=INTEGER},
|
|
#{item.tenantKey,jdbcType=VARCHAR}
|
|
from dual
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchInsert" databaseId="sqlserver">
|
|
<foreach collection="collection" item="item" separator=";">
|
|
INSERT INTO hrsa_compensation_log(
|
|
id,
|
|
employee_id,
|
|
payment_organization,
|
|
welfare_type,
|
|
category_type,
|
|
country_total,
|
|
company_total,
|
|
adjustment_total,
|
|
adjust_to,
|
|
bill_month,
|
|
create_time,
|
|
update_time,
|
|
creator,
|
|
delete_type,
|
|
tenant_key
|
|
)
|
|
VALUES
|
|
(
|
|
#{item.id},
|
|
#{item.employeeId},
|
|
#{item.paymentOrganization},
|
|
#{item.welfareType},
|
|
#{item.categoryType},
|
|
#{item.countryTotal},
|
|
#{item.companyTotal},
|
|
#{item.adjustmentTotal},
|
|
#{item.adjustTo},
|
|
#{item.billMonth},
|
|
#{item.createTime},
|
|
#{item.updateTime},
|
|
#{item.creator},
|
|
#{item.deleteType},
|
|
#{item.tenantKey}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<insert id="insert" parameterType="com.engine.salary.entity.siaccount.po.InsuranceCompensationPO">
|
|
insert into hrsa_compensation_log (
|
|
id,
|
|
employee_id,
|
|
payment_organization,
|
|
welfare_type,
|
|
category_type,
|
|
country_total,
|
|
company_total,
|
|
adjustment_total,
|
|
adjust_to,
|
|
bill_month,
|
|
create_time,
|
|
update_time,
|
|
creator,
|
|
delete_type,
|
|
tenant_key)
|
|
VALUES (
|
|
#{id},
|
|
#{employeeId},
|
|
#{paymentOrganization},
|
|
#{welfareType},
|
|
#{categoryType},
|
|
#{countryTotal},
|
|
#{companyTotal},
|
|
#{adjustmentTotal},
|
|
#{adjustTo},
|
|
#{billMonth},
|
|
#{createTime},
|
|
#{updateTime},
|
|
#{creator},
|
|
#{deleteType},
|
|
#{tenantKey})
|
|
</insert>
|
|
|
|
<!-- 根据主键获取单条记录 -->
|
|
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_compensation_log t
|
|
WHERE t.id = #{id} AND t.delete_type = 0
|
|
</select>
|
|
|
|
<select id="queryByBillMonthAndPayOrg" resultMap="BaseResultMap">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_compensation_log t
|
|
WHERE t.bill_month = #{billMonth}
|
|
AND t.payment_organization = #{paymentOrganization}
|
|
AND t.delete_type = 0
|
|
ORDER BY t.employee_id, t.create_time
|
|
</select>
|
|
|
|
<!-- 根据账单月份、个税扣缴义务人、人员id获取单条记录 -->
|
|
<select id="getOneByBillMonthPayOrgEmpId" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.siaccount.po.InsuranceCompensationPO">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_compensation_log t
|
|
WHERE t.bill_month = #{billMonth}
|
|
AND t.payment_organization = #{paymentOrganization}
|
|
AND t.employee_id = #{employeeId}
|
|
AND t.delete_type = 0
|
|
</select>
|
|
|
|
<!-- 根据账单月份、个税扣缴义务人、人员id获取多条记录 -->
|
|
<select id="getListByBillMonthPayOrgEmpId" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.siaccount.po.InsuranceCompensationPO">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_compensation_log t
|
|
WHERE t.bill_month = #{billMonth}
|
|
AND t.payment_organization = #{paymentOrganization}
|
|
AND t.employee_id = #{employeeId}
|
|
AND t.delete_type = 0
|
|
</select>
|
|
|
|
<!-- 根据账单月份、个税扣缴义务人、人员ids获取记录list -->
|
|
<select id="getByBillMonthPayOrgEmpIds" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.siaccount.po.InsuranceCompensationPO">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_compensation_log t
|
|
WHERE t.bill_month = #{billMonth}
|
|
AND t.payment_organization = #{paymentOrganization}
|
|
AND t.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="deleteById">
|
|
UPDATE hrsa_compensation_log
|
|
SET delete_type = 1
|
|
WHERE id = #{id}
|
|
AND delete_type = 0
|
|
</delete>
|
|
|
|
<delete id="deleteByBillMonthAndPayOrg">
|
|
UPDATE hrsa_compensation_log
|
|
SET delete_type = 1
|
|
WHERE bill_month = #{billMonth}
|
|
AND payment_organization = #{paymentOrganization}
|
|
AND delete_type = 0
|
|
</delete>
|
|
|
|
<delete id="deleteByBillMonthPayOrgEmpIds" parameterType="com.engine.salary.entity.siaccount.po.InsuranceCompensationPO">
|
|
UPDATE hrsa_compensation_log
|
|
SET delete_type = 1
|
|
WHERE bill_month = #{billMonth}
|
|
AND payment_organization = #{paymentOrganization}
|
|
AND 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>
|
|
|
|
</mapper> |