67 lines
3.0 KiB
XML
67 lines
3.0 KiB
XML
|
<?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.zsc.edu.gateway.modules.iot.tsl.repo.EventRepository">
|
||
|
<resultMap id="EventMap" type="com.zsc.edu.gateway.modules.iot.tsl.entity.Event">
|
||
|
<id column="id" property="id"/>
|
||
|
<result column="product_id" property="productId"/>
|
||
|
<result column="type" property="type"/>
|
||
|
<result column="identifier" property="identifier"/>
|
||
|
<result column="name" property="name"/>
|
||
|
<result column="remark" property="remark"/>
|
||
|
<association property="product" javaType="com.zsc.edu.gateway.modules.iot.product.entity.Product">
|
||
|
<id column="id" property="id"/>
|
||
|
<result column="name" property="name"/>
|
||
|
<result column="type" property="type"/>
|
||
|
<result column="model" property="model"/>
|
||
|
<result column="link" property="link"/>
|
||
|
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
|
||
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
|
||
|
<result column="create_time" jdbcType="DATE" property="createTime"/>
|
||
|
<result column="update_time" jdbcType="DATE" property="updateTime"/>
|
||
|
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
||
|
</association>
|
||
|
<collection property="outputs" ofType="com.zsc.edu.gateway.modules.iot.tsl.entity.Param">
|
||
|
<id column="id" property="id"/>
|
||
|
<result column="data_type" property="dataType"/>
|
||
|
<result column="uint" property="uint"/>
|
||
|
<result column="type" property="type"/>
|
||
|
<result column="identifier" property="identifier"/>
|
||
|
<result column="name" property="name"/>
|
||
|
<result column="remark" property="remark"/>
|
||
|
</collection>
|
||
|
</resultMap>
|
||
|
|
||
|
<select id="page" resultMap="EventMap">
|
||
|
select * from
|
||
|
iot_event e
|
||
|
left join iot_product p on e.product_id = p.id
|
||
|
left join iot_product_param pp on p.id = pp.product_id
|
||
|
left join iot_param ip on pp.param_id = ip.id
|
||
|
<where>
|
||
|
<if test="query.name != null and query.name != ''">
|
||
|
and e.name like CONCAT('%', #{query.name}, '%')
|
||
|
</if>
|
||
|
<if test="query.level != null and query.level != ''">
|
||
|
and e.level = #{query.level}
|
||
|
</if>
|
||
|
<if test="query.productId !=null">
|
||
|
and e.product_id = #{query.productId}
|
||
|
</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="selectById" resultMap="EventMap">
|
||
|
select * from
|
||
|
iot_event e
|
||
|
left join iot_product p on e.product_id = p.id
|
||
|
left join iot_product_param pp on p.id = pp.product_id
|
||
|
left join iot_param ip on pp.param_id = ip.id
|
||
|
<where>
|
||
|
<if test="id!=null">
|
||
|
e.id = #{id}
|
||
|
</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
</mapper>
|