gitignore 提交
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package fun.nojava.module.blog.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import fun.nojava.common.model.ApiResult;
|
||||
import fun.nojava.module.blog.entity.Tag;
|
||||
import fun.nojava.module.blog.mapper.TagMapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@io.swagger.v3.oas.annotations.tags.Tag(name = "标签接口")
|
||||
@RestController
|
||||
@RequestMapping("/api/public/tag")
|
||||
@RequiredArgsConstructor
|
||||
class PublicTagController {
|
||||
|
||||
private final TagMapper tagMapper;
|
||||
|
||||
@Operation(summary = "标签列表")
|
||||
@GetMapping("/list")
|
||||
public ApiResult<List<Tag>> listTags() {
|
||||
return ApiResult.success(tagMapper.selectList(new LambdaQueryWrapper<Tag>().orderByAsc(Tag::getName)));
|
||||
}
|
||||
}
|
||||
|
||||
@io.swagger.v3.oas.annotations.tags.Tag(name = "管理员-标签管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/tag")
|
||||
@RequiredArgsConstructor
|
||||
class AdminTagController {
|
||||
|
||||
private final TagMapper tagMapper;
|
||||
|
||||
@Operation(summary = "创建标签")
|
||||
@PostMapping
|
||||
public ApiResult<Tag> createTag(@RequestParam String name) {
|
||||
Tag tag = new Tag();
|
||||
tag.setName(name);
|
||||
tagMapper.insert(tag);
|
||||
return ApiResult.success(tag);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user