选项删除软删除
This commit is contained in:
parent
4383367efb
commit
a4aa03958d
|
|
@ -49,6 +49,18 @@ public class OptionalBomConstant {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum DeleteEnum implements ValueEnum<Integer> {
|
||||||
|
UN_DEL(0, "未删"),
|
||||||
|
DEL (1, "已删");
|
||||||
|
private final Integer value;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
public enum PublishEnum implements ValueEnum<Integer> {
|
public enum PublishEnum implements ValueEnum<Integer> {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import cn.hutool.core.lang.TypeReference;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -28,6 +29,7 @@ import com.nflg.product.bomnew.pojo.vo.OptionalEbomConfigRVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.OptionalEbomImportChildVO;
|
import com.nflg.product.bomnew.pojo.vo.OptionalEbomImportChildVO;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Update;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
@ -250,17 +252,20 @@ public class OptionalEbomImportChildService extends ServiceImpl<OptionalEbomImpo
|
||||||
|
|
||||||
//已发布提示
|
//已发布提示
|
||||||
if (CollectionUtil.isNotEmpty(intersectionList)) {
|
if (CollectionUtil.isNotEmpty(intersectionList)) {
|
||||||
QueryWrapper<OptionalEbomImportChildEntity> queryWrapper = new QueryWrapper();
|
//软删除
|
||||||
queryWrapper.lambda().in(OptionalEbomImportChildEntity::getRowId, intersectionList);
|
UpdateWrapper<OptionalEbomImportChildEntity> updateWrapper = new UpdateWrapper();
|
||||||
|
updateWrapper.lambda().in(OptionalEbomImportChildEntity::getRowId, intersectionList);
|
||||||
|
updateWrapper.lambda().set(OptionalEbomImportChildEntity::getIsDel, OptionalBomConstant.DeleteEnum.DEL.getValue());
|
||||||
|
update(updateWrapper);
|
||||||
|
|
||||||
List<OptionalEbomImportChildEntity> entityList = getBaseMapper().selectList(queryWrapper);
|
// List<OptionalEbomImportChildEntity> entityList = getBaseMapper().selectList(queryWrapper);
|
||||||
StringBuffer stringBuffer = new StringBuffer();
|
// StringBuffer stringBuffer = new StringBuffer();
|
||||||
for (OptionalEbomImportChildEntity item :
|
// for (OptionalEbomImportChildEntity item :
|
||||||
entityList) {
|
// entityList) {
|
||||||
stringBuffer.append(StrUtil.format("{}({}) , ", item.getMaterialName(), item.getMaterialNo()));
|
// stringBuffer.append(StrUtil.format("{}({}) , ", item.getMaterialName(), item.getMaterialNo()));
|
||||||
}
|
// }
|
||||||
stringBuffer.append("以上数据已发布不能删除");
|
// stringBuffer.append("以上数据已发布不能删除");
|
||||||
throw new NflgBusinessException(STATE.Error, stringBuffer.toString());
|
// throw new NflgBusinessException(STATE.Error, stringBuffer.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,14 +133,13 @@ public class OptionalEbomMainService extends ServiceImpl<OptionalEbomMainMapper,
|
||||||
List<OptionalEbomConfigEntity> publishList = configList.stream().filter(item -> item.getEditStatus().equals(OptionalBomConstant.PublishEnum.PUBLISH.getValue())).collect(Collectors.toList());
|
List<OptionalEbomConfigEntity> publishList = configList.stream().filter(item -> item.getEditStatus().equals(OptionalBomConstant.PublishEnum.PUBLISH.getValue())).collect(Collectors.toList());
|
||||||
List<OptionalEbomConfigEntity> tmpList = configList.stream().filter(item -> item.getEditStatus().equals(OptionalBomConstant.PublishEnum.TMP.getValue())).collect(Collectors.toList());
|
List<OptionalEbomConfigEntity> tmpList = configList.stream().filter(item -> item.getEditStatus().equals(OptionalBomConstant.PublishEnum.TMP.getValue())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
//机型下无发布数据可全删
|
||||||
if (CollectionUtil.isNotEmpty(publishList)) {
|
if (CollectionUtil.isNotEmpty(publishList)) {
|
||||||
updateList.add(rowId);
|
updateList.add(rowId);
|
||||||
} else {
|
} else {
|
||||||
delList.add(rowId);
|
delList.add(rowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(tmpList)) {
|
if (CollectionUtil.isNotEmpty(tmpList)) {
|
||||||
delTmpList.addAll(tmpList.stream().map(OptionalEbomConfigEntity::getRowId).collect(Collectors.toList()));
|
delTmpList.addAll(tmpList.stream().map(OptionalEbomConfigEntity::getRowId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
@ -159,12 +158,14 @@ public class OptionalEbomMainService extends ServiceImpl<OptionalEbomMainMapper,
|
||||||
// optionalEbomImportService.updateDelStatusByRooId(updateList);
|
// optionalEbomImportService.updateDelStatusByRooId(updateList);
|
||||||
// optionalEbomImportChildService.updateDelStatusByRootId(updateList);
|
// optionalEbomImportChildService.updateDelStatusByRootId(updateList);
|
||||||
// }
|
// }
|
||||||
//操作删除或更新
|
//操作删除机型
|
||||||
deleteByRowIds(dto.getRowIdList());
|
deleteByRowIds(dto.getRowIdList());
|
||||||
|
|
||||||
//联动删除机型下选配数据
|
//删除机型下暂存数据
|
||||||
if (CollectionUtil.isNotEmpty(delTmpList)) {
|
if (CollectionUtil.isNotEmpty(delTmpList)) {
|
||||||
|
//删暂存
|
||||||
SpringUtil.getBean(OptionalEbomConfigService.class).deleteByIds(delTmpList);
|
SpringUtil.getBean(OptionalEbomConfigService.class).deleteByIds(delTmpList);
|
||||||
|
|
||||||
QueryWrapper<OptionalEbomConfigREntity> delOptionWrapper= new QueryWrapper();
|
QueryWrapper<OptionalEbomConfigREntity> delOptionWrapper= new QueryWrapper();
|
||||||
delOptionWrapper.lambda().in(OptionalEbomConfigREntity::getParentRowId,delTmpList);
|
delOptionWrapper.lambda().in(OptionalEbomConfigREntity::getParentRowId,delTmpList);
|
||||||
SpringUtil.getBean(OptionalEbomConfigRService.class).remove(delOptionWrapper);
|
SpringUtil.getBean(OptionalEbomConfigRService.class).remove(delOptionWrapper);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue