package com.ruoyi.web.controller.system; import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.system.domain.PcscId; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.domain.PostCollections; import com.ruoyi.system.service.IPostCollectionsService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 藏品Controller * * @author ruoyi * @date 2023-02-15 */ @Api(tags = "PostCollectionsController",description = "藏品") @RestController @RequestMapping("/system/collections") public class PostCollectionsController extends BaseController { @Autowired private IPostCollectionsService postCollectionsService; /** * 查询藏品列表 */ @ApiOperation("查询藏品列表") @PreAuthorize("@ss.hasPermi('system:collections:list')") @GetMapping("/list") public TableDataInfo list(PostCollections postCollections) { startPage(); List list = postCollectionsService.selectPostCollectionsList(postCollections); return getDataTable(list); } /** * 导出藏品列表 */ @ApiOperation("导入藏品") @PreAuthorize("@ss.hasPermi('system:collections:export')") @Log(title = "藏品", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, PostCollections postCollections) { List list = postCollectionsService.selectPostCollectionsList(postCollections); ExcelUtil util = new ExcelUtil(PostCollections.class); util.exportExcel(response, list, "藏品数据"); } /** * 获取藏品详细信息 */ @ApiOperation("获取藏品详细信息") @PreAuthorize("@ss.hasPermi('system:collections:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(postCollectionsService.selectPostCollectionsById(id)); } /** * 新增藏品 */ @ApiOperation("新增藏品") @PreAuthorize("@ss.hasPermi('system:collections:add')") @Log(title = "藏品", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody PcscId pcscId) { return toAjax(postCollectionsService.insertPostCollections(pcscId)); } /** * 修改藏品 */ @ApiOperation("修改藏品") @PreAuthorize("@ss.hasPermi('system:collections:edit')") @Log(title = "藏品", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody PostCollections postCollections) { return toAjax(postCollectionsService.updatePostCollections(postCollections)); } /** * 删除藏品 */ @ApiOperation("删除藏品") @PreAuthorize("@ss.hasPermi('system:collections:remove')") @Log(title = "藏品", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(postCollectionsService.deletePostCollectionsByIds(ids)); } }