THiddenTroubleInfoMapper.xml 15.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
<?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">

    <resultMap type="THiddenTroubleInfo" id="THiddenTroubleInfoResult">
        <result property="hiddenTroubleId"    column="hidden_trouble_id"    />
        <result property="beyondEnterpriseId"    column="beyond_enterprise_id"    />
        <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"    />
        <result property="reportPersonName"    column="report_person_name"    />
        <result property="dealUrl"    column="deal_url"    />
        <result property="rejectContent"    column="reject_content"    />
        <result property="fuheGroupNum"    column="fuhe_group_num"    />
        <result property="fuheTime"    column="fuhe_time"    />
        <result property="fuhePerson"    column="fuhe_person"    />
        <result property="dealPerson"    column="deal_person"    />
        <result property="videoUrl" column="video_url" />
        <result property="dealVideo" column="deal_video" />
        <result property="isReport"    column="is_report"    />
        <result property="hiddenSource" column="hidden_source" />
    </resultMap>

    <sql id="selectTHiddenTroubleInfoVo">
        select hidden_trouble_id, work_id, hidden_trouble_name, hidden_trouble_level, hidden_trouble_type,hidden_source,
         longitude, latitude, picture_url, hidden_trouble_describe, report_time,reject_content,fuhe_group_num,
41
         suer.nick_name as report_person, report_person_id,hidden_trouble_deal_status, hidden_trouble_deal_condition, fuhe_time,deal_video,
42 43
         fuhe_person,deal_person,video_url,
         hidden_trouble_deal_finish_time, is_del, remarks,beyond_enterprise_id,deal_url,is_report
44
         from t_hidden_trouble_info info left join sys_user suer on info.report_person_id = suer.user_id
45 46
    </sql>

47

48 49 50 51 52 53 54 55 56 57 58 59 60
    <select id="selectTHiddenTroubleInfoList" parameterType="THiddenTroubleInfo" resultMap="THiddenTroubleInfoResult">
        <include refid="selectTHiddenTroubleInfoVo"/>
        <where>
            is_del='0'
            <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="fuheGroupNum != null "> and fuhe_group_num = #{fuheGroupNum}</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>
            <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>
61
            <if test="reportPerson != null  and reportPerson != ''"> and suer.nick_name like concat('%', #{reportPerson}, '%')</if>
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
            <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>
            <if test="isReport != null "> and is_report = #{isReport}</if>
            <if test="hiddenSource!=null"> and hidden_source = #{hiddenSource}</if>
            <if test="reportBeginTime != null  and reportEndTime!=null">and report_time BETWEEN #{reportBeginTime} and #{reportEndTime}</if>
        </where>
        ORDER BY hidden_trouble_id DESC
    </select>
    <select id="selectTHiddenTroubleInfoListCount" parameterType="THiddenTroubleInfo" resultType="java.util.HashMap">
        SELECT
        <if test="timeType==null or timeType==1">
            DATE_FORMAT(report_time, "%Y-%m-%d") AS `timeType`,
        </if>
        <if test="timeType==2">
            DATE_FORMAT(report_time, "%Y-%u") AS `timeType`,
        </if>
        <if test="timeType==3">
            DATE_FORMAT(report_time, "%Y-%m") AS `timeType`,
        </if>
        <if test="timeType==4">
            DATE_FORMAT(report_time, "%Y") AS `timeType`,
        </if>
        COUNT(*) AS countNum

87
        FROM t_hidden_trouble_info info left join sys_user suer on info.report_person_id = suer.user_id
88 89 90 91 92 93 94
        <where>
            is_del='0'
            <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="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>
95
            <if test="reportPerson != null  and reportPerson != ''"> and suer.nick_name like concat('%', #{reportPerson}, '%')</if>
96 97 98 99 100 101 102 103 104 105 106 107 108 109
            <if test="hiddenTroubleDealStatus != null  and hiddenTroubleDealStatus != ''"> and hidden_trouble_deal_status = #{hiddenTroubleDealStatus}</if>
        </where>
    </select>
    <select id="selectTHiddenTroubleInfoById" parameterType="Long" resultMap="THiddenTroubleInfoResult">
        <include refid="selectTHiddenTroubleInfoVo"/>
        where hidden_trouble_id = #{hiddenTroubleId}
    </select>

    <!--Excel数据导出查询接口-->
    <select id="selectTHiddenTroubleInfoExcelList" resultMap="THiddenTroubleInfoResult" parameterType="THiddenTroubleInfo">
        select hidden_trouble_id, work_id, hidden_trouble_name,reject_content,fuhe_group_num,
        (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,
110
        report_time, report_person,
111 112
        (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,is_report
113
        from t_hidden_trouble_info  info left join sys_user suer on info.report_person_id = suer.user_id
114 115 116 117
        <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>
118
            <if test="reportPerson != null  and reportPerson != ''"> and suer.nick_name like concat('%', #{reportPerson}, '%')</if>
119 120 121
            <if test="hiddenSource!=null"> and hidden_source = #{hiddenSource}</if>
            <if test="reportBeginTime != null  and reportEndTime!=null">and report_time BETWEEN #{reportBeginTime} and #{reportEndTime}</if>
        </where>
122
        order by hidden_trouble_id desc
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 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 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
    </select>


    <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>
            <if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
            <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="dealUrl!=null">deal_url,</if>
            <if test="fuheGroupNum!=null">fuhe_group_num,</if>
            <if test="rejectContent!=null">reject_content,</if>
            <if test="remarks != null">remarks,</if>
            <if test="videoUrl != null">video_url,</if>
            <if test="isReport != null">is_report,</if>
            <if test="hiddenSource!=null">hidden_source,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="workId != null">#{workId},</if>
            <if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
            <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="dealUrl!=null">#{dealUrl}</if>
            <if test="fuheGroupNum!=null">#{fuheGroupNum}</if>
            <if test="rejectContent!=null">#{rejectContent}</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="videoUrl != null">#{videoUrl},</if>
            <if test="isReport != null">#{isReport},</if>
            <if test="hiddenSource != null">#{hiddenSource},</if>
         </trim>
    </insert>

    <update id="updateTHiddenTroubleInfo" parameterType="THiddenTroubleInfo">
        update t_hidden_trouble_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="beyondEnterpriseId != null">beyond_enterprise_id = #{beyondEnterpriseId},</if>
            <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="fuheGroupNum != null">fuhe_group_num = #{fuheGroupNum},</if>
            <if test="rejectContent != null">reject_content = #{rejectContent},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="dealUrl != null">deal_url = #{dealUrl},</if>
            <if test="fuheTime != null">fuhe_time = #{fuheTime},</if>
            <if test="dealPerson != null">deal_person = #{dealPerson},</if>
            <if test="fuhePerson != null">fuhe_person = #{fuhePerson},</if>
            <if test="videoUrl != null">video_url = #{videoUrl},</if>
            <if test="dealVideo != null">deal_video = #{dealVideo},</if>
            <if test="isReport != null">is_report = #{isReport},</if>
        </trim>
        where hidden_trouble_id = #{hiddenTroubleId}
    </update>

    <update id="deleteTHiddenTroubleInfoById" parameterType="Long">
        update  t_hidden_trouble_info set is_del='1' where hidden_trouble_id = #{hiddenTroubleId}
    </update>

    <update id="deleteTHiddenTroubleInfoByIds" parameterType="String">
        update t_hidden_trouble_info set is_del='1' where hidden_trouble_id in
        <foreach item="hiddenTroubleId" collection="array" open="(" separator="," close=")">
            #{hiddenTroubleId}
        </foreach>
    </update>

    <!--查询燃气信息是否有修改-->
    <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>
</mapper>