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