feat(content): 短剧分类和标签支持多语言
This commit is contained in:
1 parent
5c20cf1ab9
commit
e60c47123c
34 files changed
+1071
-53
No files matched your search
+72
@@ -0,0 +1,72 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
package com.fruitshorts.admin.controller;
|
||||
|
||||
import com.fruitshorts.common.pojo.Result;
|
||||
import com.fruitshorts.content.service.ContentTagService;
|
||||
import com.fruitshorts.content.vo.ContentTagRespVO;
|
||||
import com.fruitshorts.content.vo.ContentTagSaveReqVO;
|
||||
import com.fruitshorts.framework.log.OperationLog;
|
||||
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.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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 短剧标签管理。短剧编辑时单选其中一个启用标签。 */
|
||||
@Tag(name = "后台-标签")
|
||||
@RestController
|
||||
@RequestMapping("/admin/content-tags")
|
||||
@RequiredArgsConstructor
|
||||
public class ContentTagController {
|
||||
|
||||
private final ContentTagService contentTagService;
|
||||
|
||||
@Operation(summary = "标签列表")
|
||||
@GetMapping
|
||||
@PreAuthorize("@ss.hasPermission('drama:list')")
|
||||
public Result<List<ContentTagRespVO>> list(
|
||||
@RequestParam(required = false) Boolean enabledOnly) {
|
||||
if (Boolean.TRUE.equals(enabledOnly)) {
|
||||
return Result.ok(contentTagService.listEnabled());
|
||||
}
|
||||
return Result.ok(contentTagService.list());
|
||||
}
|
||||
|
||||
@Operation(summary = "新建标签")
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPermission('drama:create')")
|
||||
@OperationLog(module = "内容管理", action = "新增标签")
|
||||
public Result<Long> create(@Valid @RequestBody ContentTagSaveReqVO req) {
|
||||
return Result.ok(contentTagService.create(req));
|
||||
}
|
||||
|
||||
@Operation(summary = "编辑标签")
|
||||
@PutMapping("/{id}")
|
||||
@PreAuthorize("@ss.hasPermission('drama:update')")
|
||||
@OperationLog(module = "内容管理", action = "编辑标签")
|
||||
public Result<Void> update(@PathVariable Long id, @Valid @RequestBody ContentTagSaveReqVO req) {
|
||||
contentTagService.update(id, req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "删除标签")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@ss.hasPermission('drama:delete')")
|
||||
@OperationLog(module = "内容管理", action = "删除标签")
|
||||
public Result<Void> delete(@PathVariable Long id) {
|
||||
contentTagService.delete(id);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user