|
@@ -1,22 +1,111 @@
|
|
|
<?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.IotProjectDeviceMapper">
|
|
<mapper namespace="com.middle.platform.manage.biz.mapper.IotProjectDeviceMapper">
|
|
|
- <resultMap id="BaseResultMap" type="com.middle.platform.manage.biz.entity.IotProjectDevice">
|
|
|
|
|
- <!--@mbg.generated-->
|
|
|
|
|
- <!--@Table iot_project_device-->
|
|
|
|
|
- <id column="id" jdbcType="BIGINT" property="id" />
|
|
|
|
|
- <result column="project_id" jdbcType="BIGINT" property="projectId" />
|
|
|
|
|
- <result column="device_id" jdbcType="BIGINT" property="deviceId" />
|
|
|
|
|
- <result column="create_by" jdbcType="BIGINT" property="createBy" />
|
|
|
|
|
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
|
|
|
|
- <result column="update_by" jdbcType="BIGINT" property="updateBy" />
|
|
|
|
|
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
|
|
|
- <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, project_id, device_id, create_by, update_time, update_by, create_time, delete_time,
|
|
|
|
|
- del_flag
|
|
|
|
|
- </sql>
|
|
|
|
|
|
|
+ <resultMap id="BaseResultMap" type="com.middle.platform.manage.biz.entity.IotProjectDevice">
|
|
|
|
|
+ <!--@mbg.generated-->
|
|
|
|
|
+ <!--@Table iot_project_device-->
|
|
|
|
|
+ <id column="id" jdbcType="BIGINT" property="id"/>
|
|
|
|
|
+ <result column="project_id" jdbcType="BIGINT" property="projectId"/>
|
|
|
|
|
+ <result column="device_id" jdbcType="BIGINT" property="deviceId"/>
|
|
|
|
|
+ <result column="create_by" jdbcType="BIGINT" property="createBy"/>
|
|
|
|
|
+ <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
|
|
|
+ <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
|
|
|
|
|
+ <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
|
|
|
+ <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,
|
|
|
|
|
+ project_id,
|
|
|
|
|
+ device_id,
|
|
|
|
|
+ create_by,
|
|
|
|
|
+ update_time,
|
|
|
|
|
+ update_by,
|
|
|
|
|
+ create_time,
|
|
|
|
|
+ delete_time,
|
|
|
|
|
+ del_flag
|
|
|
|
|
+ </sql>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <select id="queryDeviceNum" resultType="java.lang.Integer">
|
|
|
|
|
+ select count(ipd.id) as deviceNum
|
|
|
|
|
+ from iot_project_device ipd
|
|
|
|
|
+ left join iot_device ide on ide.id = ipd.device_id
|
|
|
|
|
+ <where>
|
|
|
|
|
+ ipd.del_flag = 0
|
|
|
|
|
+ and ide.del_flag = 0
|
|
|
|
|
+ <!-- and ide.enable_flag = 1-->
|
|
|
|
|
+ <if test="projectId != null">
|
|
|
|
|
+ and ipd.project_id = #{projectId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="status != null">
|
|
|
|
|
+ and ide.status = #{status}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <select id="pageQuery" resultType="com.middle.platform.manage.biz.domain.vo.IotDeviceVo">
|
|
|
|
|
+ select ide.*
|
|
|
|
|
+ from iot_project_device ipd
|
|
|
|
|
+ left join iot_device ide on ide.id = ipd.device_id
|
|
|
|
|
+ <where>
|
|
|
|
|
+ ipd.project_id = #{iotProjectDevicePara.projectId,jdbcType=BIGINT}
|
|
|
|
|
+ and ipd.del_flag = 0
|
|
|
|
|
+ and ide.del_flag = 0
|
|
|
|
|
+ <if test="iotProjectDevicePara.keywords != null and iotProjectDevicePara.keywords != ''">
|
|
|
|
|
+ and ide.name like concat('%', #{iotProjectDevicePara.keywords,jdbcType=VARCHAR}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <update id="updateById">
|
|
|
|
|
+ update iot_device
|
|
|
|
|
+ <set>
|
|
|
|
|
+ enable_flag = #{enableFlag,jdbcType=BIGINT}
|
|
|
|
|
+ </set>
|
|
|
|
|
+ <where>
|
|
|
|
|
+ id = #{deviceId,jdbcType=BIGINT}
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </update>
|
|
|
|
|
+
|
|
|
|
|
+ <update id="updateProDeviceUntie">
|
|
|
|
|
+ update iot_project_device
|
|
|
|
|
+ <set>
|
|
|
|
|
+ del_flag = 1
|
|
|
|
|
+ </set>
|
|
|
|
|
+ <where>
|
|
|
|
|
+ id = #{id,jdbcType=BIGINT}
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </update>
|
|
|
|
|
+
|
|
|
|
|
+ <delete id="deleteProDeviceUntie">
|
|
|
|
|
+ delete from iot_project_device
|
|
|
|
|
+ <where>
|
|
|
|
|
+ id = #{id,jdbcType=BIGINT}
|
|
|
|
|
+ </where>
|
|
|
|
|
+
|
|
|
|
|
+ </delete>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="selectByProjectDevice" resultMap="BaseResultMap">
|
|
|
|
|
+ select *
|
|
|
|
|
+ from iot_project_device
|
|
|
|
|
+ <where>
|
|
|
|
|
+ project_id = #{projectId,jdbcType=BIGINT}
|
|
|
|
|
+ and device_id = #{deviceId,jdbcType=BIGINT}
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <update id="updateByProjectDevice">
|
|
|
|
|
+ update iot_project_device
|
|
|
|
|
+ <set>
|
|
|
|
|
+ del_flag = 0
|
|
|
|
|
+ </set>
|
|
|
|
|
+ <where>
|
|
|
|
|
+ project_id = #{projectId,jdbcType=BIGINT}
|
|
|
|
|
+ and device_id = #{deviceId,jdbcType=BIGINT}
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </update>
|
|
|
</mapper>
|
|
</mapper>
|