From 195bb5267a6ece13363303e177fee7d1fa3941aa Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期二, 19 十一月 2024 15:25:25 +0800 Subject: [PATCH] 修改 --- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java | 37 ++++++++++--------------------------- 1 files changed, 10 insertions(+), 27 deletions(-) diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java index f515f52..09e47a7 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java @@ -105,7 +105,14 @@ @GetMapping("getProductList") public Result<List<XhProductModel>> getProductList(Long shipId, Integer productType) { + if (productType == 2) { + shipId = null; + } List<XhProductModel> list = xhProductModelService.getProductList(shipId, productType - 1); + if (productType == 5) { + List<XhProductModel> list2 = xhProductModelService.getProductList(shipId, productType - 2); + list.addAll(list2); + } return Result.ok(list); } @@ -148,27 +155,7 @@ public Result insert(@RequestBody XhProductModel xhProductModel) { //鏁堥獙鏁版嵁 ValidatorUtils.validateEntity(xhProductModel, AddGroup.class, DefaultGroup.class); - - Integer no = xhProductModelService.getNo(xhProductModel.getPid(), xhProductModel.getProductType()); - if (xhProductModel.getSort() == null || xhProductModel.getSort() < no) { - xhProductModel.setSort(no + 1); - } - if (xhProductModel.getProductType().equals("2")) { - Long id = UUIDUtil.generateId(); - xhProductModel.setId(id); - xhProductModel.setShipId(id); - - ParamData data = new ParamData(); - data.setShipId(id); - data.setProductId(id); - - paramDataService.insert(data); - } - - xhProductModelService.insert(xhProductModel); - Map<Long, XhProductModel> imgMap = new HashMap<>(); - imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); - imgMap.put(xhProductModel.getId(), xhProductModel); + xhProductModelService.insertProduct(xhProductModel); return Result.ok(); } @@ -195,11 +182,7 @@ public Result update(@RequestBody XhProductModel xhProductModel) { //鏁堥獙鏁版嵁 ValidatorUtils.validateEntity(xhProductModel, UpdateGroup.class, DefaultGroup.class); - xhProductModelService.update(xhProductModel); - Map<Long, XhProductModel> imgMap = new HashMap<>(); - imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); - imgMap.put(xhProductModel.getId(), xhProductModel); - + xhProductModelService.updateProduct(xhProductModel); return Result.ok(); } @@ -219,7 +202,7 @@ imgMap = (Map<Long, XhProductModel>) CacheUtils.get("sysImgCache", "sysImgCache"); for (Long id : ids) { Long[] list = xhProductModelService.getByPid(id); - if (list.length > 0){ + if (list.length > 0) { this.deleteByProduct(list); } imgMap.remove(id); -- Gitblit v1.9.1