jiangping
2023-09-21 d5bdf4cd56be6bd0e7afa81d75c35a9f15ae2a40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package com.doumee.api.business;
 
import com.doumee.api.BaseController;
import com.doumee.core.annotation.excel.ExcelExporter;
import com.doumee.core.annotation.pr.PreventRepeat;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.model.BaseCateParam;
import com.doumee.dao.business.model.BaseCategory;
import com.doumee.dao.business.model.Category;
import com.doumee.service.CateParamSelectService;
import com.doumee.service.business.BaseCateParamService;
import com.doumee.service.business.BaseCategoryService;
import com.doumee.service.business.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.java.Log;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
 
/**
 * @author 江蹄蹄
 * @date 2023/05/12 13:58
 */
@Api(tags = "品类信息表")
@RestController
@RequestMapping("/business/category")
public class CategoryController extends BaseController {
 
    @Autowired
    private CategoryService categoryService;
 
    @Autowired
    private BaseCategoryService baseCategoryService;
 
    @Autowired
    private BaseCateParamService baseCateParamService;
    @Autowired
    private CateParamSelectService cateParamSelectService;
 
 
    @ApiOperation("列表")
    @PostMapping("/list")
    public ApiResponse<List<Category>> findList (@RequestBody Category category) {
        return ApiResponse.success(categoryService.findList(category));
    }
 
    @ApiOperation("列表 - 商品选择")
    @GetMapping("/findListForGoodsId")
    public ApiResponse<List<Category>> findListForGoodsId (Integer goodsId) {
        return ApiResponse.success(categoryService.findListForGoods(goodsId));
    }
 
 
    @ApiOperation("企业选择分类列表 - H5")
    @PostMapping("/companyFindList")
    public ApiResponse<List<Category>> companyFindList (@RequestBody Category category) {
        return ApiResponse.success(categoryService.companyFindList(category));
    }
 
    @ApiOperation("平台分类列表")
    @PostMapping("/baseCategoryList")
    public ApiResponse<List<BaseCategory>> baseCategoryList () {
        BaseCategory baseCategory = new BaseCategory();
        baseCategory.setIsdeleted(Constants.ZERO);
        baseCategory.setStatus(Constants.ZERO);
        List list = baseCategoryService.findList(baseCategory);
        return ApiResponse.success(list);
    }
 
    @ApiOperation("平台分类详情")
    @GetMapping("/baseCategoryDetail")
    public ApiResponse<BaseCategory> baseCategoryDetail (Integer baseCategoryId) {
 
        BaseCategory baseCategory = baseCategoryService.findById(baseCategoryId);
        if(Objects.isNull(baseCategory)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        BaseCateParam baseCateParam = new BaseCateParam();
        baseCateParam.setIsdeleted(Constants.ZERO);
        baseCateParam.setStatus(Constants.ZERO);
        baseCateParam.setCategoryId(baseCategoryId);
        baseCategory.setBaseCateParamList(
                baseCateParamService.findList(baseCateParam)
        );
        return ApiResponse.success(baseCategory);
    }
 
    @ApiOperation("列表 - SaaSH5")
    @PostMapping("/saasList")
    public ApiResponse<List<Category>> saasList (@RequestBody Category category) {
        return ApiResponse.success(categoryService.findListSaaS(category));
    }
 
}