| | |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.smartor.domain.PatImportInfoVO; |
| | | import com.smartor.domain.SvyLibTopicRes; |
| | | import com.smartor.domain.SvyTopicReq; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.smartor.domain.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.smartor.domain.SvyLibTopic; |
| | | import com.smartor.service.ISvyLibTopicService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | |
| | | * @author ruoyi |
| | | * @date 2023-03-03 |
| | | */ |
| | | @Api("问卷题目") |
| | | @Api(description = "问卷题目") |
| | | @RestController |
| | | @RequestMapping("/smartor/svytopic") |
| | | public class SvyLibTopicController extends BaseController { |
| | |
| | | /** |
| | | * 查询问卷题目列表 |
| | | */ |
| | | @ApiOperation("查询问卷题目列表") |
| | | @PreAuthorize("@ss.hasPermi('smartor:svytopic:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SvyLibTopic svyLibTopic) { |
| | | @PostMapping("/list") |
| | | public TableDataInfo list(@RequestBody SvyLibTopic svyLibTopic) { |
| | | startPage(); |
| | | List<SvyLibTopic> list = svyLibTopicService.selectSvyLibTopicList(svyLibTopic); |
| | | return getDataTable(list); |
| | |
| | | */ |
| | | @ApiOperation("获取问卷题目详细信息") |
| | | @PreAuthorize("@ss.hasPermi('smartor:svytopic:query')") |
| | | @GetMapping(value = "/{topicid}") |
| | | @GetMapping(value = "/getInfo/{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 |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody SvyLibTopic svyLibTopic) { |
| | | return toAjax(svyLibTopicService.insertSvyLibTopic(svyLibTopic)); |
| | | } |
| | | |
| | | /** |
| | | * 新增或修改问卷详情信息 |
| | | */ |
| | | @ApiOperation("新增或修改问卷详情信息") |
| | | @PreAuthorize("@ss.hasPermi('system:script:list')") |
| | | @PostMapping("/saveOrUpdateTopic") |
| | | public AjaxResult saveOrUpdateTopic(@RequestBody SvyLibTopic svyLibTopic) { |
| | | if (ObjectUtils.isEmpty(svyLibTopic)) { |
| | | throw new BaseException("入参为空,请检查入参"); |
| | | } |
| | | return success(svyLibTopicService.saveOrUpdateTopic(svyLibTopic)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation("修改问卷题目") |
| | | @PreAuthorize("@ss.hasPermi('smartor:svytopic:edit')") |
| | | @Log(title = "问卷题目", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | @PostMapping("/edit") |
| | | 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}") |
| | | @GetMapping("/remove/{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)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导入题目模板 |
| | | * |
| | | * @param response |
| | | */ |
| | | @ApiOperation("导入题目模板") |
| | | @PostMapping("/importLitTopicTemplate") |
| | | public void importLitTopicTemplate(HttpServletResponse response) { |
| | | ExcelUtil<SvyLibTopicRes> util = new ExcelUtil<SvyLibTopicRes>(SvyLibTopicRes.class); |
| | | util.importTemplateExcel(response, "导入题目"); |
| | | } |
| | | |
| | | /** |
| | | * 获取题目 |
| | | */ |
| | | @ApiOperation("获取题目") |
| | | @PostMapping("/showTopic") |
| | | public AjaxResult showTopic(@RequestBody SvyTopicReq svyTopicReq) { |
| | | return success(svyLibTopicService.showTopic(svyTopicReq)); |
| | | } |
| | | |
| | | } |