92 lines
4.4 KiB
XML
92 lines
4.4 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.bonus.mainDataBase.mapper.IMDErrorInfoMapper">
|
|
|
|
<!--添加异常信息-->
|
|
<insert id="addErrorInfo">
|
|
INSERT INTO tb_error_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="list[0].errorId != null and list[0].errorId != ''">error_id,</if>
|
|
<if test="list[0].sourceTable != null and list[0].sourceTable != ''">source_table,</if>
|
|
<if test="list[0].errorContent != null and list[0].errorContent != ''">error_content,</if>
|
|
<if test="list[0].errorTime != null">error_time,</if>
|
|
<if test="list[0].businessId != null and list[0].businessId != ''">business_id,</if>
|
|
<if test="list[0].businessType != null and list[0].businessType != ''">business_type,</if>
|
|
<if test="list[0].enterpriseId != null and list[0].enterpriseId != ''">enterprise_id,</if>
|
|
</trim>
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="list[0].errorId != null and list[0].errorId != ''">#{item.errorId},</if>
|
|
<if test="list[0].sourceTable != null and list[0].sourceTable != ''">#{item.sourceTable},</if>
|
|
<if test="list[0].errorContent != null and list[0].errorContent != ''">#{item.errorContent},</if>
|
|
<if test="list[0].errorTime != null">#{item.errorTime},</if>
|
|
<if test="list[0].businessId != null and list[0].businessId != ''">#{item.businessId},</if>
|
|
<if test="list[0].businessType != null and list[0].businessType != ''">#{item.businessType},</if>
|
|
<if test="list[0].enterpriseId != null">#{item.enterpriseId},</if>
|
|
</trim>
|
|
</foreach>
|
|
</insert>
|
|
<!--删除异常信息根据业务id、来源表、业务类型-->
|
|
<delete id="delErrorInfo">
|
|
DELETE FROM tb_error_info WHERE business_id = #{businessId} AND source_table = #{sourceTable} AND business_type IN
|
|
<foreach collection="businessTypes" item="item" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</delete>
|
|
<!--删除异常信息 - 根据业务id、来源表、业务类型-->
|
|
<delete id="delErrorByTable">
|
|
DELETE FROM tb_error_info WHERE business_id = #{businessId} AND source_table = #{sourceTable}
|
|
</delete>
|
|
|
|
<!--删除异常信息数据-根据业务id、业务类型、来源表-->
|
|
<delete id="delErrorInfoByBusinessId">
|
|
DELETE FROM tb_error_info
|
|
WHERE EXISTS (
|
|
SELECT 1 FROM (
|
|
<foreach collection="list" item="item" separator=" UNION ALL ">
|
|
SELECT
|
|
#{item.businessId} AS business_id,
|
|
#{item.sourceTable} AS source_table,
|
|
#{item.businessType} AS business_type
|
|
</foreach>
|
|
) t
|
|
WHERE tb_error_info.business_id = t.business_id
|
|
AND tb_error_info.source_table = t.source_table
|
|
AND tb_error_info.business_type = t.business_type
|
|
)
|
|
</delete>
|
|
|
|
<!--查询异常消息-->
|
|
<select id="getErrorInfoByTable" resultType="java.lang.String">
|
|
SELECT error_content FROM tb_error_info WHERE source_table = #{sourceTable}
|
|
<if test="businessId != null">
|
|
AND business_id = #{businessId}
|
|
</if>
|
|
<if test="businessId == null and businessIds !=null and businessIds.size() > 0">
|
|
AND business_id IN
|
|
<foreach collection="businessIds" open="(" close=")" separator="," item="item">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<!--根据业务id和来源表查询已存在的异常消息-->
|
|
<select id="getErrorInfoByBusiness" resultType="com.bonus.common.domain.mainDatabase.po.ErrorInfo">
|
|
SELECT business_id AS businessId,
|
|
business_type AS businessType,
|
|
source_table AS sourceTable
|
|
FROM tb_error_info WHERE source_table = #{tableName} AND business_id IN
|
|
<foreach collection="list" open="(" close=")" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
|
|
<!--查询人员相关证件id-->
|
|
<select id="getCertificateIds" resultType="java.lang.Long">
|
|
SELECT personnel_certificate_id FROM tb_personnel_certificate WHERE personnel_id = #{personnelId} AND del_flag = '0'
|
|
</select>
|
|
</mapper>
|