jl-jjsp-service/securityControl-modules/securityControl-proteam/target/classes/mapper/TRiskPressDropRateMapper.xml

360 lines
14 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.sercurityControl.proteam.mapper.TRiskPressDropRateMapper">
<resultMap type="com.sercurityControl.proteam.domain.TRiskPressDropRate" id="TRiskPressDropRateMap">
<result column="city" property="cityName"/>
<result column="pro_name" property="proName"/>
<result column="gth" property="tower"/>
<result column="jd" property="lon"/>
<result column="wd" property="lat"/>
<result column="jc_type" property="basicBaseType"/>
<result column="oper_medel" property="basicWorkStyle"/>
<result column="zy_risk_level" property="basicRiskLevel"/>
<result column="zy_gx" property="basicOperProcedure"/>
<result column="zy_gf" property="basicAppMethod"/>
<result column="gt" property="groupTowerFullHeight"/>
<result column="zt_style" property="groupTowerStyle"/>
<result column="zt_risk" property="groupTowerRiskLevel"/>
<result column="zt_gx" property="groupTowerOperProcedure"/>
<result column="zt_gf" property="groupTowerAppMethod"/>
<result column="jx" property="wireSpan"/>
<result column="fs_style" property="wireStyle"/>
<result column="jx_risk" property="wireRiskLevel"/>
<result column="jx_gx" property="wireOperProcedure"/>
<result column="jx_gf" property="wireAppMethod"/>
<result column="ht_image" property="landFormPath"/>
<result column="a_image" property="surroundingsPath"/>
<result column="riskone_type" property="riskType"/>
<result column="riskone_detaill" property="riskDetails"/>
<result column="risktwo_type" property="riskType2"/>
<result column="risktwo_detail" property="riskDetails2"/>
<result column="riskthree_type" property="riskType3"/>
<result column="riskthree_detail" property="riskDetails3"/>
<result column="riskfour_type" property="riskType4"/>
<result column="riskfour_detail" property="riskDetails4"/>
<result column="riskfive_type" property="riskType5"/>
<result column="riskfive_datail" property="riskDetails5"/>
<result column="del_flag" property="delFlag"/>
</resultMap>
<sql id="SelectBaseMap">
SELECT city,
pro_name,
gth,
jd,
wd,
jc_type,
oper_medel,
zy_risk_level,
zy_gx,
zy_gf,
gt,
zt_style,
zt_risk,
zt_gx,
zt_gf,
jx,
fs_style,
jx_risk,
jx_gx,
jx_gf,
ht_image,
a_image,
riskone_type,
riskone_detaill,
risktwo_type,
risktwo_detail,
riskthree_type,
riskthree_detail,
riskfour_type,
riskfour_detail,
riskfive_type,
riskfive_datail
FROM t_risk_press_drop_rate
</sql>
<!--获取风险压降率数据-->
<select id="getRiskBloodList" resultMap="TRiskPressDropRateMap">
<include refid="SelectBaseMap"/>
WHERE del_flag = 0
<if test="list!=null and list!=''">
AND(
<foreach collection="list" index="index" item="item" open="" close="" separator="or">
(city = #{item})
</foreach>
)
</if>
<if test="proNameList!=null and proNameList!=''">
AND(
<foreach collection="proNameList" index="index" item="item" open="" close="" separator="or">
(pro_name = #{item})
</foreach>
)
</if>
<if test="o.basicBaseType!=null and o.basicBaseType!=''">
AND jc_type = #{o.basicBaseType}
</if>
<if test="o.basicWorkStyle!=null and o.basicWorkStyle!=''">
AND oper_medel = #{o.basicWorkStyle}
</if>
<if test="o.basicRiskLevel!=null and o.basicRiskLevel!=''">
AND zy_risk_level = #{o.basicRiskLevel}
</if>
<if test="o.basicOperProcedure!=null and o.basicOperProcedure!=''">
AND INSTR(zy_gx,#{o.basicOperProcedure}) > 0
</if>
<if test="o.basicAppMethod!=null and o.basicAppMethod!=''">
AND zy_gf = #{o.basicAppMethod}
</if>
<if test="o.groupTowerFullHeight!=null and o.groupTowerFullHeight!=''">
<if test="o.groupTowerFullHeight == 1">
AND gt <![CDATA[<]]> 60
</if>
<if test="o.groupTowerFullHeight == 2">
AND gt &gt;=60
</if>
</if>
<if test="o.groupTowerStyle!=null and o.groupTowerStyle!=''">
AND zt_style = #{o.groupTowerStyle}
</if>
<if test="o.groupTowerRiskLevel!=null and o.groupTowerRiskLevel!=''">
AND zt_risk = #{o.groupTowerRiskLevel}
</if>
<if test="o.groupTowerOperProcedure!=null and o.groupTowerOperProcedure!=''">
AND INSTR(zt_gx, #{o.groupTowerOperProcedure}) > 0
</if>
<if test="o.groupTowerAppMethod!=null and o.groupTowerAppMethod!=''">
AND zt_gf = #{o.groupTowerAppMethod}
</if>
<if test="o.wireSpan!=null and o.wireSpan!=''">
AND INSTR(jx,#{o.wireSpan}) > 0
</if>
<if test="o.wireStyle!=null and o.wireStyle!=''">
<if test="o.wireStyle == '其他'">
AND fs_style = '其他'
</if>
<if test="o.wireStyle == '张力架线,张力放线'">
AND (fs_style = '张力架线' or fs_style = '张力放线')
</if>
<if test="o.wireStyle == '低张力架线,低张力放线'">
AND (fs_style = '低张力架线' or fs_style = '低张力放线')
</if>
</if>
<if test="o.wireRiskLevel!=null and o.wireRiskLevel!=''">
AND jx_risk = #{o.wireRiskLevel}
</if>
<if test="o.wireOperProcedure!=null and o.wireOperProcedure!=''">
AND INSTR(jx_gx, #{o.wireOperProcedure}) > 0
</if>
<if test="o.wireAppMethod!=null and o.wireAppMethod!=''">
AND jx_gf = #{o.wireAppMethod}
</if>
<if test="o.riskType!=null and o.riskType!=''">
AND riskone_type = #{o.riskType}
</if>
ORDER BY create_time DESC, update_time DESC
</select>
<!--查询单个-->
<select id="queryById" resultMap="TRiskPressDropRateMap">
<include refid="SelectBaseMap"/>
WHERE pro_name = #{proName}
</select>
<!--通过主键删除-->
<delete id="deleteById">
DELETE
FROM t_risk_press_drop_rate
WHERE pro_name = #{proName}
</delete>
<!--新增或者修改-->
<insert id="addOrUpdateRisk">
REPLACE
INTO t_risk_press_drop_rate
(city, pro_name, gth, jd, wd, jc_type, oper_medel, zy_risk_level,zy_gx, zy_gf, gt, zt_style, zt_risk, zt_gx, zt_gf, jx, fs_style, jx_risk, jx_gx, jx_gf,
riskone_type, riskone_detaill, ht_image, a_image, risktwo_type, risktwo_detail, riskthree_type,
riskthree_detail, riskfour_type, riskfour_detail, riskfive_type, riskfive_datail, create_time)
VALUES (
#{cityName,jdbcType=VARCHAR},
#{proName,jdbcType=VARCHAR},
#{tower,jdbcType=VARCHAR},
#{lon,jdbcType=VARCHAR},
#{lat,jdbcType=VARCHAR},
#{basicBaseType,jdbcType=VARCHAR},
#{basicWorkStyle,jdbcType=VARCHAR},
#{basicRiskLevel,jdbcType=VARCHAR},
#{basicOperProcedure,jdbcType=VARCHAR},
#{basicAppMethod,jdbcType=VARCHAR},
#{groupTowerFullHeight,jdbcType=VARCHAR},
#{groupTowerStyle,jdbcType=VARCHAR},
#{groupTowerRiskLevel,jdbcType=VARCHAR},
#{groupTowerOperProcedure,jdbcType=VARCHAR},
#{groupTowerAppMethod,jdbcType=VARCHAR},
#{wireSpan,jdbcType=VARCHAR},
#{wireStyle,jdbcType=VARCHAR},
#{wireRiskLevel,jdbcType=VARCHAR},
#{wireOperProcedure,jdbcType=VARCHAR},
#{wireAppMethod,jdbcType=VARCHAR},
#{riskType,jdbcType=VARCHAR},
#{riskDetails,jdbcType=VARCHAR},
#{landFormPath,jdbcType=VARCHAR},
#{surroundingsPath,jdbcType=VARCHAR},
#{riskType2,jdbcType=VARCHAR},
#{riskDetails2,jdbcType=VARCHAR},
#{riskType3,jdbcType=VARCHAR},
#{riskDetails3,jdbcType=VARCHAR},
#{riskType4,jdbcType=VARCHAR},
#{riskDetails4,jdbcType=VARCHAR},
#{riskType5,jdbcType=VARCHAR},
#{riskDetails5,jdbcType=VARCHAR},
#{createTime,jdbcType=VARCHAR}
)
</insert>
<!--根据地市、或者工程来删除数据-->
<update id="delProList">
UPDATE t_risk_press_drop_rate SET del_flag = 1
<where>
<if test="type == 1">
city = #{name}
</if>
<if test="type == 2">
pro_name = #{name}
</if>
</where>
</update>
<!--获取风险压降率的工程-->
<select id="getProNameList" resultType="com.sercurityControl.proteam.domain.vo.BaseVo">
SELECT DISTINCT pro_name AS id, pro_name AS name FROM t_risk_press_drop_rate
WHERE del_flag = 0
<if test="list!=null and list!=''">
AND(
<foreach collection="list" index="index" item="item" open="" close="" separator="or">
(city like concat('%',concat(#{item},'%')))
</foreach>
)
</if>
</select>
<!--全省压降率-->
<select id="getProvinceRiskDropRate" resultType="java.util.Map">
SELECT COUNT(*) AS TOTALNUM,
COUNT(CASE oper_medel
WHEN '机械开挖' THEN 1
WHEN '旋挖钻机' THEN 1
ELSE NULL END) AS NUM
FROM t_risk_press_drop_rate
WHERE del_flag = 0
UNION ALL
SELECT COUNT(*) AS TOTALNUM,
COUNT(CASE zt_style
WHEN '流动式起重机立塔' THEN 1
WHEN '落地抱杆分解吊装组立' THEN 1
ELSE NULL END) AS NUM
FROM t_risk_press_drop_rate
WHERE del_flag = 0
UNION ALL
SELECT COUNT(*) AS TOTALNUM,
COUNT(*) AS NUM
FROM t_risk_press_drop_rate
WHERE del_flag = 0
</select>
<!-- 当前查询压降率计算结果 -->
<select id="getCurrentQueryData" resultType="java.util.Map">
SELECT COUNT(*) AS TOTALNUM,
COUNT(
CASE oper_medel
WHEN '机械开挖' THEN 1 WHEN '旋挖钻机' THEN 1 ELSE NULL END) AS BASICNUM,
COUNT(CASE zt_style
WHEN '流动式起重机立塔' THEN 1 WHEN '落地抱杆分解吊装组立' THEN 1 ELSE NULL END)AS TOWNUM,
COUNT(*) AS WIRENUM
FROM t_risk_press_drop_rate
WHERE del_flag = 0
<if test="list!=null and list!=''">
AND(
<foreach collection="list" index="index" item="item" open="" close="" separator="or">
(city = #{item})
</foreach>
)
</if>
<if test="proNameList!=null and proNameList!=''">
AND(
<foreach collection="proNameList" index="index" item="item" open="" close="" separator="or">
(pro_name = #{item})
</foreach>
)
</if>
<if test="o.basicBaseType!=null and o.basicBaseType!=''">
AND jc_type = #{o.basicBaseType}
</if>
<if test="o.basicWorkStyle!=null and o.basicWorkStyle!=''">
AND oper_medel = #{o.basicWorkStyle}
</if>
<if test="o.basicRiskLevel!=null and o.basicRiskLevel!=''">
AND zy_risk_level = #{o.basicRiskLevel}
</if>
<if test="o.basicOperProcedure!=null and o.basicOperProcedure!=''">
AND INSTR(zy_gx,#{o.basicOperProcedure}) > 0
</if>
<if test="o.basicAppMethod!=null and o.basicAppMethod!=''">
AND zy_gf = #{o.basicAppMethod}
</if>
<if test="o.groupTowerFullHeight!=null and o.groupTowerFullHeight!=''">
<if test="o.groupTowerFullHeight == 1">
AND gt <![CDATA[<]]> 60
</if>
<if test="o.groupTowerFullHeight == 2">
AND gt &gt;=60
</if>
</if>
<if test="o.groupTowerStyle!=null and o.groupTowerStyle!=''">
AND zt_style = #{o.groupTowerStyle}
</if>
<if test="o.groupTowerRiskLevel!=null and o.groupTowerRiskLevel!=''">
AND zt_risk = #{o.groupTowerRiskLevel}
</if>
<if test="o.groupTowerOperProcedure!=null and o.groupTowerOperProcedure!=''">
AND INSTR(zt_gx,#{o.groupTowerOperProcedure}) > 0
</if>
<if test="o.groupTowerAppMethod!=null and o.groupTowerAppMethod!=''">
AND zt_gf = #{o.groupTowerAppMethod}
</if>
<if test="o.wireSpan!=null and o.wireSpan!=''">
AND INSTR(jx,#{o.wireSpan}) > 0
</if>
<if test="o.wireStyle!=null and o.wireStyle!=''">
<if test="o.wireStyle!=null and o.wireStyle!=''">
<if test="o.wireStyle == '其他'">
AND fs_style = '其他'
</if>
<if test="o.wireStyle == '张力架线,张力放线'">
AND (fs_style = '张力架线' or fs_style = '张力放线')
</if>
<if test="o.wireStyle == '低张力架线,低张力放线'">
AND (fs_style = '低张力架线' or fs_style = '低张力放线')
</if>
</if>
</if>
<if test="o.wireRiskLevel!=null and o.wireRiskLevel!=''">
AND jx_risk = #{o.wireRiskLevel}
</if>
<if test="o.wireOperProcedure!=null and o.wireOperProcedure!=''">
AND INSTR(jx_gx,#{o.wireOperProcedure}) > 0
</if>
<if test="o.wireAppMethod!=null and o.wireAppMethod!=''">
AND jx_gf = #{o.wireAppMethod}
</if>
<if test="o.riskType!=null and o.riskType!=''">
AND riskone_type = #{o.riskType}
</if>
</select>
</mapper>