Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -17,7 +17,7 @@ public @interface QmsPermission {
|
||||
//模块数据权限-具有此角色可查看本模块所有数据
|
||||
String moduleDataRoleCodes() default "ytjyAdmin"; //指定所有数据查看角色,多值半角逗号分隔
|
||||
|
||||
String deptIdColumn() default "DEPT_ID"; //部门id列
|
||||
String deptIdColumn() default "DEPT_ID"; //部门id列 支持多字段,多值半角逗号分隔
|
||||
|
||||
String userIdColumn() default "CREATOR"; //人员id列
|
||||
|
||||
|
||||
@@ -308,7 +308,8 @@ public class QMSMultiDataPermissionHandler implements MultiDataPermissionHandler
|
||||
new ParenthesedExpressionList(
|
||||
new ExpressionList<LongValue>(CollectionUtils.convertList(deptIds, LongValue::new))));*/
|
||||
// 构建:(dept_id IS NULL OR dept_id IN (?, ?, ?))
|
||||
// 含义:部门 ID 为空的数据允许所有人查看,部门 ID 不为空的数据只允许指定部门查看
|
||||
// 支持多部门字段(逗号分隔),如:"dept_id,second_dept_id"
|
||||
/*// 含义:部门 ID 为空的数据允许所有人查看,部门 ID 不为空的数据只允许指定部门查看
|
||||
Column column = MyBatisUtils.buildColumn(tableName, tableAlias, columnName);
|
||||
|
||||
// 构建 IS NULL 条件(允许部门 ID 为空的数据)
|
||||
@@ -321,9 +322,69 @@ public class QMSMultiDataPermissionHandler implements MultiDataPermissionHandler
|
||||
|
||||
// 组合:IS NULL OR IN (...)
|
||||
OrExpression orExpression = new OrExpression(isNullExpr, inExpression);
|
||||
return new ParenthesedExpressionList<>(orExpression);*/
|
||||
// 支持多部门字段(逗号分隔),如:"dept_id,second_dept_id"
|
||||
String[] deptColumns = columnName.split(",");
|
||||
List<String> validColumns = new ArrayList<>();
|
||||
for (String singleColumn : deptColumns) {
|
||||
String trimmedColumn = singleColumn.trim();
|
||||
if (StrUtil.isNotEmpty(trimmedColumn)) {
|
||||
validColumns.add(trimmedColumn);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有任何有效的部门字段,返回 null
|
||||
if (validColumns.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
// 如果只有一个部门字段,构建:(dept_id IS NULL OR dept_id IN (...))
|
||||
if (validColumns.size() == 1) {
|
||||
Column column = MyBatisUtils.buildColumn(tableName, tableAlias, validColumns.get(0));
|
||||
IsNullExpression isNullExpr = new IsNullExpression(column);
|
||||
InExpression inExpression = new InExpression(column,
|
||||
new ParenthesedExpressionList<>(
|
||||
new ExpressionList<>(CollectionUtils.convertList(deptIds, LongValue::new))));
|
||||
OrExpression orExpression = new OrExpression(isNullExpr, inExpression);
|
||||
return new ParenthesedExpressionList<>(orExpression);
|
||||
}
|
||||
|
||||
// 多个部门字段,构建复杂条件:
|
||||
// (dept1 IS NULL AND dept2 IS NULL AND ...)
|
||||
// OR
|
||||
// (dept1 IN (...) OR dept2 IN (...) OR ...)
|
||||
// 含义:要么所有部门字段都为空(允许查看),要么至少有一个部门字段匹配权限
|
||||
|
||||
// 第一部分:所有部门字段都为 IS NULL
|
||||
Expression allNullExpr = null;
|
||||
for (String validColumn : validColumns) {
|
||||
Column column = MyBatisUtils.buildColumn(tableName, tableAlias, validColumn);
|
||||
IsNullExpression isNullExpr = new IsNullExpression(column);
|
||||
if (allNullExpr == null) {
|
||||
allNullExpr = isNullExpr;
|
||||
} else {
|
||||
allNullExpr = new AndExpression(allNullExpr, isNullExpr);
|
||||
}
|
||||
}
|
||||
|
||||
// 第二部分:至少有一个部门字段 IN (...)
|
||||
Expression anyInExpr = null;
|
||||
for (String columnStr : validColumns) {
|
||||
Column column = MyBatisUtils.buildColumn(tableName, tableAlias, columnStr);
|
||||
InExpression inExpression = new InExpression(column,
|
||||
new ParenthesedExpressionList<>(
|
||||
new ExpressionList<>(CollectionUtils.convertList(deptIds, LongValue::new))));
|
||||
if (anyInExpr == null) {
|
||||
anyInExpr = inExpression;
|
||||
} else {
|
||||
anyInExpr = new OrExpression(anyInExpr, inExpression);
|
||||
}
|
||||
}
|
||||
|
||||
// 组合:(所有字段都为NULL) OR (至少一个字段IN权限范围)
|
||||
OrExpression finalExpression = new OrExpression(allNullExpr, anyInExpr);
|
||||
return new ParenthesedExpressionList<>(finalExpression);
|
||||
}
|
||||
|
||||
private Expression buildUserExpression(String tableName, String columnName, Alias tableAlias, Boolean self, Long userId) {
|
||||
// 如果不查看自己,则无需作为条件
|
||||
if (Boolean.FALSE.equals(self)) {
|
||||
|
||||
@@ -30,9 +30,9 @@ import java.util.List;
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 库存盘点项")
|
||||
@Tag(name = "管理后台 - 物料库存盘点项")
|
||||
@RestController
|
||||
@RequestMapping("/qms/material-inventory-check-item")
|
||||
@RequestMapping("/qms/resource/material-inventory-check-item")
|
||||
@Validated
|
||||
@DeptDataPermissionIgnore(enable = "true")
|
||||
public class MaterialInventoryCheckItemController implements BusinessControllerMarker {
|
||||
@@ -41,22 +41,29 @@ public class MaterialInventoryCheckItemController implements BusinessControllerM
|
||||
@Resource
|
||||
private MaterialInventoryCheckItemService materialInventoryCheckItemService;
|
||||
|
||||
@PostMapping("/create")
|
||||
// @PostMapping("/create")
|
||||
@Operation(summary = "创建库存盘点项")
|
||||
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-item:create')")
|
||||
public CommonResult<MaterialInventoryCheckItemRespVO> createMaterialInventoryCheckItem(@Valid @RequestBody MaterialInventoryCheckItemSaveReqVO createReqVO) {
|
||||
return success(materialInventoryCheckItemService.createMaterialInventoryCheckItem(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
/*@PutMapping("/update")
|
||||
@Operation(summary = "更新库存盘点项")
|
||||
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-item:update')")
|
||||
public CommonResult<Boolean> updateMaterialInventoryCheckItem(@Valid @RequestBody MaterialInventoryCheckItemSaveReqVO updateReqVO) {
|
||||
materialInventoryCheckItemService.updateMaterialInventoryCheckItem(updateReqVO);
|
||||
return success(true);
|
||||
}*/
|
||||
@PutMapping("/pre-check")
|
||||
@Operation(summary = "预盘点")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:material-inventory-check-item:update')")
|
||||
public CommonResult<MaterialInventoryCheckItemRespVO> preCheck(@Valid @RequestBody MaterialInventoryCheckItemSaveReqVO updateReqVO) {
|
||||
MaterialInventoryCheckItemDO item = materialInventoryCheckItemService.preCheck(updateReqVO);
|
||||
return success(BeanUtils.toBean(item, MaterialInventoryCheckItemRespVO.class));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
// @DeleteMapping("/delete")
|
||||
@Operation(summary = "删除库存盘点项")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-item:delete')")
|
||||
@@ -65,7 +72,7 @@ public class MaterialInventoryCheckItemController implements BusinessControllerM
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
// @DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除库存盘点项")
|
||||
@PreAuthorize("@ss.hasPermission('qms:material-inventory-check-item:delete')")
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.qms.resource.material.controller.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -49,10 +50,16 @@ public class MaterialInventoryCheckItemRespVO {
|
||||
@ExcelProperty("实有量")
|
||||
private BigDecimal actual;
|
||||
|
||||
@Schema(description = "预盘点数量")
|
||||
private BigDecimal previous;
|
||||
|
||||
@Schema(description = "差异")
|
||||
@ExcelProperty("差异")
|
||||
private String difference;
|
||||
|
||||
@Schema(description = "盘点状态")
|
||||
private String checkStatus;
|
||||
|
||||
@Schema(description = "所属部门")
|
||||
@ExcelProperty("所属部门")
|
||||
private String systemDepartmentCode;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.qms.resource.material.controller.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -24,6 +25,9 @@ public class MaterialInventoryCheckItemSaveReqVO {
|
||||
@Schema(description = "实有量")
|
||||
private BigDecimal actual;
|
||||
|
||||
@Schema(description = "预盘点数量")
|
||||
private BigDecimal previous;
|
||||
|
||||
@Schema(description = "差异")
|
||||
private String difference;
|
||||
|
||||
|
||||
@@ -51,11 +51,21 @@ public class MaterialInventoryCheckItemDO extends BusinessBaseDO {
|
||||
@TableField("ACT")
|
||||
private BigDecimal actual;
|
||||
/**
|
||||
* 预盘点数量
|
||||
*/
|
||||
@TableField("PRE")
|
||||
private BigDecimal previous;
|
||||
/**
|
||||
* 差异
|
||||
*/
|
||||
@TableField("DIFF")
|
||||
private String difference;
|
||||
/**
|
||||
* 盘点状态
|
||||
*/
|
||||
@TableField("CHK_STS")
|
||||
private String checkStatus;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@TableField("SYS_DEPT_CD")
|
||||
|
||||
@@ -101,6 +101,16 @@ public class MaterialLifecycleDO extends BusinessBaseDO {
|
||||
*/
|
||||
@TableField("OPTR_NAME")
|
||||
private String operatorName;
|
||||
/**
|
||||
* 执行人部门id
|
||||
*/
|
||||
@TableField("OPTR_DEPT_ID")
|
||||
private Long operatorDepartmentId;
|
||||
/**
|
||||
* 执行人部门
|
||||
*/
|
||||
@TableField("OPTR_DEPT_NAME")
|
||||
private String operatorDepartmentName;
|
||||
/**
|
||||
* 执行进度
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface MaterialInventoryInboundMapper extends BaseMapperX<MaterialInventoryInboundDO> {
|
||||
|
||||
@QmsPermission(moduleDataRoleCodes = QmsPermissionConstant.ADMIN_ROLE + "," + QmsPermissionConstant.MATERIAL_ADMIN_ROLE)
|
||||
@QmsPermission(deptIdColumn = "DEPT_ID,APL_DEPT_ID",
|
||||
moduleDataRoleCodes = QmsPermissionConstant.ADMIN_ROLE + "," + QmsPermissionConstant.MATERIAL_ADMIN_ROLE)
|
||||
default PageResult<MaterialInventoryInboundDO> selectPage(MaterialInventoryInboundPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialInventoryInboundDO>()
|
||||
.eqIfPresent(MaterialInventoryInboundDO::getTitle, reqVO.getTitle())
|
||||
|
||||
@@ -30,7 +30,8 @@ import java.util.Map;
|
||||
*/
|
||||
@Mapper
|
||||
public interface MaterialInventoryOutboundMapper extends BaseMapperX<MaterialInventoryOutboundDO> {
|
||||
@QmsPermission(moduleDataRoleCodes = QmsPermissionConstant.ADMIN_ROLE + "," + QmsPermissionConstant.MATERIAL_ADMIN_ROLE)
|
||||
@QmsPermission(deptIdColumn = "DEPT_ID,APL_DEPT_ID",
|
||||
moduleDataRoleCodes = QmsPermissionConstant.ADMIN_ROLE + "," + QmsPermissionConstant.MATERIAL_ADMIN_ROLE)
|
||||
default PageResult<MaterialInventoryOutboundDO> selectPage(MaterialInventoryOutboundPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialInventoryOutboundDO>()
|
||||
.eqIfPresent(MaterialInventoryOutboundDO::getTitle, reqVO.getTitle())
|
||||
|
||||
@@ -21,7 +21,8 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface MaterialLifecycleMapper extends BaseMapperX<MaterialLifecycleDO> {
|
||||
|
||||
@QmsPermission(moduleDataRoleCodes = QmsPermissionConstant.ADMIN_ROLE + "," + QmsPermissionConstant.MATERIAL_ADMIN_ROLE)
|
||||
@QmsPermission(deptIdColumn = "DEPT_ID,OPTR_DEPT_ID",
|
||||
moduleDataRoleCodes = QmsPermissionConstant.ADMIN_ROLE + "," + QmsPermissionConstant.MATERIAL_ADMIN_ROLE)
|
||||
default PageResult<MaterialLifecycleDO> selectPage(MaterialLifecyclePageReqVO reqVO) {
|
||||
String businessType = reqVO.getBusinessType();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user