xuekang
2024-05-13 15a0280ae9e7db96fdf0744c722d214d2cb5a0e5
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
package com.nuvole.four.controller.pc;
 
 
import com.github.pagehelper.PageHelper;
import com.nuvole.common.domain.result.CommonResult;
import com.nuvole.common.domain.result.PageBean;
import com.nuvole.four.controller.BaseController;
import com.nuvole.four.domain.StoreIndustryManage;
import com.nuvole.four.domain.query.StoreIndustryManageQuery;
import com.nuvole.four.service.StoreIndustryManageService;
import com.nuvole.util.CommonUtil;
import io.swagger.annotations.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * @Description 行业管理
 * @Author dqh
 * @Date 2024-04-12 17:41:29
 */
@Api(value = "行业管理接口", tags = "行业管理接口")
@EnableTransactionManagement
@RestController
@RequestMapping("/v1/four/pc/store/industry/manage")
public class StoreIndustryManageController extends BaseController {
 
    @Autowired
    private StoreIndustryManageService storeIndustryManageService;
 
    /**
     * 方法描述: 查询行业管理列表
     *
     * @date  2024-04-12 17:56
     **/
    @ApiOperation(value = "查询列表", notes = "查询列表")
    @ApiImplicitParams({ @ApiImplicitParam(name = "StoreIndustryManageQuery") })
    @GetMapping("/getList")
    public CommonResult<PageBean> getList(@ApiParam(name = "pageNumber", value = "分页页码", required = true) Integer pageNumber,
                                          @ApiParam(name = "pageSize", value = "每页展示数", required = true) Integer pageSize) {
        StoreIndustryManageQuery copy = CommonUtil.getObjFromReq(StoreIndustryManageQuery.class);
        StoreIndustryManageQuery query = new StoreIndustryManageQuery();
        BeanUtils.copyProperties(copy, query);
        PageHelper.startPage(pageNumber, pageSize);
 
        PageHelper.orderBy("create_time desc");
 
        List<StoreIndustryManage> list = storeIndustryManageService.getList(query);
        CommonResult result = new CommonResult<>(new PageBean(list));
        CommonResult result1 = new CommonResult<>();
        BeanUtils.copyProperties(result, result1);
        result = result1;
        return result;
    }
 
    /**
     * 方法描述: 添加行业管理
     *
     * @date  2024-04-12 18:17
     **/
    @ApiOperation(value = "添加", notes = "添加")
    @ApiImplicitParams({ @ApiImplicitParam(name = "StoreIndustryManage") })
    @PostMapping("/add")
    public CommonResult<Integer> add() {
        StoreIndustryManage copy = CommonUtil.getObjFromReq(StoreIndustryManage.class);
        StoreIndustryManage storeIndustryManage = new StoreIndustryManage();
        BeanUtils.copyProperties(copy, storeIndustryManage);
 
        CommonResult result = new CommonResult<>(storeIndustryManageService.addSelective(storeIndustryManage));
        CommonResult result1 = new CommonResult<>();
        BeanUtils.copyProperties(result, result1);
        result = result1;
        return result;
    }
 
    /**
     * 方法描述: 查询max(sortNo)的序号信息
     * 返回 = max(sortNo) + 10
     *
     * @date  2024-04-12 18:17
     **/
    @ApiOperation(value = "查询当前最大序号", notes = "查询当前最大序号")
    @GetMapping("/getSort")
    public CommonResult<StoreIndustryManage> getSort() {
        CommonResult result = new CommonResult<>(storeIndustryManageService.getSort());
        CommonResult result1 = new CommonResult<>();
        BeanUtils.copyProperties(result, result1);
        result = result1;
        return result;
    }
 
    /**
     * 方法描述: 根据id查询行业管理详情
     *
     * @date  2024-04-12 18:32
     **/
    @ApiOperation(value = "根据id查询", notes = "根据id查询")
    @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "主键id") })
    @GetMapping("/get")
    public CommonResult<StoreIndustryManage> get(Long id) {
        CommonResult result = new CommonResult<>(storeIndustryManageService.get(id));
        CommonResult result1 = new CommonResult<>();
        BeanUtils.copyProperties(result, result1);
        result = result1;
        return result;
    }
 
    /**
     * 方法描述: 修改行业管理
     *
     * @date  2024-04-12 18:32
     **/
    @ApiOperation(value = "修改", notes = "修改")
    @ApiImplicitParams({ @ApiImplicitParam(name = "StoreIndustryManage") })
    @PostMapping("/upd")
    public CommonResult<Integer> upd() {
        StoreIndustryManage copy = CommonUtil.getObjFromReq(StoreIndustryManage.class);
        StoreIndustryManage storeIndustryManage = new StoreIndustryManage();
        BeanUtils.copyProperties(copy, storeIndustryManage);
 
        CommonResult result = new CommonResult<>(storeIndustryManageService.editSelective(storeIndustryManage));
        CommonResult result1 = new CommonResult<>();
        BeanUtils.copyProperties(result, result1);
        result = result1;
        return result;
    }
 
    @ApiOperation(value = "删除", notes = "删除")
    @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "主键id") })
    @PostMapping("/del")
    public CommonResult<Integer> del(Long id) {
        CommonResult result = new CommonResult<>(storeIndustryManageService.del(id));
        CommonResult result1 = new CommonResult<>();
        BeanUtils.copyProperties(result, result1);
        result = result1;
        return result;
    }
 
    /**
     * 方法描述: 查询所有行业树
     *
     * @date  2024-04-12 18:43
     **/
    @ApiOperation(value = "查询所有行业树", notes = "查询所有行业树")
    @GetMapping("/getIndustryTree")
    public CommonResult<List<Map>> getIndustryTree(Integer status) {
        Map map = new HashMap();
        if(status != null){
            map.put("status",status);
        }
        List<Map> list = storeIndustryManageService.getIndustryTree(map);
        return new CommonResult<>(list);
    }
 
}