package com.ltkj.web.controller.system; 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.ltkj.common.annotation.Log; import com.ltkj.common.core.controller.BaseController; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.common.enums.BusinessType; import com.ltkj.hosp.domain.TjSurveyQuestion; import com.ltkj.hosp.service.ITjSurveyQuestionService; import com.ltkj.common.utils.poi.ExcelUtil; import com.ltkj.common.core.page.TableDataInfo; /** * 问卷问题Controller * * @author ltkj_赵佳豪&李格 * @date 2023-04-07 */ @RestController @RequestMapping("/hosp/question") public class TjSurveyQuestionController extends BaseController { @Autowired private ITjSurveyQuestionService tjSurveyQuestionService; /** * 查询问卷问题列表 */ //@PreAuthorize("@ss.hasPermi('hosp:question:list')") @GetMapping("/list") public TableDataInfo list(TjSurveyQuestion tjSurveyQuestion) { startPage(); List list = tjSurveyQuestionService.selectTjSurveyQuestionList(tjSurveyQuestion); return getDataTable(list); } /** * 导出问卷问题列表 */ //@PreAuthorize("@ss.hasPermi('hosp:question:export')") @Log(title = "问卷问题", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, TjSurveyQuestion tjSurveyQuestion) { List list = tjSurveyQuestionService.selectTjSurveyQuestionList(tjSurveyQuestion); ExcelUtil util = new ExcelUtil(TjSurveyQuestion.class); util.exportExcel(response, list, "问卷问题数据"); } /** * 获取问卷问题详细信息 */ //@PreAuthorize("@ss.hasPermi('hosp:question:query')") @GetMapping(value = "/{qid}") public AjaxResult getInfo(@PathVariable("qid") String qid) { return success(tjSurveyQuestionService.selectTjSurveyQuestionByQid(qid)); } /** * 新增问卷问题 */ //@PreAuthorize("@ss.hasPermi('hosp:question:add')") @Log(title = "问卷问题", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TjSurveyQuestion tjSurveyQuestion) { return toAjax(tjSurveyQuestionService.insertTjSurveyQuestion(tjSurveyQuestion)); } /** * 修改问卷问题 */ // @PreAuthorize("@ss.hasPermi('hosp:question:edit')") @Log(title = "问卷问题", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TjSurveyQuestion tjSurveyQuestion) { return toAjax(tjSurveyQuestionService.updateTjSurveyQuestion(tjSurveyQuestion)); } /** * 删除问卷问题 */ //@PreAuthorize("@ss.hasPermi('hosp:question:remove')") @Log(title = "问卷问题", businessType = BusinessType.DELETE) @DeleteMapping("/{qids}") public AjaxResult remove(@PathVariable Long[] qids) { for (Long qid : qids) { tjSurveyQuestionService.deleteTjSurveyQuestionByQid(qid); } return toAjax(1); } }