qa-prevention-gwj/src/main/resources/mybatis/datasource/bus/GasDetectionMapper.xml

235 lines
5.6 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.zcloud.mapper.datasource.bus.GasDetectionMapper">
<!--表名 -->
<sql id="tableName">
BUS_GASDETECTION
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.LOCATION,
f.TESTINGTIME,
f.OXYGEN,
f.COMBUSTIBLEGAS,
f.HYDROTHIONSTART,
f.CARBONICOXIDESTART,
f.OTHERGASESSTART,
f.HYDROTHIONEND,
f.CARBONICOXIDEEND,
f.OTHERGASESEND,
f.DECIDE,
f.TYPE,
f.LIMITSPACEAPPROVE_ID,
f.CORPINFO_ID,
f.CREATOR,
f.CREATTIME,
f.OPERATOR,
f.OPERATTIME,
f.ISDELETE,
f.ISFINISH,
f.GASDETECTION_ID
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
LOCATION,
TESTINGTIME,
OXYGEN,
COMBUSTIBLEGAS,
HYDROTHIONSTART,
CARBONICOXIDESTART,
OTHERGASESSTART,
HYDROTHIONEND,
CARBONICOXIDEEND,
OTHERGASESEND,
DECIDE,
TYPE,
LIMITSPACEAPPROVE_ID,
CORPINFO_ID,
CREATOR,
CREATTIME,
OPERATOR,
OPERATTIME,
ISDELETE,
ISFINISH,
GASDETECTION_ID
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{LOCATION},
#{TESTINGTIME},
#{OXYGEN},
#{COMBUSTIBLEGAS},
#{HYDROTHIONSTART},
#{CARBONICOXIDESTART},
#{OTHERGASESSTART},
#{HYDROTHIONEND},
#{CARBONICOXIDEEND},
#{OTHERGASESEND},
#{DECIDE},
#{TYPE},
#{LIMITSPACEAPPROVE_ID},
#{CORPINFO_ID},
#{CREATOR},
#{CREATTIME},
#{OPERATOR},
#{OPERATTIME},
#{ISDELETE},
#{ISFINISH},
#{GASDETECTION_ID}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
GASDETECTION_ID = #{GASDETECTION_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
LOCATION = #{LOCATION},
TESTINGTIME = #{TESTINGTIME},
DECIDE = #{DECIDE},
<if test="OXYGEN != null and OXYGEN != ''"><!-- 关键词检索 -->
OXYGEN = #{OXYGEN},
</if>
<if test="COMBUSTIBLEGAS != null and COMBUSTIBLEGAS != ''"><!-- 关键词检索 -->
COMBUSTIBLEGAS = #{COMBUSTIBLEGAS},
</if>
<if test="HYDROTHIONSTART != null and HYDROTHIONSTART != ''"><!-- 关键词检索 -->
HYDROTHIONSTART = #{HYDROTHIONSTART},
</if>
<if test="CARBONICOXIDESTART != null and CARBONICOXIDESTART != ''"><!-- 关键词检索 -->
CARBONICOXIDESTART = #{CARBONICOXIDESTART},
</if>
<if test="OTHERGASESSTART != null and OTHERGASESSTART != ''"><!-- 关键词检索 -->
OTHERGASESSTART = #{OTHERGASESSTART},
</if>
<if test="HYDROTHIONEND != null and HYDROTHIONEND != ''"><!-- 关键词检索 -->
HYDROTHIONEND = #{HYDROTHIONEND},
</if>
<if test="CARBONICOXIDEEND != null and CARBONICOXIDEEND != ''"><!-- 关键词检索 -->
CARBONICOXIDEEND = #{CARBONICOXIDEEND},
</if>
<if test="OTHERGASESEND != null and OTHERGASESEND != ''"><!-- 关键词检索 -->
OTHERGASESEND = #{OTHERGASESEND},
</if>
LIMITSPACEAPPROVE_ID = #{LIMITSPACEAPPROVE_ID},
CORPINFO_ID = #{CORPINFO_ID},
GASDETECTION_ID = GASDETECTION_ID
where
GASDETECTION_ID = #{GASDETECTION_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.GASDETECTION_ID = #{GASDETECTION_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and
(
<!-- 根据需求自己加检索条件
字段1 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
or
字段2 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
-->
)
</if>
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
</select>
<!-- 列表(全部) -->
<select id="listAllBycondition" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="ISFINISH != null and ISFINISH != ''"><!-- 关键词检索 -->
and f.ISFINISH = #{ISFINISH}
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="TYPE != null and TYPE != ''"><!-- 关键词检索 -->
and f.TYPE = #{TYPE}
</if>
<if test="LIMITSPACEAPPROVE_ID != null and LIMITSPACEAPPROVE_ID != ''"><!-- 关键词检索 -->
and f.LIMITSPACEAPPROVE_ID = #{LIMITSPACEAPPROVE_ID}
</if>
order by f.TYPE
</select>
<!-- 完成 -->
<update id="finish" parameterType="pd">
update
<include refid="tableName"></include>
set
ISFINISH = '1'
where
LIMITSPACEAPPROVE_ID = #{LIMITSPACEAPPROVE_ID}
</update>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
GASDETECTION_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>