2026-01-16 18:47:52 +08:00
|
|
|
<?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.device.mapper.AircraftMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.ruoyi.device.mapper.entity.AircraftEntity" id="AircraftResult">
|
|
|
|
|
<result property="aircraftId" column="aircraft_id" />
|
|
|
|
|
<result property="aircraftName" column="aircraft_name" />
|
|
|
|
|
<result property="deviceId" column="device_id" />
|
|
|
|
|
<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="selectAircraftVo">
|
|
|
|
|
select aircraft_id, aircraft_name, device_id,
|
|
|
|
|
create_by, create_time, update_by, update_time, remark
|
|
|
|
|
from device_aircraft
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectAircraftByAircraftId" parameterType="Long" resultMap="AircraftResult">
|
|
|
|
|
<include refid="selectAircraftVo"/>
|
|
|
|
|
where aircraft_id = #{aircraftId}
|
|
|
|
|
</select>
|
|
|
|
|
|
2026-01-17 13:57:14 +08:00
|
|
|
<select id="selectAircraftByDeviceId" parameterType="Long" resultMap="AircraftResult">
|
|
|
|
|
<include refid="selectAircraftVo"/>
|
|
|
|
|
where device_id = #{deviceId}
|
|
|
|
|
limit 1
|
|
|
|
|
</select>
|
|
|
|
|
|
2026-01-16 18:47:52 +08:00
|
|
|
<select id="selectAircraftListByDeviceId" parameterType="Long" resultMap="AircraftResult">
|
|
|
|
|
<include refid="selectAircraftVo"/>
|
|
|
|
|
where device_id = #{deviceId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectAircraftList" parameterType="com.ruoyi.device.mapper.entity.AircraftEntity" resultMap="AircraftResult">
|
|
|
|
|
<include refid="selectAircraftVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="aircraftName != null and aircraftName != ''">
|
|
|
|
|
and aircraft_name like concat('%', #{aircraftName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="deviceId != null">
|
|
|
|
|
and device_id = #{deviceId}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertAircraft" parameterType="com.ruoyi.device.mapper.entity.AircraftEntity" useGeneratedKeys="true" keyProperty="aircraftId">
|
|
|
|
|
insert into device_aircraft
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="aircraftName != null and aircraftName != ''">aircraft_name,</if>
|
|
|
|
|
<if test="deviceId != null">device_id,</if>
|
|
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
|
|
|
create_time
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="aircraftName != null and aircraftName != ''">#{aircraftName},</if>
|
|
|
|
|
<if test="deviceId != null">#{deviceId},</if>
|
|
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
|
|
|
now()
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateAircraft" parameterType="com.ruoyi.device.mapper.entity.AircraftEntity">
|
|
|
|
|
update device_aircraft
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="aircraftName != null and aircraftName != ''">aircraft_name = #{aircraftName},</if>
|
|
|
|
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
|
|
update_time = now()
|
|
|
|
|
</trim>
|
|
|
|
|
where aircraft_id = #{aircraftId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteAircraftByAircraftId" parameterType="Long">
|
|
|
|
|
delete from device_aircraft where aircraft_id = #{aircraftId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteAircraftByAircraftIds" parameterType="Long">
|
|
|
|
|
delete from device_aircraft where aircraft_id in
|
|
|
|
|
<foreach item="aircraftId" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{aircraftId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
</mapper>
|