THiddenTroubleInfoMapper.xml 11.3 KB
Newer Older
1 2 3 4 5
<?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.zehong.system.mapper.THiddenTroubleInfoMapper">
wuqinghua's avatar
wuqinghua committed
6

7 8
    <resultMap type="THiddenTroubleInfo" id="THiddenTroubleInfoResult">
        <result property="hiddenTroubleId"    column="hidden_trouble_id"    />
wuqinghua's avatar
wuqinghua committed
9
        <result property="beyondEnterpriseId"    column="beyond_enterprise_id"    />
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
        <result property="workId"    column="work_id"    />
        <result property="hiddenTroubleName"    column="hidden_trouble_name"    />
        <result property="hiddenTroubleLevel"    column="hidden_trouble_level"    />
        <result property="hiddenTroubleType"    column="hidden_trouble_type"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="pictureUrl"    column="picture_url"    />
        <result property="hiddenTroubleDescribe"    column="hidden_trouble_describe"    />
        <result property="reportTime"    column="report_time"    />
        <result property="reportPerson"    column="report_person"    />
        <result property="hiddenTroubleDealStatus"    column="hidden_trouble_deal_status"    />
        <result property="hiddenTroubleDealCondition"    column="hidden_trouble_deal_condition"    />
        <result property="hiddenTroubleDealFinishTime"    column="hidden_trouble_deal_finish_time"    />
        <result property="isDel"    column="is_del"    />
        <result property="remarks"    column="remarks"    />
25
        <result property="reportPersonName"    column="report_person_name"    />
26 27 28
    </resultMap>

    <sql id="selectTHiddenTroubleInfoVo">
29
        select hidden_trouble_id, work_id, hidden_trouble_name, hidden_trouble_level, hidden_trouble_type, longitude, latitude, picture_url, hidden_trouble_describe, report_time, (select u.user_name from sys_user u where u.user_id = report_person) AS report_person_name, report_person, hidden_trouble_deal_status, hidden_trouble_deal_condition, hidden_trouble_deal_finish_time, is_del, remarks,beyond_enterprise_id from t_hidden_trouble_info
30 31 32 33
    </sql>

    <select id="selectTHiddenTroubleInfoList" parameterType="THiddenTroubleInfo" resultMap="THiddenTroubleInfoResult">
        <include refid="selectTHiddenTroubleInfoVo"/>
wuqinghua's avatar
wuqinghua committed
34 35
        <where>
            is_del='0'
36 37 38 39 40 41 42 43
            <if test="workId != null "> and work_id = #{workId}</if>
            <if test="hiddenTroubleLevel != null  and hiddenTroubleLevel != ''"> and hidden_trouble_level = #{hiddenTroubleLevel}</if>
            <if test="hiddenTroubleType != null  and hiddenTroubleType != ''"> and hidden_trouble_type = #{hiddenTroubleType}</if>
            <if test="longitude != null "> and longitude = #{longitude}</if>
            <if test="latitude != null "> and latitude = #{latitude}</if>
            <if test="pictureUrl != null  and pictureUrl != ''"> and picture_url = #{pictureUrl}</if>
            <if test="hiddenTroubleDescribe != null  and hiddenTroubleDescribe != ''"> and hidden_trouble_describe = #{hiddenTroubleDescribe}</if>
            <if test="reportTime != null "> and report_time = #{reportTime}</if>
wuqinghua's avatar
wuqinghua committed
44
            <if test="beyondEnterpriseId != null  and beyondEnterpriseId != -2"> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
45 46
            <if test="hiddenTroubleName != null  and hiddenTroubleName != ''"> and hidden_trouble_name like concat('%', #{hiddenTroubleName}, '%')</if>
            <if test="reportPerson != null  and reportPerson != ''"> and report_person = #{reportPerson}</if>
47 48 49
            <if test="hiddenTroubleDealStatus != null  and hiddenTroubleDealStatus != ''"> and hidden_trouble_deal_status = #{hiddenTroubleDealStatus}</if>
            <if test="hiddenTroubleDealCondition != null  and hiddenTroubleDealCondition != ''"> and hidden_trouble_deal_condition = #{hiddenTroubleDealCondition}</if>
            <if test="hiddenTroubleDealFinishTime != null "> and hidden_trouble_deal_finish_time = #{hiddenTroubleDealFinishTime}</if>
50
        </where>
51
        ORDER BY hidden_trouble_id DESC
52
    </select>
wuqinghua's avatar
wuqinghua committed
53

54 55 56 57
    <select id="selectTHiddenTroubleInfoById" parameterType="Long" resultMap="THiddenTroubleInfoResult">
        <include refid="selectTHiddenTroubleInfoVo"/>
        where hidden_trouble_id = #{hiddenTroubleId}
    </select>
wuqinghua's avatar
wuqinghua committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77

    <!--Excel数据导出查询接口-->
    <select id="selectTHiddenTroubleInfoExcelList" resultMap="THiddenTroubleInfoResult" parameterType="THiddenTroubleInfo">
        select hidden_trouble_id, work_id, hidden_trouble_name,
        (CASE hidden_trouble_level WHEN '1' THEN 'I级' WHEN '2' THEN 'II级'WHEN '3' THEN 'III级'end) as   hidden_trouble_level,
        (CASE hidden_trouble_type WHEN '1' THEN '漏气' WHEN '2' THEN '腐蚀'WHEN '3' THEN '裂缝' WHEN '4' THEN '设备故障' WHEN '5' THEN '安全距离不足' WHEN '6' THEN '管道承重'WHEN '7' THEN '其他'end) as   hidden_trouble_type,
         longitude, latitude, picture_url, hidden_trouble_describe,
        report_time, (select u.user_name from sys_user u where u.user_id = report_person) AS report_person_name, report_person,
        (CASE hidden_trouble_deal_status WHEN '1' THEN '待处理' WHEN '2' THEN '处理中'WHEN '3' THEN '已完成'end) as  hidden_trouble_deal_status,
        hidden_trouble_deal_condition, hidden_trouble_deal_finish_time, is_del, remarks
        from t_hidden_trouble_info
        <where>
            is_del='0'
            <if test="beyondEnterpriseId != null  and beyondEnterpriseId != -2"> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
            <if test="hiddenTroubleName != null  and hiddenTroubleName != ''"> and hidden_trouble_name like concat('%', #{hiddenTroubleName}, '%')</if>
            <if test="reportPerson != null  and reportPerson != ''"> and report_person = #{reportPerson}</if>
        </where>
        group by hidden_trouble_id desc
    </select>

wuqinghua's avatar
wuqinghua committed
78

79 80 81 82
    <insert id="insertTHiddenTroubleInfo" parameterType="THiddenTroubleInfo" useGeneratedKeys="true" keyProperty="hiddenTroubleId">
        insert into t_hidden_trouble_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="workId != null">work_id,</if>
wuqinghua's avatar
wuqinghua committed
83
            <if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
            <if test="hiddenTroubleName != null">hidden_trouble_name,</if>
            <if test="hiddenTroubleLevel != null">hidden_trouble_level,</if>
            <if test="hiddenTroubleType != null">hidden_trouble_type,</if>
            <if test="longitude != null">longitude,</if>
            <if test="latitude != null">latitude,</if>
            <if test="pictureUrl != null">picture_url,</if>
            <if test="hiddenTroubleDescribe != null">hidden_trouble_describe,</if>
            <if test="reportTime != null">report_time,</if>
            <if test="reportPerson != null">report_person,</if>
            <if test="hiddenTroubleDealStatus != null">hidden_trouble_deal_status,</if>
            <if test="hiddenTroubleDealCondition != null">hidden_trouble_deal_condition,</if>
            <if test="hiddenTroubleDealFinishTime != null">hidden_trouble_deal_finish_time,</if>
            <if test="remarks != null">remarks,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="workId != null">#{workId},</if>
wuqinghua's avatar
wuqinghua committed
100
            <if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
            <if test="hiddenTroubleName != null">#{hiddenTroubleName},</if>
            <if test="hiddenTroubleLevel != null">#{hiddenTroubleLevel},</if>
            <if test="hiddenTroubleType != null">#{hiddenTroubleType},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="pictureUrl != null">#{pictureUrl},</if>
            <if test="hiddenTroubleDescribe != null">#{hiddenTroubleDescribe},</if>
            <if test="reportTime != null">#{reportTime},</if>
            <if test="reportPerson != null">#{reportPerson},</if>
            <if test="hiddenTroubleDealStatus != null">#{hiddenTroubleDealStatus},</if>
            <if test="hiddenTroubleDealCondition != null">#{hiddenTroubleDealCondition},</if>
            <if test="hiddenTroubleDealFinishTime != null">#{hiddenTroubleDealFinishTime},</if>
            <if test="remarks != null">#{remarks},</if>
         </trim>
    </insert>

    <update id="updateTHiddenTroubleInfo" parameterType="THiddenTroubleInfo">
        update t_hidden_trouble_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="workId != null">work_id = #{workId},</if>
            <if test="hiddenTroubleName != null">hidden_trouble_name = #{hiddenTroubleName},</if>
            <if test="hiddenTroubleLevel != null">hidden_trouble_level = #{hiddenTroubleLevel},</if>
            <if test="hiddenTroubleType != null">hidden_trouble_type = #{hiddenTroubleType},</if>
            <if test="longitude != null">longitude = #{longitude},</if>
            <if test="latitude != null">latitude = #{latitude},</if>
            <if test="pictureUrl != null">picture_url = #{pictureUrl},</if>
            <if test="hiddenTroubleDescribe != null">hidden_trouble_describe = #{hiddenTroubleDescribe},</if>
            <if test="reportTime != null">report_time = #{reportTime},</if>
            <if test="reportPerson != null">report_person = #{reportPerson},</if>
            <if test="hiddenTroubleDealStatus != null">hidden_trouble_deal_status = #{hiddenTroubleDealStatus},</if>
            <if test="hiddenTroubleDealCondition != null">hidden_trouble_deal_condition = #{hiddenTroubleDealCondition},</if>
            <if test="hiddenTroubleDealFinishTime != null">hidden_trouble_deal_finish_time = #{hiddenTroubleDealFinishTime},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
        </trim>
        where hidden_trouble_id = #{hiddenTroubleId}
    </update>

wuqinghua's avatar
wuqinghua committed
139 140 141
    <update id="deleteTHiddenTroubleInfoById" parameterType="Long">
        update  t_hidden_trouble_info set is_del='1' where hidden_trouble_id = #{hiddenTroubleId}
    </update>
142

wuqinghua's avatar
wuqinghua committed
143 144
    <update id="deleteTHiddenTroubleInfoByIds" parameterType="String">
        update t_hidden_trouble_info set is_del='1' where hidden_trouble_id in
145 146 147
        <foreach item="hiddenTroubleId" collection="array" open="(" separator="," close=")">
            #{hiddenTroubleId}
        </foreach>
wuqinghua's avatar
wuqinghua committed
148
    </update>
wuqinghua's avatar
wuqinghua committed
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175

    <!--查询燃气信息是否有修改-->
    <select id="selectDetails" resultMap="THiddenTroubleInfoResult" parameterType="THiddenTroubleInfo">
        <include refid="selectTHiddenTroubleInfoVo"/>
       where hidden_trouble_id=#{hiddenTroubleId}
        <if test="hiddenTroubleName != null">
         and hidden_trouble_name = #{hiddenTroubleName}
        </if>
        <if test="hiddenTroubleLevel != null">
            and hidden_trouble_level = #{hiddenTroubleLevel}
        </if>
        <if test="hiddenTroubleType != null">
            and hidden_trouble_type = #{hiddenTroubleType}
        </if>
        <if test="hiddenTroubleDescribe != null">
            and hidden_trouble_describe = #{hiddenTroubleDescribe}
        </if>
        <if test="longitude != null">
            and longitude = #{longitude}
        </if>
        <if test="latitude != null">
            and latitude = #{latitude}
        </if>
        <if test="pictureUrl != null">
            and  picture_url= #{pictureUrl}
        </if>
    </select>
wuqinghua's avatar
wuqinghua committed
176
</mapper>