|
|
|
@ -7,6 +7,9 @@ import com.luoo.tag.service.TagS3Service;
|
|
|
|
|
import com.luoo.tag.service.TagService;
|
|
|
|
|
import io.swagger.annotations.*;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import net.oschina.j2cache.CacheChannel;
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
@ -24,7 +27,8 @@ import java.util.List;
|
|
|
|
|
public class TagInfoController {
|
|
|
|
|
private final TagService tagService;
|
|
|
|
|
private final TagS3Service s3Service;
|
|
|
|
|
|
|
|
|
|
private final CacheChannel cacheChannel;
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询标签信息", notes = "查询标签信息")
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public Result<PageResult<TagDTO>> page(@Validated TagQueryReq queryReq) {
|
|
|
|
@ -41,6 +45,7 @@ public class TagInfoController {
|
|
|
|
|
@ApiOperation(value = "新增标签信息", notes = "新增标签信息")
|
|
|
|
|
@PostMapping
|
|
|
|
|
public Result<Void> create(@Validated @RequestBody TagCreateReq createReq) {
|
|
|
|
|
cacheChannel.evict("default", "search_category");
|
|
|
|
|
tagService.create(createReq);
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
@ -50,6 +55,7 @@ public class TagInfoController {
|
|
|
|
|
@ApiImplicitParam(name = "id", value = "标签ID", required = true) })
|
|
|
|
|
@PutMapping("/{id}")
|
|
|
|
|
public Result<Void> update(@Validated @RequestBody TagUpdateReq updateReq, @PathVariable String id) {
|
|
|
|
|
cacheChannel.evict("default", "search_category");
|
|
|
|
|
updateReq.setId(id);
|
|
|
|
|
tagService.update(updateReq);
|
|
|
|
|
return Result.success();
|
|
|
|
@ -61,6 +67,7 @@ public class TagInfoController {
|
|
|
|
|
@ApiImplicitParam(name = "state", value = "标签状态", required = true) })
|
|
|
|
|
@PutMapping("/status/{id}")
|
|
|
|
|
public Result<Void> updateStatus(@PathVariable String id, @RequestParam Integer state) {
|
|
|
|
|
cacheChannel.evict("default", "search_category");
|
|
|
|
|
tagService.updateState(id, state);
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
@ -71,6 +78,7 @@ public class TagInfoController {
|
|
|
|
|
@ApiImplicitParam(name = "show", value = "是否显示", required = true) })
|
|
|
|
|
@PutMapping("/show/{id}")
|
|
|
|
|
public Result<Void> updateShow(@PathVariable String id, @RequestParam Integer show) {
|
|
|
|
|
cacheChannel.evict("default", "search_category");
|
|
|
|
|
tagService.updateIsShow(id, show);
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
@ -79,6 +87,7 @@ public class TagInfoController {
|
|
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "标签ID", required = true) })
|
|
|
|
|
@DeleteMapping("/{id}")
|
|
|
|
|
public Result<Void> delete(@PathVariable String id) {
|
|
|
|
|
cacheChannel.evict("default", "search_category");
|
|
|
|
|
tagService.delete(id);
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
@ -104,6 +113,7 @@ public class TagInfoController {
|
|
|
|
|
@ApiOperation(value = "上传封面", notes = "上传封面")
|
|
|
|
|
@RequestMapping(value = "/upload/image", method = RequestMethod.POST)
|
|
|
|
|
public Result batchUpload(@ApiParam(value = "封面图片文件", required = true) @RequestParam("file") MultipartFile file) {
|
|
|
|
|
cacheChannel.evict("default", "search_category");
|
|
|
|
|
return s3Service.upload(file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|