CommunityAssetsController.java 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package com.ruoyi.web.controller.assets;
  2. import com.ruoyi.common.annotation.Log;
  3. import com.ruoyi.common.core.controller.BaseController;
  4. import com.ruoyi.common.core.domain.AjaxResult;
  5. import com.ruoyi.common.core.page.TableDataInfo;
  6. import com.ruoyi.common.enums.BusinessType;
  7. import com.ruoyi.common.utils.poi.ExcelUtil;
  8. import com.ruoyi.system.domain.assets.CommunityAssets;
  9. import com.ruoyi.system.service.ICommunityAssetsService;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.security.access.prepost.PreAuthorize;
  12. import org.springframework.web.bind.annotation.*;
  13. import javax.servlet.http.HttpServletResponse;
  14. import java.util.List;
  15. /**
  16. * 社区资产Controller
  17. *
  18. * @author boman
  19. * @date 2025-02-14
  20. */
  21. @RestController
  22. @RequestMapping("/wuYe/assets")
  23. public class CommunityAssetsController extends BaseController {
  24. @Autowired
  25. private ICommunityAssetsService communityAssetsService;
  26. /**
  27. * 查询社区资产列表
  28. */
  29. @PreAuthorize("@ss.hasPermi('system:assets:list')")
  30. @GetMapping("/list")
  31. public TableDataInfo list(CommunityAssets communityAssets) {
  32. startPage();
  33. List<CommunityAssets> list = communityAssetsService.selectCommunityAssetsList(communityAssets);
  34. return getDataTable(list);
  35. }
  36. /**
  37. * 导出社区资产列表
  38. */
  39. @PreAuthorize("@ss.hasPermi('system:assets:export')")
  40. @Log(title = "社区资产", businessType = BusinessType.EXPORT)
  41. @PostMapping("/export")
  42. public void export(HttpServletResponse response, CommunityAssets communityAssets) {
  43. List<CommunityAssets> list = communityAssetsService.selectCommunityAssetsList(communityAssets);
  44. ExcelUtil<CommunityAssets> util = new ExcelUtil<CommunityAssets>(CommunityAssets.class);
  45. util.exportExcel(response, list, "社区资产数据");
  46. }
  47. /**
  48. * 获取社区资产详细信息
  49. */
  50. @PreAuthorize("@ss.hasPermi('system:assets:query')")
  51. @GetMapping(value = "/{assetId}")
  52. public AjaxResult getInfo(@PathVariable("assetId") Long assetId) {
  53. return success(communityAssetsService.selectCommunityAssetsByAssetId(assetId));
  54. }
  55. /**
  56. * 新增社区资产
  57. */
  58. @PreAuthorize("@ss.hasPermi('system:assets:add')")
  59. @Log(title = "社区资产", businessType = BusinessType.INSERT)
  60. @PostMapping
  61. public AjaxResult add(@RequestBody CommunityAssets communityAssets) {
  62. return toAjax(communityAssetsService.insertCommunityAssets(communityAssets));
  63. }
  64. /**
  65. * 修改社区资产
  66. */
  67. @PreAuthorize("@ss.hasPermi('system:assets:edit')")
  68. @Log(title = "社区资产", businessType = BusinessType.UPDATE)
  69. @PostMapping("/put")
  70. public AjaxResult edit(@RequestBody CommunityAssets communityAssets) {
  71. return toAjax(communityAssetsService.updateCommunityAssets(communityAssets));
  72. }
  73. /**
  74. * 删除社区资产
  75. */
  76. @PreAuthorize("@ss.hasPermi('system:assets:remove')")
  77. @Log(title = "社区资产", businessType = BusinessType.DELETE)
  78. @GetMapping("/delete/{assetIds}")
  79. public AjaxResult remove(@PathVariable Long[] assetIds) {
  80. return toAjax(communityAssetsService.deleteCommunityAssetsByAssetIds(assetIds));
  81. }
  82. }