123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- <?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.*,
- 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,
- sil.metercode meterCode,
- sgm.customer_no as account_number,
- sgm.customer_name as account_name,
- sgm.customer_phone as account_phone
- from sc_warning_log swl
- left join sc_device sd on(sd.id = swl.device_id)
- left join sc_install_list sil on sd.id=sil.device_id
- left join sc_building sb on(sb.id = sd.building_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)
- left join sc_grid_management sgm on(sgm.device_id = sil.device_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="deviceId != null"> and sd.id = #{deviceId}</if>
- <if test="channelId != null"> and sd.sys_id = #{channelId}</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 (
- pba.name LIKE concat('%',#{clientName},'%') or pba.mobilephone LIKE concat('%',#{clientName},'%') or pba.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 pay_base_customerandmeterrela pbc on(pbc.watermeter_id = swl.device_id)
- left join pay_base_account pba on(pba.id = pbc.account_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="channelId != null"> and sd.sys_id = #{channelId}</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 (
- pba.name LIKE concat('%',#{clientName},'%') or pba.mobilephone LIKE concat('%',#{clientName},'%') or pba.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>
|