IotInspectRouteMapper.xml 1.5 KB

1234567891011121314151617181920212223
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.iocoder.yudao.module.pms.dal.mysql.inspect.IotInspectRouteMapper">
  4. <!--
  5. 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  6. 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  7. 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  8. 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  9. -->
  10. <select id="getRoute"
  11. resultType="cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectRouteDO">
  12. 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 rq_iot_inspect_route where device_id is null) route
  13. left join rq_iot_device device on route.device_classify = device.asset_class)a where a.device_id not in (select device_id from rq_iot_inspect_route where device_id is not null)
  14. union all
  15. select route_name, device_name, device_id,id,item_json,create_time,dept_id,device_code from rq_iot_inspect_route where device_id is not null)fin
  16. <if test="reqVO.deviceName!=null and reqVO.deviceName!=''">
  17. AND fin.device_name LIKE concat(concat("%",#{reqVO.deviceName}),"%")
  18. </if>
  19. </select>
  20. </mapper>