更改email異常

This commit is contained in:
b110212000 2022-02-16 18:36:50 +08:00
parent 292bd0ca88
commit b095a7e807

View File

@ -696,17 +696,30 @@ namespace SolarPower.Repository.Implement
{ {
var sql = @$"SELECT a.`*`,ns.Id FROM var sql = @$"SELECT a.`*`,ns.Id FROM
( (
select a.id, site_id, `timestamp`, FROM_UNIXTIME((`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') dev_time , a.sourceState err_status, FROM_UNIXTIME( (a.normalTime / 1000), '%Y-%m-%d %H:%i:%s') normalTime, select a.id, site_id, `timestamp`, FROM_UNIXTIME((`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') dev_time ,
a.alarmClass, b.alarmClass as alarmClassName,ps.Name as PowerStationName,ps.Id as PowerStationId, a.sourceState err_status, FROM_UNIXTIME( (a.normalTime / 1000), '%Y-%m-%d %H:%i:%s') normalTime,
errDevice, err_valueKind, errValue, FROM_UNIXTIME( (a.lastUpdate / 1000), '%Y-%m-%d %H:%i:%s') lastUpdate, a.alarmClass, b.alarmClass as alarmClassName,ps.Name as PowerStationName,ps.Id as PowerStationId, errDevice, err_valueKind, errValue, FROM_UNIXTIME( (a.lastUpdate / 1000), '%Y-%m-%d %H:%i:%s') lastUpdate, d.errMsg_tw errMsg,
case when c.errMsg_tw is null then d.errMsg_tw else c.errMsg_tw end errMsg ,case when c.errMsg is null then d.errMsg else c.errMsg end errMsgT case when c.errMsg_tw is null then
from err_main a case when err_valueKind = 'b' then d.errMsg_tw
join alarmorion_orionalarmclass b on a.alarmclass = b.id when err_valueKind = 'd' then CONCAT(d.errMsg_tw, ': ', round(a.errValue, 2))
left join ref_err_device c on trim(b.alarmClass) = c.deviceType when d.errMsg_tw is null then a.errValue
left join ref_err_inv d on lower(b.alarmClass) = d.deviceType when a.errValue is null then d.errMsg_tw
and case when lower(b.alarmClass) = 'inverter' and err_valuekind = 'e' then errvalue else '' end = d.errCode else CONCAT(a.errValue, ', ' , ifNull(d.errMsg_tw, '')) end
left join power_station ps on ps.Code = site_id else
left join operation_record pr on pr.ErrorCode = a.id case when err_valueKind = 'b' then c.errMsg_tw
when err_valueKind = 'd' then CONCAT(c.errMsg_tw, ': ', round(a.errValue, 2))
when c.errMsg_tw is null then a.errValue
when a.errValue is null then c.errMsg_tw
else CONCAT(a.errValue, ', ' , ifNull(c.errMsg_tw, '')) end
end errMsgT
from err_main a
join alarmorion_orionalarmclass b on a.alarmclass = b.id
left join ref_err_device c on trim(b.alarmClass) = c.deviceType
left join ref_err_inv d on lower(b.alarmClass) = d.deviceType
# and case when lower(b.alarmClass) = 'inverter' and err_valuekind = 'e' then errvalue else '' end = d.errCode
and a.errDeviceBrand = d.brend and a.errDeviceModel = d.model and a.errValue = d.errCode
left join power_station ps on ps.Code = site_id
left join operation_record pr on pr.ErrorCode = a.id
) a ) a
LEFT JOIN LEFT JOIN
notice_schedule ns ON ns.ExceptionId = a.id notice_schedule ns ON ns.ExceptionId = a.id