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

<?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.iteaj.iboot.msn.iot.mapper.CollectTaskMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.iteaj.iboot.msn.iot.entity.CollectTask">
<result column="id" property="id" />
<result column="name" property="name" />
<result column="cron" property="cron" />
<result column="reason" property="reason" />
<result column="status" property="status" />
<result column="remark" property="remark" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<resultMap id="CollectTaskDtoMap" type="com.iteaj.iboot.msn.iot.dto.CollectTaskDto" extends="BaseResultMap">
</resultMap>
<resultMap id="CollectDetailMap" type="com.iteaj.iboot.msn.iot.entity.CollectDetail">
<result property="id" column="did" />
<result property="uid" column="uid" />
<result property="extend" column="extend"/>
<result property="childSn" column="child_sn" />
<result property="storeUid" column="store_uid" />
<result property="storeAction" column="store_action" />
<result property="collectAction" column="collect_action" />
<result property="collectTaskId" column="collect_task_id" />
<result property="pointGroupId" column="point_group_id" />
<association property="store" javaType="com.iteaj.iboot.msn.iot.entity.Device"
select="com.iteaj.iboot.msn.iot.mapper.DeviceMapper.getByUid" column="uid=store_uid"/>
<association property="device" javaType="com.iteaj.iboot.msn.iot.entity.Device"
select="com.iteaj.iboot.msn.iot.mapper.DeviceMapper.getByUid" column="uid=uid"/>
<collection property="signals" select="com.iteaj.iboot.msn.iot.mapper.SignalMapper.collectByPointGroupId"
ofType="com.iteaj.iboot.msn.iot.entity.Signal" column="groupId=point_group_id" />
</resultMap>
<resultMap id="collectDetailDtoMap" type="com.iteaj.iboot.msn.iot.dto.CollectTaskDto" extends="CollectTaskDtoMap">
<collection property="details" ofType="com.iteaj.iboot.msn.iot.entity.CollectDetail" resultMap="CollectDetailMap"/>
</resultMap>
<select id="detailOfPage" resultMap="BaseResultMap">
select a.* from iot_collect_task a
<where>
<if test="entity.status!=null and entity.status!=''">
and a.status=#{entity.status}
</if>
<if test="entity.name!=null and entity.name!=''">
and a.name like '%${entity.name}%'
</if>
</where>
</select>
<select id="detailById" resultMap="CollectTaskDtoMap">
select a.id, a.name, a.cron, a.status, a.remark, a.create_time, a.update_time from iot_collect_task a
where a.id=#{id}
</select>
<select id="collectDetailById" resultMap="collectDetailDtoMap">
select a.*, d.id did, d.uid, d.child_sn, d.point_group_id, d.extend
, d.collect_task_id, d.collect_action, d.store_action, d.store_uid from iot_collect_task a
left join iot_collect_detail d on a.id=d.collect_task_id
where a.id=#{id}
</select>
<select id="collectDetailPageById" resultType="com.iteaj.iboot.msn.iot.entity.CollectDetail">
select a.*, ct.name deviceName, pg.name collectTaskName, dc.name childName from iot_collect_detail a
left join iot_collect_task ct on a.collect_task_id=ct.id
left join iot_device_child dc on dc.uid=a.uid
left join iot_point_group pg on a.point_group_id=pg.id
where a.collect_task_id=#{id}
</select>
</mapper>