61 lines
2.7 KiB
XML
61 lines
2.7 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.ServeRepository">
|
||
|
<resultMap id="ServeMap" type="com.zsc.edu.gateway.modules.iot.tsl.entity.Serve">
|
||
|
<id column="id" property="id"/>
|
||
|
<result column="product_id" property="productId"/>
|
||
|
<result column="identifier" property="identifier"/>
|
||
|
<result column="name" property="name"/>
|
||
|
<result column="remark" property="remark"/>
|
||
|
<collection property="inputs" 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>
|
||
|
<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="ServeMap">
|
||
|
-- select * from iot_serve s
|
||
|
-- left join iot_param p on s.id = p.serve_id
|
||
|
-- left join iot_param_input pi on pi.param_id = p.id
|
||
|
-- left join iot_param_output po on po.param_id = p.id
|
||
|
<where>
|
||
|
<if test="query.name != null and query.name != ''">
|
||
|
and e.name like CONCAT('%', #{query.name}, '%')
|
||
|
</if>
|
||
|
<if test="query.identifier != null and query.identifier != ''">
|
||
|
and e.identifier like CONCAT('%', #{query.identifier}, '%')
|
||
|
</if>
|
||
|
<if test="query.productId !=null">
|
||
|
and e.product_id = #{query.productId}
|
||
|
</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="selectById" resultMap="ServeMap">
|
||
|
-- select * from iot_serve s
|
||
|
-- left join iot_param p on s.id = p.serve_id
|
||
|
-- left join iot_param_input pi on pi.param_id = p.id
|
||
|
-- left join iot_param_output po on po.param_id = p.id
|
||
|
<where>
|
||
|
<if test="productId != null">
|
||
|
and s.id = #{id}
|
||
|
</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
</mapper>
|