CoinSpeedUpgradesRulesController.java 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package top.continew.admin.controller.business;
  17. import io.swagger.v3.oas.annotations.Operation;
  18. import io.swagger.v3.oas.annotations.Parameter;
  19. import io.swagger.v3.oas.annotations.enums.ParameterIn;
  20. import io.swagger.v3.oas.annotations.tags.Tag;
  21. import lombok.AllArgsConstructor;
  22. import org.springframework.web.bind.annotation.*;
  23. import top.continew.admin.business.model.entity.CoinSpeedUpgradesRules;
  24. import top.continew.admin.business.model.query.CoinSpeedUpgradesRulesQuery;
  25. import top.continew.admin.business.model.req.CoinSpeedUpgradesRulesReq;
  26. import top.continew.admin.business.service.ICoinSpeedUpgradesRulesService;
  27. import top.continew.starter.extension.crud.model.resp.BaseIdResp;
  28. import top.continew.starter.extension.crud.model.resp.BasePageResp;
  29. import java.util.List;
  30. @RestController
  31. @RequestMapping("/coin/speed/upgrades")
  32. @AllArgsConstructor
  33. @Tag(name = "推进器API")
  34. public class CoinSpeedUpgradesRulesController {
  35. private final ICoinSpeedUpgradesRulesService rulesService;
  36. @Operation(summary = "分页查询", description = "分页查询")
  37. @GetMapping("/page")
  38. BasePageResp<CoinSpeedUpgradesRules> page(CoinSpeedUpgradesRulesQuery query) {
  39. return rulesService.getCoinSpeedUpgradesRulesPage(query);
  40. }
  41. @Operation(summary = "查询详情", description = "查询详情")
  42. @GetMapping("/{ids}")
  43. @Parameter(name = "ids", description = "ids", example = "1,2,3,4", in = ParameterIn.PATH)
  44. List<CoinSpeedUpgradesRules> getCoinSpeedUpgradesRulesByIds(@PathVariable("ids") List<Long> ids) {
  45. return rulesService.listByIds(ids);
  46. }
  47. @Operation(summary = "修改数据", description = "修改数据")
  48. @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
  49. @PutMapping({"/{id}"})
  50. //@Validated({CrudValidationGroup.Update.class})
  51. public void update(@RequestBody CoinSpeedUpgradesRulesReq req, @PathVariable("id") Long id) {
  52. this.rulesService.updateCoinSpeedUpgradesRules(id, req);
  53. }
  54. @Operation(summary = "删除数据", description = "删除数据")
  55. @DeleteMapping({"/{ids}"})
  56. public void delete(@PathVariable("ids") List<Long> ids) {
  57. this.rulesService.removeByIds(ids);
  58. }
  59. @Operation(summary = "新增数据", description = "新增数据")
  60. @PostMapping
  61. public BaseIdResp<Long> add(@RequestBody CoinSpeedUpgradesRulesReq req) {
  62. return new BaseIdResp<>(rulesService.addCoinSpeedUpgradesRules(req));
  63. }
  64. }