Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
f2f849c6e6
|
|
@ -172,5 +172,26 @@ public class AirlineFileGroupInfoController extends BaseController {
|
||||||
throw new BaseException("移动失败");
|
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("移动失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,4 +50,14 @@ public interface IAirlineFileGroupInfoDomain {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,9 @@ public class AirlineFileGroupInfoDomainImpl implements IAirlineFileGroupInfoDoma
|
||||||
public Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId) {
|
public Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId) {
|
||||||
return airlineFileGroupInfoMapper.deleteGroupInfoBatch(airLineIds, groupId);
|
return airlineFileGroupInfoMapper.deleteGroupInfoBatch(airLineIds, groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long batchMoveGroupInfo(Long oldGroupId, Long newGroupId, List<Long> airLineIds) {
|
||||||
|
return airlineFileGroupInfoMapper.batchUpdateGroupId(oldGroupId, newGroupId, airLineIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,4 +45,14 @@ public interface AirlineFileGroupInfoMapper {
|
||||||
* @return 影响的行数
|
* @return 影响的行数
|
||||||
*/
|
*/
|
||||||
Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,4 +35,14 @@ public interface IAirlineFileGroupInfoService {
|
||||||
* @throws BaseException
|
* @throws BaseException
|
||||||
*/
|
*/
|
||||||
Long deleteGroupInfoBatch(List<Long> airLineIds, Long groupId) 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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,4 +111,26 @@ public class AirlineFileServiceGroupInfoImpl implements IAirlineFileGroupInfoSer
|
||||||
// 调用domain层批量删除方法
|
// 调用domain层批量删除方法
|
||||||
return iAirlineFileGroupInfoDomain.deleteGroupInfoBatch(airLineIds, groupId);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -88,4 +88,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{airlineId}
|
#{airlineId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</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>
|
</mapper>
|
||||||
|
|
@ -59,18 +59,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<!-- 更新航线文件 -->
|
<!-- 更新航线文件 -->
|
||||||
<update id="update" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileEntity">
|
<update id="update" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileEntity">
|
||||||
update airline_file
|
update airline_file
|
||||||
set name = #{name},
|
<trim prefix="set" suffixOverrides=",">
|
||||||
air_vendor = #{airVendor},
|
name = #{name},
|
||||||
air_type = #{airType},
|
<if test="airVendor != null">
|
||||||
file_name = #{fileName},
|
air_vendor = #{airVendor},
|
||||||
file_url = #{fileUrl},
|
</if>
|
||||||
type = #{type},
|
<if test="airType != null">
|
||||||
source = #{source},
|
air_type = #{airType},
|
||||||
status = #{status},
|
</if>
|
||||||
file_md5 = #{fileMd5},
|
<if test="fileName != null">
|
||||||
update_by = #{updateBy},
|
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(),
|
update_time = now(),
|
||||||
remark = #{remark}
|
<if test="remark != null">
|
||||||
|
remark = #{remark},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue