|
@@ -5,6 +5,7 @@ import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.system.domain.PoCollection;
|
|
|
import com.ruoyi.system.service.IPoCollectionService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -13,6 +14,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -29,25 +31,36 @@ public class PoCollectionController extends BaseController {
|
|
|
/**
|
|
|
* 获取藏品列表
|
|
|
*/
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:collection:list')")
|
|
|
@GetMapping("/list")
|
|
|
- public TableDataInfo list(PoCollection collection) {
|
|
|
- return new TableDataInfo();
|
|
|
+ public TableDataInfo list(PoCollection poCollection)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ List<PoCollection> list = collectionService.selectPoCollectionList(poCollection);
|
|
|
+ return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取藏品列表
|
|
|
*/
|
|
|
- @GetMapping("/export")
|
|
|
- public AjaxResult export(PoCollection collection) {
|
|
|
- return AjaxResult.success();
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:collection:export')")
|
|
|
+ @Log(title = "获取藏品列表", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(HttpServletResponse response, PoCollection poCollection)
|
|
|
+ {
|
|
|
+ List<PoCollection> list = collectionService.selectPoCollectionList(poCollection);
|
|
|
+ ExcelUtil<PoCollection> util = new ExcelUtil<PoCollection>(PoCollection.class);
|
|
|
+ util.exportExcel(response, list, "藏品数据");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据藏品编号获取详细信息
|
|
|
*/
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:collection:query')")
|
|
|
@GetMapping(value = "/{collectionId}")
|
|
|
- public AjaxResult getInfo(@PathVariable("collectionId") Long collectionId) {
|
|
|
- return success();
|
|
|
+ public AjaxResult getInfo(@PathVariable("collectionId") Long collectionId)
|
|
|
+ {
|
|
|
+ return success(collectionService.selectCollectionById(collectionId));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -58,7 +71,7 @@ public class PoCollectionController extends BaseController {
|
|
|
@ApiOperation("添加藏品")
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@Validated @RequestBody PoCollection collection) {
|
|
|
- List<PoCollection> collectionList = collectionService.selectCollections(collection);
|
|
|
+ List<PoCollection> collectionList = collectionService.selectPoCollectionList(collection);
|
|
|
if (collectionList != null && !collectionList.isEmpty())
|
|
|
return error("重复的藏品");
|
|
|
return toAjax(collectionService.insertCollection(collection));
|
|
@@ -84,8 +97,11 @@ public class PoCollectionController extends BaseController {
|
|
|
/**
|
|
|
* 删除藏品
|
|
|
*/
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:collection:remove')")
|
|
|
+ @Log(title = "删除藏品", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{collectionIds}")
|
|
|
- public AjaxResult remove(@PathVariable Long[] collectionIds) {
|
|
|
- return AjaxResult.success();
|
|
|
+ public AjaxResult remove(@PathVariable Long[] collectionIds)
|
|
|
+ {
|
|
|
+ return toAjax(collectionService.deletePoCollectionByCollectionIds(collectionIds));
|
|
|
}
|
|
|
}
|