123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- <?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.ChargeDao">
- <select id="getDevListByChargeDTO" resultType="ChargeDTO">
- select c.id,c.num,c.online,c.status,c.updateTime,c.starttime as startTime,c.endtime as endTime,
- c.equipmentElectricity,c.free,c.connectorNum,c.hourEnergy,c.alarmStatus,c.alarmInfo,
- c.install_date installDate,c.expiration_date expirationDate,s.timezone,lp.name as lampPoleName
- from charge c left join lamp_pole lp on lp.id = c.lamp_pole_id
- left join section s on lp.sectionid = s.id
- where c.lamp_pole_id != 0
- <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 c.num like '%${keyword}%'
- </if>
- order by convert(lp.number using gbk) asc,c.id desc
- <if test="page >= 0 and count > 0">
- limit #{page},#{count}
- </if>
- </select>
- <select id="getTotalBySectionList" resultType="Integer">
- select count(c.id) as total
- from charge c left join lamp_pole lp on lp.id = c.lamp_pole_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 c.num like '%${keyword}%'
- </if>
- </select>
- <!-- 在线数 -->
- <select id="getOnlineTotalBySectionList" resultType="Integer">
- select count(c.id) as total
- from charge c left join lamp_pole lp on lp.id = c.lamp_pole_id
- where c.online = 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 c.num like '%${keyword}%'
- </if>
- </select>
- <!-- 告警数 -->
- <select id="getAlarmTotalBySectionList" resultType="Integer">
- select count(c.id) as total
- from charge c left join lamp_pole lp on lp.id = c.lamp_pole_id
- where c.online = 1 and c.alarmStatus = 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 c.num like '%${keyword}%'
- </if>
- </select>
- <!-- 充电中的数量 -->
- <select id="getChargeTotalBySectionList" resultType="Integer">
- select count(c.id) as total
- from charge c left join lamp_pole lp on lp.id = c.lamp_pole_id
- where c.online = 1 and c.status = 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 c.num like '%${keyword}%'
- </if>
- </select>
- <!-- 充电时长 -->
- <select id="getChargeTimeBySectionList" resultType="ChargeDTO">
- select c.id,c.duration
- from charge c left join lamp_pole lp on lp.id = c.lamp_pole_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 c.num like '%${keyword}%'
- </if>
- </select>
- <!-- 充电金额 -->
- <select id="getChargeMoneyBySectionList" resultType="ChargeDTO">
- select c.id,c.free
- from charge c left join lamp_pole lp on lp.id = c.lamp_pole_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 c.num like '%${keyword}%'
- </if>
- </select>
- <!-- 充电能耗 -->
- <select id="getChargeEnergyBySectionList" resultType="ChargeDTO">
- select c.id,c.equipmentElectricity
- from charge c left join lamp_pole lp on lp.id = c.lamp_pole_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 c.num like '%${keyword}%'
- </if>
- </select>
-
- <select id="getChargeInfoByLampPoleId" resultType="ChargeDTO">
- select c.type,c.macVoltage,c.power,c.macCurrent,c.voltage,c.current,c.model,c.num,c.chargeModel,
- c.electricityFee,c.serviceFee,c.connectorCode,c.stationCode,c.createtime as createTime,
- c.status,c.bill_amt as billAmt,c.energy,c.starttime as startTime,c.endtime as endTime,
- c.duration,c.free,c.connectorNum,c.equipmentElectricity,c.macVoltage,c.serviceFee,c.connectorNum
- from charge c
- where c.lamp_pole_id = #{lampPoleId}
- limit 1
- </select>
- <delete id="deleteChargeById">
- delete
- from charge
- where id = #{id};
- </delete>
- <select id="getLampPoleIdByChargeId" resultType="Integer">
- select c.lamp_pole_id
- from charge c
- where c.id = #{id}
- </select>
- <select id="getChargeCountByLampPoleId" resultType="Integer">
- select count(*)
- from charge c
- where c.lamp_pole_id = #{lampPoleId}
- </select>
- <update id="updateLampPoleChargeData" parameterType="ChargeDTO">
- update charge c
- set
- c.num = #{num},
- c.model = #{model},
- <if test="installDate != null and installDate != ''">c.install_date = #{installDate},</if>
- <if test="expirationDate != null and expirationDate != ''">c.expiration_date = #{expirationDate},</if>
- c.power = #{power},
- c.chargeModel = #{chargeModel}
- where 1=1
- <if test="lampPoleId != null and lampPoleId != 0">
- and c.lamp_pole_id = #{lampPoleId}
- </if>
- <if test="id != null and id != 0">
- and c.id = #{id}
- </if>
- </update>
- <select id="checkChargeData" resultType="Integer">
- select count(*)
- from charge c
- where 1=1
- <if test="lampPoleId != null and lampPoleId != 0">
- and c.lamp_pole_id != #{lampPoleId}
- </if>
- <if test="num != null and num != ''">
- and c.num = #{num}
- </if>
- <if test="id != null and id != 0">
- and c.id != #{id}
- </if>
- </select>
-
- <!-- 智诺云信息概览充电量和充电金额 -->
- <select id="getTotalChargeEleAndFree" resultType="ChargeDTO">
- select
- sum(c.equipmentElectricity) as equipmentElectricity,
- sum(c.free) as free
- from charge c
- left join lamp_pole lp on lp.id = c.lamp_pole_id
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="sectionId != null and sectionId != 0">
- and lp.sectionid = #{sectionId}
- </if>
- <if test="areaId != null and areaId != 0">
- and lp.areaid = #{areaId}
- </if>
- </select>
- <select id="getChargeListByDTO" resultType="ChargeDTO">
- select
- c.id,
- c.current,
- c.voltage,
- c.free,
- c.equipmentElectricity,
- c.duration,
- c.status
- <choose>
- <when test="version == 0">
- ,g1.chinese_name as area,g2.chinese_name as city,g3.chinese_name as province
- </when>
- <when test="version == 1">
- ,g1.english_name as area,g2.english_name as city,g3.english_name as province
- </when>
- <otherwise>
- ,g1.ru_name as area,g2.ru_name as city,g3.ru_name as province
- </otherwise>
- </choose>
- from charge c
- left join lamp_pole lp on lp.id = c.lamp_pole_id
- left join section s on lp.sectionid = s.id
- left join global_location g1 on s.pid = g1.id
- left join global_location g2 on g1.pid = g2.id
- left join global_location g3 on g2.pid = g3.id
- where c.lamp_pole_id != 0
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="sectionId != null and sectionId != 0">
- and lp.sectionid = #{sectionId}
- </if>
- <if test="areaId != null and areaId != 0">
- and lp.areaid = #{areaId}
- </if>
- <if test="page >= 0 and count > 0">
- limit #{page},#{count}
- </if>
- </select>
- <select id="getChargeTotalByDTO" resultType="Integer">
- select count(*)
- from charge c
- left join lamp_pole lp on lp.id = c.lamp_pole_id
- where c.lamp_pole_id != 0
- <if test="sectionList != null and !sectionList.isEmpty()">
- and lp.sectionid in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="sectionId != null and sectionId != 0">
- and lp.sectionid = #{sectionId}
- </if>
- <if test="areaId != null and areaId != 0">
- and lp.areaid = #{areaId}
- </if>
- </select>
- <select id="getOneCharge" parameterType="HashMap" resultType="ChargeDTO">
- select C.id
- from charge C
- left join lamp_pole P on P.id = C.lamp_pole_id
- where P.areaid = #{areaId} and P.sectionid = #{sectionid}
- <choose>
- <when test="number != null and model == null">
- and C.num = #{number}
- </when>
- <when test="number == null and model != null">
- and C.model = #{model}
- </when>
- <otherwise>
- and C.num = #{number} and C.model = #{model}
- </otherwise>
- </choose>
- </select>
- <select id="getOneChargeByLampPoleId" resultType="ChargeDTO" parameterType="Integer">
- select status,online,equipmentElectricity,bill_amt as billAmt
- from charge
- where lamp_pole_id = #{lampPoleId} order by id desc
- </select>
- </mapper>
|