weaver-hrm-salary/src/com/engine/salary/mapper/archive/SalaryArchiveTaxAgentMapper...

312 lines
10 KiB
XML
Raw Normal View History

2022-03-28 16:36:40 +08:00
<?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.archive.SalaryArchiveTaxAgentMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO">
<result column="id" property="id"/>
<result column="salary_archive_id" property="salaryArchiveId"/>
<result column="employee_id" property="employeeId"/>
<result column="effective_time" property="effectiveTime"/>
<result column="adjust_reason" property="adjustReason"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="operator" property="operator"/>
<result column="operate_time" property="operateTime"/>
<result column="description" property="description"/>
<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.salary_archive_id
, t.employee_id
, t.effective_time
, t.adjust_reason
, t.tax_agent_id
, t.operator
, t.operate_time
, t.description
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_archive_tax_agent t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_archive_tax_agent t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_archive_tax_agent t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="salaryArchiveId != null">
AND salary_archive_id = #{salaryArchiveId}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="effectiveTime != null">
AND effective_time = #{effectiveTime}
</if>
<if test="adjustReason != null">
AND adjust_reason = #{adjustReason}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="operator != null">
AND operator = #{operator}
</if>
<if test="operateTime != null">
AND operate_time = #{operateTime}
</if>
<if test="description != null">
AND description = #{description}
</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="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.salaryarchive.po.SalaryArchiveTaxAgentPO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_salary_archive_tax_agent
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="salaryArchiveId != null">
salary_archive_id,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="effectiveTime != null">
effective_time,
</if>
<if test="adjustReason != null">
adjust_reason,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="operator != null">
operator,
</if>
<if test="operateTime != null">
operate_time,
</if>
<if test="description != null">
description,
</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>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="salaryArchiveId != null">
#{salaryArchiveId},
</if>
<if test="employeeId != null">
#{employeeId},
</if>
<if test="effectiveTime != null">
#{effectiveTime},
</if>
<if test="adjustReason != null">
#{adjustReason},
</if>
<if test="taxAgentId != null">
#{taxAgentId},
</if>
<if test="operator != null">
#{operator},
</if>
<if test="operateTime != null">
#{operateTime},
</if>
<if test="description != null">
#{description},
</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>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO">
UPDATE hrsa_salary_archive_tax_agent
<set>
salary_archive_id=#{salaryArchiveId},
employee_id=#{employeeId},
effective_time=#{effectiveTime},
adjust_reason=#{adjustReason},
tax_agent_id=#{taxAgentId},
operator=#{operator},
operate_time=#{operateTime},
description=#{description},
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO">
UPDATE hrsa_salary_archive_tax_agent
<set>
<if test="salaryArchiveId != null">
salary_archive_id=#{salaryArchiveId},
</if>
<if test="employeeId != null">
employee_id=#{employeeId},
</if>
<if test="effectiveTime != null">
effective_time=#{effectiveTime},
</if>
<if test="adjustReason != null">
adjust_reason=#{adjustReason},
</if>
<if test="taxAgentId != null">
tax_agent_id=#{taxAgentId},
</if>
<if test="operator != null">
operator=#{operator},
</if>
<if test="operateTime != null">
operate_time=#{operateTime},
</if>
<if test="description != null">
description=#{description},
</if>
<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>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO">
UPDATE hrsa_salary_archive_tax_agent
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<!-- 条件查询 -->
<select id="listByParam" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_archive_tax_agent t
WHERE delete_type = 0
<if test="param.effectiveTime != null">
AND t.effective_time &lt;= #{effectiveTime}
</if>
<if test="param.salaryArchiveIds != null and param.salaryArchiveIds.size()>0">
AND t.salary_archive_id IN
<foreach collection="param.ids" open="(" item="salaryArchiveId" separator="," close=")">
#{salaryArchiveId}
</foreach>
</if>
ORDER BY t.effective_time DESC
</select>
</mapper>