|
|
@@ -101,64 +101,68 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
- <select id="pageQuery" resultType="com.middle.platform.manage.biz.domain.vo.IotDeviceVo">
|
|
|
- select id.*, ip.name as productName, ip.node_type
|
|
|
- from iot_device id
|
|
|
- inner join iot_product ip on id.product_id = ip.id and ip.del_flag = 0
|
|
|
- <where>
|
|
|
- <if test="keywords != null and keywords != ''">
|
|
|
- and id.name like concat('%', #{keywords,jdbcType=VARCHAR}, '%')
|
|
|
- </if>
|
|
|
- <if test="productId != null">
|
|
|
- and id.product_id = #{productId,jdbcType=BIGINT}
|
|
|
- </if>
|
|
|
- and id.del_flag = 0
|
|
|
- </where>
|
|
|
- </select>
|
|
|
+ <select id="pageQuery" resultType="com.middle.platform.manage.biz.domain.vo.IotDeviceVo">
|
|
|
+ select id.*, ip.name as productName, ip.node_type
|
|
|
+ from iot_device id
|
|
|
+ inner join iot_product ip on id.product_id = ip.id and ip.del_flag = 0
|
|
|
+ <where>
|
|
|
+ <if test="isBind != null and isBind">
|
|
|
+ id.id not in (select ipd.device_id from iot_project_device ipd where ipd.del_flag = 0)
|
|
|
+ </if>
|
|
|
+ <if test="keywords != null and keywords != ''">
|
|
|
+ and id.name like concat('%', #{keywords,jdbcType=VARCHAR}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="productId != null">
|
|
|
+ and id.product_id = #{productId,jdbcType=BIGINT}
|
|
|
+ </if>
|
|
|
+ and id.del_flag = 0
|
|
|
+ </where>
|
|
|
+ </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>
|
|
|
+ <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,
|
|
|
+ ip.id productId
|
|
|
+ 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
|
|
|
- </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>
|
|
|
+ </select>
|
|
|
|
|
|
<select id="query" resultType="com.middle.platform.manage.biz.domain.vo.ProductDeviceDto">
|
|
|
select id.id,
|
|
|
@@ -189,4 +193,16 @@
|
|
|
and id.del_flag = 0
|
|
|
</where>
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="list" resultType="com.middle.platform.manage.biz.domain.vo.IotDeviceDownVo">
|
|
|
+ select id.id, id.name, id.sn
|
|
|
+ from iot_device id
|
|
|
+ <where>
|
|
|
+ id.del_flag = 0
|
|
|
+ and id.enable_flag = 1
|
|
|
+ <if test="productId != null">
|
|
|
+ and id.product_id = #{productId,jdbcType=BIGINT}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
</mapper>
|