|
|
@@ -0,0 +1,207 @@
|
|
|
+<?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.dye.mapper.DyeDeviceMapper">
|
|
|
+
|
|
|
+ <resultMap type="DyeDevice" id="DyeDeviceResult">
|
|
|
+ <result property="deviceId" column="DEVICE_ID"/>
|
|
|
+ <result property="typeId" column="TYPE_ID"/>
|
|
|
+ <result property="wsName" column="WS_NAME"/>
|
|
|
+ <result property="line" column="LINE"/>
|
|
|
+ <result property="typeName" column="TYPE_NAME"/>
|
|
|
+ <result property="deviceCode" column="DEVICE_CODE"/>
|
|
|
+ <result property="sortNum" column="SORT_NUM"/>
|
|
|
+ <result property="deviceName" column="DEVICE_NAME"/>
|
|
|
+ <result property="devicePath" column="DEVICE_PATH"/>
|
|
|
+ <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="DyeDeviceDyeDeviceParaResult" type="DyeDevice" extends="DyeDeviceResult">
|
|
|
+ <collection property="dyeDeviceParaList" ofType="DyeDevicePara" column="DEVICE_ID"
|
|
|
+ select="selectDyeDeviceParaList"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="DyeDevicePara" id="DyeDeviceParaResult">
|
|
|
+ <result property="paraId" column="PARA_ID"/>
|
|
|
+ <result property="deviceId" column="DEVICE_ID"/>
|
|
|
+ <result property="paraCode" column="PARA_CODE"/>
|
|
|
+ <result property="paraName" column="PARA_NAME"/>
|
|
|
+ <result property="paraExp" column="PARA_EXP"/>
|
|
|
+ <result property="paraAlarm" column="PARA_ALARM"/>
|
|
|
+ <result property="lineStand" column="LINE_STAND"/>
|
|
|
+ <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="selectDyeDeviceVo">
|
|
|
+ select DEVICE_ID,
|
|
|
+ TYPE_ID,
|
|
|
+ WS_NAME,
|
|
|
+ LINE,
|
|
|
+ TYPE_NAME,
|
|
|
+ DEVICE_CODE,
|
|
|
+ SORT_NUM,
|
|
|
+ DEVICE_NAME,
|
|
|
+ DEVICE_PATH,
|
|
|
+ CREATED_BY,
|
|
|
+ CREATED_TIME,
|
|
|
+ UPDATED_BY,
|
|
|
+ UPDATED_TIME,
|
|
|
+ REMARK
|
|
|
+ from DYE_DEVICE
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectDyeDeviceList" parameterType="DyeDevice" resultMap="DyeDeviceResult">
|
|
|
+ <include refid="selectDyeDeviceVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="typeId != null ">and TYPE_ID = #{typeId}</if>
|
|
|
+ <if test="wsName != null and wsName != ''">and WS_NAME like concat('%', #{wsName}, '%')</if>
|
|
|
+ <if test="line != null and line != ''">and LINE = #{line}</if>
|
|
|
+ <if test="typeName != null and typeName != ''">and TYPE_NAME like concat('%', #{typeName}, '%')</if>
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">and DEVICE_CODE = #{deviceCode}</if>
|
|
|
+ <if test="deviceName != null and deviceName != ''">and DEVICE_NAME like concat('%', #{deviceName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="devicePath != null and devicePath != ''">and DEVICE_PATH = #{devicePath}</if>
|
|
|
+ <if test="createdBy != null and createdBy != ''">and CREATED_BY = #{createdBy}</if>
|
|
|
+ <if test="createdTime != null ">and CREATED_TIME = #{createdTime}</if>
|
|
|
+ <if test="updatedBy != null and updatedBy != ''">and UPDATED_BY = #{updatedBy}</if>
|
|
|
+ <if test="updatedTime != null ">and UPDATED_TIME = #{updatedTime}</if>
|
|
|
+ <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
|
|
|
+ </where>
|
|
|
+ order by line, SORT_NUM
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectDyeDeviceByDeviceId" parameterType="Long" resultMap="DyeDeviceDyeDeviceParaResult">
|
|
|
+ select DEVICE_ID,
|
|
|
+ TYPE_ID,
|
|
|
+ WS_NAME,
|
|
|
+ LINE,
|
|
|
+ TYPE_NAME,
|
|
|
+ DEVICE_CODE,
|
|
|
+ SORT_NUM,
|
|
|
+ DEVICE_NAME,
|
|
|
+ DEVICE_PATH,
|
|
|
+ CREATED_BY,
|
|
|
+ CREATED_TIME,
|
|
|
+ UPDATED_BY,
|
|
|
+ UPDATED_TIME,
|
|
|
+ REMARK
|
|
|
+ from DYE_DEVICE
|
|
|
+ where DEVICE_ID = #{deviceId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectDyeDeviceParaList" resultMap="DyeDeviceParaResult">
|
|
|
+ select PARA_ID,
|
|
|
+ DEVICE_ID,
|
|
|
+ PARA_CODE,
|
|
|
+ PARA_NAME,
|
|
|
+ PARA_EXP,
|
|
|
+ PARA_ALARM,
|
|
|
+ LINE_STAND,
|
|
|
+ CREATED_BY,
|
|
|
+ CREATED_TIME,
|
|
|
+ UPDATED_BY,
|
|
|
+ UPDATED_TIME,
|
|
|
+ REMARK
|
|
|
+ from DYE_DEVICE_PARA
|
|
|
+ where DEVICE_ID = #{DEVICE_ID}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertDyeDevice" parameterType="DyeDevice" useGeneratedKeys="true" keyProperty="deviceId">
|
|
|
+ insert into DYE_DEVICE
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="typeId != null">TYPE_ID,</if>
|
|
|
+ <if test="wsName != null">WS_NAME,</if>
|
|
|
+ <if test="line != null">LINE,</if>
|
|
|
+ <if test="typeName != null">TYPE_NAME,</if>
|
|
|
+ <if test="deviceCode != null">DEVICE_CODE,</if>
|
|
|
+ <if test="sortNum != null">SORT_NUM,</if>
|
|
|
+ <if test="deviceName != null">DEVICE_NAME,</if>
|
|
|
+ <if test="devicePath != null">DEVICE_PATH,</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="typeId != null">#{typeId},</if>
|
|
|
+ <if test="wsName != null">#{wsName},</if>
|
|
|
+ <if test="line != null">#{line},</if>
|
|
|
+ <if test="typeName != null">#{typeName},</if>
|
|
|
+ <if test="deviceCode != null">#{deviceCode},</if>
|
|
|
+ <if test="sortNum != null">#{sortNum},</if>
|
|
|
+ <if test="deviceName != null">#{deviceName},</if>
|
|
|
+ <if test="devicePath != null">#{devicePath},</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="updateDyeDevice" parameterType="DyeDevice">
|
|
|
+ update DYE_DEVICE
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="typeId != null">TYPE_ID = #{typeId},</if>
|
|
|
+ <if test="wsName != null">WS_NAME = #{wsName},</if>
|
|
|
+ <if test="line != null">LINE = #{line},</if>
|
|
|
+ <if test="typeName != null">TYPE_NAME = #{typeName},</if>
|
|
|
+ <if test="deviceCode != null">DEVICE_CODE = #{deviceCode},</if>
|
|
|
+ <if test="sortNum != null">SORT_NUM = #{sortNum},</if>
|
|
|
+ <if test="deviceName != null">DEVICE_NAME = #{deviceName},</if>
|
|
|
+ <if test="devicePath != null">DEVICE_PATH = #{devicePath},</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 DEVICE_ID = #{deviceId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteDyeDeviceByDeviceId" parameterType="Long">
|
|
|
+ delete
|
|
|
+ from DYE_DEVICE
|
|
|
+ where DEVICE_ID = #{deviceId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteDyeDeviceByDeviceIds" parameterType="String">
|
|
|
+ delete from DYE_DEVICE where DEVICE_ID in
|
|
|
+ <foreach item="deviceId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{deviceId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteDyeDeviceParaByDeviceIds" parameterType="String">
|
|
|
+ delete from DYE_DEVICE_PARA where DEVICE_ID in
|
|
|
+ <foreach item="deviceId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{deviceId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteDyeDeviceParaByDeviceId" parameterType="Long">
|
|
|
+ delete
|
|
|
+ from DYE_DEVICE_PARA
|
|
|
+ where DEVICE_ID = #{deviceId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <insert id="batchDyeDevicePara">
|
|
|
+ insert into DYE_DEVICE_PARA(DEVICE_ID, PARA_CODE, PARA_NAME, PARA_EXP, PARA_ALARM, LINE_STAND, CREATED_BY,
|
|
|
+ CREATED_TIME, UPDATED_BY, UPDATED_TIME, REMARK) values
|
|
|
+ <foreach item="item" index="index" collection="list" separator=",">
|
|
|
+ ( #{item.deviceId}, #{item.paraCode}, #{item.paraName}, #{item.paraExp}, #{item.paraAlarm},
|
|
|
+ #{item.lineStand}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime},
|
|
|
+ #{item.remark})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+</mapper>
|