package com.ruoyi.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; 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.domain.TopicLibrary; import com.ruoyi.service.ITopicLibraryService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 议题库Controller * * @author lu * @date 2025-10-14 */ @RestController @RequestMapping("/library") public class TopicLibraryController extends BaseController { @Autowired private ITopicLibraryService topicLibraryService; /** * 查询议题库列表 */ @PreAuthorize("@ss.hasPermi('library:library:list')") @GetMapping("/list") public TableDataInfo list(TopicLibrary topicLibrary) { startPage(); List list = topicLibraryService.selectTopicLibraryList(topicLibrary); return getDataTable(list); } /** * 导出议题库列表 */ @PreAuthorize("@ss.hasPermi('library:library:export')") @Log(title = "议题库", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, TopicLibrary topicLibrary) { List list = topicLibraryService.selectTopicLibraryList(topicLibrary); ExcelUtil util = new ExcelUtil(TopicLibrary.class); util.exportExcel(response, list, "议题库数据"); } /** * 获取议题库详细信息 */ @PreAuthorize("@ss.hasPermi('library:library:query')") @GetMapping(value = "/{topicId}") public AjaxResult getInfo(@PathVariable("topicId") Long topicId) { return success(topicLibraryService.selectTopicLibraryByTopicId(topicId)); } /** * 新增议题库 */ @PreAuthorize("@ss.hasPermi('library:library:add')") @Log(title = "议题库", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TopicLibrary topicLibrary) { return toAjax(topicLibraryService.insertTopicLibrary(topicLibrary)); } /** * 修改议题库 */ @PreAuthorize("@ss.hasPermi('library:library:edit')") @Log(title = "议题库", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TopicLibrary topicLibrary) { return toAjax(topicLibraryService.updateTopicLibrary(topicLibrary)); } /** * 删除议题库 */ @PreAuthorize("@ss.hasPermi('library:library:remove')") @Log(title = "议题库", businessType = BusinessType.DELETE) @DeleteMapping("/{topicIds}") public AjaxResult remove(@PathVariable Long[] topicIds) { return toAjax(topicLibraryService.deleteTopicLibraryByTopicIds(topicIds)); } }