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.

71 lines
3.8 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.CollectTaskMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.iteaj.iboot.msn.iot.entity.CollectTask">
  6. <result column="id" property="id" />
  7. <result column="name" property="name" />
  8. <result column="cron" property="cron" />
  9. <result column="reason" property="reason" />
  10. <result column="status" property="status" />
  11. <result column="remark" property="remark" />
  12. <result column="create_time" property="createTime" />
  13. <result column="update_time" property="updateTime" />
  14. </resultMap>
  15. <resultMap id="CollectTaskDtoMap" type="com.iteaj.iboot.msn.iot.dto.CollectTaskDto" extends="BaseResultMap">
  16. </resultMap>
  17. <resultMap id="CollectDetailMap" type="com.iteaj.iboot.msn.iot.entity.CollectDetail">
  18. <result property="id" column="did" />
  19. <result property="uid" column="uid" />
  20. <result property="extend" column="extend"/>
  21. <result property="childSn" column="child_sn" />
  22. <result property="storeUid" column="store_uid" />
  23. <result property="storeAction" column="store_action" />
  24. <result property="collectAction" column="collect_action" />
  25. <result property="collectTaskId" column="collect_task_id" />
  26. <result property="pointGroupId" column="point_group_id" />
  27. <association property="store" javaType="com.iteaj.iboot.msn.iot.entity.Device"
  28. select="com.iteaj.iboot.msn.iot.mapper.DeviceMapper.getByUid" column="uid=store_uid"/>
  29. <association property="device" javaType="com.iteaj.iboot.msn.iot.entity.Device"
  30. select="com.iteaj.iboot.msn.iot.mapper.DeviceMapper.getByUid" column="uid=uid"/>
  31. <collection property="signals" select="com.iteaj.iboot.msn.iot.mapper.SignalMapper.collectByPointGroupId"
  32. ofType="com.iteaj.iboot.msn.iot.entity.Signal" column="groupId=point_group_id" />
  33. </resultMap>
  34. <resultMap id="collectDetailDtoMap" type="com.iteaj.iboot.msn.iot.dto.CollectTaskDto" extends="CollectTaskDtoMap">
  35. <collection property="details" ofType="com.iteaj.iboot.msn.iot.entity.CollectDetail" resultMap="CollectDetailMap"/>
  36. </resultMap>
  37. <select id="detailOfPage" resultMap="BaseResultMap">
  38. select a.* from iot_collect_task a
  39. <where>
  40. <if test="entity.status!=null and entity.status!=''">
  41. and a.status=#{entity.status}
  42. </if>
  43. <if test="entity.name!=null and entity.name!=''">
  44. and a.name like '%${entity.name}%'
  45. </if>
  46. </where>
  47. </select>
  48. <select id="detailById" resultMap="CollectTaskDtoMap">
  49. select a.id, a.name, a.cron, a.status, a.remark, a.create_time, a.update_time from iot_collect_task a
  50. where a.id=#{id}
  51. </select>
  52. <select id="collectDetailById" resultMap="collectDetailDtoMap">
  53. select a.*, d.id did, d.uid, d.child_sn, d.point_group_id, d.extend
  54. , d.collect_task_id, d.collect_action, d.store_action, d.store_uid from iot_collect_task a
  55. left join iot_collect_detail d on a.id=d.collect_task_id
  56. where a.id=#{id}
  57. </select>
  58. <select id="collectDetailPageById" resultType="com.iteaj.iboot.msn.iot.entity.CollectDetail">
  59. select a.*, ct.name deviceName, pg.name collectTaskName, dc.name childName from iot_collect_detail a
  60. left join iot_collect_task ct on a.collect_task_id=ct.id
  61. left join iot_device_child dc on dc.uid=a.uid
  62. left join iot_point_group pg on a.point_group_id=pg.id
  63. where a.collect_task_id=#{id}
  64. </select>
  65. </mapper>