|
@@ -0,0 +1,97 @@
|
|
|
+<?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.ruoyi.biz.mapper.TwinWorkshopMapper">
|
|
|
+
|
|
|
+ <resultMap type="TwinWorkshop" id="TwinWorkshopResult">
|
|
|
+ <result property="wsId" column="WS_ID" />
|
|
|
+ <result property="wsName" column="WS_NAME" />
|
|
|
+ <result property="remark" column="REMARK" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="TwinWorkshopTwinWorkshopEnergyResult" type="TwinWorkshop" extends="TwinWorkshopResult">
|
|
|
+ <collection property="twinWorkshopEnergyList" notNullColumn="sub_ENERGY_ID" javaType="java.util.List" resultMap="TwinWorkshopEnergyResult" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="TwinWorkshopEnergy" id="TwinWorkshopEnergyResult">
|
|
|
+ <result property="energyId" column="sub_ENERGY_ID" />
|
|
|
+ <result property="wsId" column="sub_WS_ID" />
|
|
|
+ <result property="energyName" column="sub_ENERGY_NAME" />
|
|
|
+ <result property="energyType" column="sub_ENERGY_TYPE" />
|
|
|
+ <result property="energyPath" column="sub_ENERGY_PATH" />
|
|
|
+ <result property="energyCode" column="sub_ENERGY_CODE" />
|
|
|
+ <result property="remark" column="sub_REMARK" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectTwinWorkshopVo">
|
|
|
+ select WS_ID, WS_NAME, REMARK from twin_workshop
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectTwinWorkshopList" parameterType="TwinWorkshop" resultMap="TwinWorkshopResult">
|
|
|
+ <include refid="selectTwinWorkshopVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="wsName != null and wsName != ''"> and WS_NAME like concat('%', #{wsName}, '%')</if>
|
|
|
+ <if test="remark != null and remark != ''"> and REMARK = #{remark}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTwinWorkshopByWsId" parameterType="Long" resultMap="TwinWorkshopTwinWorkshopEnergyResult">
|
|
|
+ select a.WS_ID, a.WS_NAME, a.REMARK,
|
|
|
+ b.ENERGY_ID as sub_ENERGY_ID, b.WS_ID as sub_WS_ID, b.ENERGY_NAME as sub_ENERGY_NAME, b.ENERGY_TYPE as sub_ENERGY_TYPE, b.ENERGY_PATH as sub_ENERGY_PATH, b.ENERGY_CODE as sub_ENERGY_CODE, b.REMARK as sub_REMARK
|
|
|
+ from twin_workshop a
|
|
|
+ left join twin_workshop_energy b on b.WS_ID = a.WS_ID
|
|
|
+ where a.WS_ID = #{wsId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertTwinWorkshop" parameterType="TwinWorkshop" useGeneratedKeys="true" keyProperty="wsId">
|
|
|
+ insert into twin_workshop
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="wsName != null">WS_NAME,</if>
|
|
|
+ <if test="remark != null">REMARK,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="wsName != null">#{wsName},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateTwinWorkshop" parameterType="TwinWorkshop">
|
|
|
+ update twin_workshop
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="wsName != null">WS_NAME = #{wsName},</if>
|
|
|
+ <if test="remark != null">REMARK = #{remark},</if>
|
|
|
+ </trim>
|
|
|
+ where WS_ID = #{wsId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteTwinWorkshopByWsId" parameterType="Long">
|
|
|
+ delete from twin_workshop where WS_ID = #{wsId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteTwinWorkshopByWsIds" parameterType="String">
|
|
|
+ delete from twin_workshop where WS_ID in
|
|
|
+ <foreach item="wsId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{wsId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteTwinWorkshopEnergyByWsIds" parameterType="String">
|
|
|
+ delete from twin_workshop_energy where WS_ID in
|
|
|
+ <foreach item="wsId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{wsId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteTwinWorkshopEnergyByWsId" parameterType="Long">
|
|
|
+ delete from twin_workshop_energy where WS_ID = #{wsId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <insert id="batchTwinWorkshopEnergy">
|
|
|
+ insert into twin_workshop_energy( ENERGY_ID, WS_ID, ENERGY_NAME, ENERGY_TYPE, ENERGY_PATH, ENERGY_CODE, REMARK) values
|
|
|
+ <foreach item="item" index="index" collection="list" separator=",">
|
|
|
+ ( #{item.energyId}, #{item.wsId}, #{item.energyName}, #{item.energyType}, #{item.energyPath}, #{item.energyCode}, #{item.remark})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+</mapper>
|