|
|
@@ -11,6 +11,10 @@
|
|
|
<result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
|
|
|
<result column="modifytime" jdbcType="TIMESTAMP" property="modifytime" />
|
|
|
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
|
|
|
+ <result column="lat" jdbcType="VARCHAR" property="lat" />
|
|
|
+ <result column="lng" jdbcType="VARCHAR" property="lng" />
|
|
|
+ <result column="address" jdbcType="VARCHAR" property="address" />
|
|
|
+ <result column="radius" jdbcType="VARCHAR" property="radius" />
|
|
|
</resultMap>
|
|
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tuoren.forward.entity.Device">
|
|
|
<result column="data" jdbcType="LONGVARCHAR" property="data" />
|
|
|
@@ -47,7 +51,7 @@
|
|
|
and tenant_id = #{owner}
|
|
|
limit 1
|
|
|
</select>
|
|
|
- <select id="existByMacOwner" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
+ <select id="existByMacOwner" parameterType="java.lang.Integer" resultType="java.lang.Integer" >
|
|
|
select 1
|
|
|
from device
|
|
|
where mac = #{mac,jdbcType=VARCHAR}
|
|
|
@@ -79,6 +83,17 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+ <select id="countProviceDevice" resultType="com.tuoren.forward.entity.resp.CountCategoryResp">
|
|
|
+ select pro title,count(1) num from
|
|
|
+ (SELECT left(address,2) pro FROM forward.device where address is not null) pro_device
|
|
|
+ group by pro
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countOnlineDevice" resultType="com.tuoren.forward.entity.resp.CountResp">
|
|
|
+ select count(1) num
|
|
|
+ from device where timestampdiff(MINUTE,modifytime,now()) < 60
|
|
|
+ </select>
|
|
|
+
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
|
delete from device
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
@@ -87,11 +102,13 @@
|
|
|
insert into device (id, mac, name,
|
|
|
is_delete, product_id, description,
|
|
|
createtime, modifytime, tenant_id,
|
|
|
+ lat,lng,address,radius,
|
|
|
data)
|
|
|
values (#{id,jdbcType=VARCHAR}, #{mac,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
|
|
#{isDelete,jdbcType=CHAR}, #{productId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
|
|
|
#{createtime,jdbcType=TIMESTAMP}, #{modifytime,jdbcType=TIMESTAMP}, #{tenantId,jdbcType=VARCHAR},
|
|
|
- #{data,jdbcType=LONGVARCHAR})
|
|
|
+ #{lat,jdbcType=VARCHAR},#{lng,jdbcType=VARCHAR},#{address,jdbcType=VARCHAR},
|
|
|
+ #{radius,jdbcType=VARCHAR},#{data,jdbcType=LONGVARCHAR})
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.tuoren.forward.entity.Device">
|
|
|
insert into device
|
|
|
@@ -123,6 +140,18 @@
|
|
|
<if test="tenantId != null">
|
|
|
tenant_id,
|
|
|
</if>
|
|
|
+ <if test="lat != null">
|
|
|
+ lat,
|
|
|
+ </if>
|
|
|
+ <if test="lng != null">
|
|
|
+ lng,
|
|
|
+ </if>
|
|
|
+ <if test="address != null">
|
|
|
+ address,
|
|
|
+ </if>
|
|
|
+ <if test="radius != null">
|
|
|
+ radius,
|
|
|
+ </if>
|
|
|
<if test="data != null">
|
|
|
data,
|
|
|
</if>
|
|
|
@@ -155,6 +184,18 @@
|
|
|
<if test="tenantId != null">
|
|
|
#{tenantId,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="lat != null">
|
|
|
+ #{lat,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lng != null">
|
|
|
+ #{lng,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="address != null">
|
|
|
+ #{address,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="radius != null">
|
|
|
+ #{radius,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
<if test="data != null">
|
|
|
#{data,jdbcType=LONGVARCHAR},
|
|
|
</if>
|
|
|
@@ -187,6 +228,18 @@
|
|
|
<if test="tenantId != null">
|
|
|
tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="lat != null">
|
|
|
+ lat = #{lat,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lng != null">
|
|
|
+ lng = #{lng,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="address != null">
|
|
|
+ address = #{address,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="radius != null">
|
|
|
+ radius = #{radius,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
<if test="data != null">
|
|
|
data = #{data,jdbcType=LONGVARCHAR},
|
|
|
</if>
|
|
|
@@ -220,6 +273,18 @@
|
|
|
<if test="tenantId != null">
|
|
|
tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="lat != null">
|
|
|
+ lat = #{lat,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="lng != null">
|
|
|
+ lng = #{lng,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="address != null">
|
|
|
+ address = #{address,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="radius != null">
|
|
|
+ radius = #{radius,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
<if test="data != null">
|
|
|
data = #{data,jdbcType=LONGVARCHAR},
|
|
|
</if>
|
|
|
@@ -236,6 +301,10 @@
|
|
|
createtime = #{createtime,jdbcType=TIMESTAMP},
|
|
|
modifytime = #{modifytime,jdbcType=TIMESTAMP},
|
|
|
tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
+ lat = #{lat,jdbcType=VARCHAR},
|
|
|
+ lng = #{lng,jdbcType=VARCHAR},
|
|
|
+ address = #{address,jdbcType=VARCHAR},
|
|
|
+ radius = #{radius,jdbcType=VARCHAR},
|
|
|
data = #{data,jdbcType=LONGVARCHAR}
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
</update>
|
|
|
@@ -248,7 +317,11 @@
|
|
|
description = #{description,jdbcType=VARCHAR},
|
|
|
createtime = #{createtime,jdbcType=TIMESTAMP},
|
|
|
modifytime = #{modifytime,jdbcType=TIMESTAMP},
|
|
|
- tenant_id = #{tenantId,jdbcType=VARCHAR}
|
|
|
+ tenant_id = #{tenantId,jdbcType=VARCHAR},
|
|
|
+ lat = #{lat,jdbcType=VARCHAR},
|
|
|
+ lng = #{lng,jdbcType=VARCHAR},
|
|
|
+ address = #{address,jdbcType=VARCHAR},
|
|
|
+ radius = #{radius,jdbcType=VARCHAR}
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
</update>
|
|
|
</mapper>
|