331 lines
11 KiB
XML
331 lines
11 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.cm.tenlion.pollutantdata.dao.enterprisepoll.IEnterprisePollDao">
|
|
|
|
<resultMap id="enterprisePollDTO" type="com.cm.tenlion.pollutantdata.pojo.dtos.enterprisepoll.EnterprisePollDTO">
|
|
<result column="enterprise_poll_id" property="enterprisePollId"/>
|
|
<result column="enterprise_id" property="enterpriseId"/>
|
|
<result column="enterprise_name" property="enterpriseName"/>
|
|
<result column="poll_id" property="pollId"/>
|
|
<result column="poll_name" property="pollName"/>
|
|
<result column="enterprise_poll_beyond" property="enterprisePollBeyond"/>
|
|
<result column="poll_no" property="pollNo"/>
|
|
<result column="poll_no_old" property="pollNoOld"/>
|
|
<result column="gmt_create" property="gmtCreate"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="enterprisePollBO" type="com.cm.tenlion.pollutantdata.pojo.bos.enterprisepoll.EnterprisePollBO">
|
|
<result column="enterprise_poll_id" property="enterprisePollId"/>
|
|
<result column="enterprise_id" property="enterpriseId"/>
|
|
<result column="poll_id" property="pollId"/>
|
|
<result column="enterprise_poll_beyond" property="enterprisePollBeyond"/>
|
|
<result column="gmt_create" property="gmtCreate"/>
|
|
<result column="creator" property="creator"/>
|
|
<result column="gmt_modified" property="gmtModified"/>
|
|
<result column="modifier" property="modifier"/>
|
|
<result column="is_delete" property="isDelete"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="enterprisePollPO" type="com.cm.tenlion.pollutantdata.pojo.pos.enterprisepoll.EnterprisePollPO">
|
|
<result column="enterprise_poll_id" property="enterprisePollId"/>
|
|
<result column="enterprise_id" property="enterpriseId"/>
|
|
<result column="poll_id" property="pollId"/>
|
|
<result column="enterprise_poll_beyond" property="enterprisePollBeyond"/>
|
|
<result column="gmt_create" property="gmtCreate"/>
|
|
<result column="creator" property="creator"/>
|
|
<result column="gmt_modified" property="gmtModified"/>
|
|
<result column="modifier" property="modifier"/>
|
|
<result column="is_delete" property="isDelete"/>
|
|
</resultMap>
|
|
|
|
<!-- 新增企业监控污染因子 -->
|
|
<insert id="save" parameterType="map">
|
|
INSERT INTO pollute_enterprise_poll(
|
|
enterprise_poll_id,
|
|
enterprise_id,
|
|
poll_id,
|
|
enterprise_poll_beyond,
|
|
poll_no,
|
|
poll_no_old,
|
|
gmt_create,
|
|
creator,
|
|
gmt_modified,
|
|
modifier,
|
|
is_delete
|
|
) VALUES(
|
|
#{enterprisePollId},
|
|
#{enterpriseId},
|
|
#{pollId},
|
|
#{enterprisePollBeyond},
|
|
#{pollNo},
|
|
#{pollNoOld},
|
|
#{gmtCreate},
|
|
#{creator},
|
|
#{gmtModified},
|
|
#{modifier},
|
|
#{isDelete}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 删除企业监控污染因子 -->
|
|
<update id="remove" parameterType="map">
|
|
UPDATE
|
|
pollute_enterprise_poll
|
|
SET
|
|
gmt_modified = #{gmtModified},
|
|
modifier = #{modifier},
|
|
is_delete = 1
|
|
WHERE
|
|
enterprise_poll_id IN
|
|
<foreach collection="enterprisePollIds" index="index" open="(" separator="," close=")">
|
|
#{enterprisePollIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 删除企业监控污染因子(物理) -->
|
|
<update id="delete" parameterType="map">
|
|
DELETE FROM
|
|
pollute_enterprise_poll
|
|
WHERE
|
|
enterprise_poll_id IN
|
|
<foreach collection="enterprisePollIds" index="index" open="(" separator="," close=")">
|
|
#{enterprisePollIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 修改企业监控污染因子 -->
|
|
<update id="update" parameterType="map">
|
|
UPDATE
|
|
pollute_enterprise_poll
|
|
SET
|
|
<if test="enterpriseId != null and enterpriseId != ''">
|
|
enterprise_id = #{enterpriseId},
|
|
</if>
|
|
<if test="pollId != null">
|
|
poll_id = #{pollId},
|
|
</if>
|
|
<if test="enterprisePollBeyond != null and enterprisePollBeyond != ''">
|
|
enterprise_poll_beyond = #{enterprisePollBeyond},
|
|
</if>
|
|
gmt_modified = #{gmtModified},
|
|
modifier = #{modifier},
|
|
enterprise_poll_id = enterprise_poll_id
|
|
WHERE
|
|
enterprise_poll_id = #{enterprisePollId}
|
|
</update>
|
|
|
|
<!-- 企业监控污染因子详情 -->
|
|
<select id="get" parameterType="map" resultMap="enterprisePollDTO">
|
|
SELECT
|
|
t1.enterprise_id,
|
|
t1.poll_id,
|
|
t1.enterprise_poll_beyond,
|
|
t1.enterprise_poll_id,
|
|
t2.poll_name,
|
|
t1.poll_no,
|
|
t1.poll_no_old,
|
|
t3.enterprise_name
|
|
FROM
|
|
pollute_enterprise_poll t1
|
|
LEFT JOIN pollute_poll t2
|
|
ON t1.poll_id = t2.poll_id
|
|
LEFT JOIN pollute_enterprise t3
|
|
ON t1.enterprise_id = t3.enterprise_id
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="enterprisePollId != null and enterprisePollId != ''">
|
|
AND
|
|
t1.enterprise_poll_id = #{enterprisePollId}
|
|
</if>
|
|
<if test="enterpriseId != null and enterpriseId != ''">
|
|
AND
|
|
t1.enterprise_id = #{enterpriseId}
|
|
</if>
|
|
<if test="pollId != null and pollId != ''">
|
|
AND
|
|
t1.poll_id = #{pollId}
|
|
</if>
|
|
<if test="pollNo != null and pollNo != ''">
|
|
AND (
|
|
t1.poll_no = #{pollNo}
|
|
OR
|
|
t1.poll_no_old = #{pollNo}
|
|
OR
|
|
t1.poll_id = #{pollNo}
|
|
)
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 企业监控污染因子详情 -->
|
|
<select id="getBO" parameterType="map" resultMap="enterprisePollBO">
|
|
SELECT
|
|
t1.enterprise_poll_id,
|
|
t1.enterprise_id,
|
|
t1.poll_id,
|
|
t1.enterprise_poll_beyond,
|
|
t1.gmt_create,
|
|
t1.creator,
|
|
t1.gmt_modified,
|
|
t1.modifier,
|
|
t1.is_delete
|
|
FROM
|
|
pollute_enterprise_poll t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="enterprisePollId != null and enterprisePollId != ''">
|
|
AND
|
|
t1.enterprise_poll_id = #{enterprisePollId}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 企业监控污染因子详情 -->
|
|
<select id="getPO" parameterType="map" resultMap="enterprisePollPO">
|
|
SELECT
|
|
t1.enterprise_poll_id,
|
|
t1.enterprise_id,
|
|
t1.poll_id,
|
|
t1.enterprise_poll_beyond,
|
|
t1.gmt_create,
|
|
t1.creator,
|
|
t1.gmt_modified,
|
|
t1.modifier,
|
|
t1.is_delete
|
|
FROM
|
|
pollute_enterprise_poll t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="enterprisePollId != null and enterprisePollId != ''">
|
|
AND
|
|
t1.enterprise_poll_id = #{enterprisePollId}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 企业监控污染因子列表 -->
|
|
<select id="list" parameterType="map" resultMap="enterprisePollDTO">
|
|
SELECT
|
|
t1.enterprise_poll_id,
|
|
t1.enterprise_id,
|
|
t1.poll_id,
|
|
t1.enterprise_poll_beyond,
|
|
t1.poll_no,
|
|
t1.poll_no_old,
|
|
LEFT(t1.gmt_create, 19) AS gmt_create,
|
|
t2.poll_name,
|
|
t3.enterprise_name
|
|
FROM
|
|
pollute_enterprise_poll t1
|
|
LEFT JOIN pollute_poll t2
|
|
ON t1.poll_id = t2.poll_id
|
|
LEFT JOIN pollute_enterprise t3
|
|
ON t1.enterprise_id = t3.enterprise_id
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="keywords != null and keywords != ''">
|
|
AND (
|
|
<!-- 这里添加其他条件 -->
|
|
t2.poll_name LIKE CONCAT('%', #{keywords}, '%')
|
|
OR
|
|
t3.enterprise_name LIKE CONCAT('%', #{keywords}, '%')
|
|
)
|
|
</if>
|
|
<if test="enterpriseId != null and enterpriseId != ''">
|
|
AND t1.enterprise_id = #{enterpriseId}
|
|
</if>
|
|
ORDER BY t1.gmt_create DESC
|
|
</select>
|
|
|
|
<!-- 企业监控污染因子列表 -->
|
|
<select id="listBO" parameterType="map" resultMap="enterprisePollBO">
|
|
SELECT
|
|
t1.enterprise_poll_id,
|
|
t1.enterprise_id,
|
|
t1.poll_id,
|
|
t1.enterprise_poll_beyond,
|
|
t1.gmt_create,
|
|
t1.creator,
|
|
t1.gmt_modified,
|
|
t1.modifier,
|
|
t1.is_delete
|
|
FROM
|
|
pollute_enterprise_poll t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="keywords != null and keywords != ''">
|
|
AND (
|
|
<!-- 这里添加其他条件 -->
|
|
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
|
)
|
|
</if>
|
|
<if test="startTime != null and startTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
|
</if>
|
|
<if test="enterprisePollIds != null and enterprisePollIds.size > 0">
|
|
AND
|
|
t1.enterprise_poll_id IN
|
|
<foreach collection="enterprisePollIds" index="index" open="(" separator="," close=")">
|
|
#{enterprisePollIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 企业监控污染因子列表 -->
|
|
<select id="listPO" parameterType="map" resultMap="enterprisePollPO">
|
|
SELECT
|
|
t1.enterprise_poll_id,
|
|
t1.enterprise_id,
|
|
t1.poll_id,
|
|
t1.enterprise_poll_beyond,
|
|
t1.gmt_create,
|
|
t1.creator,
|
|
t1.gmt_modified,
|
|
t1.modifier,
|
|
t1.is_delete
|
|
FROM
|
|
pollute_enterprise_poll t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="keywords != null and keywords != ''">
|
|
AND (
|
|
<!-- 这里添加其他条件 -->
|
|
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
|
)
|
|
</if>
|
|
<if test="startTime != null and startTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
|
</if>
|
|
<if test="enterprisePollIds != null and enterprisePollIds.size > 0">
|
|
AND
|
|
t1.enterprise_poll_id IN
|
|
<foreach collection="enterprisePollIds" index="index" open="(" separator="," close=")">
|
|
#{enterprisePollIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 企业监控污染因子统计 -->
|
|
<select id="count" parameterType="map" resultType="Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
pollute_enterprise_poll t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="pollId != null and pollId != ''">
|
|
AND t1.poll_id = #{pollId}
|
|
</if>
|
|
<if test="enterpriseId != null and enterpriseId != ''">
|
|
AND t1.enterprise_id = #{enterpriseId}
|
|
</if>
|
|
</select>
|
|
|
|
</mapper> |