|
@@ -0,0 +1,213 @@
|
|
|
+<?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.bz.smart_city.dao.WarningLogMapper">
|
|
|
+ <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.WarningLog">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ <!--@Table sc_warning_log-->
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="client_user_id" property="clientUserId" />
|
|
|
+ <result column="device_id" property="deviceId" />
|
|
|
+ <result column="warning_type" property="warningType" />
|
|
|
+ <result column="feedback_status" property="feedbackStatus" />
|
|
|
+ <result column="feedback_content" property="feedbackContent" />
|
|
|
+ <result column="status" property="status" />
|
|
|
+ <result column="create_by" property="createBy" />
|
|
|
+ <result column="date_create" property="dateCreate" />
|
|
|
+ <result column="update_by" property="updateBy" />
|
|
|
+ <result column="date_update" property="dateUpdate" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ id, client_user_id, device_id, warning_type, feedback_status, feedback_content, `status`,
|
|
|
+ create_by, date_create, update_by, date_update
|
|
|
+ </sql>
|
|
|
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bz.smart_city.entity.WarningLog" useGeneratedKeys="true">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ insert into sc_warning_log
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="clientUserId != null">
|
|
|
+ client_user_id,
|
|
|
+ </if>
|
|
|
+ <if test="deviceId != null">
|
|
|
+ device_id,
|
|
|
+ </if>
|
|
|
+ <if test="warningType != null">
|
|
|
+ warning_type,
|
|
|
+ </if>
|
|
|
+ <if test="feedbackStatus != null">
|
|
|
+ feedback_status,
|
|
|
+ </if>
|
|
|
+ <if test="feedbackContent != null">
|
|
|
+ feedback_content,
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ `status`,
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">
|
|
|
+ create_by,
|
|
|
+ </if>
|
|
|
+ <if test="dateCreate != null">
|
|
|
+ date_create,
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">
|
|
|
+ update_by,
|
|
|
+ </if>
|
|
|
+ <if test="dateUpdate != null">
|
|
|
+ date_update,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="clientUserId != null">
|
|
|
+ #{clientUserId},
|
|
|
+ </if>
|
|
|
+ <if test="deviceId != null">
|
|
|
+ #{deviceId},
|
|
|
+ </if>
|
|
|
+ <if test="warningType != null">
|
|
|
+ #{warningType},
|
|
|
+ </if>
|
|
|
+ <if test="feedbackStatus != null">
|
|
|
+ #{feedbackStatus},
|
|
|
+ </if>
|
|
|
+ <if test="feedbackContent != null">
|
|
|
+ #{feedbackContent},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ #{status},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">
|
|
|
+ #{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="dateCreate != null">
|
|
|
+ #{dateCreate},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">
|
|
|
+ #{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="dateUpdate != null">
|
|
|
+ #{dateUpdate},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.bz.smart_city.entity.WarningLog">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ update sc_warning_log
|
|
|
+ <set>
|
|
|
+ <if test="clientUserId != null">
|
|
|
+ client_user_id = #{clientUserId},
|
|
|
+ </if>
|
|
|
+ <if test="deviceId != null">
|
|
|
+ device_id = #{deviceId},
|
|
|
+ </if>
|
|
|
+ <if test="warningType != null">
|
|
|
+ warning_type = #{warningType},
|
|
|
+ </if>
|
|
|
+ <if test="feedbackStatus != null">
|
|
|
+ feedback_status = #{feedbackStatus},
|
|
|
+ </if>
|
|
|
+ <if test="feedbackContent != null">
|
|
|
+ feedback_content = #{feedbackContent},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ `status` = #{status},
|
|
|
+ </if>
|
|
|
+ <if test="createBy != null">
|
|
|
+ create_by = #{createBy},
|
|
|
+ </if>
|
|
|
+ <if test="dateCreate != null">
|
|
|
+ date_create = #{dateCreate},
|
|
|
+ </if>
|
|
|
+ <if test="updateBy != null">
|
|
|
+ update_by = #{updateBy},
|
|
|
+ </if>
|
|
|
+ <if test="dateUpdate != null">
|
|
|
+ date_update = #{dateUpdate},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="getList" resultType="com.bz.smart_city.dto.WarningLogDto">
|
|
|
+ select
|
|
|
+ swl.*,
|
|
|
+ scu.accountnumber as account_number,
|
|
|
+ scu.username as account_name,
|
|
|
+ scu.mobile_phone as account_phone,
|
|
|
+ sd.device_no,
|
|
|
+ sd.water_meter_no,
|
|
|
+ sd.loc_desc,
|
|
|
+ sdt1.equipment_type as equipment_type,
|
|
|
+ sdt1.model as model,
|
|
|
+ sdm1.name as manufacturer_name
|
|
|
+ from sc_warning_log swl
|
|
|
+ left join sc_device sd on(sd.id = swl.device_id)
|
|
|
+ left join sc_building sb on(sb.id = sd.building_id)
|
|
|
+ left join sc_client_user scu on(scu.id = swl.client_user_id)
|
|
|
+ left join sc_device_type sdt1 on(sdt1.id = sd.device_type)
|
|
|
+ left join sc_device_manufacturer sdm1 on(sdm1.id = sdt1.manufacturer_id)
|
|
|
+ <if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = sd.id and sdd.status = 1)</if>
|
|
|
+ where swl.status = 1 and sd.status = 1
|
|
|
+ <if test="siteId != null"> and sd.site_id = #{siteId}</if>
|
|
|
+ <if test="deviceNo != null and deviceNo != ''"> and (
|
|
|
+ sd.device_no LIKE concat('%',#{deviceNo},'%') or sd.water_meter_no LIKE concat('%',#{deviceNo},'%')
|
|
|
+ )</if>
|
|
|
+ <if test="warningType != null"> and swl.warning_type = #{warningType}</if>
|
|
|
+ <if test="clientName != null and clientName != ''"> and (
|
|
|
+ scu.username LIKE concat('%',#{clientName},'%') or scu.mobile_phone LIKE concat('%',#{clientName},'%') or scu.accountnumber LIKE concat('%',#{clientName},'%')
|
|
|
+ )</if>
|
|
|
+ <if test="feedbackStatus != null"> and swl.feedback_status = #{feedbackStatus}</if>
|
|
|
+ <if test="provinceId != null"> and sb.province = #{provinceId}</if>
|
|
|
+ <if test="cityId != null"> and sb.city = #{cityId}</if>
|
|
|
+ <if test="regionId != null"> and sb.region = #{regionId}</if>
|
|
|
+ <if test="communityId != null"> and sb.community = #{communityId}</if>
|
|
|
+ <if test="buildingId != null"> and sd.building_id = #{buildingId}</if>
|
|
|
+ <if test="startDate != null"> and swl.date_create <![CDATA[ >= ]]> #{startDate}</if>
|
|
|
+ <if test="endDate != null"> and swl.date_create <![CDATA[ <= ]]> #{endDate}</if>
|
|
|
+ <if test="programItems != null and programItems.size() != 0"> and
|
|
|
+ <foreach collection="programItems" item="item" open="(" separator=" or " close=")">
|
|
|
+ sdd.${item.dimensionCode} = #{item.dimensionValue}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ order by swl.date_create desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getAreaList" resultType="com.bz.smart_city.dto.BuildingSelectInfoDto">
|
|
|
+ select
|
|
|
+ b.id,
|
|
|
+ b.name,
|
|
|
+ b.province,
|
|
|
+ b.city,
|
|
|
+ b.region,
|
|
|
+ b.community,
|
|
|
+ b.longitude,
|
|
|
+ b.latitude,
|
|
|
+ t1.device_count
|
|
|
+ from sc_building b
|
|
|
+ right join (
|
|
|
+ select sd.building_id,count(1) as device_count
|
|
|
+ from sc_warning_log swl
|
|
|
+ left join sc_device sd on(sd.id = swl.device_id)
|
|
|
+ left join sc_client_user scu on(scu.id = swl.client_user_id)
|
|
|
+ <if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = sd.id and sdd.status = 1)</if>
|
|
|
+ where swl.status = 1 and sd.status = 1
|
|
|
+ <if test="siteId != null"> and sd.site_id = #{siteId}</if>
|
|
|
+ <if test="deviceNo != null and deviceNo != ''"> and (
|
|
|
+ sd.device_no LIKE concat('%',#{deviceNo},'%') or sd.water_meter_no LIKE concat('%',#{deviceNo},'%')
|
|
|
+ )</if>
|
|
|
+ <if test="warningType != null"> and swl.warning_type = #{warningType}</if>
|
|
|
+ <if test="clientName != null and clientName != ''"> and (
|
|
|
+ scu.username LIKE concat('%',#{clientName},'%') or scu.mobile_phone LIKE concat('%',#{clientName},'%') or scu.accountnumber LIKE concat('%',#{clientName},'%')
|
|
|
+ )</if>
|
|
|
+ <if test="feedbackStatus != null"> and swl.feedback_status = #{feedbackStatus}</if>
|
|
|
+ <if test="startDate != null"> and swl.date_create <![CDATA[ >= ]]> #{startDate}</if>
|
|
|
+ <if test="endDate != null"> and swl.date_create <![CDATA[ <= ]]> #{endDate}</if>
|
|
|
+ <if test="programItems != null and programItems.size() != 0"> and
|
|
|
+ <foreach collection="programItems" item="item" open="(" separator=" or " close=")">
|
|
|
+ sdd.${item.dimensionCode} = #{item.dimensionValue}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ GROUP BY sd.building_id
|
|
|
+ ) t1 on (t1.building_id = b.id)
|
|
|
+ where b.status = 1
|
|
|
+ </select>
|
|
|
+</mapper>
|