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

313 lines
14 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.DerateDeductionMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
<result column="create_time" property="createTime" />
<result column="creator" property="creator" />
<result column="delete_type" property="deleteType" />
<result column="derate_amount" property="derateAmount" />
<result column="derate_item" property="derateItem" />
<result column="derate_property" property="derateProperty" />
<result column="employee_id" property="employeeId" />
<result column="employee_type" property="employeeType" />
<result column="file_status" property="fileStatus" />
<result column="id" property="id" />
<result column="main_id" property="mainId" />
<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" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.create_time
, t.creator
, t.delete_type
, t.derate_amount
, t.derate_item
, t.derate_property
, t.employee_id
, t.employee_type
, t.file_status
, t.id
, t.main_id
, t.tax_agent_id
, t.tax_year_month
, t.tenant_key
, t.update_time
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_derate_deduction t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_derate_deduction t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_derate_deduction t
WHERE delete_type = 0
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="derateAmount != null">
AND derate_amount = #{derateAmount}
</if>
<if test="derateItem != null">
AND derate_item = #{derateItem}
</if>
<if test="derateProperty != null">
AND derate_property = #{derateProperty}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="employeeType != null">
AND employee_type = #{employeeType}
</if>
<if test="fileStatus != null">
AND file_status = #{fileStatus}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="mainId != null">
AND main_id = #{mainId}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="taxYearMonth != null">
AND tax_year_month = #{taxYearMonth}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
INSERT INTO hrsa_derate_deduction
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="derateAmount != null">
derate_amount,
</if>
<if test="derateItem != null">
derate_item,
</if>
<if test="derateProperty != null">
derate_property,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="employeeType != null">
employee_type,
</if>
<if test="fileStatus != null">
file_status,
</if>
<if test="id != null">
id,
</if>
<if test="mainId != null">
main_id,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="taxYearMonth != null">
tax_year_month,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="createTime != null" >
#{createTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="derateAmount != null" >
#{derateAmount},
</if>
<if test="derateItem != null" >
#{derateItem},
</if>
<if test="derateProperty != null" >
#{derateProperty},
</if>
<if test="employeeId != null" >
#{employeeId},
</if>
<if test="employeeType != null" >
#{employeeType},
</if>
<if test="fileStatus != null" >
#{fileStatus},
</if>
<if test="id != null" >
#{id},
</if>
<if test="mainId != null" >
#{mainId},
</if>
<if test="taxAgentId != null" >
#{taxAgentId},
</if>
<if test="taxYearMonth != null" >
#{taxYearMonth},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
UPDATE hrsa_derate_deduction
<set>
create_time=#{createTime},
creator=#{creator},
delete_type=#{deleteType},
derate_amount=#{derateAmount},
derate_item=#{derateItem},
derate_property=#{derateProperty},
employee_id=#{employeeId},
employee_type=#{employeeType},
file_status=#{fileStatus},
main_id=#{mainId},
tax_agent_id=#{taxAgentId},
tax_year_month=#{taxYearMonth},
tenant_key=#{tenantKey},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.DerateDeductionPO">
UPDATE hrsa_derate_deduction
<set>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="derateAmount != null" >
derate_amount=#{derateAmount},
</if>
<if test="derateItem != null" >
derate_item=#{derateItem},
</if>
<if test="derateProperty != null" >
derate_property=#{derateProperty},
</if>
<if test="employeeId != null" >
employee_id=#{employeeId},
</if>
<if test="employeeType != null" >
employee_type=#{employeeType},
</if>
<if test="fileStatus != null" >
file_status=#{fileStatus},
</if>
<if test="mainId != null" >
main_id=#{mainId},
</if>
<if test="taxAgentId != null" >
tax_agent_id=#{taxAgentId},
</if>
<if test="taxYearMonth != null" >
tax_year_month=#{taxYearMonth},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete">
UPDATE hrsa_derate_deduction
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_derate_deduction
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>