Merge remote-tracking branch 'origin/main'

This commit is contained in:
gyb 2026-01-30 15:58:10 +08:00
commit f2f849c6e6
8 changed files with 124 additions and 11 deletions

View File

@ -172,5 +172,26 @@ public class AirlineFileGroupInfoController extends BaseController {
throw new BaseException("移动失败");
}
@PostMapping("/move/{groupId}/{newGroupId}")
@Operation(summary = "批量移动分组详情到新分组")
public AjaxResult batchMove(@RequestBody List<Long> airlines, @PathVariable("groupId") Long groupId, @PathVariable("newGroupId") Long newGroupId) throws BaseException {
if (groupId == null) {
throw new BaseException("原分组ID不能为空");
}
if (newGroupId == null) {
throw new BaseException("新分组ID不能为空");
}
if (CollectionUtils.isEmpty(airlines)) {
throw new BaseException("没有需要移动的航线");
}
Long result = iAirlineFileGroupInfoService.batchMoveGroupInfo(
airlines, groupId, newGroupId
);
if (result > 0) {
return success(result);
}
throw new BaseException("移动失败");
}
}

View File

@ -50,4 +50,14 @@ public interface IAirlineFileGroupInfoDomain {
* @return 结果
*/
Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId);
/**
* 批量移动分组详情到新分组
*
* @param oldGroupId 原分组ID
* @param newGroupId 新分组ID
* @param airLineIds 航线ID列表
* @return 结果
*/
Long batchMoveGroupInfo(Long oldGroupId, Long newGroupId, List<Long> airLineIds);
}

View File

@ -63,4 +63,9 @@ public class AirlineFileGroupInfoDomainImpl implements IAirlineFileGroupInfoDoma
public Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId) {
return airlineFileGroupInfoMapper.deleteGroupInfoBatch(airLineIds, groupId);
}
@Override
public Long batchMoveGroupInfo(Long oldGroupId, Long newGroupId, List<Long> airLineIds) {
return airlineFileGroupInfoMapper.batchUpdateGroupId(oldGroupId, newGroupId, airLineIds);
}
}

View File

@ -45,4 +45,14 @@ public interface AirlineFileGroupInfoMapper {
* @return 影响的行数
*/
Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId);
/**
* 批量更新分组ID将航线文件从一个分组移动到另一个分组
*
* @param oldGroupId 原分组ID
* @param newGroupId 新分组ID
* @param airLineIds 航线文件ID列表
* @return 影响的行数
*/
Long batchUpdateGroupId(Long oldGroupId, Long newGroupId, List<Long> airLineIds);
}

View File

@ -35,4 +35,14 @@ public interface IAirlineFileGroupInfoService {
* @throws BaseException
*/
Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId) throws BaseException;
/**
* 批量移动分组详情到新分组
* @param airLineIds 航线ID列表
* @param groupId 原分组ID
* @param newGroupId 新分组ID
* @return
* @throws BaseException
*/
Long batchMoveGroupInfo(List<Long> airLineIds, Long groupId, Long newGroupId) throws BaseException;
}

View File

@ -111,4 +111,26 @@ public class AirlineFileServiceGroupInfoImpl implements IAirlineFileGroupInfoSer
// 调用domain层批量删除方法
return iAirlineFileGroupInfoDomain.deleteGroupInfoBatch(airLineIds, groupId);
}
@Override
public Long batchMoveGroupInfo(List<Long> airLineIds, Long groupId, Long newGroupId) throws BaseException {
// 检查参数
if (groupId == null || newGroupId == null || airLineIds == null || airLineIds.isEmpty()) {
throw new BaseException("原分组ID、新分组ID和航线ID列表不能为空");
}
// 为每个航线生成新的文件名并更新
for (Long airlineId : airLineIds) {
AirlineFileDTO airlineFile = iAirlineFileService.selectById(airlineId);
if (airlineFile != null) {
String name = airlineFile.getName();
name = iAirlineFileService.getNewFileNameLikeByGroupId(name, newGroupId);
airlineFile.setName(name);
iAirlineFileService.update(airlineFile);
}
}
// 调用domain层批量移动方法
return iAirlineFileGroupInfoDomain.batchMoveGroupInfo(groupId, newGroupId, airLineIds);
}
}

View File

@ -88,4 +88,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{airlineId}
</foreach>
</update>
<!-- 批量更新分组ID将航线文件从一个分组移动到另一个分组 -->
<update id="batchUpdateGroupId">
update airline_file_group_info
set group_id = #{newGroupId},
update_time = now()
where del_flag = 0
and group_id = #{oldGroupId}
and airline_id in
<foreach item="airlineId" collection="airLineIds" open="(" separator="," close=")">
#{airlineId}
</foreach>
</update>
</mapper>

View File

@ -59,18 +59,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 更新航线文件 -->
<update id="update" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileEntity">
update airline_file
set name = #{name},
<trim prefix="set" suffixOverrides=",">
name = #{name},
<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="updateBy != null">
update_by = #{updateBy},
</if>
update_time = now(),
remark = #{remark}
<if test="remark != null">
remark = #{remark},
</if>
</trim>
where id = #{id}
</update>
</mapper>