|
@@ -0,0 +1,94 @@
|
|
|
+<?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.ems.mapper.AdmEmsDeviceMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.ruoyi.ems.domain.AdmEmsDevice" id="AdmEmsDeviceResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="deviceCode" column="device_code" />
|
|
|
+ <result property="deviceName" column="device_name" />
|
|
|
+ <result property="deviceType" column="device_type" />
|
|
|
+ <result property="deviceStatus" column="device_status" />
|
|
|
+ <result property="areaType" column="area_type" />
|
|
|
+ <result property="refArea" column="ref_area" />
|
|
|
+ <result property="refFacs" column="ref_facs" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectAdmEmsDeviceVo">
|
|
|
+ select id, device_code, device_name, device_type, device_status, area_type, ref_area, ref_facs, create_time, update_time from adm_ems_device
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectAdmEmsDeviceList" parameterType="com.ruoyi.ems.domain.AdmEmsDevice" resultMap="AdmEmsDeviceResult">
|
|
|
+ <include refid="selectAdmEmsDeviceVo"/>
|
|
|
+ <where>
|
|
|
+ <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="deviceType != null "> and device_type = #{deviceType}</if>
|
|
|
+ <if test="deviceStatus != null "> and device_status = #{deviceStatus}</if>
|
|
|
+ <if test="areaType != null and areaType != ''"> and area_type = #{areaType}</if>
|
|
|
+ <if test="refArea != null and refArea != ''"> and ref_area = #{refArea}</if>
|
|
|
+ <if test="refFacs != null and refFacs != ''"> and ref_facs = #{refFacs}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectAdmEmsDeviceById" parameterType="Long" resultMap="AdmEmsDeviceResult">
|
|
|
+ <include refid="selectAdmEmsDeviceVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertAdmEmsDevice" parameterType="com.ruoyi.ems.domain.AdmEmsDevice" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into adm_ems_device
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">device_code,</if>
|
|
|
+ <if test="deviceName != null and deviceName != ''">device_name,</if>
|
|
|
+ <if test="deviceType != null">device_type,</if>
|
|
|
+ <if test="deviceStatus != null">device_status,</if>
|
|
|
+ <if test="areaType != null">area_type,</if>
|
|
|
+ <if test="refArea != null">ref_area,</if>
|
|
|
+ <if test="refFacs != null">ref_facs,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
|
|
|
+ <if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
|
|
+ <if test="deviceType != null">#{deviceType},</if>
|
|
|
+ <if test="deviceStatus != null">#{deviceStatus},</if>
|
|
|
+ <if test="areaType != null">#{areaType},</if>
|
|
|
+ <if test="refArea != null">#{refArea},</if>
|
|
|
+ <if test="refFacs != null">#{refFacs},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateAdmEmsDevice" parameterType="com.ruoyi.ems.domain.AdmEmsDevice">
|
|
|
+ update adm_ems_device
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
|
|
|
+ <if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
|
|
|
+ <if test="deviceType != null">device_type = #{deviceType},</if>
|
|
|
+ <if test="deviceStatus != null">device_status = #{deviceStatus},</if>
|
|
|
+ <if test="areaType != null">area_type = #{areaType},</if>
|
|
|
+ <if test="refArea != null">ref_area = #{refArea},</if>
|
|
|
+ <if test="refFacs != null">ref_facs = #{refFacs},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteAdmEmsDeviceById" parameterType="Long">
|
|
|
+ delete from adm_ems_device where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteAdmEmsDeviceByIds" parameterType="String">
|
|
|
+ delete from adm_ems_device where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|