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 companyNo =#{companyNo,jdbcType=VARCHAR}))
where transportationNo in (select transportationNo from circuit where company_id =(
select id from company where companyNo=#{companyNo,jdbcType=VARCHAR}))
where transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyNo =#{companyNo,jdbcType=VARCHAR}))
select transportationNo,description,ifnull(data,"") data,alarmTime from alarm_log
where transportationNo in (select transportationNo from circuit where company_id =(
select id from company where companyNo =#{companyNo,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 transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyNo =#{companyNo,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 companyNo =#{companyNo,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 classify = "3"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyNo =#{companyNo,jdbcType=VARCHAR}))
and DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
where classify = "3"
and transportationNo in (select transportationNo from circuit where company_id =(
select id from company where companyNo =#{companyNo,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 companyNo =#{companyNo,jdbcType=VARCHAR}))
select transportationNo,description,ifnull(FORMAT(data,2),"") data,alarmTime from alarm_log
where transportationNo in (select transportationNo from circuit where company_id =(
select id from company where companyNo =#{companyNo,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)
select count(DISTINCT transportationNo) from alarm_log
where transportationNo in (select transportationNo from circuit where company_id = (
SELECT id from company where companyNo =#{companyNo,jdbcType=VARCHAR}) and circuitState = 1)
SELECT c.transportationNo,cargoNo,cargoName,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT GROUP_CONCAT(alarmType) FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT( DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation,plateNo,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
from circuit c
where c.state=1
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
SELECT c.transportationNo,cargoNo,cargoName,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT GROUP_CONCAT(alarmType) FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation,plateNo,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
from circuit c
where c.state=1
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
<iftest="time !=null">
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s'))
</if>
<iftest="circuitState!=null">
AND c.circuitState=#{circuitState,jdbcType=INTEGER}
</if>
<iftest="cargoNo!=null">
AND c.cargoNo like CONCAT(CONCAT('%',#{cargoNo,jdbcType=VARCHAR}),'%')
</if>
<iftest="startTime!=null">
AND c.createTime >= #{startTime,jdbcType=BIGINT}
SELECT c.transportationNo,cargoNo,cargoName,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT GROUP_CONCAT(alarmType) FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation,plateNo,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
from circuit c
where c.state=1
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
<iftest="time !=null">
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s'))
</if>
<iftest="circuitState!=null">
AND c.circuitState=#{circuitState,jdbcType=INTEGER}
</if>
<iftest="cargoNo!=null">
AND c.cargoNo like CONCAT(CONCAT('%',#{cargoNo,jdbcType=VARCHAR}),'%')
</if>
<iftest="startTime!=null">
AND c.createTime >= #{startTime,jdbcType=BIGINT}
SELECT c.transportationNo,cargoNo,cargoName,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT GROUP_CONCAT(alarmType) FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,ifnull(evaluate,"") evaluate,transportation,
(select DISTINCT gatewaySN FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR} ) SN,(SELECT GROUP_CONCAT(TDLSN) FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR}) TDLSN
from circuit c
where c.state=1
AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
SELECT c.transportationNo,cargoNo,cargoName,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT GROUP_CONCAT(alarmType) FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,ifnull(evaluate,"") evaluate,transportation,
(select DISTINCT gatewaySN FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR} ) SN,(SELECT GROUP_CONCAT(TDLSN) FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR}) TDLSN
from circuit c
where c.state=1
AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
SELECT c.transportationNo,cargoNo,cargoName,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT GROUP_CONCAT(alarmType) FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,ifnull(evaluate,"") evaluate,transportation,
(select DISTINCT gatewaySN FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR} ) SN,(SELECT GROUP_CONCAT(TDLSN) FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR}) TDLSN
from circuit c
where c.state=1
and c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
SELECT c.transportationNo,cargoNo,cargoName,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT GROUP_CONCAT(alarmType) FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,ifnull(evaluate,"") evaluate,transportation,
(select DISTINCT gatewaySN FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR} ) SN,(SELECT GROUP_CONCAT(TDLSN) FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR}) TDLSN
from circuit c
where c.state=1
and c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
SELECT c.transportationNo,cargoName,CONCAT_WS("-",(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id AND sequence =LEFT(s.sequence,1))),(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id AND sequence=RIGHT(s.sequence,1)))) city,
(select DISTINCT gatewaySN FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR} ) SN,
(SELECT GROUP_CONCAT(TDLSN) FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR}) TDLSN,remark
from circuit c,(SELECT GROUP_CONCAT(sequence) sequence from circuit_transfer where circuit_id=(SELECT id from circuit where transportationNo=#{transportationNo,jdbcType=VARCHAR})) s
where c.state=1
AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
SELECT c.transportationNo,cargoName,CONCAT_WS("-",(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id AND sequence =LEFT(s.sequence,1))),(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id AND sequence=RIGHT(s.sequence,1)))) city,
(select DISTINCT gatewaySN FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR} ) SN,
(SELECT GROUP_CONCAT(TDLSN) FROM tdl_gateway_log WHERE transportationNo= #{transportationNo,jdbcType=VARCHAR}) TDLSN,remark
from circuit c,(SELECT GROUP_CONCAT(sequence) sequence from circuit_transfer where circuit_id=(SELECT id from circuit where transportationNo=#{transportationNo,jdbcType=VARCHAR})) s
where c.state=1
AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})