MetaShowRoomAssetController.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package com.izouma.nineth.web;
  2. import com.izouma.nineth.domain.Asset;
  3. import com.izouma.nineth.domain.MetaShowRoomAsset;
  4. import com.izouma.nineth.dto.MetaRestResult;
  5. import com.izouma.nineth.dto.PageQuery;
  6. import com.izouma.nineth.repo.MetaShowRoomAssetRepo;
  7. import com.izouma.nineth.service.MetaShowRoomAssetService;
  8. import com.izouma.nineth.utils.excel.ExcelUtils;
  9. import lombok.AllArgsConstructor;
  10. import org.springframework.data.domain.Page;
  11. import org.springframework.web.bind.annotation.*;
  12. import javax.servlet.http.HttpServletResponse;
  13. import java.io.IOException;
  14. import java.util.List;
  15. @RestController
  16. @RequestMapping("/metaShowRoomAsset")
  17. @AllArgsConstructor
  18. public class MetaShowRoomAssetController extends BaseController {
  19. private MetaShowRoomAssetService metaShowRoomAssetService;
  20. private MetaShowRoomAssetRepo metaShowRoomAssetRepo;
  21. //@PreAuthorize("hasRole('ADMIN')")
  22. @PostMapping("/all")
  23. public Page<MetaShowRoomAsset> all(@RequestBody PageQuery pageQuery) {
  24. return metaShowRoomAssetService.all(pageQuery);
  25. }
  26. @GetMapping("/excel")
  27. @ResponseBody
  28. public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
  29. List<MetaShowRoomAsset> data = all(pageQuery).getContent();
  30. ExcelUtils.export(response, data);
  31. }
  32. @GetMapping("/{userId}/noShowRoomAndBlindBox")
  33. public MetaRestResult<List<Asset>> noShowRoomAndBlindBox(@PathVariable Long userId) {
  34. return metaShowRoomAssetService.noShowRoomAndBlindBox(userId);
  35. }
  36. @GetMapping("/{userId}/noBlindBox")
  37. public MetaRestResult<List<Asset>> noBlindBox(@PathVariable Long userId) {
  38. return metaShowRoomAssetService.noBlindBox(userId);
  39. }
  40. @PostMapping("/putOn")
  41. public MetaRestResult<String> putOn(@RequestBody MetaShowRoomAsset metaShowRoomAsset) {
  42. return metaShowRoomAssetService.putOn(metaShowRoomAsset);
  43. }
  44. @PostMapping("/putOff")
  45. public MetaRestResult<Boolean> putOff(@RequestParam Long assetId) {
  46. return metaShowRoomAssetService.putOff(assetId);
  47. }
  48. @PostMapping("/putOffAll")
  49. public MetaRestResult<Boolean> putOffAll(@RequestParam Long showRoomId) {
  50. return metaShowRoomAssetService.putOffAll(showRoomId);
  51. }
  52. @GetMapping("/{showRoomId}/{spaceId}/findShowRoomAsset")
  53. public MetaRestResult<List<MetaShowRoomAsset>> findShowRoomAsset(@PathVariable Long showRoomId, @PathVariable Long spaceId) {
  54. return metaShowRoomAssetService.findShowRoomAsset(showRoomId, spaceId);
  55. }
  56. }