|
@@ -40,12 +40,62 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="pageQuery" resultType="com.middle.platform.manage.biz.domain.vo.IotDeviceVo">
|
|
<select id="pageQuery" resultType="com.middle.platform.manage.biz.domain.vo.IotDeviceVo">
|
|
|
- select *
|
|
|
|
|
|
|
+ select id.*, ip.name as productName
|
|
|
from iot_device id
|
|
from iot_device id
|
|
|
|
|
+ inner join iot_product ip on id.product_id = ip.id and ip.del_flag = 0
|
|
|
<where>
|
|
<where>
|
|
|
<if test="keywords != null and keywords != ''">
|
|
<if test="keywords != null and keywords != ''">
|
|
|
and id.name like concat('%', #{keywords,jdbcType=VARCHAR}, '%')
|
|
and id.name like concat('%', #{keywords,jdbcType=VARCHAR}, '%')
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="productId != null">
|
|
|
|
|
+ and id.product_id = #{productId,jdbcType=BIGINT}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ and id.del_flag = 0
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="count" resultType="java.util.Map">
|
|
|
|
|
+ select count(case when id.status = 1 then 1 end) online,
|
|
|
|
|
+ count(case when id.status = 0 then 1 end) offline
|
|
|
|
|
+ from iot_device id
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="productId != null">
|
|
|
|
|
+ and id.product_id = #{productId,jdbcType=BIGINT}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ and id.del_flag = 0
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="detail" resultType="com.middle.platform.manage.biz.domain.vo.IotDeviceDetailVo">
|
|
|
|
|
+ select id.id,
|
|
|
|
|
+ id.name,
|
|
|
|
|
+ id.sn,
|
|
|
|
|
+ id.guid,
|
|
|
|
|
+ id.subtitle,
|
|
|
|
|
+ id.lat,
|
|
|
|
|
+ id.lon,
|
|
|
|
|
+ id.address,
|
|
|
|
|
+ id.online_time,
|
|
|
|
|
+ id.status,
|
|
|
|
|
+ id.enable_flag,
|
|
|
|
|
+ id.remark,
|
|
|
|
|
+ id.create_time,
|
|
|
|
|
+ id.create_by,
|
|
|
|
|
+ id.update_time,
|
|
|
|
|
+ id.update_by,
|
|
|
|
|
+ ip.code productCode,
|
|
|
|
|
+ ip.name productName,
|
|
|
|
|
+ ip.secret,
|
|
|
|
|
+ ip.node_type nodeType,
|
|
|
|
|
+ ip.network_type networkType,
|
|
|
|
|
+ ip.report_protocol reportProtocol,
|
|
|
|
|
+ ip.data_format dataFormat,
|
|
|
|
|
+ ip.auth_type authType,
|
|
|
|
|
+ ip.vendors,
|
|
|
|
|
+ ip.tag
|
|
|
|
|
+ from iot_device id
|
|
|
|
|
+ inner join iot_product ip on id.product_id = ip.id and ip.del_flag = 0
|
|
|
|
|
+ where id.id = #{id,jdbcType=BIGINT}
|
|
|
|
|
+ and id.del_flag = 0
|
|
|
|
|
+ </select>
|
|
|
</mapper>
|
|
</mapper>
|