luqingyang
2023-11-01 e80a199894f078f3b0ead5b052ea3ce5d2b9d96e
consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java
@@ -2,18 +2,23 @@
import com.consum.base.BaseController;
import com.consum.base.pojo.BaseCategoryParam;
import com.consum.base.pojo.ProjectTreeResult;
import com.consum.base.service.BaseCategoryServiceImpl;
import com.consum.base.service.BaseGoodsTemplateServiceImpl;
import com.consum.base.util.FinSysTenantUtils;
import com.consum.model.po.BaseCategory;
import com.consum.model.po.FinSysTenant;
import com.consum.model.po.FinSysTenantUser;
import com.iplatform.model.po.S_user_core;
import com.walker.db.page.GenericPager;
import com.walker.infrastructure.tree.TreeNode;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.web.ResponseValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.*;
/**
 * @Description 物品分类
@@ -29,6 +34,23 @@
    @Autowired
    private BaseGoodsTemplateServiceImpl baseGoodsTemplateService;
    private boolean multiRoot = true;
    private TreeNode dummyRoot = null;
    private Map<Long, TreeNode> rootMap = new TreeMap();
    private Map<Long, TreeNode> childMap = new TreeMap();
    private long defaultParentId = 0L;
    /**
     * @Description  获取分类树
     * @Author 卢庆阳
     * @Date 2023/10/30
     */
    @GetMapping("/select/tree")
    public ResponseValue tree(String categoryName) {
        List<ProjectTreeResult> tree = this.baseCategoryService.tree(categoryName);
        return ResponseValue.success(tree);
    }
    /**
     * @Description 新增分类
@@ -86,11 +108,7 @@
        if (baseCategory.getOrderNumber() == null) {
            return ResponseValue.error("顺序号为空");
        }
        //判断同一父类id下分类名称是否重复
        BaseCategory category = this.baseCategoryService.getByCategoryNameAndFatherCategoryId(baseCategory.getCategoryName(), baseCategory.getFatherCategoryId());
        if (category != null) {
            return ResponseValue.error("分类名称已存在");
        }
        S_user_core currentUser = this.getCurrentUser();
        if (currentUser == null) {
            return ResponseValue.error("登录用户信息不存在");
@@ -101,9 +119,8 @@
    /**
     * 修改状态
     *
     * @author 卢庆阳
     * @date 2023/9/27
     * @date 2023/10/23
     */
    //分类下有正常状态的物品时,不允许禁用
    @PostMapping("/updStatus")
@@ -122,7 +139,7 @@
    }
    /**
     * @Description 根据节点id删除节点(逻辑删除)
     * @Description 根据id删除物品分类
     * @Author 卢庆阳
     * @Date 2023/10/23
     */
@@ -137,10 +154,9 @@
    }
    /**
     * 根据节点id查询节点详情
     *
     * 根据物品id查询节点详情
     * @author 卢庆阳
     * @date 2023/9/26
     * @Date 2023/10/23
     */
    @GetMapping("/detail")
    public ResponseValue getById(Long id) {
@@ -151,5 +167,22 @@
        if (baseCategory == null) return ResponseValue.error("查询失败!");
        return ResponseValue.success("查询成功!", baseCategory);
    }
    /**
     * @Description 三级分类列表查询
     * @Author 卢庆阳
     * @Date 2023/10/24
     */
    @GetMapping("/select/lv3_tree")
    public ResponseValue tree() {
        S_user_core currentUser = this.getCurrentUser();
        if (currentUser == null) {
            return ResponseValue.error("登录用户信息不存在");
        }
        List<BaseCategory> baseCategories = this.baseCategoryService.queryForLv3Tree();
        return ResponseValue.success(baseCategories);
    }
}