|
@@ -10,9 +10,29 @@
|
|
|
-->
|
|
|
<select id="getRoute"
|
|
|
resultType="cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectRouteDO">
|
|
|
- select* from (select * from (select route.route_name, device.device_name, device.id device_id,route.id, route.item_json,route.create_time,device.dept_id, device.device_code from
|
|
|
- (select * from rqiot.rq_iot_inspect_route where device_id is null and deleted=0) route
|
|
|
- left join (select * from rqiot.rq_iot_device where deleted=0) device on route.device_classify = device.asset_class)a where a.device_id not in (select device_id from rqiot.rq_iot_inspect_route where device_id is not null)
|
|
|
+ select * from (SELECT
|
|
|
+ r.route_name,
|
|
|
+ r.device_name,
|
|
|
+ d.id as device_id,
|
|
|
+ r.id,
|
|
|
+ r.item_json,
|
|
|
+ r.create_time,
|
|
|
+ d.dept_id,d.device_code
|
|
|
+ FROM
|
|
|
+ rq_iot_inspect_route r
|
|
|
+ LEFT JOIN rq_iot_device d
|
|
|
+ ON d.asset_class IN (
|
|
|
+ SELECT id FROM rq_iot_product_classify
|
|
|
+ WHERE id = r.device_classify OR parent_id = r.device_classify
|
|
|
+ )
|
|
|
+ LEFT JOIN rq_iot_product_classify p
|
|
|
+ ON d.asset_class = p.id
|
|
|
+ WHERE
|
|
|
+ NOT EXISTS (
|
|
|
+ SELECT 1 FROM rq_iot_inspect_route i
|
|
|
+ WHERE i.device_id = d.id
|
|
|
+ )
|
|
|
+ AND d.id IS NOT NULL and r.deleted=0 and d.deleted=0 and p.deleted=0
|
|
|
union all
|
|
|
select route_name, device_name, device_id,id,item_json,create_time,dept_id,device_code from rqiot.rq_iot_inspect_route where device_id is not null
|
|
|
and deleted=0)fin
|