| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <?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.LightStripDevDao">
-
- <select id="getLightStripTotalByDTO" resultType="Integer">
- select count(l.id) as total
- from light_strip_dev l left join lamp_pole lp on lp.id = l.lamp_pole_id
- <if test="sectionList != null and !sectionList.isEmpty()">
- where lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getLightStripOnlineTotalByDTO" resultType="Integer">
- select count(l.id) as total
- from light_strip_dev l left join lamp_pole lp on lp.id = l.lamp_pole_id
- where l.online = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getLightStripOpenTotalByDTO" resultType="Integer">
- select count(l.id) as total
- from light_strip_dev l left join lamp_pole lp on lp.id = l.lamp_pole_id
- where l.online = 1 and l.status = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- </select>
- <select id="getLightStripListByDTO" resultType="LightStripDevDTO">
- 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>
- l.id,l.lamp_pole_id lampPoleId,lp.name as lampPoleName,s.name as section,l.name,l.number,l.model,l.online,l.online2,
- l.online3,l.address,l.status,l.color,l.factory,w.model as cloudBoxModel,l.serial_port serialPort,l.type,l.mode,l.netType,
- l.imei,l.patrol,l.createtime as createTime,l.updatetime as updateTime,l.powerSwitch,l.gridVolt,l.gridCurr,l.power,l.freq,
- l.soft_verson softVersion,l.hard_version hardVersion,l.usedEnergyTotal,l.gridVolt2,l.gridCurr2,l.power2,l.usedEnergyTotal2,l.groupid as groupId,
- l.batVolt,l.batCurr,l.batPower,l.solarCurr,l.solarPower,l.charge_type chargeType,l.solarVolt,l.policyid as policyId,lsp.name as policyName,
- l.install_date installDate,l.expiration_date expirationDate,s.timezone,sd.id as mpptDevId,sd.address as mpptDevAddress,sd.type as mpptDevType,
- sd.serial_port as mpptDevSerialPort,sd.number as mpptDevNumber,sd.name as mpptDevName,l.solarSwitchVol as solarVoltage,l.switchVol as voltage
- from light_strip_dev l left join lamp_pole lp on lp.id = l.lamp_pole_id
- left join light_strip_policy lsp on l.policyid = lsp.id
- left join solar_dev sd on lp.id = sd.lamp_pole_id
- left join wifi w on lp.id = w.lamp_pole_id
- left join section s on lp.sectionid = s.id
- left join global_location gl on s.pid = gl.id
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
- #{dto}
- </foreach>
- </if>
- <if test="keyword != null and keyword != ''">
- and (l.number like '%${keyword}%' or l.name like '%${keyword}%')
- </if>
- <choose>
- <when test="onlineState == 1">
- and l.online = 0
- </when>
- <when test="onlineState == 2">
- and l.online = 1
- </when>
- </choose>
- <if test="areaId != null and areaId != 0">
- and l.areaid = #{areaId}
- </if>
- <if test="sectionId != null and sectionId != 0">
- and l.sectionid = #{sectionId}
- </if>
- order by convert(l.name using gbk) desc,l.number asc
- <if test="page >= 0 and count > 0">
- limit #{page},#{count}
- </if>
- </select>
-
- <update id="updateLightStripVoltage" parameterType="LightStripDevDTO">
- update
- light_strip_dev l
- set
- l.solarSwitchVol = #{solarVoltage},
- l.switchVol = #{voltage}
- where
- l.id = #{id}
- </update>
- <update id="updateLightStripData" parameterType="LightStripDevDTO">
- update
- light_strip_dev l
- set
- l.address = #{address},
- l.number = #{number},
- l.name = #{name},
- l.model = #{model},
- l.factory = #{factory},
- <if test="imei != null and imei != ''">
- l.imei = #{imei},
- </if>
- <if test="serialPort != null and serialPort != ''">
- l.serial_port = #{serialPort},
- </if>
- <if test="installDate != null and installDate != ''">
- l.install_date = #{installDate},
- </if>
- <if test="expirationDate != null and expirationDate != ''">
- l.expiration_date = #{expirationDate},
- </if>
- l.netType = #{netType},
- l.updatetime = #{updateTime}
- where
- l.id = #{id}
- </update>
- <delete id="deleteLightStripDevData">
- delete
- from light_strip_dev
- where id = #{id};
- </delete>
- </mapper>
|