zhaowenxuan
2025-01-02 1d6c4e61ef5327d425989a2db2d113462e44c2f0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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<TjSurveyQuestion> 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<TjSurveyQuestion> list = tjSurveyQuestionService.selectTjSurveyQuestionList(tjSurveyQuestion);
        ExcelUtil<TjSurveyQuestion> util = new ExcelUtil<TjSurveyQuestion>(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);
    }
}