weaver-hrm-salary/src/com/engine/salary/mapper/taxagent/TaxAgentEmpChangeMapper.xml

344 lines
10 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.taxagent.TaxAgentEmpChangeMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
<result column="change_type" property="changeType"/>
<result column="create_time" property="createTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="employee_id" property="employeeId"/>
<result column="employee_name" property="employeeName"/>
<result column="id" property="id"/>
<result column="module_type" property="moduleType"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="tenant_key" property="tenantKey"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
change_type
, t.create_time
, t.creator
, t.delete_type
, t.employee_id
, t.employee_name
, t.id
, t.module_type
, t.tax_agent_id
, t.tenant_key
, t.update_time
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_agent_emp_change t
WHERE delete_type = 0
ORDER BY update_time ASC
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_agent_emp_change t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_agent_emp_change t
WHERE delete_type = 0
<if test="changeType != null">
AND change_type = #{changeType}
</if>
<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="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="employeeName != null">
AND employee_name = #{employeeName}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="moduleType != null">
AND module_type = #{moduleType}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</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 update_time ASC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
INSERT INTO hrsa_tax_agent_emp_change
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="changeType != null">
change_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="employeeName != null">
employee_name,
</if>
<if test="id != null">
id,
</if>
<if test="moduleType != null">
module_type,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="changeType != null">
#{changeType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="employeeId != null">
#{employeeId},
</if>
<if test="employeeName != null">
#{employeeName},
</if>
<if test="id != null">
#{id},
</if>
<if test="moduleType != null">
#{moduleType},
</if>
<if test="taxAgentId != null">
#{taxAgentId},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
UPDATE hrsa_tax_agent_emp_change
<set>
change_type=#{changeType},
create_time=#{createTime},
creator=#{creator},
delete_type=#{deleteType},
employee_id=#{employeeId},
employee_name=#{employeeName},
module_type=#{moduleType},
tax_agent_id=#{taxAgentId},
tenant_key=#{tenantKey},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
UPDATE hrsa_tax_agent_emp_change
<set>
<if test="changeType != null">
change_type=#{changeType},
</if>
<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="employeeId != null">
employee_id=#{employeeId},
</if>
<if test="employeeName != null">
employee_name=#{employeeName},
</if>
<if test="moduleType != null">
module_type=#{moduleType},
</if>
<if test="taxAgentId != null">
tax_agent_id=#{taxAgentId},
</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" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
UPDATE hrsa_tax_agent_emp_change
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_tax_agent_emp_change
SET delete_type=1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsert">
INSERT INTO hrsa_tax_agent_emp_change(
id,
employee_id,
tax_agent_id,
employee_name,
change_type,
module_type,
create_time,
update_time,
creator,
tenant_key
)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.id},
#{item.employeeId},
#{item.taxAgentId},
#{item.employeeName},
#{item.changeType},
#{item.moduleType},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_tax_agent_emp_change(
id,
employee_id,
tax_agent_id,
employee_name,
change_type,
module_type,
create_time,
update_time,
creator,
tenant_key
)
<foreach collection="collection" item="item" separator="union all">
select
#{item.id},
#{item.employeeId},
#{item.taxAgentId},
#{item.employeeName},
#{item.changeType},
#{item.moduleType},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
<foreach collection="collection" item="item" separator=";">
INSERT INTO hrsa_tax_agent_emp_change(
id,
employee_id,
tax_agent_id,
employee_name,
change_type,
module_type,
create_time,
update_time,
creator,
tenant_key
)
VALUES
(
#{item.id},
#{item.employeeId},
#{item.taxAgentId},
#{item.employeeName},
#{item.changeType},
#{item.moduleType},
#{item.operator},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
)
</foreach>
</insert>
</mapper>