feat:增加批量移动接口,优化查询接口逻辑
This commit is contained in:
parent
e761efb850
commit
c7793d7c71
|
|
@ -98,8 +98,10 @@ public class AirlineMarkerController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/user-available")
|
@GetMapping("/user-available")
|
||||||
@Operation(summary = "获取用户下所有可用标注")
|
@Operation(summary = "获取用户下所有可用标注")
|
||||||
public AjaxResult getUserAvailableMarkers() {
|
public AjaxResult getUserAvailableMarkers(AirlineMarkerVO vo) {
|
||||||
List<AirlineMarkerDTO> dtoList = iAirlineMarkerGroupInfoService.selectUserAvailableMarkers();
|
AirlineMarkerDTO dto = AirlineMarkerControllerConvert.to(vo);
|
||||||
|
dto.setCreateBy(SecurityUtils.getUserId().toString());
|
||||||
|
List<AirlineMarkerDTO> dtoList = iAirlineMarkerGroupInfoService.selectAllAvailableMarkers(dto);
|
||||||
List<AirlineMarkerVO> result = AirlineMarkerControllerConvert.fromList(dtoList);
|
List<AirlineMarkerVO> result = AirlineMarkerControllerConvert.fromList(dtoList);
|
||||||
return success(result);
|
return success(result);
|
||||||
}
|
}
|
||||||
|
|
@ -109,8 +111,10 @@ public class AirlineMarkerController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/all-available")
|
@GetMapping("/all-available")
|
||||||
@Operation(summary = "获取全部可用标注")
|
@Operation(summary = "获取全部可用标注")
|
||||||
public AjaxResult getAllAvailableMarkers() {
|
public AjaxResult getAllAvailableMarkers(AirlineMarkerVO vo) {
|
||||||
List<AirlineMarkerDTO> dtoList = iAirlineMarkerGroupInfoService.selectAllAvailableMarkers();
|
AirlineMarkerDTO dto = AirlineMarkerControllerConvert.to(vo);
|
||||||
|
dto.setStatus(1);
|
||||||
|
List<AirlineMarkerDTO> dtoList = iAirlineMarkerGroupInfoService.selectAllAvailableMarkers(dto);
|
||||||
List<AirlineMarkerVO> result = AirlineMarkerControllerConvert.fromList(dtoList);
|
List<AirlineMarkerVO> result = AirlineMarkerControllerConvert.fromList(dtoList);
|
||||||
return success(result);
|
return success(result);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,4 +31,11 @@ public interface IAirlineMarkerDomain {
|
||||||
* @return 标注列表
|
* @return 标注列表
|
||||||
*/
|
*/
|
||||||
List<AirlineMarker> selectMarkerListByUserId(AirlineMarker model);
|
List<AirlineMarker> selectMarkerListByUserId(AirlineMarker model);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有可用标注(关联分组信息表)
|
||||||
|
* @param model 查询条件
|
||||||
|
* @return 标注列表
|
||||||
|
*/
|
||||||
|
List<AirlineMarker> selectAllAvailableMarkers(AirlineMarker model);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,4 +78,10 @@ public class AirlineMarkerDomainImpl implements IAirlineMarkerDomain {
|
||||||
AirlineMarkerEntity entity = AirlineMarkerDomainConvert.to(model);
|
AirlineMarkerEntity entity = AirlineMarkerDomainConvert.to(model);
|
||||||
return AirlineMarkerDomainConvert.fromList(airlineMarkerMapper.selectMarkerListByUserId(entity));
|
return AirlineMarkerDomainConvert.fromList(airlineMarkerMapper.selectMarkerListByUserId(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AirlineMarker> selectAllAvailableMarkers(AirlineMarker model) {
|
||||||
|
AirlineMarkerEntity entity = AirlineMarkerDomainConvert.to(model);
|
||||||
|
return AirlineMarkerDomainConvert.fromList(airlineMarkerMapper.selectAllAvailableMarkers(entity));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,11 @@ public interface AirlineMarkerMapper {
|
||||||
* @return 标注列表
|
* @return 标注列表
|
||||||
*/
|
*/
|
||||||
List<AirlineMarkerEntity> selectMarkerListByUserId(AirlineMarkerEntity entity);
|
List<AirlineMarkerEntity> selectMarkerListByUserId(AirlineMarkerEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有可用标注(关联分组信息表)
|
||||||
|
* @param entity 查询条件
|
||||||
|
* @return 标注列表
|
||||||
|
*/
|
||||||
|
List<AirlineMarkerEntity> selectAllAvailableMarkers(AirlineMarkerEntity entity);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,10 @@ public interface IAirlineMarkerGroupInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取全部可用标注
|
* 获取全部可用标注
|
||||||
|
* @param dto 查询条件
|
||||||
* @return 标注列表
|
* @return 标注列表
|
||||||
*/
|
*/
|
||||||
List<AirlineMarkerDTO> selectAllAvailableMarkers();
|
List<AirlineMarkerDTO> selectAllAvailableMarkers(AirlineMarkerDTO dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量移动标注到指定分组
|
* 批量移动标注到指定分组
|
||||||
|
|
|
||||||
|
|
@ -161,42 +161,24 @@ public class AirlineMarkerGroupInfoServiceImpl implements IAirlineMarkerGroupInf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AirlineMarkerDTO> selectAllAvailableMarkers() {
|
public List<AirlineMarkerDTO> selectAllAvailableMarkers(AirlineMarkerDTO queryDto) {
|
||||||
// 先获取所有未被删除的标注分组关系
|
// 将 DTO 转换为 Model,用于查询条件
|
||||||
AirlineMarkerGroupInfo groupInfo = new AirlineMarkerGroupInfo();
|
AirlineMarker model = new AirlineMarker();
|
||||||
// 只查询未被删除的记录(deletedBy 为 null)
|
if (queryDto != null) {
|
||||||
List<AirlineMarkerGroupInfo> groupInfos = iAirlineMarkerGroupInfoDomain.selectMarkerGroupInfoList(groupInfo);
|
model.setCreateBy(queryDto.getCreateBy());
|
||||||
|
model.setMarkerName(queryDto.getMarkerName());
|
||||||
if (groupInfos == null || groupInfos.isEmpty()) {
|
model.setMarkerType(queryDto.getMarkerType());
|
||||||
return List.of();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提取标注ID列表
|
// 直接通过 XML 关联 SQL 查询所有可用标注
|
||||||
List<Long> markerIds = groupInfos.stream()
|
List<AirlineMarker> markers = iAirlineMarkerDomain.selectAllAvailableMarkers(model);
|
||||||
.map(AirlineMarkerGroupInfo::getMarkerId)
|
|
||||||
.distinct()
|
|
||||||
.collect(java.util.stream.Collectors.toList());
|
|
||||||
|
|
||||||
if (markerIds.isEmpty()) {
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据标注ID列表查询标注详情
|
|
||||||
List<AirlineMarker> markers = iAirlineMarkerDomain.selectMarkerListByIds(markerIds);
|
|
||||||
|
|
||||||
if (markers == null || markers.isEmpty()) {
|
if (markers == null || markers.isEmpty()) {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 过滤出启用的标注
|
// 转换为 DTO 并返回
|
||||||
List<AirlineMarkerDTO> availableMarkers = new ArrayList<>();
|
return AirlineMarkerServiceConvert.fromList(markers);
|
||||||
for (AirlineMarker airlineMarker : markers) {
|
|
||||||
if (airlineMarker.getStatus() == 1) {
|
|
||||||
availableMarkers.add(AirlineMarkerServiceConvert.from(airlineMarker));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return availableMarkers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -31,17 +31,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<!-- 更新标注 -->
|
<!-- 更新标注 -->
|
||||||
<update id="updateMarker" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerEntity">
|
<update id="updateMarker" parameterType="com.ruoyi.airline.mapper.entity.AirlineMarkerEntity">
|
||||||
update airline_marker
|
update airline_marker
|
||||||
set marker_name = #{markerName},
|
<set>
|
||||||
|
<if test="markerName != null and markerName != ''">
|
||||||
|
marker_name = #{markerName},
|
||||||
|
</if>
|
||||||
|
<if test="markerType != null and markerType != ''">
|
||||||
marker_type = #{markerType},
|
marker_type = #{markerType},
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
status = #{status},
|
status = #{status},
|
||||||
|
</if>
|
||||||
|
<if test="color != null and color != ''">
|
||||||
color = #{color},
|
color = #{color},
|
||||||
|
</if>
|
||||||
|
<if test="icon != null and icon != ''">
|
||||||
icon = #{icon},
|
icon = #{icon},
|
||||||
|
</if>
|
||||||
|
<if test="fontSize != null">
|
||||||
font_size = #{fontSize},
|
font_size = #{fontSize},
|
||||||
|
</if>
|
||||||
|
<if test="coordinates != null">
|
||||||
coordinates = #{coordinates},
|
coordinates = #{coordinates},
|
||||||
|
</if>
|
||||||
|
<if test="description != null and description != ''">
|
||||||
description = #{description},
|
description = #{description},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">
|
||||||
update_by = #{updateBy},
|
update_by = #{updateBy},
|
||||||
|
</if>
|
||||||
update_time = now(),
|
update_time = now(),
|
||||||
remark = #{remark}
|
<if test="remark != null and remark != ''">
|
||||||
|
remark = #{remark},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
@ -117,4 +139,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</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
|
||||||
|
<where>
|
||||||
|
amgi.del_flag = 0
|
||||||
|
and amgi.deleted_by is null
|
||||||
|
and amgi.deleted_time 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>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue