From c7f12c87e3a3e459281750d4387e8310b4aa460a Mon Sep 17 00:00:00 2001
From: 邱宇豪 <qyh123230312>
Date: 星期五, 10 十一月 2023 16:34:07 +0800
Subject: [PATCH] 20231110_qiuyh_区域巡检
---
hd/pipe/secure/src/main/resources/mapping/RegionInspectionMapper.xml | 190 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 190 insertions(+), 0 deletions(-)
diff --git a/hd/pipe/secure/src/main/resources/mapping/RegionInspectionMapper.xml b/hd/pipe/secure/src/main/resources/mapping/RegionInspectionMapper.xml
new file mode 100644
index 0000000..8b5841d
--- /dev/null
+++ b/hd/pipe/secure/src/main/resources/mapping/RegionInspectionMapper.xml
@@ -0,0 +1,190 @@
+<?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.thhy.secure.modules.biz.regionInspection.mapper.RegionInspectionMapper">
+
+ <insert id="insert">
+ insert into t_region_inspection
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ id,
+ </if>
+ <if test="task != null">
+ task,
+ </if>
+ <if test="standard != null">
+ standard,
+ </if>
+ <if test="createUser != null">
+ createUser,
+ </if>
+ <if test="createTime != null">
+ createTime,
+ </if>
+ <if test="updateUser != null">
+ updateUser,
+ </if>
+ <if test="updateTime != null">
+ updateTime,
+ </if>
+ <if test="companyId != null">
+ companyId,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ #{id,jdbcType=VARCHAR},
+ </if>
+ <if test="task != null">
+ #{task,jdbcType=VARCHAR},
+ </if>
+ <if test="standard != null">
+ #{standard,jdbcType=VARCHAR},
+ </if>
+ <if test="createUser != null">
+ #{createUser,jdbcType=VARCHAR},
+ </if>
+ <if test="createTime != null">
+ #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="updateUser != null">
+ #{updateUser,jdbcType=VARCHAR},
+ </if>
+ <if test="updateTime != null">
+ #{updateTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="companyId != null">
+ #{companyId,jdbcType=VARCHAR},
+ </if>
+ </trim>
+ on duplicate key update
+ <if test="task != null">
+ task = #{task,jdbcType=VARCHAR},
+ </if>
+ <if test="standard != null">
+ standard = #{standard,jdbcType=VARCHAR},
+ </if>
+ <if test="createUser != null">
+ createUser = #{createUser,jdbcType=VARCHAR},
+ </if>
+ <if test="createTime != null">
+ createTime = #{createTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="updateUser != null">
+ updateUser = #{updateUser,jdbcType=VARCHAR},
+ </if>
+ <if test="updateTime != null">
+ updateTime = #{updateTime,jdbcType=TIMESTAMP},
+ </if>
+ <if test="companyId != null">
+ companyId = #{companyId,jdbcType=VARCHAR},
+ </if>
+
+ </insert>
+
+ <delete id="delete">
+ update t_region_inspection set isUse = 0 where id = #{id,jdbcType=VARCHAR}
+ </delete>
+
+ <select id="selectPageList" resultType="com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionEntity">
+ SELECT * FROM (
+ SELECT
+ t.id,
+ t.task,
+ t.standard,
+ t.createUser,
+ t.createTime,
+ t.updateUser,
+ t.updateTime,
+ t.isUse,
+ t.companyId,
+ GROUP_CONCAT(DISTINCT b.real_name ORDER BY b.job_num SEPARATOR '、') realNames,
+ GROUP_CONCAT(DISTINCT b.user_id ORDER BY b.job_num SEPARATOR '、') userIds,
+ GROUP_CONCAT(DISTINCT d.region ORDER BY c.sort SEPARATOR ',') regions,
+ GROUP_CONCAT(DISTINCT d.id ORDER BY c.sort SEPARATOR ',') regionIds
+ FROM t_region_inspection t
+ LEFT JOIN t_region_inspection_user a ON a.regionInspectionId = t.id
+ LEFT JOIN sys_plat_user b ON b.user_id = a.userId
+ LEFT JOIN t_region_inspection_hazard_inform c ON c.regionInspectionId = t.id
+ LEFT JOIN t_region_hazard_inform d ON d.id = c.regionHazardInformId
+ GROUP BY t.id
+ order by t.createTime desc
+ ) a
+ WHERE a.isUse = 1 and a.companyId = #{companyId}
+ <if test="realName != null and realName !=''">
+ AND a.realNames LIKE CONCAT('%',#{realName},'%')
+ </if>
+ <if test="task != null and task !=''">
+ AND a.task LIKE CONCAT('%',#{task},'%')
+ </if>
+ </select>
+
+ <insert id="insertUser">
+ insert into t_region_inspection_user
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ id,
+ </if>
+ <if test="regionInspectionId != null">
+ regionInspectionId,
+ </if>
+ <if test="userId != null">
+ userId,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ #{id,jdbcType=VARCHAR},
+ </if>
+ <if test="regionInspectionId != null">
+ #{regionInspectionId,jdbcType=VARCHAR},
+ </if>
+ <if test="userId != null">
+ #{userId,jdbcType=VARCHAR},
+ </if>
+ </trim>
+ </insert>
+
+ <delete id="deleteUser">
+ delete from t_region_inspection_user where regionInspectionId = #{regionInspectionId,jdbcType=VARCHAR}
+ </delete>
+
+ <select id="selectUserList" resultType="com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionUserEntity">
+ select * from t_region_inspection_user where regionInspectionId = #{regionInspectionId,jdbcType=VARCHAR}
+ </select>
+
+ <insert id="insertInspectionHazardInform">
+ insert into t_region_inspection_hazard_inform
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ id,
+ </if>
+ <if test="regionInspectionId != null">
+ regionInspectionId,
+ </if>
+ <if test="regionHazardInformId != null">
+ regionHazardInformId,
+ </if>
+ <if test="sort != null">
+ sort,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">
+ #{id,jdbcType=VARCHAR},
+ </if>
+ <if test="regionInspectionId != null">
+ #{regionInspectionId,jdbcType=VARCHAR},
+ </if>
+ <if test="regionHazardInformId != null">
+ #{regionHazardInformId,jdbcType=VARCHAR},
+ </if>
+ <if test="sort != null">
+ #{sort,jdbcType=INTEGER},
+ </if>
+ </trim>
+ </insert>
+
+ <delete id="deleteInspectionHazardInform">
+ delete from t_region_inspection_hazard_inform where regionInspectionId = #{regionInspectionId,jdbcType=VARCHAR}
+ </delete>
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3