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"));
|
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();
|
}
|
}
|
|
|
}
|