| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?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="com.xunmei.iot.mapper.IotDeviceInfoMapper">
- <select id="selectDeviceInfoPage" resultType="com.xunmei.iot.vo.deviceInfo.IotDeviceInfoPageVo">
- SELECT
- d.*,
- o.affiliated_area AS firstOrgName,
- o.affiliated_bank AS secondOrgName,
- o.short_name AS orgName
- FROM
- iot_device_info d
- LEFT JOIN sys_org o ON o.id = d.org_id
- where d.deleted = 0
- <if test="req.deviceName !=null and req.deviceName !=''">
- and d.device_name like concat('%',#{req.deviceName},'%')
- </if>
- <if test="req.deviceType !=null and req.deviceType !=''">
- and d.device_type = #{req.deviceType}
- </if>
- <if test="req.deviceTypeList != null and req.deviceTypeList.size > 0">
- and d.device_type in
- <foreach collection="req.deviceTypeList" item="deviceType" open="(" separator="," close=")">
- #{deviceType}
- </foreach>
- </if>
- <if test="req.netStatus !=null and req.netStatus !=''">
- and d.net_status = #{req.netStatus}
- </if>
- <choose>
- <when test="req.checkSub == false">
- and d.org_id=#{req.orgId}
- </when>
- <otherwise>
- and d.org_path like concat(#{req.orgPath},'%')
- </otherwise>
- </choose>
- order by d.device_type asc,d.id desc
- </select>
- <select id="getDetailById" resultType="com.xunmei.iot.vo.deviceInfo.DeviceDetailInfoVo">
- SELECT
- d.*,
- (select device_name from iot_device_info i where i.device_code = d.host_code and i.iot_token = d.iot_token) as parentName,
- o.affiliated_area AS firstOrgName,
- o.affiliated_bank AS secondOrgName,
- o.short_name AS orgName,
- e.net_address AS deviceAddress,
- e.`port` AS devicePort
- FROM
- iot_device_info d
- LEFT JOIN sys_org o ON o.id = d.org_id
- LEFT JOIN iot_device_info_extend e ON d.id = e.device_id
- where d.deleted = 0 and d.id = #{id}
- </select>
- <select id="getChildrenInfoList" resultType="com.xunmei.iot.vo.deviceInfo.DeviceDetailInfoVo">
- SELECT
- d.*,
- o.affiliated_area AS firstOrgName,
- o.affiliated_bank AS secondOrgName,
- o.short_name AS orgName
- FROM
- iot_device_info d
- LEFT JOIN sys_org o ON o.id = d.org_id
- where d.deleted = 0
- and d.iot_token = #{iotToken}
- and d.host_code = #{hostCode}
- <if test="deviceProduct !=null and deviceProduct !=''">
- and d.device_product = #{deviceProduct}
- </if>
- </select>
- <select id="getByProductTypes" resultType="com.xunmei.iot.vo.deviceInfo.DeviceDetailInfoVo">
- SELECT
- d.id,
- d.device_type,
- d.device_product,
- d.device_code,
- d.device_name,
- ifnull( s.state, 0 ) AS state
- FROM
- iot_device_info d
- LEFT JOIN iot_device_status s ON d.id = s.device_id
- WHERE
- d.deleted = 0
- and d.org_path like concat(#{orgPath},'%')
- <if test="productTypes !=null and productTypes.size()>0">
- and d.device_product in
- <foreach collection="productTypes" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="getByProductTypesAndOrgId" resultType="com.xunmei.iot.vo.deviceInfo.DeviceDetailInfoVo">
- SELECT
- d.id,
- d.device_type,
- d.device_product,
- d.device_code,
- d.device_name,
- ifnull( s.state, 0 ) AS state
- FROM
- iot_device_info d
- LEFT JOIN iot_device_status s ON d.id = s.device_id
- WHERE
- d.deleted = 0
- and d.org_id = #{orgId}
- <if test="productTypes !=null and productTypes.size()>0">
- and d.device_product in
- <foreach collection="productTypes" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- </mapper>
|