2024-12-09 18:08:42 +08:00
|
|
|
<?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">
|
2024-12-10 15:22:07 +08:00
|
|
|
<mapper namespace="com.zsc.edu.gateway.modules.iot.device.repo.DeviceRepository">
|
2024-12-09 18:08:42 +08:00
|
|
|
<resultMap id="BaseResultMap" type="com.zsc.edu.gateway.modules.iot.device.entity.Device">
|
|
|
|
<id column="id" property="id"/>
|
|
|
|
<result column="name" property="name"/>
|
|
|
|
<result column="online" property="online"/>
|
|
|
|
<result column="state" property="state"/>
|
|
|
|
<result column="hardware_version" property="hardwareVersion"/>
|
|
|
|
<result column="firmware_version" property="firmwareVersion"/>
|
|
|
|
<result column="factory_id" property="factoryId"/>
|
|
|
|
<result column="client_id" property="clientId"/>
|
|
|
|
<result column="product_id" property="productId"/>
|
|
|
|
<result column="extend_params" property="extendParams"/>
|
|
|
|
<result column="properties" property="properties"/>
|
2024-12-10 15:22:07 +08:00
|
|
|
<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 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"/>
|
|
|
|
<collection property="params" 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>
|
|
|
|
</association>
|
2024-12-09 18:08:42 +08:00
|
|
|
</resultMap>
|
2024-12-10 15:22:07 +08:00
|
|
|
|
|
|
|
<select id="page" resultMap="BaseResultMap">
|
|
|
|
select * from
|
|
|
|
iot_device d
|
|
|
|
left join iot_product p on d.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 d.name = #{query.name}
|
|
|
|
</if>
|
|
|
|
<if test="query.clientId != null and query.clientId != ''">
|
|
|
|
and d.client_id = #{query.clientId}
|
|
|
|
</if>
|
|
|
|
<if test="query.productId != null">
|
|
|
|
and d.product_id = #{query.productId}
|
|
|
|
</if>
|
|
|
|
<if test="query.status != null">
|
|
|
|
and d.status = #{query.status}
|
|
|
|
</if>
|
|
|
|
<if test="query.isOnline != null">
|
|
|
|
and d.is_online = #{query.isOnline}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectById" resultMap="BaseResultMap">
|
|
|
|
select * from
|
|
|
|
iot_device d
|
|
|
|
left join iot_product p on d.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">
|
|
|
|
d.id = #{id}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
2024-12-09 18:08:42 +08:00
|
|
|
</mapper>
|