feat: 增加系统配置
增加系统配置功能
This commit is contained in:
@@ -7,6 +7,7 @@ import com.youlai.system.model.form.ConfigForm;
|
||||
import com.youlai.system.model.query.ConfigPageQuery;
|
||||
import com.youlai.system.model.vo.ConfigVO;
|
||||
import com.youlai.system.service.SysConfigService;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -18,10 +19,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
|
||||
/**
|
||||
* 系统配置 前端控制器
|
||||
* 系统配置前端控制层
|
||||
*
|
||||
* @author Theo
|
||||
* @since 2024-07-29 11:17:26
|
||||
* @since 2024-07-30 11:25
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@@ -34,27 +35,43 @@ public class SysConfigController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "系统配置分页列表")
|
||||
@PreAuthorize("@ss.hasPerm('business:config:query')")
|
||||
@PreAuthorize("@ss.hasPerm('sys:config:query')")
|
||||
public PageResult<ConfigVO> page(@ParameterObject ConfigPageQuery configPageQuery) {
|
||||
IPage<ConfigVO> result = sysConfigService.page(configPageQuery);
|
||||
return PageResult.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增系统配置")
|
||||
@PostMapping(value = "/save")
|
||||
@PreAuthorize("@ss.hasPerm('business:config:add')")
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:config:add')")
|
||||
public Result<?> save(@RequestBody @Valid ConfigForm configForm) {
|
||||
return Result.judge(sysConfigService.save(configForm));
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
@Operation(summary = "获取系统配置表单数据")
|
||||
@GetMapping("/{id}/form")
|
||||
public Result<ConfigForm> getConfigForm(
|
||||
@Parameter(description = "系统配置ID") @PathVariable Long id
|
||||
) {
|
||||
ConfigForm formData = sysConfigService.getConfigFormData(id);
|
||||
return Result.success(formData);
|
||||
}
|
||||
|
||||
@Operation(summary = "刷新系统配置缓存")
|
||||
@PatchMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:config:refresh')")
|
||||
public Result<ConfigForm> refreshCache() {
|
||||
return Result.judge(sysConfigService.refreshCache());
|
||||
}
|
||||
|
||||
@PutMapping(value = "/{id}")
|
||||
@Operation(summary = "修改系统配置")
|
||||
@PreAuthorize("@ss.hasPerm('business:config:update')")
|
||||
@PreAuthorize("@ss.hasPerm('sys:config:update')")
|
||||
public Result<?> update(@Valid @PathVariable Long id, @RequestBody ConfigForm configForm) {
|
||||
return Result.judge(sysConfigService.edit(id, configForm));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@DeleteMapping("/{id}")
|
||||
@Operation(summary = "删除系统配置")
|
||||
@PreAuthorize("@ss.hasPerm('business:config:delete')")
|
||||
public Result<?> delete(@PathVariable Long id) {
|
||||
|
||||
Reference in New Issue
Block a user