weaver-hrm-salary/src/com/engine/salary/mapper/report/SalaryStatisticsPushMapper.xml

359 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.report.SalaryStatisticsPushMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
<result column="id" property="id" />
<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" />
<result column="report_ids" property="reportIds" />
<result column="start_time" property="startTime" />
<result column="end_time" property="endTime" />
<result column="push_channel" property="pushChannel" />
<result column="email_account" property="emailAccount" />
<result column="mark" property="mark" />
<result column="push_title" property="pushTitle" />
<result column="email_account_id" property="emailAccountId" />
<result column="remind" property="remind" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
, t.report_ids
, t.start_time
, t.end_time
, t.push_channel
, t.email_account
, t.mark
, t.push_title
, t.email_account_id
, t.remind
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</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="reportIds != null">
AND report_ids = #{reportIds}
</if>
<if test="startTime != null">
AND start_time = #{startTime}
</if>
<if test="endTime != null">
AND end_time = #{endTime}
</if>
<if test="pushChannel != null">
AND push_channel = #{pushChannel}
</if>
<if test="emailAccount != null">
AND email_account = #{emailAccount}
</if>
<if test="mark != null">
AND mark = #{mark}
</if>
<if test="pushTitle != null">
AND push_title = #{pushTitle}
</if>
<if test="emailAccountId != null">
AND email_account_id = #{emailAccountId}
</if>
<if test="remind != null">
AND remind = #{remind}
</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>
<select id="listLatestRecordByCreator"
resultType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
AND creator = #{empId}
ORDER BY create_time DESC
</select>
<select id="listByReportIdAndIds" resultType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
<if test="reportId != null and reportId != ''">
AND t.report_ids like CONCAT('%',#{reportId},'%')
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<select id="listByReportIdAndIds" resultType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO" databaseId="oracle">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
<if test="reportId != null and reportId != ''">
AND t.report_ids like '%'||#{reportId}||'%'
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<select id="listByReportIdAndIds" resultType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO" databaseId="sqlserver">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
<if test="reportId != null and reportId != ''">
AND t.report_ids like '%'+#{reportId}+'%'
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
INSERT INTO hrsa_report_push
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</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>
<if test="reportIds != null">
report_ids,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="pushChannel != null">
push_channel,
</if>
<if test="emailAccount != null">
email_account,
</if>
<if test="mark != null">
mark,
</if>
<if test="pushTitle != null">
push_title,
</if>
<if test="emailAccountId != null">
email_account_id,
</if>
<if test="remind != null">
remind,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null" >
#{id},
</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>
<if test="reportIds != null" >
#{reportIds},
</if>
<if test="startTime != null" >
#{startTime},
</if>
<if test="endTime != null" >
#{endTime},
</if>
<if test="pushChannel != null" >
#{pushChannel},
</if>
<if test="emailAccount != null" >
#{emailAccount},
</if>
<if test="mark != null" >
#{mark},
</if>
<if test="pushTitle != null" >
#{pushTitle},
</if>
<if test="emailAccountId != null" >
#{emailAccountId},
</if>
<if test="remind != null" >
#{remind},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
UPDATE hrsa_report_push
<set>
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
report_ids=#{reportIds},
start_time=#{startTime},
end_time=#{endTime},
push_channel=#{pushChannel},
email_account=#{emailAccount},
mark=#{mark},
push_title=#{pushTitle},
email_account_id=#{emailAccountId},
remind=#{remind},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
UPDATE hrsa_report_push
<set>
<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>
<if test="reportIds != null" >
report_ids=#{reportIds},
</if>
<if test="startTime != null" >
start_time=#{startTime},
</if>
<if test="endTime != null" >
end_time=#{endTime},
</if>
<if test="pushChannel != null" >
push_channel=#{pushChannel},
</if>
<if test="emailAccount != null" >
email_account=#{emailAccount},
</if>
<if test="mark != null" >
mark=#{mark},
</if>
<if test="pushTitle != null" >
push_title=#{pushTitle},
</if>
<if test="emailAccountId != null" >
email_account_id=#{emailAccountId},
</if>
<if test="remind != null" >
remind=#{remind},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
UPDATE hrsa_report_push
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
</mapper>