修改根据根据零件号获取关键零部件名称接口

This commit is contained in:
梁琦涛
2024-10-14 10:35:43 +08:00
parent fdb9a748d4
commit 2d65f23679
3 changed files with 10 additions and 8 deletions
@@ -200,8 +200,8 @@ public class LawsPartTypeController {
@GetMapping(value = "/queryByPartNum") @GetMapping(value = "/queryByPartNum")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@Translation @Translation
public Result<LawsPartRelevance> queryByPartNum(LawsPartType lawsPartType) { public Result<List<LawsPartRelevance>> queryByPartNum(LawsPartType lawsPartType) {
LawsPartRelevance result = lawsPartTypeService.queryByPartNum(lawsPartType.getPartNum()); List<LawsPartRelevance> result = lawsPartTypeService.queryByPartNum(lawsPartType.getPartNum());
return Result.OK(result); return Result.OK(result);
} }
@@ -30,7 +30,7 @@ public interface ILawsPartTypeService extends IService<LawsPartType> {
ModelAndView export(LawsPartType lawsPartType, HttpServletRequest request); ModelAndView export(LawsPartType lawsPartType, HttpServletRequest request);
LawsPartRelevance queryByPartNum(String partNum); List<LawsPartRelevance> queryByPartNum(String partNum);
List<LawsPartType> queryByPartNumList(String partNum); List<LawsPartType> queryByPartNumList(String partNum);
} }
@@ -20,6 +20,7 @@ import com.jero.modules.laws.part.service.ILawsPartInfoService;
import com.jero.modules.laws.part.service.ILawsPartRelevanceService; import com.jero.modules.laws.part.service.ILawsPartRelevanceService;
import com.jero.modules.laws.part.service.ILawsPartTypeService; import com.jero.modules.laws.part.service.ILawsPartTypeService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@@ -188,7 +189,7 @@ public class LawsPartTypeServiceImpl extends ServiceImpl<LawsPartTypeMapper, Law
} }
@Override @Override
public LawsPartRelevance queryByPartNum(String partNum) { public List<LawsPartRelevance> queryByPartNum(String partNum) {
LambdaQueryWrapper<LawsPartInfo> queryLawsPartInfo = new LambdaQueryWrapper<>(); LambdaQueryWrapper<LawsPartInfo> queryLawsPartInfo = new LambdaQueryWrapper<>();
queryLawsPartInfo.eq(LawsPartInfo::getPartNum,partNum); queryLawsPartInfo.eq(LawsPartInfo::getPartNum,partNum);
LawsPartInfo lawsPartInfo = lawsPartInfoService.getOne(queryLawsPartInfo,false); LawsPartInfo lawsPartInfo = lawsPartInfoService.getOne(queryLawsPartInfo,false);
@@ -197,11 +198,12 @@ public class LawsPartTypeServiceImpl extends ServiceImpl<LawsPartTypeMapper, Law
} }
QueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new QueryWrapper<>(); QueryWrapper<LawsPartRelevance> queryLawsPartRelevance = new QueryWrapper<>();
queryLawsPartRelevance.gt("FIND_IN_SET('" + lawsPartInfo.getFndGpc() + "',fnd_gpc)", 0); queryLawsPartRelevance.gt("FIND_IN_SET('" + lawsPartInfo.getFndGpc() + "',fnd_gpc)", 0);
LawsPartRelevance lawsPartRelevance = lawsPartRelevanceService.getOne(queryLawsPartRelevance,false); queryLawsPartRelevance.orderByDesc("create_time");
if(Objects.isNull(lawsPartRelevance)){ List<LawsPartRelevance> lawsPartRelevanceList = lawsPartRelevanceService.list(queryLawsPartRelevance);
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND); if(CollectionUtils.isEmpty(lawsPartRelevanceList)){
throw new JeroBootException(lawsPartInfo.getPartName() + "没有绑定数据,请联系标准管理员维护绑定关系。");
} }
return lawsPartRelevance; return lawsPartRelevanceList;
} }
@Override @Override