SysBaseConfigController.java 2.0 KB
package com.skua.modules.system.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.modules.system.entity.SysBaseConfig;
import com.skua.modules.system.service.ISysBaseConfigService;
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.*;

/**
 * <pre>
 * 基础信息配置
 * </pre>
 * @author 谢超
 * @version V1.0, 2022-06-16 14:00:00
 */
@Slf4j
@Api(tags="基础信息配置")
@RestController
@RequestMapping("/system/sysBaseConfig")
public class SysBaseConfigController {
	@Autowired
	private ISysBaseConfigService sysBaseConfigService;

	/**
	 * <pre>
	 * 	 新增或更新
	 * </pre>
	 * @param sysBaseConfig
	 * @return
	 * @author xiechao
	 */
	@AutoLog(value = "基础信息配置-编辑")
	@ApiOperation(value="基础信息配置-编辑", notes="基础信息配置-编辑")
	@PostMapping(value = "/addOrEdit")
	public Result<SysBaseConfig> addOrEdit(@RequestBody SysBaseConfig sysBaseConfig) {
		Result<SysBaseConfig> result = new Result<SysBaseConfig>();
		sysBaseConfigService.saveOrUpdate(sysBaseConfig);
		result.success("更新成功!");
		return result;
	}

	/**
	 * <pre>
	 * 	 查询基础配置信息
	 * </pre>
	 * @return
	 * @author xiechao
	 */
	@AutoLog(value = "基础信息配置-查询基础配置信息")
	@ApiOperation(value="基础信息配置-查询基础配置信息", notes="基础信息配置-查询基础配置信息")
	@GetMapping(value = "/getSysBaseConfig")
	public Result<SysBaseConfig> getSysBaseConfig() {
		Result<SysBaseConfig> result = new Result<>();
		SysBaseConfig sysBaseConfig = sysBaseConfigService.getOne(new QueryWrapper<>());
		if (sysBaseConfig == null){
			sysBaseConfig = new SysBaseConfig();
		}
		result.setResult(sysBaseConfig);
		result.setSuccess(true);
		return result;
	}
}