| | |
| | | package com.smartor.controller; |
| | | package com.ruoyi.web.controller.smartor; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | import com.smartor.service.ISvyLibTopicService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * 问卷题目Controller |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2023-03-03 |
| | | */ |
| | | @Api("问卷题目") |
| | | @RestController |
| | | @RequestMapping("/smartor/svytopic") |
| | | public class SvyLibTopicController extends BaseController |
| | | { |
| | | public class SvyLibTopicController extends BaseController { |
| | | @Autowired |
| | | private ISvyLibTopicService svyLibTopicService; |
| | | |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('smartor:svytopic:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SvyLibTopic svyLibTopic) |
| | | { |
| | | public TableDataInfo list(SvyLibTopic svyLibTopic) { |
| | | startPage(); |
| | | List<SvyLibTopic> list = svyLibTopicService.selectSvyLibTopicList(svyLibTopic); |
| | | return getDataTable(list); |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('smartor:svytopic:export')") |
| | | @Log(title = "问卷题目", businessType = BusinessType.EXPORT) |
| | | @ApiOperation("导出问卷题目列表") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SvyLibTopic svyLibTopic) |
| | | { |
| | | public void export(HttpServletResponse response, SvyLibTopic svyLibTopic) { |
| | | List<SvyLibTopic> list = svyLibTopicService.selectSvyLibTopicList(svyLibTopic); |
| | | ExcelUtil<SvyLibTopic> util = new ExcelUtil<SvyLibTopic>(SvyLibTopic.class); |
| | | util.exportExcel(response, list, "问卷题目数据"); |
| | |
| | | /** |
| | | * 获取问卷题目详细信息 |
| | | */ |
| | | @ApiOperation("获取问卷题目详细信息") |
| | | @PreAuthorize("@ss.hasPermi('smartor:svytopic:query')") |
| | | @GetMapping(value = "/{topicid}") |
| | | public AjaxResult getInfo(@PathVariable("topicid") Long topicid) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable("topicid") Long topicid) { |
| | | return success(svyLibTopicService.selectSvyLibTopicByTopicid(topicid)); |
| | | } |
| | | |
| | | /** |
| | | * 新增问卷题目 |
| | | */ |
| | | @ApiOperation("新增问卷题目") |
| | | @PreAuthorize("@ss.hasPermi('smartor:svytopic:add')") |
| | | @Log(title = "问卷题目", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody SvyLibTopic svyLibTopic) |
| | | { |
| | | public AjaxResult add(@RequestBody SvyLibTopic svyLibTopic) { |
| | | return toAjax(svyLibTopicService.insertSvyLibTopic(svyLibTopic)); |
| | | } |
| | | |
| | | /** |
| | | * 修改问卷题目 |
| | | */ |
| | | @ApiOperation("修改问卷题目") |
| | | @PreAuthorize("@ss.hasPermi('smartor:svytopic:edit')") |
| | | @Log(title = "问卷题目", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody SvyLibTopic svyLibTopic) |
| | | { |
| | | public AjaxResult edit(@RequestBody SvyLibTopic svyLibTopic) { |
| | | return toAjax(svyLibTopicService.updateSvyLibTopic(svyLibTopic)); |
| | | } |
| | | |
| | | /** |
| | | * 删除问卷题目 |
| | | */ |
| | | @ApiOperation("删除问卷题目") |
| | | @PreAuthorize("@ss.hasPermi('smartor:svytopic:remove')") |
| | | @Log(title = "问卷题目", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{topicids}") |
| | | public AjaxResult remove(@PathVariable Long[] topicids) |
| | | { |
| | | @DeleteMapping("/{topicids}") |
| | | public AjaxResult remove(@PathVariable Long[] topicids) { |
| | | return toAjax(svyLibTopicService.deleteSvyLibTopicByTopicids(topicids)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 批量导入问问题目 |
| | | */ |
| | | @ApiOperation("批量导入问问题目") |
| | | @PostMapping("/importLitTopic") |
| | | public AjaxResult importLitTopic(MultipartFile multipartFile) { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | |
| | | return success(svyLibTopicService.importLitTopic(user, multipartFile)); |
| | | } |
| | | |
| | | } |