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
2.7 KiB
71 lines
2.7 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.PointGroupMapper">
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
<resultMap id="BaseResultMap" type="com.iteaj.iboot.msn.iot.entity.PointGroup">
|
|
<result column="id" property="id" />
|
|
<result column="name" property="name" />
|
|
<result column="type_id" property="typeId" />
|
|
<result column="type_name" property="typeName" />
|
|
<result column="model_id" property="modelId" />
|
|
<result column="model_name" property="modelName" />
|
|
<result column="create_time" property="createTime" />
|
|
</resultMap>
|
|
|
|
<resultMap id="DetailResultMap" type="com.iteaj.iboot.msn.iot.entity.PointGroup" extends="BaseResultMap">
|
|
<collection property="signalIds" ofType="java.lang.String">
|
|
<constructor>
|
|
<arg column="signal_id" />
|
|
</constructor>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<select id="detailOfPage" resultMap="BaseResultMap">
|
|
select a.id, a.name, dm.model model_name, dm.id model_id, dy.id type_id, dy.name type_name
|
|
from iot_point_group a
|
|
left join iot_device_model dm on a.model_id=dm.id
|
|
left join iot_device_type dy on dm.type_id=dy.id
|
|
<where>
|
|
<if test="entity.typeId != null">
|
|
and find_in_set(#{entity.typeId}, dy.path)
|
|
</if>
|
|
<if test="entity.modelId != null">
|
|
and dm.id=#{entity.modelId}
|
|
</if>
|
|
<if test="entity.name != null">
|
|
and a.name like '%${entity.name}%'
|
|
</if>
|
|
order by a.create_time desc
|
|
</where>
|
|
|
|
|
|
</select>
|
|
|
|
<select id="detailById" resultMap="DetailResultMap">
|
|
select a.id, a.name, dm.model model_name, dm.id model_id, dy.id type_id, dy.name type_name, igp.signal_id
|
|
from iot_point_group a
|
|
left join iot_device_model dm on a.model_id=dm.id
|
|
left join iot_device_type dy on dm.type_id=dy.id
|
|
left join iot_group_point igp on igp.group_id=a.id
|
|
where a.id=#{id}
|
|
</select>
|
|
|
|
<select id="isBindSignals" resultType="java.lang.Boolean">
|
|
select a.group_id is not null from iot_group_point a
|
|
where a.signal_id in (
|
|
<foreach collection="list" item="id" separator=",">
|
|
#{id}
|
|
</foreach>
|
|
)
|
|
limit 1
|
|
</select>
|
|
|
|
<insert id="batchSaveGroupPoint">
|
|
insert into iot_group_point (signal_id, group_id) values
|
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
|
#{item.signalId},#{item.groupId}
|
|
</foreach>
|
|
</insert>
|
|
|
|
</mapper>
|