| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package com.ydtech.modules.admin.controller;
- import com.ydtech.core.page.HttpResult;
- import com.ydtech.modules.admin.model.po.SysSwitchConfig;
- import com.ydtech.modules.admin.model.vo.SysSwitchConfigQueryVo;
- import com.ydtech.modules.admin.model.vo.SysSwitchConfigVo;
- import com.ydtech.modules.admin.service.SysSwitchConfigService;
- import com.ydtech.modules.order.entity.BasePageResult;
- import com.ydtech.modules.protocol.utils.AssertionUtils;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.RequiredArgsConstructor;
- import org.springframework.web.bind.annotation.*;
- @RestController
- @RequestMapping("/sys/switch")
- @Api(tags = "开关配置")
- @RequiredArgsConstructor
- public class SysSwitchConfigController {
- private final SysSwitchConfigService sysSwitchConfigService;
- @PostMapping("/page")
- @ApiOperation(value = "获取分页列表")
- public HttpResult<BasePageResult<SysSwitchConfig>> queryPage(@RequestBody SysSwitchConfigQueryVo sysSwitchConfigQueryVo) {
- BasePageResult<SysSwitchConfig> pageResult = sysSwitchConfigService.queryPage(sysSwitchConfigQueryVo);
- return HttpResult.ok(pageResult);
- }
- @PostMapping
- @ApiOperation(value = "增加")
- public HttpResult<Object> add(@RequestBody SysSwitchConfigVo sysSwitchConfigVo) {
- sysSwitchConfigService.add(sysSwitchConfigVo);
- return HttpResult.ok();
- }
- @DeleteMapping("/{id}")
- @ApiOperation(value = "删除")
- public HttpResult<Object> del(@PathVariable String id) {
- boolean b = sysSwitchConfigService.removeById(id);
- AssertionUtils.isSucceed(b, "删除失败");
- return HttpResult.ok();
- }
- @PutMapping("/{id}")
- @ApiOperation(value = "修改")
- public HttpResult<Object> revise(@PathVariable String id, @RequestBody SysSwitchConfigVo sysSwitchConfigVo) {
- sysSwitchConfigService.revise(id, sysSwitchConfigVo);
- return HttpResult.ok();
- }
- }
|