|
@@ -1,11 +1,13 @@
|
|
package com.fdkankan.fusion.controller;
|
|
package com.fdkankan.fusion.controller;
|
|
|
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
import com.fdkankan.fusion.common.ResultData;
|
|
import com.fdkankan.fusion.common.ResultData;
|
|
import com.fdkankan.fusion.entity.SystemSetting;
|
|
import com.fdkankan.fusion.entity.SystemSetting;
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
import com.fdkankan.fusion.service.ISystemSettingService;
|
|
import com.fdkankan.fusion.service.ISystemSettingService;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -29,8 +31,10 @@ public class SystemSettingController {
|
|
|
|
|
|
|
|
|
|
@GetMapping("/info")
|
|
@GetMapping("/info")
|
|
- public ResultData info(){
|
|
|
|
- List<SystemSetting> list = systemSettingService.list();
|
|
|
|
|
|
+ public ResultData info(@RequestParam(required = false,defaultValue = "fire") String platformKey){
|
|
|
|
+ LambdaQueryWrapper<SystemSetting> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(SystemSetting::getPlatformKey,platformKey);
|
|
|
|
+ List<SystemSetting> list = systemSettingService.list(wrapper);
|
|
if(list == null || list.isEmpty()){
|
|
if(list == null || list.isEmpty()){
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
}
|
|
}
|
|
@@ -40,7 +44,12 @@ public class SystemSettingController {
|
|
|
|
|
|
@PostMapping("/save")
|
|
@PostMapping("/save")
|
|
public ResultData save(@RequestBody SystemSetting systemSetting){
|
|
public ResultData save(@RequestBody SystemSetting systemSetting){
|
|
- List<SystemSetting> list = systemSettingService.list();
|
|
|
|
|
|
+ if(StringUtils.isBlank(systemSetting.getPlatformKey())){
|
|
|
|
+ systemSetting.setPlatformKey("fire");
|
|
|
|
+ }
|
|
|
|
+ LambdaQueryWrapper<SystemSetting> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(SystemSetting::getPlatformKey,systemSetting.getPlatformKey());
|
|
|
|
+ List<SystemSetting> list = systemSettingService.list(wrapper);
|
|
if(list == null || list.isEmpty()){
|
|
if(list == null || list.isEmpty()){
|
|
systemSettingService.save(systemSetting);
|
|
systemSettingService.save(systemSetting);
|
|
}else {
|
|
}else {
|