package com.izouma.nineth.web; import com.izouma.nineth.domain.Asset; import com.izouma.nineth.domain.MetaShowRoomAsset; import com.izouma.nineth.dto.MetaRestResult; import com.izouma.nineth.dto.PageQuery; import com.izouma.nineth.repo.MetaShowRoomAssetRepo; import com.izouma.nineth.service.MetaShowRoomAssetService; import com.izouma.nineth.utils.excel.ExcelUtils; import lombok.AllArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @RestController @RequestMapping("/metaShowRoomAsset") @AllArgsConstructor public class MetaShowRoomAssetController extends BaseController { private MetaShowRoomAssetService metaShowRoomAssetService; private MetaShowRoomAssetRepo metaShowRoomAssetRepo; //@PreAuthorize("hasRole('ADMIN')") @PostMapping("/all") public Page all(@RequestBody PageQuery pageQuery) { return metaShowRoomAssetService.all(pageQuery); } @GetMapping("/excel") @ResponseBody public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException { List data = all(pageQuery).getContent(); ExcelUtils.export(response, data); } @GetMapping("/{userId}/noShowRoomAndBlindBox") public MetaRestResult> noShowRoomAndBlindBox(@PathVariable Long userId) { return metaShowRoomAssetService.noShowRoomAndBlindBox(userId); } @GetMapping("/{userId}/noBlindBox") public MetaRestResult> noBlindBox(@PathVariable Long userId) { return metaShowRoomAssetService.noBlindBox(userId); } @PostMapping("/putOn") public MetaRestResult putOn(@RequestBody MetaShowRoomAsset metaShowRoomAsset) { return metaShowRoomAssetService.putOn(metaShowRoomAsset); } @PostMapping("/putOff") public MetaRestResult putOff(@RequestParam Long assetId) { return metaShowRoomAssetService.putOff(assetId); } @PostMapping("/putOffAll") public MetaRestResult putOffAll(@RequestParam Long showRoomId) { return metaShowRoomAssetService.putOffAll(showRoomId); } @GetMapping("/{showRoomId}/{spaceId}/findShowRoomAsset") public MetaRestResult> findShowRoomAsset(@PathVariable Long showRoomId, @PathVariable Long spaceId) { return metaShowRoomAssetService.findShowRoomAsset(showRoomId, spaceId); } }