/* * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package top.continew.admin.controller.business; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; import top.continew.admin.business.model.entity.CoinSpeedUpgradesRules; import top.continew.admin.business.model.query.CoinSpeedUpgradesRulesQuery; import top.continew.admin.business.model.req.CoinSpeedUpgradesRulesReq; import top.continew.admin.business.service.ICoinSpeedUpgradesRulesService; import top.continew.starter.extension.crud.model.resp.BaseIdResp; import top.continew.starter.extension.crud.model.resp.BasePageResp; import java.util.List; @RestController @RequestMapping("/coin/speed/upgrades") @AllArgsConstructor @Tag(name = "推进器API") public class CoinSpeedUpgradesRulesController { private final ICoinSpeedUpgradesRulesService rulesService; @Operation(summary = "分页查询", description = "分页查询") @GetMapping("/page") BasePageResp page(CoinSpeedUpgradesRulesQuery query) { return rulesService.getCoinSpeedUpgradesRulesPage(query); } @Operation(summary = "查询详情", description = "查询详情") @GetMapping("/{ids}") @Parameter(name = "ids", description = "ids", example = "1,2,3,4", in = ParameterIn.PATH) List getCoinSpeedUpgradesRulesByIds(@PathVariable("ids") List ids) { return rulesService.listByIds(ids); } @Operation(summary = "修改数据", description = "修改数据") @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH) @PutMapping({"/{id}"}) //@Validated({CrudValidationGroup.Update.class}) public void update(@RequestBody CoinSpeedUpgradesRulesReq req, @PathVariable("id") Long id) { this.rulesService.updateCoinSpeedUpgradesRules(id, req); } @Operation(summary = "删除数据", description = "删除数据") @DeleteMapping({"/{ids}"}) public void delete(@PathVariable("ids") List ids) { this.rulesService.removeByIds(ids); } @Operation(summary = "新增数据", description = "新增数据") @PostMapping public BaseIdResp add(@RequestBody CoinSpeedUpgradesRulesReq req) { return new BaseIdResp<>(rulesService.addCoinSpeedUpgradesRules(req)); } }