| | |
| | | return ResponseValue.error("顺序号为空"); |
| | | } |
| | | //判断同一父类id下分类名称是否重复 |
| | | BaseCategory category = this.baseCategoryService.getByCategoryNameAndFatherCategoryId(param.getCategoryName(),param.getFatherCategoryId()); |
| | | BaseCategory category = this.baseCategoryService.getByCategoryNameAndFatherCategoryId(param.getCategoryName(), param.getFatherCategoryId()); |
| | | if (category != null) { |
| | | return ResponseValue.error("分类名称已存在"); |
| | | } |
| | | |
| | | // int result = this.baseCategoryService.add(param,this.getCurrentUser()); |
| | | int result = this.baseCategoryService.add(param); |
| | | if(result>0) return ResponseValue.success(1); |
| | | int result = this.baseCategoryService.add(param, this.getCurrentUser()); |
| | | if (result > 0) return ResponseValue.success(1); |
| | | return ResponseValue.error("新增失败!"); |
| | | } |
| | | |
| | | /** |
| | | * @Description 物品分类列表查询 |
| | | * @Description 物品分类列表查询 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/23 |
| | | */ |
| | | @GetMapping("/list") |
| | | public ResponseValue queryBaseCategoryList(BaseCategoryParam param) { |
| | | // S_user_core currentUser = this.getCurrentUser(); |
| | | // if (currentUser == null) { |
| | | // return ResponseValue.error("登录用户信息不存在"); |
| | | // } |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | if (currentUser == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | GenericPager<BaseCategory> pager = this.baseCategoryService.queryBaseCategoryList(param); |
| | | return ResponseValue.success(pager); |
| | | } |
| | | |
| | | /** |
| | | * @Description 编辑 |
| | | * @Description 编辑 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/23 |
| | | */ |
| | |
| | | return ResponseValue.error("顺序号为空"); |
| | | } |
| | | //判断同一父类id下分类名称是否重复 |
| | | BaseCategory category = this.baseCategoryService.getByCategoryNameAndFatherCategoryId(baseCategory.getCategoryName(),baseCategory.getFatherCategoryId()); |
| | | 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("登录用户信息不存在"); |
| | | // } |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | if (currentUser == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | int num = this.baseCategoryService.updateBaseCategory(baseCategory); |
| | | return num>0 ? ResponseValue.success(1):ResponseValue.error("编辑失败!"); |
| | | return num > 0 ? ResponseValue.success(1) : ResponseValue.error("编辑失败!"); |
| | | } |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * |
| | | * @author 卢庆阳 |
| | | * @date 2023/9/27 |
| | | */ |
| | | //分类下有正常状态的物品时,不允许禁用 |
| | | @PostMapping("/updStatus") |
| | | public ResponseValue updateStatus(@RequestBody BaseCategory baseCategory){ |
| | | if (baseCategory==null || baseCategory.getId() ==null || baseCategory.getStates() == null) { |
| | | public ResponseValue updateStatus(@RequestBody BaseCategory baseCategory) { |
| | | if (baseCategory == null || baseCategory.getId() == null || baseCategory.getStates() == null) { |
| | | return ResponseValue.error("参数错误"); |
| | | } |
| | | //根据分类id和状态查询物品模版 |
| | |
| | | } |
| | | |
| | | int num = this.baseCategoryService.updateStatus(baseCategory); |
| | | return num>0 ? ResponseValue.success(1):ResponseValue.error("修改失败!"); |
| | | return num > 0 ? ResponseValue.success(1) : ResponseValue.error("修改失败!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @Date 2023/10/23 |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public ResponseValue updateById(@RequestBody BaseCategory baseCategory){ |
| | | public ResponseValue updateById(@RequestBody BaseCategory baseCategory) { |
| | | if (baseCategory.getId() == null) { |
| | | return ResponseValue.error("分类id为空"); |
| | | } |
| | | //S_user_core currentUser = this.getCurrentUser(); |
| | | int num = this.baseCategoryService.updateById(baseCategory); |
| | | int num = this.baseCategoryService.updateById(baseCategory,this.getCurrentUser()); |
| | | |
| | | return num>0 ? ResponseValue.success(1):ResponseValue.error("删除失败!"); |
| | | return num > 0 ? ResponseValue.success(1) : ResponseValue.error("删除失败!"); |
| | | } |
| | | |
| | | /** |
| | | * 根据节点id查询节点详情 |
| | | * |
| | | * @author 卢庆阳 |
| | | * @date 2023/9/26 |
| | | */ |
| | | @GetMapping("/detail") |
| | | public ResponseValue getById(Long id){ |
| | | public ResponseValue getById(Long id) { |
| | | if (id == null) { |
| | | return ResponseValue.error("分类id为空"); |
| | | } |
| | | BaseCategory baseCategory = this.baseCategoryService.getById(id); |
| | | if (baseCategory == null) return ResponseValue.error("查询失败!"); |
| | | return ResponseValue.success("查询成功!",baseCategory); |
| | | return ResponseValue.success("查询成功!", baseCategory); |
| | | } |
| | | } |
| | | |