xyc
2025-01-08 c8c42a473eb1269d8c9eed26b90975340850b0ea
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);