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

281 lines
9.7 KiB
XML
Raw Normal View History

2022-03-03 13:50:03 +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.datacollection.AddUpDeductionMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.AddUpDeduction">
<result column="add_up_child_education" property="addUpChildEducation"/>
<result column="add_up_continuing_education" property="addUpContinuingEducation"/>
<result column="add_up_housing_loan_interest" property="addUpHousingLoanInterest"/>
<result column="add_up_housing_rent" property="addUpHousingRent"/>
<result column="add_up_support_elderly" property="addUpSupportElderly"/>
<result column="create_time" property="createTime"/>
<result column="creator" property="creator"/>
<result column="declare_month" property="declareMonth"/>
<result column="delete_type" property="deleteType"/>
<result column="employee_id" property="employeeId"/>
<result column="id" property="id"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="tenant_key" property="tenantKey"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
add_up_child_education
, t.add_up_continuing_education
, t.add_up_housing_loan_interest
, t.add_up_housing_rent
, t.add_up_support_elderly
, t.create_time
, t.creator
, t.declare_month
, t.delete_type
, t.employee_id
, t.id
, t.tax_agent_id
, t.tenant_key
, t.update_time
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_add_up_deduction t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_add_up_deduction t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 插入全部字段 -->
<insert id="insert" parameterType="com.engine.salary.entity.datacollection.AddUpDeduction"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_add_up_deduction
<trim prefix="(" suffix=")" suffixOverrides=",">
add_up_child_education,
add_up_continuing_education,
add_up_housing_loan_interest,
add_up_housing_rent,
add_up_support_elderly,
create_time,
creator,
declare_month,
delete_type,
employee_id,
id,
tax_agent_id,
tenant_key,
update_time,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
#{addUpChildEducation},
#{addUpContinuingEducation},
#{addUpHousingLoanInterest},
#{addUpHousingRent},
#{addUpSupportElderly},
#{createTime},
#{creator},
#{declareMonth},
#{deleteType},
#{employeeId},
#{id},
#{taxAgentId},
#{tenantKey},
#{updateTime},
</trim>
</insert>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.AddUpDeduction"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_add_up_deduction
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="addUpChildEducation != null">
add_up_child_education,
</if>
<if test="addUpContinuingEducation != null">
add_up_continuing_education,
</if>
<if test="addUpHousingLoanInterest != null">
add_up_housing_loan_interest,
</if>
<if test="addUpHousingRent != null">
add_up_housing_rent,
</if>
<if test="addUpSupportElderly != null">
add_up_support_elderly,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="declareMonth != null">
declare_month,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="id != null">
id,
</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="addUpChildEducation != null">
#{addUpChildEducation},
</if>
<if test="addUpContinuingEducation != null">
#{addUpContinuingEducation},
</if>
<if test="addUpHousingLoanInterest != null">
#{addUpHousingLoanInterest},
</if>
<if test="addUpHousingRent != null">
#{addUpHousingRent},
</if>
<if test="addUpSupportElderly != null">
#{addUpSupportElderly},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="declareMonth != null">
#{declareMonth},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="employeeId != null">
#{employeeId},
</if>
<if test="id != null">
#{id},
</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.datacollection.AddUpDeduction">
UPDATE hrsa_add_up_deduction
<set>
add_up_child_education=#{addUpChildEducation},
add_up_continuing_education=#{addUpContinuingEducation},
add_up_housing_loan_interest=#{addUpHousingLoanInterest},
add_up_housing_rent=#{addUpHousingRent},
add_up_support_elderly=#{addUpSupportElderly},
create_time=#{createTime},
creator=#{creator},
declare_month=#{declareMonth},
delete_type=#{deleteType},
employee_id=#{employeeId},
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.datacollection.AddUpDeduction">
UPDATE hrsa_add_up_deduction
<set>
<if test="addUpChildEducation != null">
add_up_child_education=#{addUpChildEducation},
</if>
<if test="addUpContinuingEducation != null">
add_up_continuing_education=#{addUpContinuingEducation},
</if>
<if test="addUpHousingLoanInterest != null">
add_up_housing_loan_interest=#{addUpHousingLoanInterest},
</if>
<if test="addUpHousingRent != null">
add_up_housing_rent=#{addUpHousingRent},
</if>
<if test="addUpSupportElderly != null">
add_up_support_elderly=#{addUpSupportElderly},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="declareMonth != null">
declare_month=#{declareMonth},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="employeeId != null">
employee_id=#{employeeId},
</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.datacollection.AddUpDeduction">
UPDATE hrsa_add_up_deduction
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<!-- 员工基本信息 -->
<select id="listEmployee" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.ID as employeeId,
e.LASTNAME as username,
d.DEPARTMENTNAME as deparmentName
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
where e.status not in (4, 5, 6, 7)
</select>
</mapper>