| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?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.ufo.project.config.mapper.ConfigStationDeviceMapper">
- <resultMap type="ConfigStationDevice" id="ConfigStationDeviceResult">
- <result property="id" column="id" />
- <result property="stationId" column="station_id" />
- <result property="stationName" column="station_name" />
- <result property="deviceName" column="device_name" />
- <result property="deviceType" column="device_type" />
- <result property="brand" column="brand" />
- <result property="model" column="model" />
- <result property="serialNumber" column="serial_number" />
- <result property="status" column="status" />
- <result property="installDate" column="install_date" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="remark" column="remark" />
- </resultMap>
- <sql id="selectConfigStationDeviceVo">
- select t.id, t.station_id, s.station_name, t.device_name, t.device_type, t.brand, t.model, t.serial_number, t.status, t.install_date, t.create_by, t.create_time, t.update_by, t.update_time, t.remark from config_station_device t left join config_station s on s.id = t.station_id
- </sql>
- <select id="selectConfigStationDeviceList" parameterType="ConfigStationDevice" resultMap="ConfigStationDeviceResult">
- <include refid="selectConfigStationDeviceVo"/>
- <where>
- <if test="stationId != null"> and t.station_id = #{stationId}</if>
- <if test="deviceName != null and deviceName != ''"> and t.device_name like concat('%', #{deviceName}, '%')</if>
- <if test="deviceType != null"> and t.device_type = #{deviceType}</if>
- <if test="brand != null and brand != ''"> and t.brand like concat('%', #{brand}, '%')</if>
- <if test="model != null and model != ''"> and t.model like concat('%', #{model}, '%')</if>
- <if test="serialNumber != null and serialNumber != ''"> and t.serial_number like concat('%', #{serialNumber}, '%')</if>
- <if test="status != null"> and t.status = #{status}</if>
- </where>
- order by t.id desc
- </select>
- <select id="selectConfigStationDeviceById" parameterType="Long" resultMap="ConfigStationDeviceResult">
- <include refid="selectConfigStationDeviceVo"/>
- where t.id = #{id}
- </select>
- <insert id="insertConfigStationDevice" parameterType="ConfigStationDevice" useGeneratedKeys="true" keyProperty="id">
- insert into config_station_device (station_id, device_name, device_type, brand, model, serial_number, status, install_date, create_by, create_time, update_by, update_time, remark)
- values (#{stationId}, #{deviceName}, #{deviceType}, #{brand}, #{model}, #{serialNumber}, #{status}, #{installDate}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{remark})
- </insert>
- <update id="updateConfigStationDevice" parameterType="ConfigStationDevice">
- update config_station_device
- <trim prefix="SET" suffixOverrides=",">
- <if test="stationId != null">station_id = #{stationId},</if>
- <if test="deviceName != null">device_name = #{deviceName},</if>
- <if test="deviceType != null">device_type = #{deviceType},</if>
- <if test="brand != null">brand = #{brand},</if>
- <if test="model != null">model = #{model},</if>
- <if test="serialNumber != null">serial_number = #{serialNumber},</if>
- <if test="status != null">status = #{status},</if>
- <if test="installDate != null">install_date = #{installDate},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="remark != null">remark = #{remark},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteConfigStationDeviceById" parameterType="Long">
- delete from config_station_device where id = #{id}
- </delete>
- <delete id="deleteConfigStationDeviceByIds" parameterType="Long">
- delete from config_station_device where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|