SysSwitchConfigController.java 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package com.ydtech.modules.admin.controller;
  2. import com.ydtech.core.page.HttpResult;
  3. import com.ydtech.modules.admin.model.po.SysSwitchConfig;
  4. import com.ydtech.modules.admin.model.vo.SysSwitchConfigQueryVo;
  5. import com.ydtech.modules.admin.model.vo.SysSwitchConfigVo;
  6. import com.ydtech.modules.admin.service.SysSwitchConfigService;
  7. import com.ydtech.modules.order.entity.BasePageResult;
  8. import com.ydtech.modules.protocol.utils.AssertionUtils;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import lombok.RequiredArgsConstructor;
  12. import org.springframework.web.bind.annotation.*;
  13. @RestController
  14. @RequestMapping("/sys/switch")
  15. @Api(tags = "开关配置")
  16. @RequiredArgsConstructor
  17. public class SysSwitchConfigController {
  18. private final SysSwitchConfigService sysSwitchConfigService;
  19. @PostMapping("/page")
  20. @ApiOperation(value = "获取分页列表")
  21. public HttpResult<BasePageResult<SysSwitchConfig>> queryPage(@RequestBody SysSwitchConfigQueryVo sysSwitchConfigQueryVo) {
  22. BasePageResult<SysSwitchConfig> pageResult = sysSwitchConfigService.queryPage(sysSwitchConfigQueryVo);
  23. return HttpResult.ok(pageResult);
  24. }
  25. @PostMapping
  26. @ApiOperation(value = "增加")
  27. public HttpResult<Object> add(@RequestBody SysSwitchConfigVo sysSwitchConfigVo) {
  28. sysSwitchConfigService.add(sysSwitchConfigVo);
  29. return HttpResult.ok();
  30. }
  31. @DeleteMapping("/{id}")
  32. @ApiOperation(value = "删除")
  33. public HttpResult<Object> del(@PathVariable String id) {
  34. boolean b = sysSwitchConfigService.removeById(id);
  35. AssertionUtils.isSucceed(b, "删除失败");
  36. return HttpResult.ok();
  37. }
  38. @PutMapping("/{id}")
  39. @ApiOperation(value = "修改")
  40. public HttpResult<Object> revise(@PathVariable String id, @RequestBody SysSwitchConfigVo sysSwitchConfigVo) {
  41. sysSwitchConfigService.revise(id, sysSwitchConfigVo);
  42. return HttpResult.ok();
  43. }
  44. @GetMapping("/appUndeveloped/display")
  45. @ApiOperation(value = "app未开发完功能隐藏")
  46. public HttpResult<Boolean> appUndeveloped() {
  47. boolean display = sysSwitchConfigService.appUndeveloped();
  48. return HttpResult.ok(display);
  49. }
  50. @GetMapping("/isEnabled")
  51. @ApiOperation(value = "开关是否开启")
  52. public HttpResult<Boolean> isEnabled(String keyWord) {
  53. boolean display = sysSwitchConfigService.isEnabled(keyWord);
  54. return HttpResult.ok(display);
  55. }
  56. }