|
@@ -1,70 +1,104 @@
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<?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">
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.middle.platform.manage.biz.mapper.IotDeviceMapper">
|
|
<mapper namespace="com.middle.platform.manage.biz.mapper.IotDeviceMapper">
|
|
|
- <resultMap id="BaseResultMap" type="com.middle.platform.manage.biz.entity.IotDevice">
|
|
|
|
|
- <!--@mbg.generated-->
|
|
|
|
|
- <!--@Table iot_device-->
|
|
|
|
|
- <id column="id" jdbcType="BIGINT" property="id" />
|
|
|
|
|
- <result column="product_id" jdbcType="BIGINT" property="productId" />
|
|
|
|
|
- <result column="name" jdbcType="VARCHAR" property="name" />
|
|
|
|
|
- <result column="sn" jdbcType="VARCHAR" property="sn" />
|
|
|
|
|
- <result column="guid" jdbcType="VARCHAR" property="guid" />
|
|
|
|
|
- <result column="subtitle" jdbcType="VARCHAR" property="subtitle" />
|
|
|
|
|
- <result column="lon" jdbcType="DECIMAL" property="lon" />
|
|
|
|
|
- <result column="lat" jdbcType="DECIMAL" property="lat" />
|
|
|
|
|
- <result column="address" jdbcType="VARCHAR" property="address" />
|
|
|
|
|
- <result column="online_time" jdbcType="TIMESTAMP" property="onlineTime" />
|
|
|
|
|
- <result column="status" jdbcType="TINYINT" property="status" />
|
|
|
|
|
- <result column="enable_flag" jdbcType="TINYINT" property="enableFlag" />
|
|
|
|
|
- <result column="remark" jdbcType="VARCHAR" property="remark" />
|
|
|
|
|
- <result column="create_by" jdbcType="BIGINT" property="createBy" />
|
|
|
|
|
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
|
|
|
- <result column="update_by" jdbcType="BIGINT" property="updateBy" />
|
|
|
|
|
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
|
|
|
|
- <result column="delete_time" jdbcType="TIMESTAMP" property="deleteTime" />
|
|
|
|
|
- <result column="del_flag" jdbcType="TINYINT" property="delFlag" />
|
|
|
|
|
- </resultMap>
|
|
|
|
|
- <sql id="Base_Column_List">
|
|
|
|
|
- <!--@mbg.generated-->
|
|
|
|
|
- id,
|
|
|
|
|
- product_id,
|
|
|
|
|
- `name`,
|
|
|
|
|
- sn,
|
|
|
|
|
- guid,
|
|
|
|
|
- subtitle,
|
|
|
|
|
- lon,
|
|
|
|
|
- lat,
|
|
|
|
|
- address,
|
|
|
|
|
- online_time,
|
|
|
|
|
- `status`,
|
|
|
|
|
- enable_flag,
|
|
|
|
|
- remark,
|
|
|
|
|
- create_by,
|
|
|
|
|
- create_time,
|
|
|
|
|
- update_by,
|
|
|
|
|
- update_time,
|
|
|
|
|
- delete_time,
|
|
|
|
|
- del_flag
|
|
|
|
|
- </sql>
|
|
|
|
|
|
|
+ <resultMap id="BaseResultMap" type="com.middle.platform.manage.biz.entity.IotDevice">
|
|
|
|
|
+ <!--@mbg.generated-->
|
|
|
|
|
+ <!--@Table iot_device-->
|
|
|
|
|
+ <id column="id" jdbcType="BIGINT" property="id"/>
|
|
|
|
|
+ <result column="product_id" jdbcType="BIGINT" property="productId"/>
|
|
|
|
|
+ <result column="name" jdbcType="VARCHAR" property="name"/>
|
|
|
|
|
+ <result column="sn" jdbcType="VARCHAR" property="sn"/>
|
|
|
|
|
+ <result column="guid" jdbcType="VARCHAR" property="guid"/>
|
|
|
|
|
+ <result column="subtitle" jdbcType="VARCHAR" property="subtitle"/>
|
|
|
|
|
+ <result column="lon" jdbcType="DECIMAL" property="lon"/>
|
|
|
|
|
+ <result column="lat" jdbcType="DECIMAL" property="lat"/>
|
|
|
|
|
+ <result column="address" jdbcType="VARCHAR" property="address"/>
|
|
|
|
|
+ <result column="online_time" jdbcType="TIMESTAMP" property="onlineTime"/>
|
|
|
|
|
+ <result column="status" jdbcType="TINYINT" property="status"/>
|
|
|
|
|
+ <result column="enable_flag" jdbcType="TINYINT" property="enableFlag"/>
|
|
|
|
|
+ <result column="remark" jdbcType="VARCHAR" property="remark"/>
|
|
|
|
|
+ <result column="create_by" jdbcType="BIGINT" property="createBy"/>
|
|
|
|
|
+ <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
|
|
|
+ <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
|
|
|
|
|
+ <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
|
|
|
+ <result column="delete_time" jdbcType="TIMESTAMP" property="deleteTime"/>
|
|
|
|
|
+ <result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
|
|
|
|
|
+ </resultMap>
|
|
|
|
|
+ <sql id="Base_Column_List">
|
|
|
|
|
+ <!--@mbg.generated-->
|
|
|
|
|
+ id,
|
|
|
|
|
+ product_id,
|
|
|
|
|
+ `name`,
|
|
|
|
|
+ sn,
|
|
|
|
|
+ guid,
|
|
|
|
|
+ subtitle,
|
|
|
|
|
+ lon,
|
|
|
|
|
+ lat,
|
|
|
|
|
+ address,
|
|
|
|
|
+ online_time,
|
|
|
|
|
+ `status`,
|
|
|
|
|
+ enable_flag,
|
|
|
|
|
+ remark,
|
|
|
|
|
+ create_by,
|
|
|
|
|
+ create_time,
|
|
|
|
|
+ update_by,
|
|
|
|
|
+ update_time,
|
|
|
|
|
+ delete_time,
|
|
|
|
|
+ del_flag
|
|
|
|
|
+ </sql>
|
|
|
|
|
|
|
|
- <select id="queryByProduct" resultType="java.lang.Long">
|
|
|
|
|
- select count(1)
|
|
|
|
|
- from iot_device id
|
|
|
|
|
- <where>
|
|
|
|
|
- id.product_id = #{id,jdbcType=BIGINT}
|
|
|
|
|
- </where>
|
|
|
|
|
|
|
+ <select id="queryByProduct" resultType="java.lang.Long">
|
|
|
|
|
+ select count(1)
|
|
|
|
|
+ from iot_device id
|
|
|
|
|
+ <where>
|
|
|
|
|
+ id.product_id = #{id,jdbcType=BIGINT}
|
|
|
|
|
+ </where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="pageQuery" resultType="com.middle.platform.manage.biz.domain.vo.IotDeviceVo">
|
|
|
|
|
- select *
|
|
|
|
|
- from iot_device id
|
|
|
|
|
- <where>
|
|
|
|
|
- <if test="keywords != null and keywords != ''">
|
|
|
|
|
- and id.name like concat('%', #{keywords,jdbcType=VARCHAR}, '%')
|
|
|
|
|
- </if>
|
|
|
|
|
- </where>
|
|
|
|
|
- </select>
|
|
|
|
|
|
|
+ <select id="pageQuery" resultType="com.middle.platform.manage.biz.domain.vo.IotDeviceVo">
|
|
|
|
|
+ select *
|
|
|
|
|
+ from iot_device id
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="keywords != null and keywords != ''">
|
|
|
|
|
+ and id.name like concat('%', #{keywords,jdbcType=VARCHAR}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
|
+ <select id="queryTotalNumberOfDevices" resultType="int">
|
|
|
|
|
+ select count(id) as num
|
|
|
|
|
+ from iot_device
|
|
|
|
|
+ <where>
|
|
|
|
|
+ del_flag = 0
|
|
|
|
|
+ and enable_flag = 1
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
|
+ <select id="queryOnlineEquipment" resultType="int">
|
|
|
|
|
+ select count(id) as num
|
|
|
|
|
+ from iot_device
|
|
|
|
|
+ <where>
|
|
|
|
|
+ del_flag = 0
|
|
|
|
|
+ and status = 1
|
|
|
|
|
+ and enable_flag = 1
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
|
+ <select id="queryTypeStatistics" resultType="com.middle.platform.manage.biz.domain.vo.TypeStatisticsVo">
|
|
|
|
|
+ select ide.*,
|
|
|
|
|
+ ipr.title projectTitle
|
|
|
|
|
+ from iot_device ide
|
|
|
|
|
+ left join iot_project_device ipd on ipd.device_id = ide.id
|
|
|
|
|
+ left join iot_project ipr on ipr.id = ipd.project_id
|
|
|
|
|
+ <where>
|
|
|
|
|
+ ide.del_flag = 0
|
|
|
|
|
+ and ide.enable_flag = 1
|
|
|
|
|
+ <if test="deviceId != null">
|
|
|
|
|
+ and id = #{deviceId,jdbcType=BIGINT}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="productId != null">
|
|
|
|
|
+ and product_id = #{productId,jdbcType=BIGINT}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
</mapper>
|
|
</mapper>
|