jinlin
2024-11-19 195bb5267a6ece13363303e177fee7d1fa3941aa
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java
@@ -105,12 +105,12 @@
    @GetMapping("getProductList")
    public Result<List<XhProductModel>> getProductList(Long shipId, Integer productType) {
        if(productType==2){
            shipId =null;
        if (productType == 2) {
            shipId = null;
        }
        List<XhProductModel> list = xhProductModelService.getProductList(shipId, productType - 1);
        if(productType == 5){
            List<XhProductModel> list2 =  xhProductModelService.getProductList(shipId, productType - 2);
        if (productType == 5) {
            List<XhProductModel> list2 = xhProductModelService.getProductList(shipId, productType - 2);
            list.addAll(list2);
        }
        return Result.ok(list);
@@ -155,31 +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);
        }
        xhProductModel.setNamePath(xhProductModel.getNamePath() + "," + xhProductModel.getName());
        xhProductModelService.insert(xhProductModel);
        ParamData data = new ParamData();
        data.setShipId(xhProductModel.getShipId());
        data.setProductId(xhProductModel.getId());
        paramDataService.insert(data);
        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();
    }
@@ -206,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();
    }
@@ -230,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);