|
|
@@ -0,0 +1,128 @@
|
|
|
+<?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">
|
|
|
+<mapper namespace="com.jjt.rz.mapper.TwinDeviceTypeMapper">
|
|
|
+
|
|
|
+ <resultMap type="TwinDeviceType" id="TwinDeviceTypeResult">
|
|
|
+ <result property="typeId" column="TYPE_ID" />
|
|
|
+ <result property="typeGroup" column="TYPE_GROUP" />
|
|
|
+ <result property="typeName" column="TYPE_NAME" />
|
|
|
+ <result property="typeMatch" column="TYPE_MATCH" />
|
|
|
+ <result property="createdBy" column="CREATED_BY" />
|
|
|
+ <result property="createdTime" column="CREATED_TIME" />
|
|
|
+ <result property="updatedBy" column="UPDATED_BY" />
|
|
|
+ <result property="updatedTime" column="UPDATED_TIME" />
|
|
|
+ <result property="remark" column="REMARK" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="TwinDeviceTypeTwinDeviceTypeDataResult" type="TwinDeviceType" extends="TwinDeviceTypeResult">
|
|
|
+ <collection property="twinDeviceTypeDataList" ofType="TwinDeviceTypeData" column="TYPE_ID" select="selectTwinDeviceTypeDataList" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="TwinDeviceTypeData" id="TwinDeviceTypeDataResult">
|
|
|
+ <result property="dataId" column="DATA_ID" />
|
|
|
+ <result property="typeId" column="TYPE_ID" />
|
|
|
+ <result property="dataName" column="DATA_NAME" />
|
|
|
+ <result property="dataCode" column="DATA_CODE" />
|
|
|
+ <result property="dataType" column="DATA_TYPE" />
|
|
|
+ <result property="createdBy" column="CREATED_BY" />
|
|
|
+ <result property="createdTime" column="CREATED_TIME" />
|
|
|
+ <result property="updatedBy" column="UPDATED_BY" />
|
|
|
+ <result property="updatedTime" column="UPDATED_TIME" />
|
|
|
+ <result property="remark" column="REMARK" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectTwinDeviceTypeVo">
|
|
|
+ select TYPE_ID, TYPE_GROUP, TYPE_NAME, TYPE_MATCH, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, REMARK from TWIN_DEVICE_TYPE
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectTwinDeviceTypeList" parameterType="TwinDeviceType" resultMap="TwinDeviceTypeResult">
|
|
|
+ <include refid="selectTwinDeviceTypeVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="typeGroup != null and typeGroup != ''"> and TYPE_GROUP = #{typeGroup}</if>
|
|
|
+ <if test="typeName != null and typeName != ''"> and TYPE_NAME like concat('%', #{typeName}, '%')</if>
|
|
|
+ <if test="typeMatch != null and typeMatch != ''"> and TYPE_MATCH = #{typeMatch}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTwinDeviceTypeByTypeId" parameterType="Long" resultMap="TwinDeviceTypeTwinDeviceTypeDataResult">
|
|
|
+ select TYPE_ID, TYPE_GROUP, TYPE_NAME, TYPE_MATCH, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, REMARK
|
|
|
+ from TWIN_DEVICE_TYPE
|
|
|
+ where TYPE_ID = #{typeId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTwinDeviceTypeDataList" resultMap="TwinDeviceTypeDataResult">
|
|
|
+ select DATA_ID, TYPE_ID, DATA_NAME, DATA_CODE, DATA_TYPE, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, REMARK
|
|
|
+ from TWIN_DEVICE_TYPE_DATA
|
|
|
+ where TYPE_ID = #{TYPE_ID}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertTwinDeviceType" parameterType="TwinDeviceType" useGeneratedKeys="true" keyProperty="typeId">
|
|
|
+ insert into TWIN_DEVICE_TYPE
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="typeGroup != null">TYPE_GROUP,</if>
|
|
|
+ <if test="typeName != null">TYPE_NAME,</if>
|
|
|
+ <if test="typeMatch != null">TYPE_MATCH,</if>
|
|
|
+ <if test="createdBy != null">CREATED_BY,</if>
|
|
|
+ <if test="createdTime != null">CREATED_TIME,</if>
|
|
|
+ <if test="updatedBy != null">UPDATED_BY,</if>
|
|
|
+ <if test="updatedTime != null">UPDATED_TIME,</if>
|
|
|
+ <if test="remark != null">REMARK,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="typeGroup != null">#{typeGroup},</if>
|
|
|
+ <if test="typeName != null">#{typeName},</if>
|
|
|
+ <if test="typeMatch != null">#{typeMatch},</if>
|
|
|
+ <if test="createdBy != null">#{createdBy},</if>
|
|
|
+ <if test="createdTime != null">#{createdTime},</if>
|
|
|
+ <if test="updatedBy != null">#{updatedBy},</if>
|
|
|
+ <if test="updatedTime != null">#{updatedTime},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateTwinDeviceType" parameterType="TwinDeviceType">
|
|
|
+ update TWIN_DEVICE_TYPE
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="typeGroup != null">TYPE_GROUP = #{typeGroup},</if>
|
|
|
+ <if test="typeName != null">TYPE_NAME = #{typeName},</if>
|
|
|
+ <if test="typeMatch != null">TYPE_MATCH = #{typeMatch},</if>
|
|
|
+ <if test="createdBy != null">CREATED_BY = #{createdBy},</if>
|
|
|
+ <if test="createdTime != null">CREATED_TIME = #{createdTime},</if>
|
|
|
+ <if test="updatedBy != null">UPDATED_BY = #{updatedBy},</if>
|
|
|
+ <if test="updatedTime != null">UPDATED_TIME = #{updatedTime},</if>
|
|
|
+ <if test="remark != null">REMARK = #{remark},</if>
|
|
|
+ </trim>
|
|
|
+ where TYPE_ID = #{typeId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteTwinDeviceTypeByTypeId" parameterType="Long">
|
|
|
+ delete from TWIN_DEVICE_TYPE where TYPE_ID = #{typeId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteTwinDeviceTypeByTypeIds" parameterType="String">
|
|
|
+ delete from TWIN_DEVICE_TYPE where TYPE_ID in
|
|
|
+ <foreach item="typeId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{typeId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteTwinDeviceTypeDataByTypeIds" parameterType="String">
|
|
|
+ delete from TWIN_DEVICE_TYPE_DATA where TYPE_ID in
|
|
|
+ <foreach item="typeId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{typeId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteTwinDeviceTypeDataByTypeId" parameterType="Long">
|
|
|
+ delete from TWIN_DEVICE_TYPE_DATA where TYPE_ID = #{typeId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <insert id="batchTwinDeviceTypeData">
|
|
|
+ insert into TWIN_DEVICE_TYPE_DATA( TYPE_ID, DATA_NAME, DATA_CODE, DATA_TYPE, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, REMARK) values
|
|
|
+ <foreach item="item" index="index" collection="list" separator=",">
|
|
|
+ ( #{item.typeId}, #{item.dataName}, #{item.dataCode}, #{item.dataType}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}, #{item.remark})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+</mapper>
|