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,
...
...
@@ -12,11 +12,17 @@
from circuit c
where c.state=1
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
order by c.createTime desc LIMIT #{page,jdbcType=INTEGER},#{rows,jdbcType=INTEGER}
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,
...
...
@@ -25,6 +31,27 @@
(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=#{circuitTermVo.companyNo,jdbcType=VARCHAR})
<iftest="circuitTermVo.time !=null">
AND DATE_SUB(CURDATE(), INTERVAL #{circuitTermVo.time,jdbcType=VARCHAR} DAY) <= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s'))
</if>
<iftest="circuitTermVo.circuitState!=null">
AND c.circuitState=#{circuitTermVo.circuitState,jdbcType=INTEGER}
</if>
<iftest="circuitTermVo.cargoNo!=null">
AND c.cargoNo like CONCAT(CONCAT('%',#{circuitTermVo.cargoNo,jdbcType=VARCHAR}),'%')
</if>
<iftest="circuitTermVo.startTime!=null">
AND c.createTime >= #{circuitTermVo.circuitTermVo.startTime,jdbcType=BIGINT}
</if>
<iftest="circuitTermVo.endTime!=null">
AND c.createTime <= #{circuitTermVo.endTime,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,
...
...
@@ -250,14 +276,12 @@
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
from gateway WHERE id=(SELECT gateway_id from tdldevice where circuit_id =(SELECT id from circuit WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}) LIMIT 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,
...
...
@@ -330,7 +348,6 @@
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
select c.transportationNo,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)))) routeName,
...
...
@@ -350,6 +365,15 @@
and c.transportationNo=#{transportationNo,jdbcType=VARCHAR}