| 1234567891011121314151617181920212223 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="cn.iocoder.yudao.module.pms.dal.mysql.inspect.IotInspectRouteMapper">
- <!--
- 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
- 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
- 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
- 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
- -->
- <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 rq_iot_inspect_route where device_id is null) route
- 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)
- union all
- 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
- <if test="reqVO.deviceName!=null and reqVO.deviceName!=''">
- AND fin.device_name LIKE concat(concat("%",#{reqVO.deviceName}),"%")
- </if>
- </select>
- </mapper>
|