package com.ruoyi.web.controller.assets; import com.ruoyi.common.annotation.Log; 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.assets.CommunityAssets; import com.ruoyi.system.service.ICommunityAssetsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 社区资产Controller * * @author boman * @date 2025-02-14 */ @RestController @RequestMapping("/wuYe/assets") public class CommunityAssetsController extends BaseController { @Autowired private ICommunityAssetsService communityAssetsService; /** * 查询社区资产列表 */ @PreAuthorize("@ss.hasPermi('system:assets:list')") @GetMapping("/list") public TableDataInfo list(CommunityAssets communityAssets) { startPage(); List list = communityAssetsService.selectCommunityAssetsList(communityAssets); return getDataTable(list); } /** * 导出社区资产列表 */ @PreAuthorize("@ss.hasPermi('system:assets:export')") @Log(title = "社区资产", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, CommunityAssets communityAssets) { List list = communityAssetsService.selectCommunityAssetsList(communityAssets); ExcelUtil util = new ExcelUtil(CommunityAssets.class); util.exportExcel(response, list, "社区资产数据"); } /** * 获取社区资产详细信息 */ @PreAuthorize("@ss.hasPermi('system:assets:query')") @GetMapping(value = "/{assetId}") public AjaxResult getInfo(@PathVariable("assetId") Long assetId) { return success(communityAssetsService.selectCommunityAssetsByAssetId(assetId)); } /** * 新增社区资产 */ @PreAuthorize("@ss.hasPermi('system:assets:add')") @Log(title = "社区资产", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody CommunityAssets communityAssets) { return toAjax(communityAssetsService.insertCommunityAssets(communityAssets)); } /** * 修改社区资产 */ @PreAuthorize("@ss.hasPermi('system:assets:edit')") @Log(title = "社区资产", businessType = BusinessType.UPDATE) @PostMapping("/put") public AjaxResult edit(@RequestBody CommunityAssets communityAssets) { return toAjax(communityAssetsService.updateCommunityAssets(communityAssets)); } /** * 删除社区资产 */ @PreAuthorize("@ss.hasPermi('system:assets:remove')") @Log(title = "社区资产", businessType = BusinessType.DELETE) @GetMapping("/delete/{assetIds}") public AjaxResult remove(@PathVariable Long[] assetIds) { return toAjax(communityAssetsService.deleteCommunityAssetsByAssetIds(assetIds)); } }