| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <?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.SolarDevDao">
-
- <select id="getSolarListByDTO" resultType="SolarDevDTO">
- select
- <choose>
- <when test="version == 0">
- gl.chinese_name as area,
- </when>
- <when test="version == 1">
- gl.english_name as area,
- </when>
- <otherwise>
- gl.ru_name as area,
- </otherwise>
- </choose>
- s.id,s.lamp_pole_id lampPoleId,s.number,s.netStatus,s.lighteness as lightness,s.lampvoltage as lampVoltage,
- s.lampcurrent as lampCurrent,s.lamppower as lampPower,s.solar_voltage solarVoltage,s.solar_current solarCurrent,
- s.solar_power solarPower,s.battery_voltage batteryVoltage,s.battery_current batteryCurrent,s.battery_power batteryPower,
- s.totalLightTime,s.address,s.logtime as logTime,s1.name as section,s1.timezone,lp.name as lampPoleName
- from solar_dev s
- left join section s1 on s.sectionid = s1.id
- left join global_location gl on s1.pid = gl.id
- left join lamp_pole lp on lp.id = s.lamp_pole_id
- where 1=1
- <if test="keyword != null and keyword != ''">
- and s.number like '%${keyword}%'
- </if>
- <if test="sectionList != null and !sectionList.isEmpty()">
- and s.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <choose>
- <when test="online == 0">
- and s.netStatus = 0
- </when>
- <when test="online == 1">
- and s.netStatus = 1
- </when>
- </choose>
- order by s.id desc
- <if test="page >= 0 and count > 0">
- limit #{page},#{count}
- </if>
- </select>
- <select id="getSolarDevTotalByDTO" resultType="Integer">
- select count(s.id)
- from solar_dev s
- <if test="sectionList != null and !sectionList.isEmpty()">
- where s.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getSolarDevOnlineTotalByDTO" resultType="Integer">
- select count(s.id)
- from solar_dev s
- where s.netStatus = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and s.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getSolarDevLightTotalByDTO" resultType="Integer">
- select count(s.id)
- from solar_dev s
- where s.netStatus = 1 and s.lighteness > 0
- <if test="sectionList != null and !sectionList.isEmpty()">
- and s.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getSolarDevDayElectricTotalByDTO" resultType="SolarDevDTO">
- select s.id,s.dayconsumption as dayConsumption
- from solar_dev s
- <if test="sectionList != null and !sectionList.isEmpty()">
- where s.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getSolarDevSumElectricTotalByDTO" resultType="SolarDevDTO">
- select s.id,s.totalconsumption as totalConsumption
- from solar_dev s
- <if test="sectionList != null and !sectionList.isEmpty()">
- where s.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <update id="updateSolarDevData" parameterType="SolarDevDTO">
- update
- solar_dev s
- set
- s.number = #{number},
- s.address = #{address},
- s.type = #{type},
- s.serial_port = #{serialPort},
- s.name = #{name}
- where
- s.id = #{id}
- </update>
- </mapper>
|