DmpDeviceMapper.xml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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="com.usky.ems.mapper.DmpDeviceMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.usky.ems.domain.DmpDevice">
  6. <id column="id" property="id" />
  7. <result column="device_id" property="deviceId" />
  8. <result column="device_name" property="deviceName" />
  9. <result column="device_type" property="deviceType" />
  10. <result column="product_id" property="productId" />
  11. <result column="product_code" property="productCode" />
  12. <result column="device_uuid" property="deviceUuid" />
  13. <result column="category_type" property="categoryType" />
  14. <result column="gateway_uuid" property="gatewayUuid" />
  15. <result column="build_id" property="buildId" />
  16. <result column="delete_flag" property="deleteFlag" />
  17. <result column="tenant_id" property="tenantId" />
  18. </resultMap>
  19. <!-- 根据网关ID查询网关设备 -->
  20. <select id="selectGatewayByDeviceId" resultMap="BaseResultMap">
  21. SELECT * FROM dmp_device
  22. WHERE tenant_id = #{tenantId}
  23. AND product_code = #{productCode}
  24. AND category_type = 2
  25. AND delete_flag = 0
  26. </select>
  27. <!-- 根据网关UUID查询所有子设备 -->
  28. <select id="selectDevicesByGatewayUuid" resultMap="BaseResultMap">
  29. 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
  30. WHERE gateway_uuid = #{gatewayUuid}
  31. AND category_type = 3
  32. AND delete_flag = 0
  33. </select>
  34. </mapper>