123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- 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<TopicLibrary> 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<TopicLibrary> list = topicLibraryService.selectTopicLibraryList(topicLibrary);
- ExcelUtil<TopicLibrary> util = new ExcelUtil<TopicLibrary>(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));
- }
- }
|