From f8d83607a7eaa4e44ef9a3ad738ba5366ec43d9d Mon Sep 17 00:00:00 2001 From: ranke <213539@qq.com> Date: Wed, 14 Jan 2026 15:25:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=89=A9=E6=96=99=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=B1=95=E7=A4=BA=E5=BC=B9=E7=AA=97=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E9=80=9A=E7=94=A8=E7=89=A9=E6=96=99=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E7=9A=84=E5=8F=AA=E8=AF=BB=E5=B1=95=E7=A4=BA,=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=89=A9=E6=96=99=E4=BF=A1=E6=81=AF=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=95=88=E7=8E=87=20=20http://172.16.46.63:31560/index.php=3Fm?= =?UTF-8?q?=3Dtask&f=3Dview&taskID=3D706?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/logback-spring.xml | 4 +++ sql/dm/2026-1-14物料相关表增加索引.sql | 29 +++++++++++++++++++ .../MaterialHasPropertiesDeptController.java | 2 +- .../MaterialPropertiesDeptController.java | 8 ++--- .../MaterialHasPropertiesServiceImpl.java | 10 +++++-- 5 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 sql/dm/2026-1-14物料相关表增加索引.sql diff --git a/base-server/src/main/resources/logback-spring.xml b/base-server/src/main/resources/logback-spring.xml index 19d38bf5..2156fc14 100644 --- a/base-server/src/main/resources/logback-spring.xml +++ b/base-server/src/main/resources/logback-spring.xml @@ -108,4 +108,8 @@ + + + + diff --git a/sql/dm/2026-1-14物料相关表增加索引.sql b/sql/dm/2026-1-14物料相关表增加索引.sql new file mode 100644 index 00000000..2ab2ea62 --- /dev/null +++ b/sql/dm/2026-1-14物料相关表增加索引.sql @@ -0,0 +1,29 @@ +CREATE INDEX idx_hs_cls_tenant_deleted_cls + ON bse_mtrl_hs_cls(tenant_id, deleted, CLS_ID, INF_ID); + +CREATE INDEX idx_hs_cls_composite + ON bse_mtrl_hs_cls(tenant_id, deleted, CLS_ID); + +CREATE INDEX idx_mtrl_inf_tenant_deleted_id + ON bse_mtrl_inf(tenant_id, deleted, id); + +CREATE INDEX idx_mtrl_inf_tenant_deleted_cd + ON bse_mtrl_inf(tenant_id, deleted, CD, id); + +CREATE INDEX idx_mtrl_inf_cover + ON bse_mtrl_inf(tenant_id, deleted, CD, id, NAME, RMK, create_time, update_time, creator, updater); + +CREATE INDEX idx_hs_prps_tenant_deleted_inf + ON bse_mtrl_hs_prps(tenant_id, deleted, INF_ID, PRPS_ID); + +CREATE INDEX idx_hs_prps_tenant_inf_deleted + ON bse_mtrl_hs_prps(tenant_id, INF_ID, deleted); + +CREATE INDEX idx_hs_prps_cover + ON bse_mtrl_hs_prps(tenant_id, deleted, INF_ID, PRPS_ID, UNT_ID, IS_KY, IS_MTNG, SRT, DEPT_ID); + +CREATE INDEX idx_mtrl_prps_tenant_deleted_id + ON bse_mtrl_prps(tenant_id, deleted, id); + +CREATE INDEX idx_mtrl_prps_cover + ON bse_mtrl_prps(tenant_id, deleted, id, CD, NAME, UNT_QTY_ID, DIC_DAT_VAL, DAT_TP, RMK, DEPT_ID); \ No newline at end of file diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/materialhasproperties/MaterialHasPropertiesDeptController.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/materialhasproperties/MaterialHasPropertiesDeptController.java index 27e8fb63..08bb476a 100644 --- a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/materialhasproperties/MaterialHasPropertiesDeptController.java +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/materialhasproperties/MaterialHasPropertiesDeptController.java @@ -52,7 +52,7 @@ public class MaterialHasPropertiesDeptController { public CommonResult batchSave(@Valid @RequestBody MaterialHasPropertiesBatchSaveReqVO reqVO) { Long deptId = reqVO.getDeptId(); if (deptId == null) { - throw new ServiceException(401, "部门ID不能为空"); + throw new ServiceException(500, "部门ID不能为空"); } MaterialHasPropertiesBatchSaveRespVO resp = materialHasPropertiesService.batchSave(reqVO, deptId); return success(resp); diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/materialproperties/MaterialPropertiesDeptController.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/materialproperties/MaterialPropertiesDeptController.java index fe37ca8e..e1237a90 100644 --- a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/materialproperties/MaterialPropertiesDeptController.java +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/materialproperties/MaterialPropertiesDeptController.java @@ -97,7 +97,7 @@ public class MaterialPropertiesDeptController { public CommonResult getMaterialProperties(@RequestParam("id") Long id) { MaterialPropertiesRespVO materialProperties = materialPropertiesService.getMaterialProperties(id); if (materialProperties.getDeptId() == null) { - throw new ServiceException(401, "没有权限"); + throw new ServiceException(500, "没有权限"); } return success(materialProperties); } @@ -107,7 +107,7 @@ public class MaterialPropertiesDeptController { @PreAuthorize("@ss.hasPermission('base:material-properties-dept:query')") public CommonResult> getMaterialPropertiesPage(@Valid MaterialPropertiesPageReqVO pageReqVO) { if (pageReqVO.getDeptId() == null) { - throw new ServiceException(401, "部门ID不能为空"); + throw new ServiceException(500, "部门ID不能为空"); } PageResult pageResult = materialPropertiesService.getMaterialPropertiesPage(pageReqVO); return success(pageResult); @@ -118,7 +118,7 @@ public class MaterialPropertiesDeptController { @PreAuthorize("@ss.hasPermission('base:material-properties-dept:query')") public CommonResult> getMaterialPropertiesSimplePage(@Valid MaterialPropertiesSimplePageReqVO pageReqVO) { if (pageReqVO.getDeptId() == null) { - throw new ServiceException(401, "部门ID不能为空"); + throw new ServiceException(500, "部门ID不能为空"); } return success(materialPropertiesService.getMaterialPropertiesSimplePage(pageReqVO)); } @@ -130,7 +130,7 @@ public class MaterialPropertiesDeptController { public void exportMaterialPropertiesExcel(@Valid MaterialPropertiesPageReqVO pageReqVO, HttpServletResponse response) throws IOException { if (pageReqVO.getDeptId() == null) { - throw new ServiceException(401, "部门ID不能为空"); + throw new ServiceException(500, "部门ID不能为空"); } pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); List list = materialPropertiesService.getMaterialPropertiesPage(pageReqVO).getList(); diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/materialhasproperties/MaterialHasPropertiesServiceImpl.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/materialhasproperties/MaterialHasPropertiesServiceImpl.java index 6681d747..d9903e76 100644 --- a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/materialhasproperties/MaterialHasPropertiesServiceImpl.java +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/materialhasproperties/MaterialHasPropertiesServiceImpl.java @@ -114,8 +114,14 @@ public class MaterialHasPropertiesServiceImpl implements MaterialHasPropertiesSe return resp; } // 全量替换:先删除该物料的已有属性 - materialHasPropertiesMapper.delete(new LambdaQueryWrapperX() - .eq(MaterialHasPropertiesDO::getInfomationId, infoId)); + LambdaQueryWrapperX delQuery = new LambdaQueryWrapperX<>(); + delQuery.eq(MaterialHasPropertiesDO::getInfomationId, infoId); + if (deptId == null) { + delQuery.isNull(MaterialHasPropertiesDO::getDeptId); + } else { + delQuery.eq(MaterialHasPropertiesDO::getDeptId, deptId); + } + materialHasPropertiesMapper.delete(delQuery); List properties = batchReqVO.getProperties(); if (CollUtil.isEmpty(properties)) {