select transportationNo,TDLSN,description,data,alarmTime,classify from alarm_log
select transportationNo,TDLSN,description,ifnull(data,"") data,alarmTime,classify from alarm_log
where transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
where DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
order by alarmTime desc;
where transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
and DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
select count(DISTINCT transportationNo) from alarm_log
where DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
where transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
and DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
select count(DISTINCT transportationNo) from alarm_log
where description like CONCAT(CONCAT('%',"震动"),'%')
where classify = "3"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
and DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
SELECT ifnull(classify,"1") classify,count(description) count FROM alarm_log WHERE classify = "1"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT ifnull(classify,"2") classify,count(description) count FROM alarm_log WHERE classify = "2"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT ifnull(classify,"3") classify,count(description) count FROM alarm_log WHERE classify = "3"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT ifnull(classify,"4") classify,count(description) count FROM alarm_log WHERE classify = "4"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT ifnull(classify,"5") classify,count(description) count FROM alarm_log WHERE classify = "5"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT ifnull(classify,"6") classify,count(description) count FROM alarm_log WHERE classify = "6"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
where transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
and DATE_SUB(CURDATE(), INTERVAL 1 HOUR ) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
select count(DISTINCT transportationNo) from alarm_log
where transportationNo in (select transportationNo from circuit where company_id = (SELECT id from company where companyName =#{companyName,jdbcType=VARCHAR}) and circuitState = 1)