You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
2.5 KiB

3 years ago
  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.iteaj.iboot.msn.iot.mapper.CollectDetailMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.iteaj.iboot.msn.iot.entity.CollectDetail">
  6. <result column="id" property="id" />
  7. <result property="uid" column="uid" />
  8. <result property="extend" column="extend"/>
  9. <result property="childSn" column="child_sn" />
  10. <result property="deviceSn" column="device_sn" />
  11. <result property="modelId" column="model_id" />
  12. <result property="childName" column="child_name" />
  13. <result property="deviceName" column="device_name" />
  14. <result property="storeAction" column="store_action" />
  15. <result property="deviceTypeId" column="device_type_id" />
  16. <result property="collectAction" column="collect_action" />
  17. <result property="collectTaskId" column="collect_task_id" />
  18. <result property="collectTaskName" column="collect_task_name" />
  19. <result property="pointGroupId" column="point_group_id" />
  20. <result property="pointGroupName" column="point_group_name" />
  21. <result column="create_time" property="createTime" />
  22. </resultMap>
  23. <select id="detailPage" resultMap="BaseResultMap">
  24. select a.*, d.name device_name, pg.name collect_task_name, dc.name child_name, pg.name point_group_name, d.device_sn from iot_collect_detail a
  25. left join iot_collect_task ct on a.collect_task_id=ct.id
  26. left join iot_device d on d.uid = a.uid
  27. left join iot_device_child dc on dc.uid=a.uid and dc.child_sn=a.child_sn
  28. left join iot_point_group pg on a.point_group_id=pg.id
  29. <where>
  30. <if test="entity.id!=null">
  31. a.collect_task_id=#{entity.id}
  32. </if>
  33. <if test="entity.deviceSn!=null and entity.deviceSn!=''">
  34. and d.device_sn like '%${entity.deviceSn}%'
  35. </if>
  36. <if test="entity.deviceName!=null and entity.deviceName!=''">
  37. and d.name like '%${entity.deviceName}%'
  38. </if>
  39. </where>
  40. </select>
  41. <select id="detailById" resultMap="BaseResultMap">
  42. select a.*, d.device_type_id, d.device_sn, d.model model_id from iot_collect_detail a
  43. left join iot_device d on a.uid=d.uid
  44. where a.id=#{id}
  45. </select>
  46. </mapper>