| | |
| | | package com.ots.project.exam.controller; |
| | | |
| | | import com.ots.common.utils.StringUtils; |
| | | import com.ots.common.utils.poi.ExcelUtil; |
| | | import com.ots.framework.aspectj.lang.annotation.Log; |
| | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 问卷类型Controller |
| | | * |
| | | * @author ots |
| | | * @date 2019-12-15 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/exam/level") |
| | | public class TExamLevelController extends BaseController { |
| | | private String prefix = "exam/level"; |
| | | |
| | | @Autowired |
| | | private ITExamLevelService tExamLevelService; |
| | | |
| | | @Autowired |
| | | private DictService dictService; |
| | | |
| | | @RequiresPermissions("exam:level:view") |
| | | @GetMapping() |
| | | public String level() { |
| | | return prefix + "/level"; |
| | | } |
| | | |
| | | /** |
| | | * 查询问卷类型列表 |
| | | */ |
| | | @RequiresPermissions("exam:level:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | | public TableDataInfo list(TExamLevel tExamLevel) { |
| | | startPage(); |
| | | List<TExamLevel> list = tExamLevelService.selectTExamLevelList(tExamLevel); |
| | | |
| | | // 翻译一下 Item Template |
| | | List<DictData> questionnaireTemplate = dictService.getType("questionnaire_template"); |
| | | Map<String, String> dictMap = questionnaireTemplate.stream().collect(Collectors.toMap(DictData::getDictValue, DictData::getDictLabel)); |
| | | list.stream().forEach(t -> { |
| | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导出问卷类型列表 |
| | | */ |
| | | @RequiresPermissions("exam:level:export") |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | |
| | | return util.exportExcel(list, "level"); |
| | | } |
| | | |
| | | /** |
| | | * 新增问卷类型 |
| | | */ |
| | | @GetMapping("/add") |
| | | public String add(String uuid,ModelMap mmap) { |
| | | if(StringUtils.isNotBlank(uuid)){ |
| | |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存问卷类型 |
| | | */ |
| | | @RequiresPermissions("exam:level:add") |
| | | @Log(title = "问卷类型", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | |
| | | return toAjax(tExamLevelService.insertTExamLevel(tExamLevel)); |
| | | } |
| | | |
| | | /** |
| | | * 修改问卷类型 |
| | | */ |
| | | @GetMapping("/edit/{id}") |
| | | public String edit(@PathVariable("id") Long id, ModelMap mmap) { |
| | | TExamLevel tExamLevel = tExamLevelService.selectTExamLevelById(id); |
| | |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存问卷类型 |
| | | */ |
| | | @RequiresPermissions("exam:level:edit") |
| | | @Log(title = "问卷类型", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | |
| | | return toAjax(tExamLevelService.updateTExamLevel(tExamLevel)); |
| | | } |
| | | |
| | | /** |
| | | * 删除问卷类型 |
| | | */ |
| | | @RequiresPermissions("exam:level:remove") |
| | | @Log(title = "问卷类型", businessType = BusinessType.DELETE) |
| | | @PostMapping("/remove") |