driver-server/src/main/java/com/jwl/driver/server/controller/TdSysConfigController.java

64 lines
2.3 KiB
Java

package com.jwl.driver.server.controller;
import cn.hutool.core.util.StrUtil;
import com.jwl.driver.server.entity.TdSysConfig;
import com.jwl.driver.server.response.BaseResponse;
import com.jwl.driver.server.service.ITdSysConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Map;
/**
* <p>
* 系统配置表; 前端控制器
* </p>
*
* @author Automated procedures
* @since 2023-08-10
*/
@Api(tags = "字典值配置")
@RestController
@RequestMapping("/tdSysConfig")
@Slf4j
public class TdSysConfigController {
@Autowired
private ITdSysConfigService configService;
/**
* 根据配置key和carTypeId获取配置信息,配置与车型无关则carTypeId为-1
*/
@ApiOperation("根据配置key和carTypeId获取配置信息,配置与车型无关则carTypeId为-1")
@GetMapping(value = "/queryConfigByKey")
public BaseResponse queryConfigByKey(@RequestParam("configKey") String configKey, @RequestParam("carTypeId") Integer carTypeId) {
return BaseResponse.success(configService.queryConfigByKey(configKey, carTypeId));
}
/**
* 根据配置key和carTypeId获取配置值,配置与车型无关则carTypeId为-1
*/
@ApiOperation("根据配置key获取配置值")
@GetMapping(value = "/queryConfigValueByKey")
public BaseResponse<String> queryConfigValueByKey(@RequestParam("configKey") String configKey, @RequestParam("carTypeId") Integer carTypeId) {
return BaseResponse.success(configService.queryConfigValueByKey(configKey, carTypeId));
}
/**
* 根据配置keys和carTypeId获取配置信息,配置与车型无关则carTypeId为-1
*/
@ApiOperation("根据配置keys和carTypeId获取配置信息,配置与车型无关则carTypeId为-1")
@GetMapping(value = "/queryConfigByKeys")
public BaseResponse<Map<String, TdSysConfig>> queryConfigByKeys(@RequestParam("configKeys") String configKeys, @RequestParam("carTypeId") Integer carTypeId) {
return BaseResponse.success(configService.queryConfigByKeys(Arrays.asList(configKeys.split(",")),carTypeId));
}
}