fix:修复编译报错
This commit is contained in:
parent
8e83c0adc1
commit
99e961c476
|
|
@ -111,4 +111,25 @@ public class AirlineFileGroupInfoController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
/***
|
||||
* 删除分组详情
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws BaseException
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "在当前分组下添加初始航线,必须上传分组ID")
|
||||
public AjaxResult delete(@RequestBody AirlineFileGroupInfoVO vo) throws BaseException {
|
||||
if (vo.getGroupId() == null) {
|
||||
throw new BaseException("分组ID不能为空");
|
||||
}
|
||||
AirlineFileGroupInfoDTO dto = AirlineFileGroupInfoControllerConvert.toDTO(vo);
|
||||
Long result = iAirlineFileGroupInfoService.deleteGroupInf(dto);
|
||||
if (result > 0) {
|
||||
return success(result);
|
||||
}
|
||||
throw new BaseException("删除失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,9 @@ public class AirlineFileGroupInfoControllerConvert {
|
|||
}
|
||||
AirlineFileGroupInfoVO vo = new AirlineFileGroupInfoVO();
|
||||
vo.setId(dto.getId());
|
||||
vo.setAirlineId(dto.getAirlineId());
|
||||
vo.setGroupId(dto.getGroupId());
|
||||
vo.setAirlineFileVO(AirlineFileControllerConvert.toVO(dto.getAirlineFileDTO()));
|
||||
vo.setCreateBy(dto.getCreateBy());
|
||||
vo.setCreateTime(dto.getCreateTime());
|
||||
|
||||
|
|
@ -54,6 +56,7 @@ public class AirlineFileGroupInfoControllerConvert {
|
|||
AirlineFileGroupInfoDTO dto = new AirlineFileGroupInfoDTO();
|
||||
dto.setId(vo.getId());
|
||||
dto.setGroupId(vo.getGroupId());
|
||||
dto.setAirlineId(vo.getAirlineId());
|
||||
dto.setCreateBy(vo.getCreateBy());
|
||||
dto.setCreateTime(vo.getCreateTime());
|
||||
dto.setUpdateBy(vo.getUpdateBy());
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public class AirlineFileDomainImpl implements IAirlineFileDomain {
|
|||
@Override
|
||||
public Long save(AirlineFile model) {
|
||||
AirlineFileEntity entity = AirlineFileDomainConvert.toEntity(model);
|
||||
return airlineFileMapper.save(entity);
|
||||
airlineFileMapper.save(entity);
|
||||
return entity.getId();
|
||||
}
|
||||
}
|
||||
|
|
@ -16,4 +16,5 @@ public interface IAirlineFileGroupInfoService {
|
|||
|
||||
Long save(AirlineFileGroupInfoDTO dto) throws BaseException;
|
||||
|
||||
Long deleteGroupInf(AirlineFileGroupInfoDTO dto) throws BaseException ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,14 +37,18 @@ public class AirlineFileServiceGroupInfoImpl implements IAirlineFileGroupInfoSer
|
|||
@Override
|
||||
public List<AirlineFileGroupInfoDTO> selectGroupInfoListById(Long groupId) {
|
||||
List<AirlineFileGroupInfo> models = iAirlineFileGroupInfoDomain.selectGroupInfoListById(groupId);
|
||||
models.forEach(model -> {
|
||||
model.setAirlineFile(iAirlineFileService.selectById(model.getAirlineId()));
|
||||
});
|
||||
if (models != null) {
|
||||
models.forEach(model -> {
|
||||
model.setAirlineFile(iAirlineFileService.selectById(model.getAirlineId()));
|
||||
});
|
||||
}
|
||||
return AirlineFileGroupInfoServiceConvert.toDtoList(models);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long save(AirlineFileGroupInfoDTO dto) throws BaseException {
|
||||
|
||||
|
||||
AirlineFileDTO result = iAirlineFileService.save(dto.getAirlineFileDTO());
|
||||
|
||||
dto.setAirlineId(result.getId());
|
||||
|
|
@ -52,12 +56,23 @@ public class AirlineFileServiceGroupInfoImpl implements IAirlineFileGroupInfoSer
|
|||
AirlineFileGroupInfo model = AirlineFileGroupInfoServiceConvert.toModel(dto);
|
||||
|
||||
// 检查唯一性:同一个分组下不能有相同的航线
|
||||
boolean exists = iAirlineFileGroupInfoDomain.existsByGroupIdAndAirlineId(model.getGroupId(), model.getAirlineId());
|
||||
if (exists) {
|
||||
throw new BaseException("该航线已存在于当前分组中");
|
||||
}
|
||||
|
||||
|
||||
return iAirlineFileGroupInfoDomain.save(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long deleteGroupInf(AirlineFileGroupInfoDTO dto) throws BaseException {
|
||||
// 检查参数
|
||||
if (dto.getGroupId() == null || dto.getAirlineId() == null) {
|
||||
throw new BaseException("分组ID和航线ID不能为空");
|
||||
}
|
||||
|
||||
// 转换为模型
|
||||
AirlineFileGroupInfo model = AirlineFileGroupInfoServiceConvert.toModel(dto);
|
||||
|
||||
// 调用domain层删除方法
|
||||
return iAirlineFileGroupInfoDomain.deleteGroupInfo(model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -37,13 +37,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
set del_flag = 1,
|
||||
deleted_by = #{deletedBy},
|
||||
deleted_time = #{deletedTime}
|
||||
where id = #{id}
|
||||
<if test="groupId != null">
|
||||
and group_id = #{groupId}
|
||||
</if>
|
||||
<if test="airlineId != null">
|
||||
and airline_id = #{airlineId}
|
||||
</if>
|
||||
<where>
|
||||
<if test="groupId != null">
|
||||
and group_id = #{groupId}
|
||||
</if>
|
||||
<if test="airlineId != null">
|
||||
and airline_id = #{airlineId}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<!-- 保存分组详情 -->
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<!-- 保存航线文件 -->
|
||||
<insert id="save" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileEntity" useGeneratedKeys="true" keyProperty="id">
|
||||
<insert id="save" parameterType="com.ruoyi.airline.mapper.entity.AirlineFileEntity" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
insert into airline_file (name, air_vendor, air_type, file_name, file_url, type, source, status, file_md5, create_by, create_time, update_by, update_time, remark)
|
||||
values (#{name}, #{airVendor}, #{airType}, #{fileName}, #{fileUrl}, #{type}, #{source}, #{status}, #{fileMd5}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{remark})
|
||||
</insert>
|
||||
|
|
|
|||
Loading…
Reference in New Issue