Parcourir la source

生产报工添加权限过滤,工序过滤

yzc il y a 1 an
Parent
commit
cf4160fbf6

+ 11 - 1
hx-mes/src/main/java/com/fjhx/mes/entity/production/dto/ProductionReportingDetailSelectDto.java

@@ -7,11 +7,21 @@ import lombok.Setter;
 /**
  * 生产报工明细列表查询入参实体
  *
- * @author 
+ * @author
  * @since 2023-03-30
  */
 @Getter
 @Setter
 public class ProductionReportingDetailSelectDto extends BaseSelectDto {
 
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
+    /**
+     * 工序id
+     */
+    private Long productionProcessesId;
+
 }

+ 5 - 0
hx-mes/src/main/java/com/fjhx/mes/entity/production/po/ProductionReportingDetail.java

@@ -45,4 +45,9 @@ public class ProductionReportingDetail extends BasePo {
      */
     private BigDecimal quantity;
 
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
 }

+ 13 - 0
hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProductionReportingDetailServiceImpl.java

@@ -32,6 +32,7 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 
 
 /**
@@ -60,6 +61,18 @@ public class ProductionReportingDetailServiceImpl extends ServiceImpl<Production
     public Page<ProductionReportingDetailVo> getPage(ProductionReportingDetailSelectDto dto) {
         IWrapper<ProductionReportingDetail> wrapper = getWrapper();
         wrapper.orderByDesc("prd", ProductionReportingDetail::getId);
+
+        //权限过滤:生产报工-子公司看自己的,总公司看全部
+        Long companyId = SecurityUtils.getCompanyId();
+        if (!Objects.equals(companyId, 100L)) {
+            wrapper.eq("prd", ProductionReportingDetail::getCompanyId, companyId);
+        } else {
+            wrapper.eq("prd", ProductionReportingDetail::getCompanyId, dto.getCompanyId());
+        }
+
+        //工序过滤
+        wrapper.eq("prd", ProductionReportingDetail::getProductionProcessesId, dto.getProductionProcessesId());
+
         Page<ProductionReportingDetailVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<ProductionReportingDetailVo> records = page.getRecords();
         if (ObjectUtil.isEmpty(records)) {