|
@@ -142,147 +142,146 @@
|
|
|
hn.room_number
|
|
hn.room_number
|
|
|
</select>
|
|
</select>
|
|
|
<select id="getNumberState" resultType="java.lang.Integer">
|
|
<select id="getNumberState" resultType="java.lang.Integer">
|
|
|
- SELECT
|
|
|
|
|
- hn.id
|
|
|
|
|
- FROM
|
|
|
|
|
- `house_number` hn
|
|
|
|
|
- LEFT JOIN house_number_state hns on hns.house_number_id=hn.id AND hns.deleted=0
|
|
|
|
|
- WHERE hns.end_time> #{date}
|
|
|
|
|
- AND hn.deleted=0
|
|
|
|
|
|
|
+ SELECT hn.id
|
|
|
|
|
+ FROM `house_number` hn
|
|
|
|
|
+ LEFT JOIN house_number_state hns on hns.house_number_id = hn.id AND hns.deleted = 0
|
|
|
|
|
+ WHERE hns.end_time > #{date}
|
|
|
|
|
+ AND hn.deleted = 0
|
|
|
GROUP BY hn.id
|
|
GROUP BY hn.id
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="freeDropDownShow" resultType="com.template.model.vo.FreeVo">
|
|
<select id="freeDropDownShow" resultType="com.template.model.vo.FreeVo">
|
|
|
- SELECT
|
|
|
|
|
- hn.id ,
|
|
|
|
|
- hn.house_id as houseId,
|
|
|
|
|
- hn.room_number as roomNumber,
|
|
|
|
|
- hn.house_status as houseStatus,
|
|
|
|
|
- h.room_type as roomType
|
|
|
|
|
- FROM
|
|
|
|
|
- `house_number` hn
|
|
|
|
|
- LEFT JOIN house h ON h.id = hn.house_id
|
|
|
|
|
- AND h.deleted = 0
|
|
|
|
|
- WHERE hn.deleted=0
|
|
|
|
|
- AND FIND_IN_SET(hn.id,#{houseNumberIds})
|
|
|
|
|
- AND hn.house_status=1
|
|
|
|
|
|
|
+ SELECT hn.id,
|
|
|
|
|
+ hn.house_id as houseId,
|
|
|
|
|
+ hn.room_number as roomNumber,
|
|
|
|
|
+ hn.house_status as houseStatus,
|
|
|
|
|
+ h.room_type as roomType
|
|
|
|
|
+ FROM `house_number` hn
|
|
|
|
|
+ LEFT JOIN house h ON h.id = hn.house_id
|
|
|
|
|
+ AND h.deleted = 0
|
|
|
|
|
+ WHERE hn.deleted = 0
|
|
|
|
|
+ AND FIND_IN_SET(hn.id, #{houseNumberIds})
|
|
|
|
|
+ AND hn.house_status = 1
|
|
|
</select>
|
|
</select>
|
|
|
<select id="dirtyDropDownShow" resultType="com.template.model.vo.FreeVo">
|
|
<select id="dirtyDropDownShow" resultType="com.template.model.vo.FreeVo">
|
|
|
- SELECT
|
|
|
|
|
- hn.id ,
|
|
|
|
|
- hn.house_id as houseId,
|
|
|
|
|
- hn.room_number as roomNumber,
|
|
|
|
|
- hn.house_status as houseStatus,
|
|
|
|
|
- h.room_type as roomType
|
|
|
|
|
- FROM
|
|
|
|
|
- `house_number` hn
|
|
|
|
|
- LEFT JOIN house h ON h.id = hn.house_id
|
|
|
|
|
- AND h.deleted = 0
|
|
|
|
|
- WHERE hn.deleted=0
|
|
|
|
|
- AND hn.house_status=2
|
|
|
|
|
|
|
+ SELECT hn.id,
|
|
|
|
|
+ hn.house_id as houseId,
|
|
|
|
|
+ hn.room_number as roomNumber,
|
|
|
|
|
+ hn.house_status as houseStatus,
|
|
|
|
|
+ h.room_type as roomType
|
|
|
|
|
+ FROM `house_number` hn
|
|
|
|
|
+ LEFT JOIN house h ON h.id = hn.house_id
|
|
|
|
|
+ AND h.deleted = 0
|
|
|
|
|
+ WHERE hn.deleted = 0
|
|
|
|
|
+ AND hn.house_status = 2
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="lockDropDownShow" resultType="com.template.model.vo.FreeVo">
|
|
<select id="lockDropDownShow" resultType="com.template.model.vo.FreeVo">
|
|
|
- SELECT
|
|
|
|
|
- hn.id ,
|
|
|
|
|
- hn.house_id as houseId,
|
|
|
|
|
- hn.room_number as roomNumber,
|
|
|
|
|
- hn.house_status as houseStatus,
|
|
|
|
|
- h.room_type as roomType
|
|
|
|
|
- FROM
|
|
|
|
|
- `house_number` hn
|
|
|
|
|
- LEFT JOIN house_number_state hns ON hns.house_number_id = hn.id
|
|
|
|
|
- AND hns.deleted = 0
|
|
|
|
|
- LEFT JOIN house h ON h.id = hn.house_id
|
|
|
|
|
- AND h.deleted = 0
|
|
|
|
|
- WHERE
|
|
|
|
|
- #{date} >= hns.start_time
|
|
|
|
|
|
|
+ SELECT hn.id,
|
|
|
|
|
+ hn.house_id as houseId,
|
|
|
|
|
+ hn.room_number as roomNumber,
|
|
|
|
|
+ hn.house_status as houseStatus,
|
|
|
|
|
+ h.room_type as roomType
|
|
|
|
|
+ FROM `house_number` hn
|
|
|
|
|
+ LEFT JOIN house_number_state hns ON hns.house_number_id = hn.id
|
|
|
|
|
+ AND hns.deleted = 0
|
|
|
|
|
+ LEFT JOIN house h ON h.id = hn.house_id
|
|
|
|
|
+ AND h.deleted = 0
|
|
|
|
|
+ WHERE #{date} >= hns.start_time
|
|
|
AND hns.end_time > #{date}
|
|
AND hns.end_time > #{date}
|
|
|
- AND hns.status=5
|
|
|
|
|
|
|
+ AND hns.status = 5
|
|
|
AND hn.deleted = 0
|
|
AND hn.deleted = 0
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="shutDropDownShow" resultType="com.template.model.vo.FreeVo">
|
|
<select id="shutDropDownShow" resultType="com.template.model.vo.FreeVo">
|
|
|
- SELECT
|
|
|
|
|
- hn.id ,
|
|
|
|
|
- hn.house_id as houseId,
|
|
|
|
|
- hn.room_number as roomNumber,
|
|
|
|
|
- hn.house_status as houseStatus,
|
|
|
|
|
- h.room_type as roomType
|
|
|
|
|
- FROM
|
|
|
|
|
- `house_number` hn
|
|
|
|
|
- LEFT JOIN house h ON h.id = hn.house_id
|
|
|
|
|
- AND h.deleted = 0
|
|
|
|
|
- WHERE hn.deleted=0
|
|
|
|
|
- AND FIND_IN_SET(hn.id,#{houseNumberIds})
|
|
|
|
|
- AND hn.house_status=1
|
|
|
|
|
- AND hn.electric_type=1
|
|
|
|
|
|
|
+ SELECT hn.id,
|
|
|
|
|
+ hn.house_id as houseId,
|
|
|
|
|
+ hn.room_number as roomNumber,
|
|
|
|
|
+ hn.house_status as houseStatus,
|
|
|
|
|
+ h.room_type as roomType
|
|
|
|
|
+ FROM `house_number` hn
|
|
|
|
|
+ LEFT JOIN house h ON h.id = hn.house_id
|
|
|
|
|
+ AND h.deleted = 0
|
|
|
|
|
+ WHERE hn.deleted = 0
|
|
|
|
|
+ AND FIND_IN_SET(hn.id, #{houseNumberIds})
|
|
|
|
|
+ AND hn.house_status = 1
|
|
|
|
|
+ AND hn.electric_type = 1
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
<select id="openDropDownShow" resultType="com.template.model.vo.FreeVo">
|
|
<select id="openDropDownShow" resultType="com.template.model.vo.FreeVo">
|
|
|
- SELECT
|
|
|
|
|
- hn.id ,
|
|
|
|
|
- hn.house_id as houseId,
|
|
|
|
|
- hn.room_number as roomNumber,
|
|
|
|
|
- hn.house_status as houseStatus,
|
|
|
|
|
- h.room_type as roomType
|
|
|
|
|
- FROM
|
|
|
|
|
- `house_number` hn
|
|
|
|
|
- LEFT JOIN house h ON h.id = hn.house_id
|
|
|
|
|
- AND h.deleted = 0
|
|
|
|
|
- WHERE hn.deleted=0
|
|
|
|
|
- AND FIND_IN_SET(hn.id,#{houseNumberIds})
|
|
|
|
|
- AND hn.house_status=1
|
|
|
|
|
- AND hn.electric_type=2
|
|
|
|
|
|
|
+ SELECT hn.id,
|
|
|
|
|
+ hn.house_id as houseId,
|
|
|
|
|
+ hn.room_number as roomNumber,
|
|
|
|
|
+ hn.house_status as houseStatus,
|
|
|
|
|
+ h.room_type as roomType
|
|
|
|
|
+ FROM `house_number` hn
|
|
|
|
|
+ LEFT JOIN house h ON h.id = hn.house_id
|
|
|
|
|
+ AND h.deleted = 0
|
|
|
|
|
+ WHERE hn.deleted = 0
|
|
|
|
|
+ AND FIND_IN_SET(hn.id, #{houseNumberIds})
|
|
|
|
|
+ AND hn.house_status = 1
|
|
|
|
|
+ AND hn.electric_type = 2
|
|
|
</select>
|
|
</select>
|
|
|
<select id="roomChangePage" resultType="com.template.model.vo.HouseNumberVo">
|
|
<select id="roomChangePage" resultType="com.template.model.vo.HouseNumberVo">
|
|
|
- SELECT
|
|
|
|
|
- hn.id,
|
|
|
|
|
- hn.house_id as houseId,
|
|
|
|
|
- hn.room_number as roomNumber,
|
|
|
|
|
- hn.house_status as houseStatus,
|
|
|
|
|
- hn.electric_type as electricType,
|
|
|
|
|
- hn.electric_equipment_id as electricEquipmentId,
|
|
|
|
|
- hn.electric_equipment_meter_name as electricEquipmentMeterName,
|
|
|
|
|
- hn.water_equipment_id as waterEquipmentId,
|
|
|
|
|
- hn.water_equipment_meter_name as waterEquipmentMeterName,
|
|
|
|
|
- h.room_name as roomName,
|
|
|
|
|
- h.room_type as roomType,
|
|
|
|
|
- h.room_price as roomPrice
|
|
|
|
|
- FROM
|
|
|
|
|
- `house_number` hn
|
|
|
|
|
- LEFT JOIN house h on h.id=hn.house_id and hn.deleted=0
|
|
|
|
|
- WHERE hn.house_id=#{houseId} AND hn.deleted=0 and hn.house_status=1
|
|
|
|
|
|
|
+ SELECT hn.id,
|
|
|
|
|
+ hn.house_id as houseId,
|
|
|
|
|
+ hn.room_number as roomNumber,
|
|
|
|
|
+ hn.house_status as houseStatus,
|
|
|
|
|
+ hn.electric_type as electricType,
|
|
|
|
|
+ hn.electric_equipment_id as electricEquipmentId,
|
|
|
|
|
+ hn.electric_equipment_meter_name as electricEquipmentMeterName,
|
|
|
|
|
+ hn.water_equipment_id as waterEquipmentId,
|
|
|
|
|
+ hn.water_equipment_meter_name as waterEquipmentMeterName,
|
|
|
|
|
+ h.room_name as roomName,
|
|
|
|
|
+ h.room_type as roomType,
|
|
|
|
|
+ h.room_price as roomPrice
|
|
|
|
|
+ FROM `house_number` hn
|
|
|
|
|
+ LEFT JOIN house h on h.id = hn.house_id and hn.deleted = 0
|
|
|
|
|
+ WHERE hn.house_id = #{houseId}
|
|
|
|
|
+ AND hn.deleted = 0
|
|
|
|
|
+ and hn.house_status = 1
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="pageList" resultType="com.template.model.vo.HouseNumberPageVo">
|
|
<select id="pageList" resultType="com.template.model.vo.HouseNumberPageVo">
|
|
|
SELECT
|
|
SELECT
|
|
|
- hn.id,
|
|
|
|
|
- hn.house_id as houseId,
|
|
|
|
|
- hn.room_number as roomNumber,
|
|
|
|
|
- hn.house_status as houseStatus,
|
|
|
|
|
- hn.electric_type as electricType,
|
|
|
|
|
- hn.electric_equipment_id as electricEquipmentId,
|
|
|
|
|
- hn.electric_equipment_meter_name as electricEquipmentMeterName,
|
|
|
|
|
- hn.water_equipment_id as waterEquipmentId,
|
|
|
|
|
- hn.water_equipment_meter_name as waterEquipmentMeterName,
|
|
|
|
|
- hn.create_time as createTime,
|
|
|
|
|
- h.room_name as houseName,
|
|
|
|
|
- h.room_type as roomType
|
|
|
|
|
|
|
+ hn.id,
|
|
|
|
|
+ hn.house_id as houseId,
|
|
|
|
|
+ hn.room_number as roomNumber,
|
|
|
|
|
+ hn.house_status as houseStatus,
|
|
|
|
|
+ hn.electric_type as electricType,
|
|
|
|
|
+ hn.electric_equipment_id as electricEquipmentId,
|
|
|
|
|
+ hn.electric_equipment_meter_name as electricEquipmentMeterName,
|
|
|
|
|
+ hn.water_equipment_id as waterEquipmentId,
|
|
|
|
|
+ hn.water_equipment_meter_name as waterEquipmentMeterName,
|
|
|
|
|
+ hn.create_time as createTime,
|
|
|
|
|
+ h.room_name as houseName,
|
|
|
|
|
+ h.room_type as roomType
|
|
|
FROM
|
|
FROM
|
|
|
- `house_number` hn
|
|
|
|
|
- LEFT JOIN house h on h.id=hn.house_id AND h.deleted=0
|
|
|
|
|
|
|
+ `house_number` hn
|
|
|
|
|
+ LEFT JOIN house h on h.id=hn.house_id AND h.deleted=0
|
|
|
|
|
+ LEFT JOIN building b ON b.id = hn.building_id
|
|
|
|
|
+ AND b.deleted = 0
|
|
|
WHERE
|
|
WHERE
|
|
|
- hn.deleted=0
|
|
|
|
|
|
|
+ hn.deleted=0
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- AND (hn.room_number LIKE '%' #{keyWord} '%' OR hn.electric_equipment_meter_name LIKE '%' #{keyWord} '%' OR hn.water_equipment_meter_name LIKE '%' #{keyWord} '%')
|
|
|
|
|
|
|
+ AND (hn.room_number LIKE '%' #{keyWord} '%' OR hn.electric_equipment_meter_name LIKE '%' #{keyWord} '%' OR
|
|
|
|
|
+ hn.water_equipment_meter_name LIKE '%' #{keyWord} '%')
|
|
|
</if>
|
|
</if>
|
|
|
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
|
|
|
AND #{endTime} >= hn.create_time
|
|
AND #{endTime} >= hn.create_time
|
|
|
AND hn.create_time >= #{startTime}
|
|
AND hn.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="houseId != null and houseId != ''">
|
|
|
|
|
+ AND h.id = #{houseId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="buildingId != null and buildingId != ''">
|
|
|
|
|
+ AND hn.building_id=#{buildingId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
ORDER BY h.id
|
|
ORDER BY h.id
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -303,44 +302,56 @@
|
|
|
FROM
|
|
FROM
|
|
|
`house_number` hn
|
|
`house_number` hn
|
|
|
LEFT JOIN house h on h.id=hn.house_id AND h.deleted=0
|
|
LEFT JOIN house h on h.id=hn.house_id AND h.deleted=0
|
|
|
|
|
+ LEFT JOIN building b ON b.id = hn.building_id
|
|
|
|
|
+ AND b.deleted = 0
|
|
|
WHERE
|
|
WHERE
|
|
|
hn.deleted=0
|
|
hn.deleted=0
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- AND (hn.room_number LIKE '%' #{keyWord} '%' OR hn.electric_equipment_meter_name LIKE '%' #{keyWord} '%' OR hn.water_equipment_meter_name LIKE '%' #{keyWord} '%')
|
|
|
|
|
|
|
+ AND (hn.room_number LIKE '%' #{keyWord} '%' OR hn.electric_equipment_meter_name LIKE '%' #{keyWord} '%' OR
|
|
|
|
|
+ hn.water_equipment_meter_name LIKE '%' #{keyWord} '%')
|
|
|
</if>
|
|
</if>
|
|
|
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
|
|
|
AND #{endTime} >= hn.create_time
|
|
AND #{endTime} >= hn.create_time
|
|
|
AND hn.create_time >= #{startTime}
|
|
AND hn.create_time >= #{startTime}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="houseId != null and houseId != ''">
|
|
|
|
|
+ AND h.id = #{houseId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ <if test="buildingId != null and buildingId != ''">
|
|
|
|
|
+ AND hn.building_id=#{buildingId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
ORDER BY h.id
|
|
ORDER BY h.id
|
|
|
</select>
|
|
</select>
|
|
|
<select id="getpage" resultType="com.template.model.vo.HouseNumberListVo">
|
|
<select id="getpage" resultType="com.template.model.vo.HouseNumberListVo">
|
|
|
SELECT
|
|
SELECT
|
|
|
- b.building as building,
|
|
|
|
|
- b.element,
|
|
|
|
|
- hl.equipment_type as doorLock,
|
|
|
|
|
- h.room_name as roomName,
|
|
|
|
|
- h.room_type as roomType,
|
|
|
|
|
- hn.id,
|
|
|
|
|
- hn.room_number AS roomNumber,
|
|
|
|
|
- hn.house_status AS houseStatus,
|
|
|
|
|
- hn.electric_type AS electricType,
|
|
|
|
|
- hn.electric_equipment_id AS electricEquipmentId,
|
|
|
|
|
- hn.electric_equipment_meter_name AS electricEquipmentMeterName,
|
|
|
|
|
- hn.water_equipment_id AS waterEquipmentId,
|
|
|
|
|
- hn.water_equipment_meter_name AS waterEquipmentMeterName,
|
|
|
|
|
- b.id as buildingId,
|
|
|
|
|
- h.id as houseId
|
|
|
|
|
|
|
+ b.building as building,
|
|
|
|
|
+ b.element,
|
|
|
|
|
+ hl.equipment_type as doorLock,
|
|
|
|
|
+ h.room_name as roomName,
|
|
|
|
|
+ h.room_type as roomType,
|
|
|
|
|
+ hn.id,
|
|
|
|
|
+ hn.room_number AS roomNumber,
|
|
|
|
|
+ hn.house_status AS houseStatus,
|
|
|
|
|
+ hn.electric_type AS electricType,
|
|
|
|
|
+ hn.electric_equipment_id AS electricEquipmentId,
|
|
|
|
|
+ hn.electric_equipment_meter_name AS electricEquipmentMeterName,
|
|
|
|
|
+ hn.water_equipment_id AS waterEquipmentId,
|
|
|
|
|
+ hn.water_equipment_meter_name AS waterEquipmentMeterName,
|
|
|
|
|
+ b.id as buildingId,
|
|
|
|
|
+ h.id as houseId
|
|
|
FROM
|
|
FROM
|
|
|
- `house_number` hn
|
|
|
|
|
- LEFT JOIN building b ON b.id = hn.building_id
|
|
|
|
|
- LEFT JOIN house_lock hl ON hl.house_number_id = hn.id
|
|
|
|
|
- LEFT JOIN house h ON h.id = hn.house_id
|
|
|
|
|
|
|
+ `house_number` hn
|
|
|
|
|
+ LEFT JOIN building b ON b.id = hn.building_id
|
|
|
|
|
+ LEFT JOIN house_lock hl ON hl.house_number_id = hn.id
|
|
|
|
|
+ LEFT JOIN house h ON h.id = hn.house_id
|
|
|
WHERE
|
|
WHERE
|
|
|
- hn.deleted=0
|
|
|
|
|
|
|
+ hn.deleted=0
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- AND hn.room_number LIKE '%' #{keyWord} '%'
|
|
|
|
|
|
|
+ AND hn.room_number LIKE '%' #{keyWord} '%'
|
|
|
</if>
|
|
</if>
|
|
|
<if test="buildingId != null and buildingId != ''">
|
|
<if test="buildingId != null and buildingId != ''">
|
|
|
AND b.id= #{buildingId}
|
|
AND b.id= #{buildingId}
|