fit:增加批量删除分组航线功能

This commit is contained in:
高大 2026-01-29 11:38:50 +08:00
parent ea0a741933
commit 7e426b3bc7
9 changed files with 97 additions and 1 deletions

View File

@ -48,7 +48,7 @@ public class AirlineFileController extends BaseController {
@Operation(summary = "编辑航线文件描述信息")
public AjaxResult edit(@RequestBody AirlineFileVO entity) {
AirlineFileDTO dto = AirlineFileControllerConvert.to(entity);
return success(airlineFileService.save(dto));
return success(airlineFileService.update(dto));
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.airline.controller;
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
import com.ruoyi.airline.api.domain.AirlineFileGroupInfoVO;
import com.ruoyi.airline.controller.convert.AirlineFileGroupInfoControllerConvert;
import com.ruoyi.airline.service.api.IAirlineFileGroupInfoService;
@ -127,6 +128,28 @@ public class AirlineFileGroupInfoController extends BaseController {
throw new BaseException("删除失败");
}
/***
* 批量删除分组详情
* @param airLineIds
* @return
* @throws BaseException
*/
@DeleteMapping("/batchDelete/{groupId}")
@Operation(summary = "批量删除分组详情")
public AjaxResult delete(@RequestBody List<Long> airLineIds, @PathVariable("groupId") Long groupId) throws BaseException {
if (groupId == null) {
throw new BaseException("分组ID不能为空");
}
if (CollectionUtils.isEmpty(airLineIds)) {
throw new BaseException("没有需要删除的航线");
}
Long result = iAirlineFileGroupInfoService.deleteGroupInfoBatch(airLineIds, groupId);
if (result > 0) {
return success(result);
}
throw new BaseException("删除失败");
}
/***
* 移动分组详情到新分组
* @param vo

View File

@ -41,4 +41,13 @@ public interface IAirlineFileGroupInfoDomain {
* @return 结果
*/
Long moveGroupInfo(Long oldGroupId, Long newGroupId, Long airlineId);
/**
* 批量删除分组详情
*
* @param airLineIds 航线ID列表
* @param groupId 分组ID
* @return 结果
*/
Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId);
}

View File

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

View File

@ -36,4 +36,13 @@ public interface AirlineFileGroupInfoMapper {
* @return 影响的行数
*/
Long updateGroupId(Long oldGroupId, Long newGroupId, Long airlineId);
/**
* 批量删除分组详情
*
* @param airLineIds 航线ID列表
* @param groupId 分组ID
* @return 影响的行数
*/
Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId);
}

View File

@ -26,4 +26,13 @@ public interface IAirlineFileGroupInfoService {
* @throws BaseException
*/
Long moveGroupInfo(AirlineFileGroupInfoDTO dto, Long groupId) throws BaseException;
/**
* 批量删除分组详情
* @param airLineIds 航线ID列表
* @param groupId 分组ID
* @return
* @throws BaseException
*/
Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId) throws BaseException;
}

View File

@ -101,4 +101,14 @@ public class AirlineFileServiceGroupInfoImpl implements IAirlineFileGroupInfoSer
return iAirlineFileGroupInfoDomain.moveGroupInfo(dto.getGroupId(), groupId, dto.getAirlineId());
}
@Override
public Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId) throws BaseException {
// 检查参数
if (groupId == null || airLineIds == null || airLineIds.isEmpty()) {
throw new BaseException("分组ID和航线ID列表不能为空");
}
// 调用domain层批量删除方法
return iAirlineFileGroupInfoDomain.deleteGroupInfoBatch(airLineIds, groupId);
}
}

View File

@ -75,4 +75,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and group_id = #{oldGroupId}
and airline_id = #{airlineId}
</update>
<!-- 批量删除分组详情(软删除) -->
<update id="deleteGroupInfoBatch">
update airline_file_group_info
set del_flag = 1,
deleted_time = now()
where del_flag = 0
and group_id = #{groupId}
and airline_id in
<foreach item="airlineId" collection="airLineIds" open="(" separator="," close=")">
#{airlineId}
</foreach>
</update>
</mapper>

View File

@ -55,4 +55,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and afgi.group_id = #{groupId}
and af.name like concat(#{name}, '%')
</select>
<!-- 更新航线文件 -->
<update id="update" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileEntity">
update airline_file
set name = #{name},
air_vendor = #{airVendor},
air_type = #{airType},
file_name = #{fileName},
file_url = #{fileUrl},
type = #{type},
source = #{source},
status = #{status},
file_md5 = #{fileMd5},
update_by = #{updateBy},
update_time = now(),
remark = #{remark}
where id = #{id}
</update>
</mapper>