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.

54 lines
2.4 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.CollectDataMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.iteaj.iboot.msn.iot.entity.CollectData">
  6. <result column="id" property="id" />
  7. <result column="cid" property="cid" />
  8. <result column="uid" property="uid" />
  9. <result column="value" property="value" />
  10. <result column="status" property="status" />
  11. <result column="reason" property="reason" />
  12. <result column="address" property="address" />
  13. <result column="field_type" property="fieldType" />
  14. <result column="create_time" property="createTime" />
  15. <result column="collect_time" property="collectTime" />
  16. <result column="collect_task_id" property="collectTaskId" />
  17. </resultMap>
  18. <resultMap id="DtoResultMap" type="com.iteaj.iboot.msn.iot.dto.CollectDataDto" extends="BaseResultMap">
  19. <result property="deviceSn" column="device_sn" />
  20. <result property="deviceName" column="device_name" />
  21. </resultMap>
  22. <select id="detailOfPage" resultMap="DtoResultMap">
  23. select a.id, a.cid, a.uid, a.signal_id, a.field_type, a.collect_task_id, a.address, a.value
  24. , a.status, a.reason, a.collect_time, a.create_time, d.name device_name, d.device_sn
  25. from iot_collect_data a left join iot_device d on a.uid=d.uid
  26. <where>
  27. <if test="entity.uid != null">
  28. and a.uid=#{entity.uid}
  29. </if>
  30. <if test="entity.cid != null">
  31. and a.cid=#{entity.cid}
  32. </if>
  33. <if test="entity.deviceTypeId != null">
  34. and d.device_type_id=#{entity.deviceTypeId}
  35. </if>
  36. <if test="entity.modelId != null">
  37. and d.model=#{entity.modelId}
  38. </if>
  39. <if test="entity.signalId != null">
  40. and a.signal_id=#{entity.signalId}
  41. </if>
  42. <if test="entity.collectTaskId != null">
  43. and a.collect_task_id=#{entity.collectTaskId}
  44. </if>
  45. <if test="entity.status != null">
  46. and a.status=#{entity.status}
  47. </if>
  48. </where>
  49. order by a.collect_time desc
  50. </select>
  51. </mapper>