认证-上报库-删除

This commit is contained in:
liyawei
2022-09-13 10:48:25 +08:00
parent 2872feb45c
commit 7c0cc6e8f2
9 changed files with 95 additions and 21 deletions
@@ -101,6 +101,23 @@ public class ParamsReportEOController extends JeroController<ParamsReportEO, IPa
return Result.OK(pageList);
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "上报库-通过id删除")
@ApiOperation(value="上报库-通过id删除", notes="上报库-通过id删除")
@GetMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
boolean isSuccess = paramsReportEOService.deleteById(id);
if (isSuccess) {
return Result.OK("删除成功!");
} else {
return Result.error("删除失败!");
}
}
@@ -147,20 +164,6 @@ public class ParamsReportEOController extends JeroController<ParamsReportEO, IPa
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "上报库-通过id删除")
@ApiOperation(value="上报库-通过id删除", notes="上报库-通过id删除")
@GetMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
paramsReportEOService.deleteById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
@@ -30,4 +30,11 @@ public interface IParamsReportConfigDataEOService extends IService<ParamsReportC
* @return
*/
List<ParamsReportConfigDataEO> queryListByConfigIdList(List<String> configIdList);
/**
* 批量删除清单的所有配置数据
* @param paramsReportDetailIdList
* @return
*/
int deleteByParamsReportDetailIdList(List<String> paramsReportDetailIdList);
}
@@ -59,4 +59,6 @@ public interface IParamsReportDetailEOService extends IService<ParamsReportDetai
// 保存
boolean save(List<Map<String, Object>> configDataList, String paramsManifestId);
// 删除
boolean deleteByIds(List<String> ids);
}
@@ -36,7 +36,7 @@ public interface IParamsReportEOService extends IService<ParamsReportEO> {
* @param id
* @return
*/
void deleteById(String id);
boolean deleteById(String id);
/**
* 批量删除
@@ -61,4 +61,6 @@ public interface IParamsReportExportHistoryEOService extends IService<ParamsRepo
List<ParamsReportExportHistoryEO> queryList();
IPage queryPage(IPage page, ParamsReportExportHistoryEO paramsReportExportHistoryEO, String cut);
void deleteByParamsManifestId(String paramsManifestId);
}
@@ -55,4 +55,11 @@ public class ParamsReportConfigDataEOServiceImpl extends ServiceImpl<ParamsRepor
return null;
}
@Override
public int deleteByParamsReportDetailIdList(List<String> paramsReportDetailIdList) {
LambdaQueryWrapper<ParamsReportConfigDataEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(ParamsReportConfigDataEO::getParamsCollectManifestId, paramsReportDetailIdList);
return baseMapper.delete(queryWrapper);
}
}
@@ -1711,6 +1711,19 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
}
}
/**
* 删除
*
* @param ids
* @return
*/
@Override
public boolean deleteByIds(List<String> ids) {
// 关联删除配置数据
paramsReportConfigDataEOService.deleteByParamsReportDetailIdList(ids);
return removeByIds(ids);
}
/**
* 实体对象转成Map
* @param obj 实体对象
@@ -6,9 +6,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.modules.cert.collect.mapper.ParamsManifestEOMapper;
import com.jero.modules.cert.collect.vo.ParamsManifestVO;
import com.jero.modules.cert.report.entity.ParamsReportConfigEO;
import com.jero.modules.cert.report.entity.ParamsReportDetailEO;
import com.jero.modules.cert.report.entity.ParamsReportEO;
import com.jero.modules.cert.report.mapper.ParamsReportConfigEOMapper;
import com.jero.modules.cert.report.mapper.ParamsReportEOMapper;
import com.jero.modules.cert.report.service.IParamsReportDetailEOService;
import com.jero.modules.cert.report.service.IParamsReportEOService;
import com.jero.modules.cert.report.service.IParamsReportExportHistoryEOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -32,6 +37,15 @@ public class ParamsReportEOServiceImpl extends ServiceImpl<ParamsReportEOMapper,
@Autowired
private ParamsManifestEOMapper paramsManifestEOMapper;
@Autowired
private ParamsReportConfigEOMapper paramsReportConfigEOMapper;
@Autowired
private IParamsReportDetailEOService paramsReportDetailEOService;
@Autowired
private IParamsReportExportHistoryEOService paramsReportExportHistoryEOService;
/**
* 保存
*
@@ -66,8 +80,26 @@ public class ParamsReportEOServiceImpl extends ServiceImpl<ParamsReportEOMapper,
* @return
*/
@Override
public void deleteById(String id) {
removeById(id);
public boolean deleteById(String id) {
// 关联删除配置
LambdaQueryWrapper<ParamsReportConfigEO> configEOQueryWrapper = new LambdaQueryWrapper<>();
configEOQueryWrapper.eq(ParamsReportConfigEO::getParamsManifestId, id);
paramsReportConfigEOMapper.delete(configEOQueryWrapper);
// 关联删除收集的参数项(包含配置数据)
LambdaQueryWrapper<ParamsReportDetailEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ParamsReportDetailEO::getParamsManifestId, id);
List<ParamsReportDetailEO> paramsReportDetailEOList = paramsReportDetailEOService.list(queryWrapper);
if (CollectionUtil.isNotEmpty(paramsReportDetailEOList)) {
List<String> paramsReportDetailIdList = paramsReportDetailEOList.stream().map(ParamsReportDetailEO::getId).collect(Collectors.toList());
paramsReportDetailEOService.deleteByIds(paramsReportDetailIdList);
}
// 关联删除导出历史
paramsReportExportHistoryEOService.deleteByParamsManifestId(id);
return removeById(id);
}
/**
@@ -1,7 +1,9 @@
package com.jero.modules.cert.report.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.modules.cert.report.entity.ParamsReportExportHistoryEO;
import com.jero.modules.cert.report.enums.ExportTypeEnum;
import com.jero.modules.cert.report.mapper.ParamsReportExportHistoryEOMapper;
@@ -10,11 +12,10 @@ import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @Description: 上报库导出历史
@@ -119,4 +120,11 @@ public class ParamsReportExportHistoryEOServiceImpl extends ServiceImpl<ParamsRe
return pageInfo;
}
@Override
public void deleteByParamsManifestId(String paramsManifestId) {
LambdaQueryWrapper<ParamsReportExportHistoryEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ParamsReportExportHistoryEO::getParamsManifestId, paramsManifestId);
paramsReportExportHistoryEOMapper.delete(queryWrapper);
}
}