|
@@ -6,6 +6,7 @@
|
|
<!--@mbg.generated-->
|
|
<!--@mbg.generated-->
|
|
<!--@Table sc_water_meter_replace_log-->
|
|
<!--@Table sc_water_meter_replace_log-->
|
|
<id column="id" property="id" />
|
|
<id column="id" property="id" />
|
|
|
|
+ <result column="site_id" property="siteId" />
|
|
<result column="main_log_id" property="mainLogId" />
|
|
<result column="main_log_id" property="mainLogId" />
|
|
<result column="device_id" property="deviceId" />
|
|
<result column="device_id" property="deviceId" />
|
|
<result column="replace_method" property="replaceMethod" />
|
|
<result column="replace_method" property="replaceMethod" />
|
|
@@ -32,7 +33,7 @@
|
|
</resultMap>
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
<sql id="Base_Column_List">
|
|
<!--@mbg.generated-->
|
|
<!--@mbg.generated-->
|
|
- id, main_log_id, device_id, replace_method, new_device_type_id, old_device_type_id,
|
|
|
|
|
|
+ id, site_id, main_log_id, device_id, replace_method, new_device_type_id, old_device_type_id,
|
|
new_water_no, old_water_no, new_begin_wsv, old_end_wsv, new_device_no, old_device_no,
|
|
new_water_no, old_water_no, new_begin_wsv, old_end_wsv, new_device_no, old_device_no,
|
|
new_sim_no, old_sim_no, new_device_flag_no, old_device_flag_no, remark, `status`,
|
|
new_sim_no, old_sim_no, new_device_flag_no, old_device_flag_no, remark, `status`,
|
|
replace_username, replace_user_phone, date_create, date_update, create_by, update_by
|
|
replace_username, replace_user_phone, date_create, date_update, create_by, update_by
|
|
@@ -41,6 +42,9 @@
|
|
<!--@mbg.generated-->
|
|
<!--@mbg.generated-->
|
|
insert into sc_water_meter_replace_log
|
|
insert into sc_water_meter_replace_log
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="siteId != null">
|
|
|
|
+ site_id,
|
|
|
|
+ </if>
|
|
<if test="mainLogId != null">
|
|
<if test="mainLogId != null">
|
|
main_log_id,
|
|
main_log_id,
|
|
</if>
|
|
</if>
|
|
@@ -112,6 +116,9 @@
|
|
</if>
|
|
</if>
|
|
</trim>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
+ <if test="siteId != null">
|
|
|
|
+ #{siteId},
|
|
|
|
+ </if>
|
|
<if test="mainLogId != null">
|
|
<if test="mainLogId != null">
|
|
#{mainLogId},
|
|
#{mainLogId},
|
|
</if>
|
|
</if>
|
|
@@ -187,6 +194,9 @@
|
|
<!--@mbg.generated-->
|
|
<!--@mbg.generated-->
|
|
update sc_water_meter_replace_log
|
|
update sc_water_meter_replace_log
|
|
<set>
|
|
<set>
|
|
|
|
+ <if test="siteId != null">
|
|
|
|
+ site_id = #{siteId},
|
|
|
|
+ </if>
|
|
<if test="mainLogId != null">
|
|
<if test="mainLogId != null">
|
|
main_log_id = #{mainLogId},
|
|
main_log_id = #{mainLogId},
|
|
</if>
|
|
</if>
|
|
@@ -262,14 +272,14 @@
|
|
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
|
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
|
<!--@mbg.generated-->
|
|
<!--@mbg.generated-->
|
|
insert into sc_water_meter_replace_log
|
|
insert into sc_water_meter_replace_log
|
|
- (main_log_id, device_id, replace_method, new_device_type_id, old_device_type_id,
|
|
|
|
|
|
+ (site_id, main_log_id, device_id, replace_method, new_device_type_id, old_device_type_id,
|
|
new_water_no, old_water_no, new_begin_wsv, old_end_wsv, new_device_no, old_device_no,
|
|
new_water_no, old_water_no, new_begin_wsv, old_end_wsv, new_device_no, old_device_no,
|
|
new_sim_no, old_sim_no, new_device_flag_no, old_device_flag_no, remark, `status`,
|
|
new_sim_no, old_sim_no, new_device_flag_no, old_device_flag_no, remark, `status`,
|
|
replace_username, replace_user_phone, date_create, date_update, create_by, update_by
|
|
replace_username, replace_user_phone, date_create, date_update, create_by, update_by
|
|
)
|
|
)
|
|
values
|
|
values
|
|
<foreach collection="list" item="item" separator=",">
|
|
<foreach collection="list" item="item" separator=",">
|
|
- (#{item.mainLogId}, #{item.deviceId}, #{item.replaceMethod}, #{item.newDeviceTypeId},
|
|
|
|
|
|
+ (#{item.siteId}, #{item.mainLogId}, #{item.deviceId}, #{item.replaceMethod}, #{item.newDeviceTypeId},
|
|
#{item.oldDeviceTypeId}, #{item.newWaterNo}, #{item.oldWaterNo}, #{item.newBeginWsv},
|
|
#{item.oldDeviceTypeId}, #{item.newWaterNo}, #{item.oldWaterNo}, #{item.newBeginWsv},
|
|
#{item.oldEndWsv}, #{item.newDeviceNo}, #{item.oldDeviceNo}, #{item.newSimNo},
|
|
#{item.oldEndWsv}, #{item.newDeviceNo}, #{item.oldDeviceNo}, #{item.newSimNo},
|
|
#{item.oldSimNo}, #{item.newDeviceFlagNo}, #{item.oldDeviceFlagNo}, #{item.remark},
|
|
#{item.oldSimNo}, #{item.newDeviceFlagNo}, #{item.oldDeviceFlagNo}, #{item.remark},
|
|
@@ -307,6 +317,7 @@
|
|
left join sc_device_manufacturer sdm2 on(sdm2.id = sdt2.manufacturer_id)
|
|
left join sc_device_manufacturer sdm2 on(sdm2.id = sdt2.manufacturer_id)
|
|
<if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = d.id and sdd.status = 1)</if>
|
|
<if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = d.id and sdd.status = 1)</if>
|
|
where rl.status = 1 and d.status = 1
|
|
where rl.status = 1 and d.status = 1
|
|
|
|
+ <if test="siteId != null"> and d.site_id = #{siteId}</if>
|
|
<if test="deviceId != null"> and rl.device_id = #{deviceId}</if>
|
|
<if test="deviceId != null"> and rl.device_id = #{deviceId}</if>
|
|
<if test="deviceNo != null and deviceNo != ''"> and (
|
|
<if test="deviceNo != null and deviceNo != ''"> and (
|
|
rl.new_device_no LIKE concat('%',#{deviceNo},'%') or rl.old_device_no LIKE concat('%',#{deviceNo},'%') or
|
|
rl.new_device_no LIKE concat('%',#{deviceNo},'%') or rl.old_device_no LIKE concat('%',#{deviceNo},'%') or
|
|
@@ -318,6 +329,11 @@
|
|
<if test="replaceUsername != null and replaceUsername != ''"> and rl.replace_username LIKE concat('%',#{replaceUsername},'%')</if>
|
|
<if test="replaceUsername != null and replaceUsername != ''"> and rl.replace_username LIKE concat('%',#{replaceUsername},'%')</if>
|
|
<if test="isAccepted != null and isAccepted == 1"> and sil.is_accepted = #{isAccepted}</if>
|
|
<if test="isAccepted != null and isAccepted == 1"> and sil.is_accepted = #{isAccepted}</if>
|
|
<if test="isAccepted != null and isAccepted == 0"> and (sil.is_accepted = #{isAccepted} or sil.is_accepted is null)</if>
|
|
<if test="isAccepted != null and isAccepted == 0"> and (sil.is_accepted = #{isAccepted} or sil.is_accepted is null)</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 d.building_id = #{buildingId}</if>
|
|
<if test="startDate != null"> and rl.date_create <![CDATA[ >= ]]> #{startDate}</if>
|
|
<if test="startDate != null"> and rl.date_create <![CDATA[ >= ]]> #{startDate}</if>
|
|
<if test="endDate != null"> and rl.date_create <![CDATA[ <= ]]> #{endDate}</if>
|
|
<if test="endDate != null"> and rl.date_create <![CDATA[ <= ]]> #{endDate}</if>
|
|
<if test="programItems != null and programItems.size() != 0"> and
|
|
<if test="programItems != null and programItems.size() != 0"> and
|
|
@@ -333,8 +349,11 @@
|
|
count(1)
|
|
count(1)
|
|
from sc_water_meter_replace_log rl
|
|
from sc_water_meter_replace_log rl
|
|
left join sc_device d on(d.id = rl.device_id)
|
|
left join sc_device d on(d.id = rl.device_id)
|
|
|
|
+ left join sc_building sb on(sb.id = d.building_id)
|
|
|
|
+ <if test="isAccepted != null">left join sc_install_list sil on(sil.device_id = rl.device_id)</if>
|
|
<if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = d.id and sdd.status = 1)</if>
|
|
<if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = d.id and sdd.status = 1)</if>
|
|
where rl.status = 1 and d.status = 1
|
|
where rl.status = 1 and d.status = 1
|
|
|
|
+ <if test="siteId != null"> and d.site_id = #{siteId}</if>
|
|
<if test="deviceId != null"> and rl.device_id = #{deviceId}</if>
|
|
<if test="deviceId != null"> and rl.device_id = #{deviceId}</if>
|
|
<if test="deviceNo != null and deviceNo != ''"> and (
|
|
<if test="deviceNo != null and deviceNo != ''"> and (
|
|
rl.new_device_no LIKE concat('%',#{deviceNo},'%') or rl.old_device_no LIKE concat('%',#{deviceNo},'%') or
|
|
rl.new_device_no LIKE concat('%',#{deviceNo},'%') or rl.old_device_no LIKE concat('%',#{deviceNo},'%') or
|
|
@@ -346,6 +365,11 @@
|
|
<if test="replaceUsername != null and replaceUsername != ''"> and rl.replace_username LIKE concat('%',#{replaceUsername},'%')</if>
|
|
<if test="replaceUsername != null and replaceUsername != ''"> and rl.replace_username LIKE concat('%',#{replaceUsername},'%')</if>
|
|
<if test="isAccepted != null and isAccepted == 1"> and sil.is_accepted = #{isAccepted}</if>
|
|
<if test="isAccepted != null and isAccepted == 1"> and sil.is_accepted = #{isAccepted}</if>
|
|
<if test="isAccepted != null and isAccepted == 0"> and (sil.is_accepted = #{isAccepted} or sil.is_accepted is null)</if>
|
|
<if test="isAccepted != null and isAccepted == 0"> and (sil.is_accepted = #{isAccepted} or sil.is_accepted is null)</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 d.building_id = #{buildingId}</if>
|
|
<if test="startDate != null"> and rl.date_create <![CDATA[ >= ]]> #{startDate}</if>
|
|
<if test="startDate != null"> and rl.date_create <![CDATA[ >= ]]> #{startDate}</if>
|
|
<if test="endDate != null"> and rl.date_create <![CDATA[ <= ]]> #{endDate}</if>
|
|
<if test="endDate != null"> and rl.date_create <![CDATA[ <= ]]> #{endDate}</if>
|
|
<if test="programItems != null and programItems.size() != 0"> and
|
|
<if test="programItems != null and programItems.size() != 0"> and
|
|
@@ -354,4 +378,47 @@
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</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_water_meter_replace_log rl
|
|
|
|
+ left join sc_device sd on(sd.id = rl.device_id)
|
|
|
|
+ <if test="isAccepted != null">left join sc_install_list sil on(sil.device_id = rl.device_id)</if>
|
|
|
|
+ <if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = d.id and sdd.status = 1)</if>
|
|
|
|
+ where rl.status = 1 and sd.status = 1
|
|
|
|
+ <if test="siteId != null"> and sd.site_id = #{siteId}</if>
|
|
|
|
+ <if test="deviceId != null"> and rl.device_id = #{deviceId}</if>
|
|
|
|
+ <if test="deviceNo != null and deviceNo != ''"> and (
|
|
|
|
+ rl.new_device_no LIKE concat('%',#{deviceNo},'%') or rl.old_device_no LIKE concat('%',#{deviceNo},'%') or
|
|
|
|
+ rl.new_water_no LIKE concat('%',#{deviceNo},'%') or rl.old_water_no LIKE concat('%',#{deviceNo},'%') or
|
|
|
|
+ sd.water_meter_file_no LIKE concat('%',#{deviceNo},'%')
|
|
|
|
+ )</if>
|
|
|
|
+ <if test="replaceMethod != null"> and rl.replace_method = #{replaceMethod}</if>
|
|
|
|
+ <if test="customerId != null"> and sd.customer_id = #{customerId}</if>
|
|
|
|
+ <if test="replaceUsername != null and replaceUsername != ''"> and rl.replace_username LIKE concat('%',#{replaceUsername},'%')</if>
|
|
|
|
+ <if test="isAccepted != null and isAccepted == 1"> and sil.is_accepted = #{isAccepted}</if>
|
|
|
|
+ <if test="isAccepted != null and isAccepted == 0"> and (sil.is_accepted = #{isAccepted} or sil.is_accepted is null)</if>
|
|
|
|
+ <if test="startDate != null"> and rl.date_create <![CDATA[ >= ]]> #{startDate}</if>
|
|
|
|
+ <if test="endDate != null"> and rl.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>
|
|
</mapper>
|