| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?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.usky.ems.mapper.DmpDeviceMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.usky.ems.domain.DmpDevice">
- <id column="id" property="id" />
- <result column="device_id" property="deviceId" />
- <result column="device_name" property="deviceName" />
- <result column="device_type" property="deviceType" />
- <result column="product_id" property="productId" />
- <result column="product_code" property="productCode" />
- <result column="device_uuid" property="deviceUuid" />
- <result column="category_type" property="categoryType" />
- <result column="gateway_uuid" property="gatewayUuid" />
- <result column="build_id" property="buildId" />
- <result column="delete_flag" property="deleteFlag" />
- <result column="tenant_id" property="tenantId" />
- </resultMap>
- <!-- 根据网关ID查询网关设备 -->
- <select id="selectGatewayByDeviceId" resultMap="BaseResultMap">
- SELECT * FROM dmp_device
- WHERE tenant_id = #{tenantId}
- AND product_code = #{productCode}
- AND category_type = 2
- AND delete_flag = 0
- </select>
- <!-- 根据网关UUID查询所有子设备 -->
- <select id="selectDevicesByGatewayUuid" resultMap="BaseResultMap">
- SELECT device_id,device_name,device_type,product_id,product_code,IFNULL(TRIM(sim_code), device_uuid) AS device_uuid,category_type,gateway_uuid,build_id,delete_flag,tenant_id FROM dmp_device
- WHERE gateway_uuid = #{gatewayUuid}
- AND category_type = 3
- AND delete_flag = 0
- </select>
- </mapper>
|