365 lines
12 KiB
XML
365 lines
12 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.VariableArchiveItemMapper">
|
|
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
|
|
<result column="id" property="id" />
|
|
<result column="employee_id" property="employeeId" />
|
|
<result column="variable_archive_id" property="variableArchiveId" />
|
|
<result column="variable_item_id" property="variableItemId" />
|
|
<result column="item_value" property="itemValue" />
|
|
<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.employee_id
|
|
, t.variable_archive_id
|
|
, t.variable_item_id
|
|
, t.item_value
|
|
, 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_variable_archive_item t
|
|
WHERE delete_type = 0
|
|
</select>
|
|
|
|
<!-- 根据主键获取单条记录 -->
|
|
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
|
SELECT
|
|
<include refid="baseColumns" />
|
|
FROM hrsa_variable_archive_item t
|
|
WHERE id = #{id} AND delete_type = 0
|
|
</select>
|
|
|
|
<!-- 条件查询 -->
|
|
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
|
|
SELECT
|
|
<include refid="baseColumns" />
|
|
FROM hrsa_variable_archive_item t
|
|
WHERE delete_type = 0
|
|
<if test="param.id != null">
|
|
AND id = #{param.id}
|
|
</if>
|
|
<if test="param.employeeId != null">
|
|
AND employee_id = #{param.employeeId}
|
|
</if>
|
|
<if test="param.variableArchiveId != null">
|
|
AND variable_archive_id = #{param.variableArchiveId}
|
|
</if>
|
|
<if test="param.variableItemId != null">
|
|
AND variable_item_id = #{param.variableItemId}
|
|
</if>
|
|
<if test="param.itemValue != null">
|
|
AND item_value = #{param.itemValue}
|
|
</if>
|
|
<if test="param.createTime != null">
|
|
AND create_time = #{param.createTime}
|
|
</if>
|
|
<if test="param.updateTime != null">
|
|
AND update_time = #{param.updateTime}
|
|
</if>
|
|
<if test="param.creator != null">
|
|
AND creator = #{param.creator}
|
|
</if>
|
|
<if test="param.deleteType != null">
|
|
AND delete_type = #{param.deleteType}
|
|
</if>
|
|
<if test="param.tenantKey != null">
|
|
AND tenant_key = #{param.tenantKey}
|
|
</if>
|
|
<if test="param.ids != null and param.ids.size()>0">
|
|
AND id IN
|
|
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.variableArchiveIds != null and param.variableArchiveIds.size()>0">
|
|
AND variable_archive_id IN
|
|
<foreach collection="param.variableArchiveIds" open="(" item="varArchId" separator="," close=")">
|
|
#{varArchId}
|
|
</foreach>
|
|
</if>
|
|
ORDER BY id DESC
|
|
</select>
|
|
|
|
<select id="listUsingItems" resultType="java.lang.Long">
|
|
select distinct variable_item_id
|
|
from hrsa_variable_archive_item
|
|
where delete_type = 0
|
|
</select>
|
|
|
|
|
|
<!-- 插入不为NULL的字段 -->
|
|
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
|
|
INSERT INTO hrsa_variable_archive_item
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
<if test="employeeId != null">
|
|
employee_id,
|
|
</if>
|
|
<if test="variableArchiveId != null">
|
|
variable_archive_id,
|
|
</if>
|
|
<if test="variableItemId != null">
|
|
variable_item_id,
|
|
</if>
|
|
<if test="itemValue != null">
|
|
item_value,
|
|
</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="employeeId != null" >
|
|
#{employeeId},
|
|
</if>
|
|
<if test="variableArchiveId != null" >
|
|
#{variableArchiveId},
|
|
</if>
|
|
<if test="variableItemId != null" >
|
|
#{variableItemId},
|
|
</if>
|
|
<if test="itemValue != null" >
|
|
#{itemValue},
|
|
</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>
|
|
|
|
<insert id="batchInsert">
|
|
INSERT INTO hrsa_variable_archive_item (
|
|
id
|
|
, employee_id
|
|
, variable_archive_id
|
|
, variable_item_id
|
|
, item_value
|
|
, create_time
|
|
, update_time
|
|
, creator
|
|
, delete_type
|
|
, tenant_key
|
|
)
|
|
VALUES
|
|
<foreach collection="collection" item="item" separator=",">
|
|
(
|
|
#{item.id},
|
|
#{item.employeeId},
|
|
#{item.variableArchiveId},
|
|
#{item.variableItemId},
|
|
#{item.itemValue},
|
|
#{item.createTime},
|
|
#{item.updateTime},
|
|
#{item.creator},
|
|
#{item.deleteType},
|
|
#{item.tenantKey}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchInsert" databaseId="oracle">
|
|
INSERT INTO hrsa_variable_archive_item (
|
|
id
|
|
, employee_id
|
|
, variable_archive_id
|
|
, variable_item_id
|
|
, item_value
|
|
, create_time
|
|
, update_time
|
|
, creator
|
|
, delete_type
|
|
, tenant_key
|
|
)
|
|
|
|
<foreach collection="collection" item="item" separator="union all">
|
|
select
|
|
#{item.id,jdbcType=DOUBLE},
|
|
#{item.employeeId,jdbcType=DOUBLE},
|
|
#{item.variableArchiveId,jdbcType=DOUBLE},
|
|
#{item.variableItemId,jdbcType=DOUBLE},
|
|
#{item.itemValue,jdbcType=VARCHAR},
|
|
#{item.createTime,jdbcType=DATE},
|
|
#{item.updateTime,jdbcType=DATE},
|
|
#{item.creator,jdbcType=DOUBLE},
|
|
#{item.deleteType,jdbcType=INTEGER},
|
|
#{item.tenantKey,jdbcType=VARCHAR}
|
|
from dual
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchInsert" databaseId="sqlserver">
|
|
<foreach collection="collection" item="item" separator=";">
|
|
INSERT INTO hrsa_variable_archive_item (
|
|
id
|
|
, employee_id
|
|
, variable_archive_id
|
|
, variable_item_id
|
|
, item_value
|
|
, create_time
|
|
, update_time
|
|
, creator
|
|
, delete_type
|
|
, tenant_key
|
|
)
|
|
VALUES
|
|
(
|
|
#{item.id},
|
|
#{item.employeeId},
|
|
#{item.variableArchiveId},
|
|
#{item.variableItemId},
|
|
#{item.itemValue},
|
|
#{item.createTime},
|
|
#{item.updateTime},
|
|
#{item.creator},
|
|
#{item.deleteType},
|
|
#{item.tenantKey}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 更新,更新全部字段 -->
|
|
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
|
|
UPDATE hrsa_variable_archive_item
|
|
<set>
|
|
employee_id=#{employeeId},
|
|
variable_archive_id=#{variableArchiveId},
|
|
variable_item_id=#{variableItemId},
|
|
item_value=#{itemValue},
|
|
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.datacollection.po.VariableArchiveItemPO">
|
|
UPDATE hrsa_variable_archive_item
|
|
<set>
|
|
<if test="employeeId != null" >
|
|
employee_id=#{employeeId},
|
|
</if>
|
|
<if test="variableArchiveId != null" >
|
|
variable_archive_id=#{variableArchiveId},
|
|
</if>
|
|
<if test="variableItemId != null" >
|
|
variable_item_id=#{variableItemId},
|
|
</if>
|
|
<if test="itemValue != null" >
|
|
item_value=#{itemValue},
|
|
</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>
|
|
<update id="updateBatchSelective">
|
|
update hrsa_variable_archive_item
|
|
<trim prefix="set" suffixOverrides=",">
|
|
<trim prefix="item_value = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
<if test="item.itemValue != null">
|
|
when id = #{item.id} then #{item.itemValue}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
</trim>
|
|
where id in
|
|
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
|
#{item.id}
|
|
</foreach>
|
|
</update>
|
|
|
|
|
|
<!-- 根据主键删除记录 -->
|
|
<delete id="delete" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
|
|
UPDATE hrsa_variable_archive_item
|
|
SET delete_type=1
|
|
WHERE id = #{id} AND delete_type = 0
|
|
</delete>
|
|
|
|
<delete id="deleteByIds">
|
|
UPDATE hrsa_variable_archive_item
|
|
SET delete_type=1
|
|
WHERE delete_type = 0
|
|
<if test="collection != null and collection.size()>0">
|
|
AND id IN
|
|
<foreach collection="collection" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
</delete>
|
|
|
|
<delete id="deleteByArchiveIds">
|
|
UPDATE hrsa_variable_archive_item
|
|
SET delete_type=1
|
|
WHERE delete_type = 0
|
|
<if test="collection != null and collection.size()>0">
|
|
AND variable_archive_id IN
|
|
<foreach collection="collection" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
</delete>
|
|
|
|
|
|
</mapper> |