|  |  |  | 
|---|
|  |  |  | package com.vincent.rsf.server.system.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.vincent.rsf.framework.common.Cools; | 
|---|
|  |  |  | import com.vincent.rsf.framework.common.R; | 
|---|
|  |  |  | import com.vincent.rsf.framework.common.SnowflakeIdWorker; | 
|---|
|  |  |  | import com.vincent.rsf.framework.exception.CoolException; | 
|---|
|  |  |  | import com.vincent.rsf.server.common.annotation.OperationLog; | 
|---|
|  |  |  | import com.vincent.rsf.server.common.domain.BaseParam; | 
|---|
|  |  |  | import com.vincent.rsf.server.common.domain.KeyValVo; | 
|---|
|  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping("") | 
|---|
|  |  |  | public class ConfigController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | 
|---|
|  |  |  | public R get(@PathVariable("id") Long id) { | 
|---|
|  |  |  | return R.ok().add(configService.getById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('system:config:list')") | 
|---|
|  |  |  | @GetMapping("/config/flag/{flag}") | 
|---|
|  |  |  | public R getByFlag(@PathVariable("flag") String flag) { | 
|---|
|  |  |  | return R.ok().add(configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, flag))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('system:config:save')") | 
|---|
|  |  |  | @OperationLog("Create Config") | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok("Update Success").add(config); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('system:config:update')") | 
|---|
|  |  |  | @OperationLog("Update Config") | 
|---|
|  |  |  | @PostMapping("/config/byFlag") | 
|---|
|  |  |  | public R updateByFlag(@RequestBody Config config) { | 
|---|
|  |  |  | if (Objects.isNull(config)) { | 
|---|
|  |  |  | return R.error("参数不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return configService.modiftyStatus(config); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('system:config:remove')") | 
|---|
|  |  |  | @OperationLog("Delete Config") | 
|---|
|  |  |  | @PostMapping("/config/remove/{ids}") | 
|---|