nickchange
2023-10-10 ee9cb0da4a43bcf523ebb157678f64a2895fba1a
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
package com.dsh.other.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsh.other.entity.StoreConfig;
import com.dsh.other.model.StoreConfigVo;
import com.dsh.other.service.StoreConfigService;
import com.dsh.other.util.ResultUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * @author zhibing.pu
 * @date 2023/6/24 16:11
 */
@RestController
@RequestMapping("")
public class StoreConfigController {
 
    @Autowired
    private StoreConfigService storeConfigService;
 
 
 
    @ResponseBody
    @PostMapping("/base/store/queryStoreConfig")
    @ApiOperation(value = "获取门店模块配置", tags = {"APP-加入玩湃"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "门店id", name = "storeId", dataType = "int", required = true),
    })
    public ResultUtil<List<StoreConfigVo>> queryStoreConfig(Integer storeId){
        if(null == storeId){
            return ResultUtil.paranErr("storeId");
        }
        try {
            List<StoreConfig> list = storeConfigService.list(new QueryWrapper<StoreConfig>().eq("storeId", storeId).orderByAsc("sort").eq("isOpen",1));
            List<StoreConfigVo> listVo = new ArrayList<>();
            for (StoreConfig storeConfig : list) {
                StoreConfigVo storeConfigVo = new StoreConfigVo();
                BeanUtils.copyProperties(storeConfig, storeConfigVo);
                listVo.add(storeConfigVo);
            }
            return ResultUtil.success(listVo);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
}