weaver-hrm-salary/src/com/engine/salary/mapper/salarysob/SalarySobTaxReportRuleMappe...

349 lines
11 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.salarysob.SalarySobTaxReportRuleMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salarysob.po.SalarySobTaxReportRulePO">
<result column="id" property="id"/>
<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="salary_sob_id" property="salarySobId"/>
<result column="income_category" property="incomeCategory"/>
<result column="report_column_data_index" property="reportColumnDataIndex"/>
<result column="salary_item_id" property="salaryItemId"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
, t.salary_sob_id
, t.income_category
, t.report_column_data_index
, t.salary_item_id
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_sob_tax_report_rule t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_sob_tax_report_rule t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salarysob.po.SalarySobTaxReportRulePO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_sob_tax_report_rule t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="salarySobId != null">
AND salary_sob_id = #{salarySobId}
</if>
<if test="incomeCategory != null">
AND income_category = #{incomeCategory}
</if>
<if test="reportColumnDataIndex != null">
AND report_column_data_index = #{reportColumnDataIndex}
</if>
<if test="salaryItemId != null">
AND salary_item_id = #{salaryItemId}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="salarySobIds != null and salarySobIds.size()>0">
AND salary_sob_id IN
<foreach collection="salarySobIds" open="(" item="salarySobId" separator="," close=")">
#{salarySobId}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobTaxReportRulePO">
INSERT INTO hrsa_sob_tax_report_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="salarySobId != null">
salary_sob_id,
</if>
<if test="incomeCategory != null">
income_category,
</if>
<if test="reportColumnDataIndex != null">
report_column_data_index,
</if>
<if test="salaryItemId != null">
salary_item_id,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="salarySobId != null">
#{salarySobId},
</if>
<if test="incomeCategory != null">
#{incomeCategory},
</if>
<if test="reportColumnDataIndex != null">
#{reportColumnDataIndex},
</if>
<if test="salaryItemId != null">
#{salaryItemId},
</if>
</trim>
</insert>
<insert id="batchInsert">
INSERT INTO hrsa_sob_tax_report_rule
(
id,
create_time,
update_time,
creator,
delete_type,
tenant_key,
salary_sob_id,
income_category,
report_column_data_index,
salary_item_id,
)
VALUES
(
<foreach collection="collection" item="item" separator=",">
#{item.id},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.deleteType},
#{item.tenantKey},
#{item.salarySobId},
#{item.incomeCategory},
#{item.reportColumnDataIndex},
#{item.salaryItemId},
</foreach>
)
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_sob_tax_report_rule (
id,
create_time,
update_time,
creator,
delete_type,
tenant_key,
salary_sob_id,
income_category,
report_column_data_index,
salary_item_id,
)
<foreach collection="collection" item="item" separator="union all">
select
#{item.id,jdbcType=DOUBLE},
#{item.createTime,jdbcType=DATE},
#{item.updateTime,jdbcType=DATE},
#{item.creator,jdbcType=DOUBLE},
#{item.deleteType,jdbcType=INTEGER},
#{item.tenantKey,jdbcType=VARCHAR},
#{item.salarySobId,jdbcType=DOUBLE},
#{item.incomeCategory,jdbcType=VARCHAR},
#{item.reportColumnDataIndex,jdbcType=VARCHAR},
#{item.salaryItemId,jdbcType=DOUBLE},
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
<foreach collection="collection" item="item" separator=";">
INSERT INTO hrsa_sob_tax_report_rule (
id,
create_time,
update_time,
creator,
delete_type,
tenant_key,
salary_sob_id,
income_category,
report_column_data_index,
salary_item_id,
)
VALUES
(
#{item.id},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.deleteType},
#{item.tenantKey},
#{item.salarySobId},
#{item.incomeCategory},
#{item.reportColumnDataIndex},
#{item.salaryItemId},
)
</foreach>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.salarysob.po.SalarySobTaxReportRulePO">
UPDATE hrsa_sob_tax_report_rule
<set>
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
salary_sob_id=#{salarySobId},
income_category=#{incomeCategory},
report_column_data_index=#{reportColumnDataIndex},
salary_item_id=#{salaryItemId},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobTaxReportRulePO">
UPDATE hrsa_sob_tax_report_rule
<set>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
<if test="salarySobId != null">
salary_sob_id=#{salarySobId},
</if>
<if test="incomeCategory != null">
income_category=#{incomeCategory},
</if>
<if test="reportColumnDataIndex != null">
report_column_data_index=#{reportColumnDataIndex},
</if>
<if test="salaryItemId != null">
salary_item_id=#{salaryItemId},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete">
UPDATE hrsa_sob_tax_report_rule
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_sob_tax_report_rule
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteBySalarySobIds">
UPDATE hrsa_sob_tax_report_rule
SET delete_type = 1
WHERE delete_type = 0
AND salary_sob_id IN
<foreach collection="salarySobIds" open="(" item="salarySobId" separator="," close=")">
#{salarySobId}
</foreach>
</delete>
</mapper>