package com.ruoyi.web.controller.partyNews; 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.partyNews.PartyNews; import com.ruoyi.system.service.IPartyNewsService; 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/partyNews") public class PartyNewsController extends BaseController { @Autowired private IPartyNewsService partyNewsService; /** * 查询党建资讯列表 */ @PreAuthorize("@ss.hasPermi('wuYe:partyNews:list')") @GetMapping("/list") public TableDataInfo list(PartyNews partyNews) { startPage(); List list = partyNewsService.selectPartyNewsList(partyNews); return getDataTable(list); } /** * 导出党建资讯列表 */ @PreAuthorize("@ss.hasPermi('wuYe:partyNews:export')") @Log(title = "党建资讯", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, PartyNews partyNews) { List list = partyNewsService.selectPartyNewsList(partyNews); ExcelUtil util = new ExcelUtil(PartyNews.class); util.exportExcel(response, list, "党建资讯数据"); } /** * 获取党建资讯详细信息 */ @PreAuthorize("@ss.hasPermi('wuYe:partyNews:query')") @GetMapping(value = "/{partyId}") public AjaxResult getInfo(@PathVariable("partyId") Long partyId) { return success(partyNewsService.selectPartyNewsByPartyId(partyId)); } /** * 新增党建资讯 */ @PreAuthorize("@ss.hasPermi('wuYe:partyNews:add')") @Log(title = "党建资讯", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody PartyNews partyNews) { return toAjax(partyNewsService.insertPartyNews(partyNews)); } /** * 修改党建资讯 */ @PreAuthorize("@ss.hasPermi('wuYe:partyNews:edit')") @Log(title = "党建资讯", businessType = BusinessType.UPDATE) @PostMapping("/put") public AjaxResult edit(@RequestBody PartyNews partyNews) { return toAjax(partyNewsService.updatePartyNews(partyNews)); } /** * 批量关闭党建资讯 * @param partyIds * @return */ @PreAuthorize("@ss.hasPermi('wuYe:partyNews:remove')") @Log(title = "党建资讯", businessType = BusinessType.DELETE) @GetMapping("/delete/{partyIds}") public AjaxResult remove(@PathVariable Long[] partyIds) { return toAjax(partyNewsService.deletePartyNewsByPartyIds(partyIds)); } }