feat(feature/DM/nflg-bom): 原始bom明细表查询参数添加“是否仅显示自己的数据”

This commit is contained in:
曹鹏飞 2024-03-27 14:44:22 +08:00
parent ba19d4f1be
commit e04e638f03
3 changed files with 14 additions and 16 deletions

View File

@ -1,6 +1,5 @@
package com.nflg.product.bomnew.pojo.query; package com.nflg.product.bomnew.pojo.query;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -8,7 +7,6 @@ import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -20,8 +18,6 @@ import java.util.List;
@ApiModel(value = "com-nflg-product-bom-obom-pojo-query-BomOriginalParentEntityQuery") @ApiModel(value = "com-nflg-product-bom-obom-pojo-query-BomOriginalParentEntityQuery")
public class OriginalBomQuery extends BasePageQuery { public class OriginalBomQuery extends BasePageQuery {
@ApiModelProperty(value = "图号集合,英文逗号隔开") @ApiModelProperty(value = "图号集合,英文逗号隔开")
private String drawingNoList; private String drawingNoList;
@ -45,12 +41,10 @@ public class OriginalBomQuery extends BasePageQuery {
@ApiModelProperty(value = "状态1=待转换、2=已转换") @ApiModelProperty(value = "状态1=待转换、2=已转换")
private Integer status; private Integer status;
private String startDate; private String startDate;
private String endDate; private String endDate;
@ApiModelProperty(value = "是否仅显示自己的数据0=所有人的数据1=仅自己的数据默认为0")
private Integer showMySelfOnly = 0;
} }

View File

@ -145,11 +145,9 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
Page<BomOriginalListVO> result = new Page<>(); Page<BomOriginalListVO> result = new Page<>();
//物料编码搜索或图号搜索 //物料编码搜索或图号搜索
if (CollUtil.isNotEmpty(query.getMaterialNos()) || CollUtil.isNotEmpty(query.getDrawingNos())) { if (CollUtil.isNotEmpty(query.getMaterialNos()) || CollUtil.isNotEmpty(query.getDrawingNos())) {
List<String> queryDrawingNos = new ArrayList<>(); List<String> queryDrawingNos = new ArrayList<>(query.getDrawingNos());
queryDrawingNos.addAll(query.getDrawingNos());
List<String> drawingParentNos=new ArrayList<>();
if (CollUtil.isNotEmpty(query.getMaterialNos())) { if (CollUtil.isNotEmpty(query.getMaterialNos())) {
drawingParentNos = this.getBaseMapper().getDrawingNoByMaterialNos(query.getMaterialNos()); List<String> drawingParentNos = this.getBaseMapper().getDrawingNoByMaterialNos(query.getMaterialNos());
if (CollUtil.isNotEmpty(drawingParentNos)) { if (CollUtil.isNotEmpty(drawingParentNos)) {
queryDrawingNos.addAll(drawingParentNos); queryDrawingNos.addAll(drawingParentNos);
} }
@ -160,7 +158,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
if(query.getStatus().equals(1) && CollUtil.isEmpty(materialBoms)){ if(query.getStatus().equals(1) && CollUtil.isEmpty(materialBoms)){
return result; return result;
} }
List<String> parentDrawingNos = getParentDrawingNoByMaterialNo(queryDrawingNos).stream().collect(Collectors.toList()); List<String> parentDrawingNos = new ArrayList<>(getParentDrawingNoByMaterialNo(queryDrawingNos));
parentDrawingNos.addAll(queryDrawingNos); parentDrawingNos.addAll(queryDrawingNos);
if (CollUtil.isNotEmpty(parentDrawingNos)) { if (CollUtil.isNotEmpty(parentDrawingNos)) {
List<BomOriginalListVO> parents = this.getBaseMapper().getParentForDrawingNoSeach(parentDrawingNos, query.getStatus()); List<BomOriginalListVO> parents = this.getBaseMapper().getParentForDrawingNoSeach(parentDrawingNos, query.getStatus());
@ -173,8 +171,11 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
} }
} }
} else { } else {
String userCode = null;
result = this.getBaseMapper().getOriginalBomListPage(new Page<>(query.getPage(), query.getPageSize()), query, SessionUtil.getUserCode()); if (query.getShowMySelfOnly() == 1) {
userCode = SessionUtil.getUserCode();
}
result = this.getBaseMapper().getOriginalBomListPage(new Page<>(query.getPage(), query.getPageSize()), query, userCode);
materialMainService.intiMaterialInfo(result.getRecords()); materialMainService.intiMaterialInfo(result.getRecords());
} }
return result; return result;
@ -201,7 +202,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
if (CollUtil.isNotEmpty(childEntities)) { if (CollUtil.isNotEmpty(childEntities)) {
//删除行 //删除行
List<Long> delRowIds = bom.getBomList().stream().filter(u -> u.getRowId() > 0).map(u -> u.getRowId()).collect(Collectors.toList()); List<Long> delRowIds = bom.getBomList().stream().map(BomOriginalListVO::getRowId).filter(rowId -> rowId > 0).collect(Collectors.toList());
originalChildService.getBaseMapper().delOriginalChildNotInRowIds(delRowIds, bom.getParentRowId()); originalChildService.getBaseMapper().delOriginalChildNotInRowIds(delRowIds, bom.getParentRowId());
originalChildService.saveOrUpdateBatch(childEntities); originalChildService.saveOrUpdateBatch(childEntities);
} }

View File

@ -70,6 +70,9 @@
<if test="query.startDate!=null and query.startDate!=''"> <if test="query.startDate!=null and query.startDate!=''">
and created_time between #{query.startDate} and DATE_ADD(#{query.endDate}, INTERVAL 1 DAY) and created_time between #{query.startDate} and DATE_ADD(#{query.endDate}, INTERVAL 1 DAY)
</if> </if>
<if test="userCode!=null">
and created_by=#{userCode}
</if>
</sql> </sql>
<!--获取原始bom列表--> <!--获取原始bom列表-->