a-tuoheng-airline/src/main/resources/mapper/airline/AirlineFileMapper.xml

125 lines
5.8 KiB
XML

<?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.airline.mapper.AirlineFileMapper">
<!-- 结果映射 -->
<resultMap type="com.ruoyi.airline.mapper.entity.AirlineFileEntity" id="AirlineFileResult">
<id property="id" column="id" />
<result property="name" column="name" />
<result property="airVendor" column="air_vendor" />
<result property="airType" column="air_type" />
<result property="fileName" column="file_name" />
<result property="fileUrl" column="file_url" />
<result property="type" column="type" />
<result property="source" column="source" />
<result property="status" column="status" />
<result property="fileMd5" column="file_md5" />
<result property="climbMode" column="climb_mode" />
<result property="altitude" column="altitude" />
<result property="flightSpeed" column="flight_speed" />
<result property="globalWaypointHeight" column="global_waypoint_height" />
<result property="photoMode" column="photo_mode" />
<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>
<!-- 保存航线文件 -->
<insert id="save" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileEntity" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into airline_file (name, air_vendor, air_type, file_name, file_url, type, source, status, file_md5, climb_mode, altitude, flight_speed, global_waypoint_height, photo_mode, create_by, create_time, update_by, update_time, remark)
values (#{name}, #{airVendor}, #{airType}, #{fileName}, #{fileUrl}, #{type}, #{source}, #{status}, #{fileMd5}, #{climbMode}, #{altitude}, #{flightSpeed}, #{globalWaypointHeight}, #{photoMode}, #{createBy}, now(), #{updateBy}, now(), #{remark})
</insert>
<!-- 根据ID列表查询航线文件 -->
<select id="selectFileListByIds" parameterType="java.util.List" resultMap="AirlineFileResult">
select id, name, air_vendor, air_type, file_name, file_url, type, source, status, file_md5, climb_mode, altitude, flight_speed, global_waypoint_height, photo_mode, create_by, create_time, update_by, update_time, remark
from airline_file
where id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
order by update_time desc
</select>
<!-- 根据航线名称模糊查询航线文件 -->
<select id="selectFileNameLike" parameterType="java.lang.String" resultMap="AirlineFileResult">
select id, name, air_vendor, air_type, file_name, file_url, type, source, status, file_md5, climb_mode, altitude, flight_speed, global_waypoint_height, photo_mode, create_by, create_time, update_by, update_time, remark
from airline_file
where name like concat(#{name}, '%')
order by update_time desc
</select>
<!-- 根据分组ID和航线名称模糊查询航线文件 -->
<select id="selectFileNameLikeByGroupId" parameterType="java.util.Map" resultMap="AirlineFileResult">
select af.id, af.name, af.air_vendor, af.air_type, af.file_name, af.file_url, af.type, af.source, af.status, af.file_md5, af.climb_mode, af.altitude, af.flight_speed, af.global_waypoint_height, af.photo_mode, af.create_by, af.create_time, af.update_by, af.update_time, af.remark
from airline_file af
inner join airline_file_group_info afgi on af.id = afgi.airline_id
where afgi.del_flag = 0
and afgi.group_id = #{groupId}
and af.name like concat(#{name}, '%')
order by af.update_time desc
</select>
<!-- 更新航线文件 -->
<update id="update" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileEntity">
update airline_file
<trim prefix="set" suffixOverrides=",">
<if test="name != null">
name = #{name},
</if>
<if test="airVendor != null">
air_vendor = #{airVendor},
</if>
<if test="airType != null">
air_type = #{airType},
</if>
<if test="fileName != null">
file_name = #{fileName},
</if>
<if test="fileUrl != null">
file_url = #{fileUrl},
</if>
<if test="type != null">
type = #{type},
</if>
<if test="source != null">
source = #{source},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="fileMd5 != null">
file_md5 = #{fileMd5},
</if>
<if test="climbMode != null">
climb_mode = #{climbMode},
</if>
<if test="altitude != null">
altitude = #{altitude},
</if>
<if test="flightSpeed != null">
flight_speed = #{flightSpeed},
</if>
<if test="globalWaypointHeight != null">
global_waypoint_height = #{globalWaypointHeight},
</if>
<if test="photoMode != null">
photo_mode = #{photoMode},
</if>
<if test="updateBy != null">
update_by = #{updateBy},
</if>
update_time = now(),
<if test="remark != null">
remark = #{remark},
</if>
</trim>
where id = #{id}
</update>
</mapper>