feat(app): 新增后台 App 版本管理接口
This commit is contained in:
1 parent
34c775620d
commit
62792413df
8 files changed
+472
No files matched your search
+85
@@ -0,0 +1,85 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
package com.fruitshorts.admin.controller;
|
||||
|
||||
import com.fruitshorts.common.pojo.PageResult;
|
||||
import com.fruitshorts.common.pojo.Result;
|
||||
import com.fruitshorts.framework.log.OperationLog;
|
||||
import com.fruitshorts.system.service.AppVersionService;
|
||||
import com.fruitshorts.system.vo.AppVersionQueryReqVO;
|
||||
import com.fruitshorts.system.vo.AppVersionRespVO;
|
||||
import com.fruitshorts.system.vo.AppVersionSaveReqVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/** 后台 - App 版本管理。 */
|
||||
@Tag(name = "后台-App 版本")
|
||||
@RestController
|
||||
@RequestMapping("/admin/app-versions")
|
||||
@RequiredArgsConstructor
|
||||
public class AppVersionAdminController {
|
||||
|
||||
private final AppVersionService appVersionService;
|
||||
|
||||
@Operation(summary = "版本分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@ss.hasPermission('app-version:list')")
|
||||
public Result<PageResult<AppVersionRespVO>> page(@Validated AppVersionQueryReqVO req) {
|
||||
return Result.ok(appVersionService.page(req));
|
||||
}
|
||||
|
||||
@Operation(summary = "版本详情")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@ss.hasPermission('app-version:list')")
|
||||
public Result<AppVersionRespVO> detail(@PathVariable Long id) {
|
||||
return Result.ok(appVersionService.detail(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新建版本(默认发布)")
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPermission('app-version:create')")
|
||||
@OperationLog(module = "版本管理", action = "新建版本")
|
||||
public Result<Long> create(@Valid @RequestBody AppVersionSaveReqVO req) {
|
||||
return Result.ok(appVersionService.create(req));
|
||||
}
|
||||
|
||||
@Operation(summary = "编辑版本")
|
||||
@PutMapping("/{id}")
|
||||
@PreAuthorize("@ss.hasPermission('app-version:update')")
|
||||
@OperationLog(module = "版本管理", action = "编辑版本")
|
||||
public Result<Void> update(@PathVariable Long id, @Valid @RequestBody AppVersionSaveReqVO req) {
|
||||
appVersionService.update(id, req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "发布 / 下架")
|
||||
@PutMapping("/{id}/status")
|
||||
@PreAuthorize("@ss.hasPermission('app-version:update')")
|
||||
@OperationLog(module = "版本管理", action = "版本上下架")
|
||||
public Result<Void> updateStatus(@PathVariable Long id, @RequestParam Integer status) {
|
||||
appVersionService.updateStatus(id, status);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "删除版本")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@ss.hasPermission('app-version:delete')")
|
||||
@OperationLog(module = "版本管理", action = "删除版本")
|
||||
public Result<Void> delete(@PathVariable Long id) {
|
||||
appVersionService.delete(id);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user