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.
 
 
 
 
 

45 lines
2.0 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.SignalMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.iteaj.iboot.msn.iot.entity.Signal">
<result column="id" property="id" />
<result column="name" property="name" />
<result column="type" property="type" />
<result column="encode" property="encode" />
<result column="address" property="address" />
<result column="message" property="message" />
<result column="type_id" property="typeId" />
<result column="model_id" property="modelId" />
<result column="field_name" property="fieldName" />
<result column="field_type" property="fieldType" />
<result column="create_time" property="createTime" />
</resultMap>
<select id="detailByPage" resultMap="BaseResultMap">
select a.id, a.name, a.address, a.model_id, a.field_name, a.field_type, a.create_time
, a.message, a.encode, a.type, idm.type_id from iot_signal a
left join iot_device_model idm on a.model_id = idm.id
left join iot_device_type idt on idm.type_id=idt.id
<where>
<if test="entity.typeId!=null">
and find_in_set(#{entity.typeId}, idt.path)
</if>
<if test="entity.modelId!=null">
and a.model_id=#{entity.modelId}
</if>
<if test="entity.name!=null and entity.name != ''">
and a.name like '%${entity.name}%'
</if>
<if test="entity.fieldName!=null and entity.fieldName != ''">
and a.field_name like '%${entity.fieldName}%'
</if>
</where>
</select>
<select id="collectByPointGroupId" resultMap="BaseResultMap">
select * from iot_signal a left join iot_group_point g on g.signal_id=a.id where g.group_id=#{groupId}
</select>
</mapper>