<?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, suer.nick_name as report_person, report_person_id,hidden_trouble_deal_status, hidden_trouble_deal_condition, fuhe_time,deal_video, fuhe_person,deal_person,video_url, hidden_trouble_deal_finish_time, is_del, remarks,beyond_enterprise_id,deal_url,is_report from t_hidden_trouble_info info left join sys_user suer on info.report_person_id = suer.user_id </sql> <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> <if test="reportPerson != null and reportPerson != ''"> and suer.nick_name like concat('%', #{reportPerson}, '%')</if> <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 FROM t_hidden_trouble_info info left join sys_user suer on info.report_person_id = suer.user_id <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> <if test="reportPerson != null and reportPerson != ''"> and suer.nick_name like concat('%', #{reportPerson}, '%')</if> <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, report_time, 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,is_report from t_hidden_trouble_info info left join sys_user suer on info.report_person_id = suer.user_id <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 suer.nick_name like concat('%', #{reportPerson}, '%')</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> <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>