select count(*) from lampinfo L
left join section as S on S.id = L.sectionid
left join global_location as G on G.id = S.pid
left join lamp_info_log_new as LI on LI.lampid = L.id
left join network as N on N.id = L.networkid
left join net_card_info as CD on N.id = CD.net_id
left join policy as P on P.id = L.policyid
left join (select t1.* from all_alarm_info_log t1, (select lampid, max(updatetime) as maxtime from all_alarm_info_log group by lampid) t2 where t1.lampid = t2.lampid and t1.updatetime = t2.maxtime) as AI on L.id = AI.lampid
where 1=1
and L.sectionid in
#{vo}
and N.status = #{onlineStatus}
and L.lighteness = 0
and L.lighteness > 0
and (L.faultstatus = 0 or L.faultstatus = 128)
and L.faultstatus != 0 and L.faultstatus != 128
AND (L.number like '%#{keyword}%' OR L.address like '%#{keyword}%' OR L.macAddress like '%#{keyword}%')
select sum((select sum(consum) from lamp_info_cache_by_day t
where t.lampid = a.id
and t.updatetime >= #{startDate}
)) as consum
from lampinfo a
left join lamp_info_log_new b on a.id = b.lampid
where 1=1
and a.sectionid in
#{vo}
select sum(b.day_gener_energy) as consum
from lampinfo a left join lamp_info_log_new b on a.id = b.lampid
where 1=1
and a.sectionid in
#{vo}
and b.updatetime >= #{startDate}
select * from (
select sum(a.consum) as consumption,sum(a.powerSave) as powerSave,a.updatetime as updateTime
from lamp_info_cache_by_day a left join lampinfo b on b.id = a.lampid
where b.id is not null
and a.sectionid in
#{vo}
and a.updatetime >= #{startDate}
and a.updatetime <= #{endDate}
group by a.updatetime
) as t order by t.updatetime asc
select
L.number,
L.id,
L.address as sn,
G.english_name as area,
G.ru_name as area,
G.chinese_name as area,
S.name as section,
S.timezone,
L.lighteness,
L.name,
LI.gridvolt as voltage,
LI.gridcurr as current,
LI.grid_active_power as power,
LI.work_time_total as lightTime,
LI.used_energy_total as totalEnergy,
LI.devicetime as cmdTime,
LI.led_lux_value,LI.leakage_cur,
N.status as networkStatus,
L.status as lampStatus,
L.online as lampOnline,
N.rssi,
N.snr,
N.protocoltype,
LI.updatetime as updateTime,
L.faultstatus as faultStatus,
L.mode,
N.hw_version as hwVersion,
N.sw_version as swVersion,
L.control_type as controlType,
L.macAddress,
L.dev_addr as devAddr,
L.bindStatus,
L.policy_type as policyType,
L.policyid as policyId,
L.longitude,
L.latitude,L.new_faultstatus as newFaultStatus,L.install_date,L.expiration_date,
P.name as policyName,AI.status as alarmStatus,AI.id as alarmid,AI.stralarmtype,
CD.dueDate,CD.workingCondition,CD.remainGprs,CD.useGprs,CD.totalGprs,CD.comboName,CD.comboType,CD.id as card_id
from lampinfo L
left join section as S on S.id = L.sectionid
left join global_location as G on G.id = S.pid
left join lamp_info_log_new as LI on LI.lampid = L.id
left join network as N on N.id = L.networkid
left join net_card_info as CD on N.id = CD.net_id
left join policy as P on P.id = L.policyid
left join (select t1.* from all_alarm_info_log t1, (select lampid, max(updatetime) as maxtime from all_alarm_info_log group by lampid) t2 where t1.lampid = t2.lampid and t1.updatetime = t2.maxtime) as AI on L.id = AI.lampid
where 1=1
and L.sectionid in
#{vo}
AND ((N.status = #{online} and N.protocoltype != 5 and N.protocoltype != 11) or (L.online = #{online} and N.protocoltype = 5) or (L.online = #{online} and N.protocoltype = 11 and L.control_type != 26 and L.control_type != 27) or (N.status = #{online} and N.protocoltype = 11 and (L.control_type = 26 or L.control_type = 27)))
AND ((N.status = 0 and N.protocoltype != 5) or (L.online = 0 and N.protocoltype = 5) or L.lighteness = 0)
AND ((N.status = 1 and N.protocoltype != 5) or (L.online = 1 and N.protocoltype = 5)) and L.lighteness != 0
AND (L.number like '%#{keyword}%' OR L.address like '%#{keyword}%' OR L.macAddress like '%#{keyword}%')
AND L.faultstatus = #{alarmType}
AND L.lamp_pole_id = #{lampPoleId}
order by L.number asc,L.mode asc,L.createtime desc,L.id desc
limit #{offset},#{limit}
select
L.number,
L.id,
L.address as sn,
GL.english_name as area,
GL.ru_name as area,
GL.chinese_name as area,
L.networkid as networkId,N.protocoltype as protocolType,L.areaid as areaId,
L.sectionid as sectionId,L.groupid as groupId,L.longitude,L.latitude,S.name as section,L.dev_addr as devAddr,
L.macAddress,L.zegbee_section_id as loopNumber,G.name as `group`,N.network_name as network,N.rssi,
L.lamp_pole_id as lampPoleId,LP.name as lampPoleName,L.control_type as controlType,
L.lighteness,N.status as netStatus,LI.colour_value as colourValue,LI.used_energy_total as usedEnergyTotal,LI.updatetime,LI.work_time_total as workTimeTotal,
LI.gridPF,LI.used_energy_tonight as usedEnergyTonight,L.faultstatus as faultStatus,N.snr,N.rssi,AI.id as alarmId,
AI.stralarmtype as alarmInfo,S.timezone,L.status as lampStatas,L.freqId,
L.ratedpower as power,L.address as imei,N.simid,L.name,N.sw_version as solfVersion,
N.hw_version as hardVersion,L.install_date,L.expiration_date,L.mode,lamp_ctrl_id
from lampinfo L
left join section as S on S.id = L.sectionid
left join global_location as GL on GL.id = S.pid
left join lamp_info_log_new as LI on LI.lampid = L.id
left join network as N on N.id = L.networkid
left join net_card_info as CD on N.id = CD.net_id
left join policy as P on P.id = L.policyid
left join lamp_pole as LP on LP.id = L.lamp_pole_id
left join `group` as G on G.id = L.groupid
left join (select t1.* from all_alarm_info_log t1, (select lampid, max(updatetime) as maxtime from all_alarm_info_log group by lampid) t2 where t1.lampid = t2.lampid and t1.updatetime = t2.maxtime) as AI on L.id = AI.lampid
where L.id=#{id}
select
L.number,
L.id,
L.address as sn,
GL.english_name as area,
GL.ru_name as area,
GL.chinese_name as area,
L.networkid as networkId,N.protocoltype as protocolType,L.areaid as areaId,
L.sectionid as sectionId,L.groupid as groupId,L.longitude,L.latitude,S.name as section,L.dev_addr as devAddr,
L.macAddress,L.zegbee_section_id as loopNumber,G.name as `group`,N.network_name as network,N.rssi,
L.lamp_pole_id as lampPoleId,LP.name as lampPoleName,L.control_type as controlType,
L.lighteness,N.status as netStatus,LI.colour_value as colourValue,LI.used_energy_total as usedEnergyTotal,LI.updatetime,LI.work_time_total as workTimeTotal,
LI.gridPF,LI.used_energy_tonight as usedEnergyTonight,L.faultstatus as faultStatus,N.snr,N.rssi,AI.id as alarmId,
AI.stralarmtype as alarmInfo,S.timezone,L.status as lampStatas,L.freqId,
L.ratedpower as power,L.address as imei,N.simid,L.name,N.sw_version as solfVersion,
N.hw_version as hardVersion,L.install_date,L.expiration_date
from lampinfo L
left join section as S on S.id = L.sectionid
left join global_location as GL on GL.id = S.pid
left join lamp_info_log_new as LI on LI.lampid = L.id
left join network as N on N.id = L.networkid
left join net_card_info as CD on N.id = CD.net_id
left join policy as P on P.id = L.policyid
left join lamp_pole as LP on LP.id = L.lamp_pole_id
left join `group` as G on G.id = L.groupid
left join (select t1.* from all_alarm_info_log t1, (select lampid, max(updatetime) as maxtime from all_alarm_info_log group by lampid) t2 where t1.lampid = t2.lampid and t1.updatetime = t2.maxtime) as AI on L.id = AI.lampid
where L.address=#{address}
select count(*) from lampinfo L
where 1=1
and L.sectionid = #{sectionId}
and L.name = #{name}
and L.number = #{number}
and L.address = #{address}
and L.id != #{id}
select IFNULL(L.id,0) from lampinfo L
where 1=1
and L.sectionid = #{sectionId}
and L.networkid != #{networkId}
and L.name = #{name}
and L.number = #{number}
and L.address = #{address}
and L.id != #{id}
and L.macAddress = #{macAddress}
and L.dev_addr = #{devAddr}
limit 1
insert into lampinfo(networkid,name,number,address,areaid,sectionid,longitude,latitude,createtime,ratedpower,control_type
,mode
,lamp_pole_id
,install_date
,expiration_date
,dev_addr
,freqId
,zegbee_section_id
)
values
(#{networkId},#{name},#{number},#{sn},#{areaId},#{sectionId},#{longitude},#{latitude},#{createTime},#{ratedPower},#{controlType}
,#{mode}
,#{lampPoleId}
,#{installDate}
,#{expirationDate}
,#{devAddr}
,#{freqId}
,#{zegbeeSectionId}
)
update lampinfo
set
networkid=#{networkId},
name=#{name},
number=#{number},
address=#{sn},
areaid=#{areaId},
control_type=#{controlType},
sectionid=#{sectionId},
longitude=#{longitude},
latitude=#{latitude},
mode=#{mode},
lamp_pole_id=#{lampPoleId},
install_date=#{installDate},
expiration_date=#{expirationDate},
ratedpower=#{ratedPower}
where id = #{id}
select
L.number,
L.id,
L.address as sn,
G.english_name as area,
G.ru_name as area,
G.chinese_name as area,
S.name as section,
S.timezone,
L.lighteness,
L.name,
LI.gridvolt as voltage,
LI.gridcurr as current,
LI.grid_active_power as power,
LI.work_time_total as lightTime,
LI.used_energy_total as totalEnergy,
LI.devicetime as cmdTime,
LI.led_lux_value,LI.leakage_cur,
N.status as networkStatus,
L.status as lampStatus,
L.online as lampOnline,
N.rssi,
N.snr,
N.protocoltype,
LI.updatetime as updateTime,
L.faultstatus as faultStatus,
L.mode,
N.hw_version as hwVersion,
N.sw_version as swVersion,
L.control_type as controlType,
L.macAddress,
L.dev_addr as devAddr,
L.bindStatus,
L.policy_type as policyType,
L.policyid as policyId,
L.longitude,
L.latitude,L.new_faultstatus as newFaultStatus
from lampinfo L
left join section as S on S.id = L.sectionid
left join global_location as G on G.id = S.pid
left join lamp_info_log_new as LI on LI.lampid = L.id
left join network as N on N.id = L.networkid
where 1=1
and L.sectionid in
#{vo}
and L.id in (#{lampIds})
delete from lampinfo where id=#{id};
select
L.number,
L.id,
L.mode,
N.protocoltype,
L.areaid as areaId,
L.control_type as controlType
from lampinfo L
left join network as N on N.id = L.networkid
where 1=1
and L.sectionid in
#{vo}
and L.lamp_pole_id != 0
order by L.number asc,L.mode asc,L.createtime desc,L.id desc
select
L.number,
L.id,
L.address as sn,
L.address,
L.areaid as areaId,
L.sectionid as sectionId,
L.name,
N.protocoltype,
L.control_type as controlType,
L.macAddress,
L.dev_addr as devAddr,
L.longitude,
L.latitude,L.install_date as installDate,L.expiration_date as expirationDate,L.ratedpower as ratedPower
from lampinfo L
left join section as S on S.id = L.sectionid
left join network as N on N.id = L.networkid
where lamp_pole_id=#{lampPoleId}
select l.id,l.number,l.status,l.lighteness,n.status as netStatus,l1.grid_active_power as power,l.updatetime as updateTime,
l1.gridvolt as voltage,l1.gridcurr as current,l1.gridPF,l1.used_energy_tonight as usedEnergyTonight,l1.work_time_total as lightTime,
l.faultstatus as faultStatus,l.longitude,l.latitude,l.groupid as groupId,l.loopid as loopId,n.rssi,n.snr,l1.used_energy_total as usedEnergyTotal,
l.control_type as controlType,l.colour_val as colourVal,a.id as alarmId,s.timezone
from lampinfo l
left join network n on l.networkid = n.id
left join lamp_info_log_new l1 on l.id = l1.lampid
left join all_alarm_info_log a on l.id = a.lampid
left join section s on s.id = l.sectionid
where 1=1
and (l.name like '%${keyword}%' or l.number like '%${keyword}%')
and l.sectionid in
#{item}
and l.faultstatus != 0 and n.status = 1 and l.faultstatus != 128
and n.status = 1
and n.status = 0
and n.status = 1 and l.status = 0
and n.status = 1 and l.status = 1
and l.faultstatus = 16
and l.faultstatus = 8
and l.faultstatus = 4
and l.faultstatus = 2
and l.faultstatus = 1
and l.faultstatus = 0
select l.latitude,l.longitude
from lampinfo l
left join `group` g on g.id = l.groupid
where g.id = #{id}
select l.latitude,l.longitude
from lampinfo l
left join `loop` l1 on l1.id = l.loopid
where l1.id = #{id}
select count(l.id)
from lampinfo l
where 1=1
and l.lamp_pole_id != 0
and l.sectionid in
#{item}
and l.areaid = #{areaId}
and l.sectionid = #{sectionId}
select count(l.id)
from lampinfo l
left join network n on l.networkid = n.id
where n.status = 1 and l.status = 1
and l.lamp_pole_id != 0
and l.sectionid in
#{item}
and l.areaid = #{areaId}
and l.sectionid = #{sectionId}
select count(l.id)
from lampinfo l
left join network n on l.networkid = n.id
where ((n.status = 1 and n.protocoltype != 11) or (n.protocoltype = 11 and l.online = 1 ))
and l.lamp_pole_id != 0
and l.sectionid in
#{item}
and l.areaid = #{areaId}
and l.sectionid = #{sectionId}
select count(l.id)
from lampinfo l
left join network n on l.networkid = n.id
where l.faultstatus != 0
and l.lamp_pole_id != 0
and l.sectionid in
#{item}
and l.areaid = #{areaId}
and l.sectionid = #{sectionId}
update
lampinfo l
set
l.longitude = #{longitude},
l.latitude = #{latitude}
where l.id = #{id}
select count(l.id) as total
from lampinfo l
where l.sectionid = #{id}
select l.number
from lampinfo l
where l.id = #{value}
select s.name
from section s
where s.id = #{value}
select
g.chinese_name
g.english_name
g.ru_name
from global_location g
where g.id = #{value}
select l.id,l.number
from lampinfo l
where l.id = #{id}
select
l.id,l.lamp_pole_id as lampPoleId,lp.name as lampPoleName,w.num as sn,s.name as section,l.number,l.name
,gl.chinese_name as area
,gl.english_name as area
,gl.ru_name as area
,n.status,l.lighteness,l1.gridcurr as current,l1.gridvolt as voltage,n.protocoltype as protocolType,
l1.grid_active_power as power,l.address,l.updatetime as updateTime,l.install_date as installDate,l.online as lampOnline,
l.expiration_date as expirationDate,p.name as policyName,l1.devicetime as serverTime,l1.work_time_total as lightTime
from lampinfo l
left join lamp_pole lp on l.lamp_pole_id = lp.id
left join wifi w on lp.id = w.lamp_pole_id
left join section s on l.sectionid = s.id
left join global_location gl on gl.id = l.areaid
left join network n on l.networkid = n.id
left join lamp_info_log_new l1 on l1.lampid = l.id
left join policy p on l.policyid = p.id
where 1=1
and l.sectionid in
#{item}
and l.areaid = #{areaId}
and l.sectionid = #{sectionId}
and (l.number like '%${keyword}%' or l.address like '%${keyword}%')
and n.status = 0
and n.status = 1
limit #{page},#{count}
select count(*)
from lampinfo l
where 1=1
and l.sectionid in
#{item}
and l.areaid = #{areaId}
and l.sectionid = #{sectionId}
select count(*)
from lampinfo l
left join section s on l.sectionid = s.id
left join global_location gl on s.pid = gl.id
left join global_location gl1 on gl.pid = gl1.id
where gl1.id = #{id}
select
l.name,
l.address,
l.number,
l.lighteness,
l.status,
l.control_type as controlType,
n.status as `online`,
l.power,
l.mode,
n.protocoltype as protocolType
from lampinfo l
left join network n on l.networkid = n.id
where l.id in
#{item}
update lampinfo
set
lighteness=#{lighteness}
,policyid=#{policyId}
,policy_type=#{policyType}
,status=1
,status=0
,updatetime=#{updateTime}
where id = #{id}
select
L.id,
L.address as sn,
N.protocoltype,
L.mode,
L.control_type as controlType,
from lampinfo L
left join section as S on S.id = L.sectionid
left join network as N on N.id = L.networkid
where 1=1
and L.id in
#{vo}
select count(*) from lampinfo L
left join section as S on S.id = L.sectionid
left join network as N on N.id = L.networkid
where L.lamp_pole_id != 0
and L.sectionid in
#{vo}
select a.areaid as areaId,a.id,d.id as companyId from lampinfo a
left join lamp_pole b on a.lamp_pole_id = b.id
left join user c on b.create_id = c.id
left join company d on d.id = c.company_id
where a.lamp_pole_id != 0
and a.sectionid in
#{vo}
select
l.id,
l.number
from lampinfo l
left join lamp_pole lp on l.lamp_pole_id = lp.id
where l.lamp_pole_id = #{lampPoleId}
select l.lamp_pole_id
from lampinfo l
where l.id = #{id}
select count(*)
from lampinfo l
where l.lamp_pole_id = #{lampPoleId}
update lampinfo l
set
l.loopid = #{loopId}
where l.id = #{id}
select
l.id,
l.number,
n.status as networkStatus,
l.status as lampStatus,
l.lighteness,
l1.gridcurr as `current`,
l1.gridvolt as voltage,
l1.grid_active_power as power,
n.rssi,
n.snr,
n.protocoltype as protocolType,
l.updatetime as updateTime,
s.name as section,
l1.work_time_total as lightTime
,gl.chinese_name as area
,gl.english_name as area
,gl.ru_name as area
from lampinfo l
left join lamp_info_log_new l1 on l1.lampid = l.id
left join network n on l.networkid = n.id
left join section s on s.id = l.sectionid
left join global_location gl on gl.id = s.pid
where 1=1
and l.sectionid in
#{item}
and l.sectionid = #{secitonId}
SELECT COUNT(*) AS alarmCount
,a.chinese_name AS area
,a.english_name AS area
,a.ru_name AS area
FROM `lampinfo` l
LEFT JOIN global_location a ON a.id = l.areaid
WHERE l.faultstatus != 0 AND l.faultstatus != 128
and l.sectionid IN
#{item}
GROUP BY l.areaid
ORDER BY alarmCount DESC
LIMIT 5
SELECT
COUNT(l.id) as lampCount,
s.name as section,
SUM(a.total_gener_energy_cache) as consumption
FROM lampinfo l
LEFT JOIN section s ON s.id = l.sectionid
LEFT JOIN lamp_info_log_new a ON a.lampid = l.id
WHERE l.sectionid IN
#{item}
GROUP BY l.sectionid
ORDER BY consumption DESC
LIMIT 5
SELECT
a.stralarmtype AS alarmStr,
a.updatetime AS updateTime,
l.number,
s.name AS section
,gl.chinese_name AS area
,gl.english_name AS area
,gl.ru_name AS area
FROM lampinfo l
LEFT JOIN section s ON s.id = l.sectionid
LEFT JOIN global_location gl ON gl.id = s.pid
LEFT JOIN
(SELECT t1.*
FROM all_alarm_info_log t1,
(SELECT lampid,
max(updatetime) AS maxtime
FROM all_alarm_info_log
GROUP BY lampid) t2
WHERE t1.lampid = t2.lampid
AND t1.updatetime = t2.maxtime) AS a ON a.lampid = l.id
WHERE a.devType = 0
AND l.sectionid IN
#{item}
ORDER BY a.updatetime DESC
LIMIT #{page},#{count}
SELECT
COUNT(l.id) AS lampCount,
DATE(a.updatetime) AS updateTime
FROM lampinfo l
LEFT JOIN
(SELECT t1.*
FROM all_alarm_info_log t1,
(SELECT lampid, MAX(updatetime) AS maxtime FROM all_alarm_info_log ORDER BY lampid) t2
WHERE t1.lampid = t2.lampid AND t1.updatetime = t2.maxtime) AS a ON a.lampid = l.id
WHERE a.devType = 0 AND a.updatetime #{endDate} AND a.updatetime >= #{startDate}
AND l.sectionid IN
#{item}
GROUP BY DATE(a.updatetime)
ORDER BY DATE(a.updatetime) DESC
select sum(b.day_gener_energy) as dayGeneraEnergy,
sum(b.month_gener_energy_cache) as monthGeneraEnergyCache,
sum(b.year_gener_energy_cache) as yearGeneraEnergyCache,
sum(b.total_gener_energy_cache) as totalGeneraEnergyCache,
sum(b.month_ele_save_cache) as monthEleSaveCache,
sum(b.year_ele_save_cache) as yearEleSaveCache,
sum(b.total_ele_save_cache) as totalEleSaveCache,
sum(b.day_ele_save) as dayEleSave
from lampinfo a
left join lamp_info_log_new b on b.lampid = a.id
where a.id is not null and b.day_gener_energy < 50 and b.day_ele_save < 50
and a.sectionid in
#{vo}
select count(*)
from lampinfo a
where ((a.faultstatus != 0 and a.faultstatus != 128) or a.new_faultstatus != 0)
and a.sectionid in
#{vo}
select count(*)
from lampinfo a
left join network b on a.networkid = b.id
where b.status = 1
and a.sectionid in
#{vo}
and a.status = #{status}
select L.id,L.number,L.longitude,L.latitude,N.status as netStatus,
A.english_name as area,
A.ru_name as area,
A.chinese_name as area,
S.name as section,L.status,L.lighteness,LI.gridvolt as voltage,LI.gridcurr as current,LI.day_gener_energy as dayConsumption,LI.work_time_total as lightTime,LI.updatetime as updateTime,L.loopid,LI.grid_active_power as power,N.rssi,N.snr,L.faultstatus as faultStatus,L.new_faultstatus as newFaultStatus,AI.stralarmtype,LO.name as loopName,AI.id as alarmId,L.name,L.install_date as installDate,L.expiration_date as expirationDate
from lampinfo L
left join network N on L.networkid = N.id
left join section S on L.sectionid = S.id
left join global_location A on A.id = S.pid
left join `loop` LO on LO.id = L.loopid
left join policy P on P.id = L.policyid
left join lamp_info_log_new LI on L.id = LI.lampid
left join (select t1.* from all_alarm_info_log t1, (select lampid, max(updatetime) as maxtime from all_alarm_info_log group by lampid) t2 where t1.lampid = t2.lampid and t1.updatetime = t2.maxtime) AI on L.id = AI.lampid
where L.lamp_pole_id = 0
and L.sectionid in
#{vo}
and L.number like '%${keyword}%'
and ((L.longitude >= #{lngLow} and L.longitude <= 180) or (L.longitude <= #{lngLow} and L.longitude >= -180))
and L.longitude >= #{lngLow}
and L.longitude <= #{lngHigh}
and L.latitude >= #{latLow}
and L.latitude <= #{latHigh}
group by L.id
select L.id,L.number,L.longitude,L.latitude,N.status as netStatus,L.status,L.lighteness as light,N.rssi,N.snr,L.faultstatus,L.name
from lampinfo L
left join network N on L.networkid = N.id
where L.lamp_pole_id = 0
and L.sectionid in
#{vo}
and L.number like '%${keyword}%'
and ((L.longitude = ]]> #{lngLow} and L.longitude 180) or (L.longitude #{lngLow} and L.longitude = ]]> -180))
and L.longitude = ]]> #{lngLow}
and L.longitude #{lngHigh}
and L.latitude = ]]> #{latLow}
and L.latitude #{latHigh}
group by L.id
SELECT
COUNT(b.id) as total,
s.name
FROM
lampinfo b
LEFT JOIN section s on b.sectionid = s.id,
(
SELECT
t1.lampid AS lampId
FROM
all_alarm_info_log t1,
(
SELECT
l.id,
a.id AS alarmId,
MAX( a.id ) AS maxId,
MAX( a.updatetime ) AS maxTime,
a.lampid,
a.`status`,
a.devType
FROM
lampinfo l
LEFT JOIN
all_alarm_info_log a ON a.lampid = l.id
WHERE
a.devType = 0
AND l.sectionid IN
#{item}
AND l.areaid = #{areaId}
AND l.sectionid = #{sectionId}
GROUP BY
a.lampid
) t2
WHERE
t1.id = t2.maxId
AND t1.`status` != 2
) t3
WHERE
b.id = t3.lampId
GROUP BY b.sectionid
ORDER BY total DESC
LIMIT 10
select l.id as lampId,l2.gridvolt as gridVolt,l2.gridcurr as gridCurr,l.id,lp.createtime as createTime,
l2.grid_active_power as gridActivePower,l2.gridPF,l2.work_time_total as workTimeTotal,
l2.total_gener_energy_cache as usedEnergyTotal,l2.total_ele_save_cache as powerSave,
p.name as policyName,l.lighteness,l.colour_val as colourVal,l.status,l.control_type as controlType
from lampinfo l
left join lamp_pole lp on l.lamp_pole_id = lp.id
left join lamp_info_log_new l2 on l2.lampid = l.id
left join policy p on p.id = l.policyid
where l.lamp_pole_id = #{lampPoleId}
and l.id = #{lampId}
select l.id,n.protocoltype as protocolType,l.control_type as controlType,
s.name as section,n.status as `online`,l1.gridvolt as voltage,l1.gridcurr as `current`,
l1.grid_active_power as power,l1.gridPF,l.lighteness,l1.devicetime as cmdTime,l1.updatetime as updateTime,
l1.total_gener_energy_cache as totalEnergy,l1.work_time_total as lightTime
,g1.chinese_name as area,g2.chinese_name as city,g3.chinese_name as province
,g1.english_name as area,g2.english_name as city,g3.english_name as province
,g1.ru_name as area,g2.ru_name as city,g3.ru_name as province
from lampinfo l
left join lamp_info_log_new l1 on l1.lampid = l.id
left join network n on n.id = l.networkid
left join section s on l.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 l.address = #{address}
select id,address,sectionid as sectionId,number,networkid as networkId from lampinfo
id = #{id} or
address = #{address} or
networkid = #{networkId} or
macAddress = #{macAddress} or
limit 0,1
select id,address,mode,control_type as controlType,dev_addr as devAddr from lampinfo
id = #{id} or
address = #{address} and macAddress = #{macAddress} or
limit 0,2
insert into lampinfo(networkid,name,number,address,areaid,sectionid,longitude,latitude,createtime,ratedpower,control_type
,macAddress
,mode
,lamp_pole_id
,install_date
,expiration_date
,dev_addr
,freqId
,zegbee_section_id
,bindStatus
)
values
(#{networkId},#{name},#{number},#{address},#{areaId},#{sectionId},#{longitude},#{latitude},#{createTime},#{ratedPower},#{controlType}
,#{macAddress}
,#{mode}
,#{lampPoleId}
,#{installDate}
,#{expirationDate}
,#{devAddr}
,#{freqId}
,#{zegbeeSectionId}
,#{bindStatus}
)
update lampinfo
set
networkid=#{networkId},
name=#{name},
number=#{number},
address=#{address},
areaid=#{areaId},
control_type=#{controlType},
sectionid=#{sectionId},
longitude=#{longitude},
latitude=#{latitude}
,mode=#{mode}
,lamp_pole_id=#{lampPoleId}
,install_date=#{installDate}
,expiration_date=#{expirationDate}
,ratedpower=#{ratedPower}
where id = #{id}
select id,name,address,mode
from lampinfo
where areaid = #{areaId} and sectionid = #{sectionId}
and name = #{name}
and number = #{number}
and mode = #{mode}
select a.lighteness,a.usedEnergyTotal,a.power_save as powerSave,b.work_time_total as workTimeTotal,a.policy_type as policyType,a.policyid as policyId,a.number,a.id from lampinfo a left join lamp_info_log_new b on a.id = b.lampid where a.lamp_pole_id = #{id} order by a.id desc
select id,longitude,latitude,number from lampinfo
lamp_pole_id = #{lampPoleId} and
sectionid IN
#{item}
select lighteness,colour_val as colourVal,power_save as powerSave,id,sectionid as sectionId
from lampinfo
where lamp_pole_id = #{id};