This commit is contained in:
jing's 2024-01-01 21:25:42 +08:00
parent cf1662caae
commit 6099e46245
2 changed files with 37 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.base.core.exception.NflgBusinessException;
import com.nflg.product.bomnew.constant.MBomConstantEnum;
import com.nflg.product.bomnew.pojo.query.BomNewMbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomDetailVO;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomParentVO;
import com.nflg.product.bomnew.service.BomNewMbomDetailService;
import com.nflg.product.bomnew.service.BomNewMbomParentService;
@ -18,6 +19,7 @@ import nflg.product.common.vo.ResultVO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
/**
@ -55,6 +57,16 @@ public class MBomApi extends BaseApi {
}
@PostMapping("superSaterialList")
@ApiOperation("设置超级物料列表")
public ResultVO<List<BomNewMbomDetailVO>> superSaterialList(@RequestParam(value = "rowId") Long rowId ) {
if (Objects.isNull(rowId)) {
throw new NflgBusinessException(STATE.ParamErr, "选择行后操作");
}
return ResultVO.success(bomNewMbomDetailService.superSaterialList(rowId));
}
@PostMapping("superSaterialStatus")
@ApiOperation("设置超级物料")

View File

@ -2,6 +2,8 @@ package com.nflg.product.bomnew.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.TypeReference;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -12,6 +14,7 @@ import com.nflg.product.bomnew.constant.MBomConstantEnum;
import com.nflg.product.bomnew.mapper.master.BomNewMbomDetailMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewMbomParentEntity;
import com.nflg.product.bomnew.pojo.vo.BomNewMbomDetailVO;
import nflg.product.common.constant.STATE;
import org.springframework.stereotype.Service;
@ -30,6 +33,28 @@ import java.util.Objects;
public class BomNewMbomDetailService extends ServiceImpl<BomNewMbomDetailMapper, BomNewMbomDetailEntity> {
public List<BomNewMbomDetailVO> superSaterialList(Long rowId){
QueryWrapper<BomNewMbomDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId,rowId);
List<BomNewMbomDetailEntity> list= this.list(queryWrapper);
List<BomNewMbomDetailVO> voList= Convert.convert(new TypeReference<List<BomNewMbomDetailVO>>() {
} ,list);
return voList;
}
/**
* 超级物料标签
* <p>
@ -45,7 +70,6 @@ public class BomNewMbomDetailService extends ServiceImpl<BomNewMbomDetailMapper,
if (entity == null) {
throw new NflgBusinessException(STATE.Error, "设置超级物料数据不存在");
}
BomNewMbomParentEntity parentEntity = SpringUtil.getBean(BomNewMbomParentService.class).getById(entity.getBomRowId());
if (parentEntity == null) {
throw new NflgBusinessException(STATE.Error, "根数据不存在");