|
@@ -0,0 +1,45 @@
|
|
|
+<?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.welampiot.dao.ElectricBoxDao">
|
|
|
+
|
|
|
+ <resultMap id="electricBoxAndSectionAndAirSwitchInfoResultMap" type="com.welampiot.dto.ElectricBoxDTO">
|
|
|
+ <id property="id" column="id" jdbcType="INTEGER"/>
|
|
|
+ <result property="name" column="name" jdbcType="VARCHAR"/>
|
|
|
+ <result property="sectionId" column="sectionid" jdbcType="INTEGER"/>
|
|
|
+ <result property="areaId" column="areaid" jdbcType="INTEGER"/>
|
|
|
+ <result property="address" column="address" jdbcType="VARCHAR"/>
|
|
|
+ <result property="longitude" column="longitude" jdbcType="FLOAT"/>
|
|
|
+ <result property="latitude" column="latitude" jdbcType="FLOAT"/>
|
|
|
+ <result property="image" column="image" jdbcType="VARCHAR"/>
|
|
|
+ <result property="createTime" column="createTime" jdbcType="DATE"/>
|
|
|
+ <result property="updateTime" column="updateTime" jdbcType="DATE"/>
|
|
|
+ <result property="installDate" column="install_date" jdbcType="DATE"/>
|
|
|
+ <result property="expirationDate" column="expiration_date" jdbcType="DATE"/>
|
|
|
+ <collection property="airSwitchInfoDTOS" ofType="com.welampiot.dto.AirSwitchInfoDTO">
|
|
|
+ <id property="id" column="id" jdbcType="INTEGER"/>
|
|
|
+ <result property="online" column="online" jdbcType="INTEGER"/>
|
|
|
+ <result property="boxId" column="box_id" jdbcType="INTEGER"/>
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="getElectricBoxListBySectionId" resultMap="electricBoxAndSectionAndAirSwitchInfoResultMap" parameterType="com.welampiot.vo.ElectricBoxRequestVO">
|
|
|
+ select e.id,e.areaid areaId,e.sectionid sectionId,e.name,e.address,count(a.id) as airCount,a.online,
|
|
|
+ e.longitude,e.latitude,e.image,e.install_date installDate,e.expiration_date expirationDate,
|
|
|
+ (select count(*) from air_switch_info c where c.box_id = e.id and c.online = 1) as onlineCount
|
|
|
+ from electric_box e left join air_switch_info a on a.box_id = e.id
|
|
|
+ where <if test="keyword != null and keyword != ''">
|
|
|
+ e.name like '%${keyword}%' or e.address like '%${keyword}%'
|
|
|
+ </if>
|
|
|
+ and <if test="sectionList != null and !sectionList.isEmpty()">
|
|
|
+ e.sectionid in
|
|
|
+ <foreach item="vo" collection="sectionList" open="(" separator="," close=")">
|
|
|
+ #{vo.sectionId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ order by convert(e.name using gbk) asc,e.id desc
|
|
|
+ <if test="page != 0">
|
|
|
+ limit #{page},#{count}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|