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

166 lines
7.4 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.AirlineMarkerMapper">
<!-- 结果映射 -->
<resultMap id="AirlineMarkerResult" type="com.ruoyi.airline.mapper.entity.AirlineMarkerEntity">
<id property="id" column="id" />
<result property="markerName" column="marker_name" />
<result property="markerType" column="marker_type" />
<result property="status" column="status" />
<result property="color" column="color" />
<result property="icon" column="icon" />
<result property="fontSize" column="font_size" />
<result property="coordinates" column="coordinates" />
<result property="description" column="description" />
<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="insertMarker" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerEntity" useGeneratedKeys="true" keyProperty="id">
insert into airline_marker (marker_name, marker_type, color, icon, font_size, coordinates, description, create_by, create_time, update_by, update_time, remark)
values (#{markerName}, #{markerType}, #{color}, #{icon}, #{fontSize}, #{coordinates}, #{description}, #{createBy}, now(), #{updateBy}, now(), #{remark})
</insert>
<!-- 更新标注 -->
<update id="updateMarker" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerEntity">
update airline_marker
<set>
<if test="markerName != null and markerName != ''">
marker_name = #{markerName},
</if>
<if test="markerType != null and markerType != ''">
marker_type = #{markerType},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="color != null and color != ''">
color = #{color},
</if>
<if test="icon != null and icon != ''">
icon = #{icon},
</if>
<if test="fontSize != null">
font_size = #{fontSize},
</if>
<if test="coordinates != null">
coordinates = #{coordinates},
</if>
<if test="description != null and description != ''">
description = #{description},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
update_time = now(),
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
</set>
where id = #{id}
</update>
<!-- 删除标注 -->
<update id="deleteMarker" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerEntity">
update airline_marker
set status = 0,
update_by = #{updateBy},
update_time = now()
where id = #{id}
</update>
<!-- 查询标注列表 -->
<select id="selectMarkerList" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerEntity" resultMap="AirlineMarkerResult">
select id, marker_name, marker_type, status, color, icon, font_size, coordinates, description, create_by, create_time, update_by, update_time, remark
from airline_marker
<where>
status = 1
<if test="id != null">
and id = #{id}
</if>
<if test="markerName != null and markerName != ''">
and marker_name like concat('%', #{markerName}, '%')
</if>
<if test="markerType != null and markerType != ''">
and marker_type = #{markerType}
</if>
<if test="status != null">
and status = #{status}
</if>
</where>
</select>
<!-- 根据ID查询标注 -->
<select id="selectMarkerById" parameterType="java.lang.Long" resultMap="AirlineMarkerResult">
select id, marker_name, marker_type, status, color, icon, font_size, coordinates, description, create_by, create_time, update_by, update_time, remark
from airline_marker
where id = #{id}
</select>
<!-- 根据ID列表查询标注 -->
<select id="selectMarkerListByIds" parameterType="java.util.List" resultMap="AirlineMarkerResult">
select id, marker_name, marker_type, status, color, icon, font_size, coordinates, description, create_by, create_time, update_by, update_time, remark
from airline_marker
where id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
and status = 1
</select>
<!-- 根据用户ID查询标注列表 -->
<select id="selectMarkerListByUserId" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerEntity" resultMap="AirlineMarkerResult">
select distinct am.id, am.marker_name, am.marker_type, am.status, am.color, am.icon, am.font_size, am.coordinates, am.description, am.create_by, am.create_time, am.update_by, am.update_time, am.remark
from airline_marker am
left join airline_marker_group_info amgi on am.id = amgi.marker_id
left join airline_marker_group amg on amgi.group_id = amg.id
<where>
amgi.del_flag = 0
and (amg.del_flag = 0 or amg.del_flag is null)
<if test="createBy != null and createBy != ''">
and am.create_by = #{createBy}
</if>
<if test="markerName != null and markerName != ''">
and am.marker_name like concat('%', #{markerName}, '%')
</if>
<if test="markerType != null and markerType != ''">
and am.marker_type = #{markerType}
</if>
<if test="status != null">
and am.status = #{status}
</if>
</where>
</select>
<!-- 查询所有可用标注(关联分组信息表) -->
<select id="selectAllAvailableMarkers" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerEntity" resultMap="AirlineMarkerResult">
select distinct am.id, am.marker_name, am.marker_type, am.status, am.color, am.icon, am.font_size, am.coordinates, am.description, am.create_by, am.create_time, am.update_by, am.update_time, am.remark
from airline_marker am
inner join airline_marker_group_info amgi on am.id = amgi.marker_id
left join airline_marker_group amg on amgi.group_id = amg.id
<where>
amgi.del_flag = 0
and amgi.deleted_by is null
and amgi.deleted_time is null
and (amg.del_flag = 0 or amg.del_flag is null)
<if test="createBy != null and createBy != ''">
and am.create_by = #{createBy}
</if>
<if test="markerName != null and markerName != ''">
and am.marker_name like concat('%', #{markerName}, '%')
</if>
<if test="markerType != null and markerType != ''">
and am.marker_type = #{markerType}
</if>
</where>
</select>
</mapper>