组织架构物料管理新增组织级别的属性管理 http://172.16.46.63:31560/index.php?m=task&f=view&id=688

This commit is contained in:
ranke
2026-01-12 10:38:09 +08:00
parent 1ea3e847b4
commit 47fd100b44
20 changed files with 278 additions and 14 deletions

View File

@@ -0,0 +1,5 @@
ALTER TABLE "BSE_MTRL_PRPS" ADD COLUMN "DEPT_ID" BIGINT;
COMMENT ON COLUMN "BSE_MTRL_PRPS"."DEPT_ID" IS '部门ID,如果为空则表示通用属性,不为空则是对应部门的私有属性';
ALTER TABLE "BSE_MTRL_HS_PRPS" ADD COLUMN "DEPT_ID" BIGINT;
COMMENT ON COLUMN "BSE_MTRL_HS_PRPS"."DEPT_ID" IS '部门ID,如果为空则表示通用属性,不为空则是对应部门的私有属性';

View File

@@ -110,7 +110,7 @@ public class DepartmentMaterialController {
@Parameter(name = "ids", description = "要克隆的数据ID", required = true)
@Parameter(name = "deptId", description = "目标组织架构ID", required = true)
@PreAuthorize("@ss.hasPermission('base:department-material:clone')")
@Transactional
@Transactional(rollbackFor = Exception.class)
public CommonResult<Boolean> getDepartmentMaterial(@RequestBody DepartmentMaterialCloneReqVO req) {
List<DepartmentMaterialRespVO> list = departmentMaterialService.getDepartmentMaterialByIds(req.getIds());
for (DepartmentMaterialRespVO departmentMaterial : list) {

View File

@@ -87,6 +87,7 @@ public class MaterialHasPropertiesController {
@Operation(summary = "获得物料持有属性分页")
@PreAuthorize("@ss.hasPermission('base:material-has-properties:query')")
public CommonResult<PageResult<MaterialHasPropertiesRespVO>> getMaterialHasPropertiesPage(@Valid MaterialHasPropertiesPageReqVO pageReqVO) {
pageReqVO.setDeptId(null);
PageResult<MaterialHasPropertiesDO> pageResult = materialHasPropertiesService.getMaterialHasPropertiesPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialHasPropertiesRespVO.class));
}
@@ -95,7 +96,7 @@ public class MaterialHasPropertiesController {
@Operation(summary = "批量保存物料持有属性(全量替换)")
@PreAuthorize("@ss.hasPermission('base:material-has-properties:update')")
public CommonResult<MaterialHasPropertiesBatchSaveRespVO> batchSave(@Valid @RequestBody MaterialHasPropertiesBatchSaveReqVO reqVO) {
MaterialHasPropertiesBatchSaveRespVO resp = materialHasPropertiesService.batchSave(reqVO);
MaterialHasPropertiesBatchSaveRespVO resp = materialHasPropertiesService.batchSave(reqVO, null);
return success(resp);
}

View File

@@ -0,0 +1,61 @@
package com.zt.plat.module.base.controller.admin.materialhasproperties;
import com.zt.plat.framework.common.exception.ServiceException;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.base.controller.admin.materialhasproperties.vo.MaterialHasPropertiesBatchSaveReqVO;
import com.zt.plat.module.base.controller.admin.materialhasproperties.vo.MaterialHasPropertiesBatchSaveRespVO;
import com.zt.plat.module.base.controller.admin.materialhasproperties.vo.MaterialHasPropertiesPageReqVO;
import com.zt.plat.module.base.controller.admin.materialhasproperties.vo.MaterialHasPropertiesRespVO;
import com.zt.plat.module.base.dal.dataobject.materialhasproperties.MaterialHasPropertiesDO;
import com.zt.plat.module.base.service.materialhasproperties.MaterialHasPropertiesService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 部门私有物料持有属性")
@RestController
@RequestMapping("/base/material-has-properties-dept")
@Validated
public class MaterialHasPropertiesDeptController {
@Resource
private MaterialHasPropertiesService materialHasPropertiesService;
@GetMapping("/page")
@Operation(summary = "获得物料持有属性分页")
@PreAuthorize("@ss.hasPermission('base:material-has-properties-dept:query')")
public CommonResult<PageResult<MaterialHasPropertiesRespVO>> getMaterialHasPropertiesPage(@Valid MaterialHasPropertiesPageReqVO pageReqVO) {
Long deptId = pageReqVO.getDeptId();
if (deptId == null) {
throw new ServiceException(401, "部门ID不能为空");
}
PageResult<MaterialHasPropertiesDO> pageResult = materialHasPropertiesService.getMaterialHasPropertiesPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialHasPropertiesRespVO.class));
}
@PostMapping("/batch-save")
@Operation(summary = "批量保存物料持有属性(全量替换)")
@PreAuthorize("@ss.hasPermission('base:material-has-properties-dept:update')")
public CommonResult<MaterialHasPropertiesBatchSaveRespVO> batchSave(@Valid @RequestBody MaterialHasPropertiesBatchSaveReqVO reqVO) {
Long deptId = reqVO.getDeptId();
if (deptId == null) {
throw new ServiceException(401, "部门ID不能为空");
}
MaterialHasPropertiesBatchSaveRespVO resp = materialHasPropertiesService.batchSave(reqVO, deptId);
return success(resp);
}
}

View File

@@ -29,4 +29,5 @@ public class MaterialHasPropertiesBatchItemReqVO {
@Schema(description = "排序号")
private Long sort;
}

View File

@@ -19,4 +19,7 @@ public class MaterialHasPropertiesBatchSaveReqVO {
@Schema(description = "属性列表", requiredMode = Schema.RequiredMode.REQUIRED)
@Valid
private List<MaterialHasPropertiesBatchItemReqVO> properties = new ArrayList<>();
@Schema(description = "部门ID,私有属性有值,通用属性无值")
private Long deptId;
}

View File

@@ -38,4 +38,9 @@ public class MaterialHasPropertiesPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "部门ID,私有属性有值,通用属性无值")
private Long deptId;
}

View File

@@ -1,7 +1,5 @@
package com.zt.plat.module.base.controller.admin.materialproperties;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.base.dal.dataobject.materialproperties.MaterialPropertiesDO;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -45,6 +43,7 @@ public class MaterialPropertiesController {
@Operation(summary = "创建物料属性")
@PreAuthorize("@ss.hasPermission('base:material-properties:create')")
public CommonResult<MaterialPropertiesRespVO> createMaterialProperties(@Valid @RequestBody MaterialPropertiesSaveReqVO createReqVO) {
createReqVO.setDeptId(null);
return success(materialPropertiesService.createMaterialProperties(createReqVO));
}
@@ -52,6 +51,7 @@ public class MaterialPropertiesController {
@Operation(summary = "更新物料属性")
@PreAuthorize("@ss.hasPermission('base:material-properties:update')")
public CommonResult<Boolean> updateMaterialProperties(@Valid @RequestBody MaterialPropertiesSaveReqVO updateReqVO) {
updateReqVO.setDeptId(null);
materialPropertiesService.updateMaterialProperties(updateReqVO);
return success(true);
}
@@ -80,6 +80,9 @@ public class MaterialPropertiesController {
@PreAuthorize("@ss.hasPermission('base:material-properties:query')")
public CommonResult<MaterialPropertiesRespVO> getMaterialProperties(@RequestParam("id") Long id) {
MaterialPropertiesRespVO materialProperties = materialPropertiesService.getMaterialProperties(id);
if (materialProperties.getDeptId() != null) {
return CommonResult.error(401, "没有权限");
}
return success(materialProperties);
}
@@ -87,6 +90,7 @@ public class MaterialPropertiesController {
@Operation(summary = "获得物料属性分页")
@PreAuthorize("@ss.hasPermission('base:material-properties:query')")
public CommonResult<PageResult<MaterialPropertiesRespVO>> getMaterialPropertiesPage(@Valid MaterialPropertiesPageReqVO pageReqVO) {
pageReqVO.setDeptId(null);
PageResult<MaterialPropertiesRespVO> pageResult = materialPropertiesService.getMaterialPropertiesPage(pageReqVO);
return success(pageResult);
}
@@ -95,6 +99,7 @@ public class MaterialPropertiesController {
@Operation(summary = "获得物料属性精简分页")
@PreAuthorize("@ss.hasPermission('base:material-properties:query')")
public CommonResult<PageResult<MaterialPropertiesSimpleRespVO>> getMaterialPropertiesSimplePage(@Valid MaterialPropertiesSimplePageReqVO pageReqVO) {
pageReqVO.setDeptId(null);
return success(materialPropertiesService.getMaterialPropertiesSimplePage(pageReqVO));
}
@@ -105,6 +110,7 @@ public class MaterialPropertiesController {
public void exportMaterialPropertiesExcel(@Valid MaterialPropertiesPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
pageReqVO.setDeptId(null);
List<MaterialPropertiesRespVO> list = materialPropertiesService.getMaterialPropertiesPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "物料属性.xls", "数据", MaterialPropertiesRespVO.class,

View File

@@ -38,4 +38,7 @@ public class MaterialPropertiesPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "部门ID,私有属性有值,通用属性无值")
private Long deptId;
}

Some files were not shown because too many files have changed in this diff Show More