feat(ebom): ebom工作表,只能查看本部门的数据

This commit is contained in:
曹鹏飞 2024-05-30 11:15:55 +08:00
parent f83fdd9770
commit 152c5c3ecf
7 changed files with 19 additions and 3 deletions

View File

@ -82,7 +82,7 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
List<BomNewEbomParentEntity> getEBomParentByMaterialNos(@Param("job") Integer job, @Param("createdBy")String createdBy, @Param("materialNos") List<String> materialNos); List<BomNewEbomParentEntity> getEBomParentByMaterialNos(@Param("job") Integer job, @Param("createdBy")String createdBy, @Param("materialNos") List<String> materialNos);
Page<BomNewEbomParentVO> workDetailsListByPageNew(Page<Object> objectPage, BomNewEbomParentQuery query, Integer userJob, String userCode); Page<BomNewEbomParentVO> workDetailsListByPageNew(Page<Object> objectPage, BomNewEbomParentQuery query, Integer userJob, String userCode, Long deptRowId);
List<BomNewEbomParentVO> getChildren(Long bomRowId, int type); List<BomNewEbomParentVO> getChildren(Long bomRowId, int type);

View File

@ -385,5 +385,12 @@ public class BomNewEbomParentEntity implements Serializable {
@ApiModelProperty(value = "导入SAP时间") @ApiModelProperty(value = "导入SAP时间")
private LocalDateTime sapTime; private LocalDateTime sapTime;
/**
* 创建人所属部门rowId
*/
@TableField(value = "dept_row_id")
@ApiModelProperty(value = "创建人所属部门rowId")
private Long deptRowId;
private static final long serialVersionUID = 265246823929418418L; private static final long serialVersionUID = 265246823929418418L;
} }

View File

@ -2224,7 +2224,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
query.setPage(1L); query.setPage(1L);
query.setPageSize(20L); query.setPageSize(20L);
} }
Page<BomNewEbomParentVO> result = this.getBaseMapper().workDetailsListByPageNew(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode()); Page<BomNewEbomParentVO> result = this.getBaseMapper().workDetailsListByPageNew(new Page<>(query.getPage()
, query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode(), SessionUtil.getDepartRowId());
if (StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isBlank(query.getDrawingNo())) { if (StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isBlank(query.getDrawingNo())) {
//列表搜索 //列表搜索
materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);

View File

@ -131,6 +131,7 @@ public class EBomEdit {
parentEntity.setEditStatus(createDTO.getOpType()); parentEntity.setEditStatus(createDTO.getOpType());
parentEntity.setRootIs(parentEntity.getMaterialNo().startsWith("31") ? 1 : 0); parentEntity.setRootIs(parentEntity.getMaterialNo().startsWith("31") ? 1 : 0);
parentEntity.setUserRootIs(1); parentEntity.setUserRootIs(1);
parentEntity.setDeptRowId(SessionUtil.getDepartRowId());
createDTO.getDatas().forEach(k -> { createDTO.getDatas().forEach(k -> {
k.setParentRowId(parentEntity.getRowId()); k.setParentRowId(parentEntity.getRowId());

View File

@ -387,6 +387,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
this.eBomParentResult.add(ebom); this.eBomParentResult.add(ebom);
} }
eBomParent.setMaterialOriginalUnit(eBomParent.getMaterialUnit()); eBomParent.setMaterialOriginalUnit(eBomParent.getMaterialUnit());
eBomParent.setDeptRowId(SessionUtil.getDepartRowId());
this.eBomParentResult.add(eBomParent); this.eBomParentResult.add(eBomParent);
return eBomParent.getRowId(); return eBomParent.getRowId();

View File

@ -393,11 +393,13 @@
<select id="workDetailsListByPageNew" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO"> <select id="workDetailsListByPageNew" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
SELECT *,row_id as bomRowId SELECT *,row_id as bomRowId
FROM t_bom_new_ebom_parent FROM t_bom_new_ebom_parent
<!-- WHERE (root_is=1 OR ((user_root_is=1 OR root_is_for_wait_review=1) AND created_by=#{userCode}))-->
<where> <where>
<if test="query.showMySelfOnly == 1"> <if test="query.showMySelfOnly == 1">
AND created_by = #{userCode} AND created_by = #{userCode}
</if> </if>
<if test="query.showMySelfOnly == 0">
AND dept_row_id = #{deptRowId}
</if>
<if test="userJob==0"> <if test="userJob==0">
AND status IN (1,3) AND (root_is=1 OR user_root_is=1 OR root_is_for_wait_review=1) AND AND status IN (1,3) AND (root_is=1 OR user_root_is=1 OR root_is_for_wait_review=1) AND
created_by=#{userCode} created_by=#{userCode}

View File

@ -106,6 +106,10 @@ public class SessionUtil {
return getUser().getSessionKey(); return getUser().getSessionKey();
} }
public static Long getDepartRowId() {
return getUser().getDepartRowId();
}
public static LoginUserInfoDTO getUser() { public static LoginUserInfoDTO getUser() {
return Optional.ofNullable(BaseApi.loginUser.get()) return Optional.ofNullable(BaseApi.loginUser.get())
.orElseThrow(() -> new NflgBusinessException(STATE.LoginError, "请登录")); .orElseThrow(() -> new NflgBusinessException(STATE.LoginError, "请登录"));