|
@@ -961,43 +961,44 @@
|
|
|
</select>
|
|
|
<select id="getDeviceListByRange" resultType="com.bz.smart_city.dto.DeviceDto">
|
|
|
SELECT
|
|
|
- d.id ,
|
|
|
- d.device_no ,
|
|
|
+ d.id,
|
|
|
+ d.device_no,
|
|
|
dt.equipment_type,
|
|
|
d.device_type
|
|
|
FROM
|
|
|
- sc_device d
|
|
|
+ sc_device d
|
|
|
LEFT JOIN sc_device_type dt ON ( d.device_type = dt.id )
|
|
|
LEFT JOIN sc_building b ON ( d.building_id = b.id )
|
|
|
LEFT JOIN sc_community c ON ( b.community = c.id )
|
|
|
WHERE
|
|
|
- d.`status` = 1
|
|
|
+ d.`status` = 1
|
|
|
AND d.sys_id != - 99
|
|
|
- AND d.sys_id != 55
|
|
|
- AND d.id IN ( SELECT dd.device_id FROM sc_device_dimension dd WHERE
|
|
|
- <trim prefixOverrides="or" >
|
|
|
- <if test="customers != null and customers != '' ">
|
|
|
- FIND_IN_SET( dd.customer, #{customers} )
|
|
|
- </if>
|
|
|
- <if test="communitys != null and communitys != '' ">
|
|
|
- or FIND_IN_SET( dd.community, #{communitys} )
|
|
|
- </if>
|
|
|
- <if test="buildings != null and buildings != '' ">
|
|
|
- or FIND_IN_SET( dd.building, #{buildings} )
|
|
|
- </if>
|
|
|
- </trim>
|
|
|
- )
|
|
|
+ <if test="customers != null and customers != '' ">
|
|
|
+ AND FIND_IN_SET( d.customer_id, #{customers} )
|
|
|
+ </if>
|
|
|
+ <if test="communitys != null and communitys != '' ">
|
|
|
+ AND FIND_IN_SET( c.id, #{communitys} )
|
|
|
+ </if>
|
|
|
+ <if test="buildings != null and buildings != '' ">
|
|
|
+ AND FIND_IN_SET( d.building_id, #{buildings} )
|
|
|
+ </if>
|
|
|
+ <if test="channels != null and channels != '' ">
|
|
|
+ AND FIND_IN_SET( d.sys_id, #{channels} )
|
|
|
+ </if>
|
|
|
+ <if test="deviceTypes != null and deviceTypes != '' ">
|
|
|
+ AND FIND_IN_SET( d.device_type, #{deviceTypes} )
|
|
|
+ </if>
|
|
|
</select>
|
|
|
<select id="getPushDeviceDataList" resultType="java.util.HashMap">
|
|
|
SELECT
|
|
|
d.id AS deviceId,
|
|
|
d.device_no AS deviceNo,
|
|
|
- d.status AS status,
|
|
|
+ cast(d.status as SIGNED ) AS status,
|
|
|
dt.equipment_type AS deviceType,
|
|
|
- DATE_FORMAT(d.date_update,'%Y-%m-%d') AS dateCreate,
|
|
|
+ DATE_FORMAT( d.date_create, '%Y-%m-%d' ) AS dateCreate,
|
|
|
ifnull(m.factory,f.`name`) as factory,
|
|
|
m.user_name AS userName,
|
|
|
- '0' AS beginWSV,
|
|
|
+ ifnull(ll.new_meter_start,'0') AS beginWSV,
|
|
|
ifnull(m.area_name,c.`name`) AS areaName,
|
|
|
d.loc_desc AS location,
|
|
|
d.water_meter_no AS meterNumber,
|
|
@@ -1009,33 +1010,33 @@
|
|
|
m.caliber
|
|
|
FROM
|
|
|
sc_device d
|
|
|
+ Left JOIN sc_install_list ll on (d.id = ll.device_id and ll.status =1 )
|
|
|
LEFT JOIN sc_meter_info m ON ( CONCAT('91000',d.water_meter_no) = m.meter_no )
|
|
|
LEFT JOIN sc_device_type dt ON ( d.device_type = dt.id )
|
|
|
LEFT JOIN sc_building b on (d.building_id =b.id)
|
|
|
LEFT JOIN sc_community c on (b.community = c.id)
|
|
|
left join sc_device_manufacturer f on (dt.manufacturer_id = f.id)
|
|
|
- where d.`status` = 1
|
|
|
- and d.sys_id != -99
|
|
|
- and d.sys_id != 55
|
|
|
- and d.id in (
|
|
|
- SELECT
|
|
|
- dd.device_id
|
|
|
- FROM sc_device_dimension dd
|
|
|
- WHERE
|
|
|
- <trim prefixOverrides="or" >
|
|
|
- <if test="customers != null and customers != '' ">
|
|
|
- FIND_IN_SET( dd.customer, #{customers} )
|
|
|
- </if>
|
|
|
- <if test="communitys != null and communitys != '' ">
|
|
|
- or FIND_IN_SET( dd.community, #{communitys} )
|
|
|
- </if>
|
|
|
- <if test="buildings != null and buildings != '' ">
|
|
|
- or FIND_IN_SET( dd.building, #{buildings} )
|
|
|
- </if>
|
|
|
- </trim>
|
|
|
- )
|
|
|
- and d.date_update >= #{beginDate ,jdbcType=TIMESTAMP }
|
|
|
- and d.date_update <![CDATA[ < ]]> #{endDate ,jdbcType=TIMESTAMP }
|
|
|
+ where d.sys_id != -99
|
|
|
+ <if test="customers != null and customers != '' ">
|
|
|
+ AND FIND_IN_SET( d.customer_id, #{customers} )
|
|
|
+ </if>
|
|
|
+ <if test="communitys != null and communitys != '' ">
|
|
|
+ AND FIND_IN_SET( c.id, #{communitys} )
|
|
|
+ </if>
|
|
|
+ <if test="buildings != null and buildings != '' ">
|
|
|
+ AND FIND_IN_SET( d.building_id, #{buildings} )
|
|
|
+ </if>
|
|
|
+ <if test="channels != null and channels != '' ">
|
|
|
+ AND FIND_IN_SET( d.sys_id, #{channels} )
|
|
|
+ </if>
|
|
|
+ <if test="deviceTypes != null and deviceTypes != '' ">
|
|
|
+ AND FIND_IN_SET( d.device_type, #{deviceTypes} )
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ AND d.status = #{status}
|
|
|
+ </if>
|
|
|
+ and d.date_update > #{beginDate ,jdbcType=TIMESTAMP }
|
|
|
+ and d.date_update <![CDATA[ <= ]]> #{endDate ,jdbcType=TIMESTAMP }
|
|
|
</select>
|
|
|
<select id="findFaultByCommunity" resultType="com.bz.smart_city.dto.assistant.PlanCommunityDTO">
|
|
|
SELECT
|