若依 Excel导入与导出 配置下拉选项
/**
* 题目类型(字典配置)
*/
@Excel(name = "题目类型(字典配置)", readConverterExp = "117=试卷类型1,118=试卷类型2,119=试卷类型3,120=试卷类型4", combo = "试卷类型1,试卷类型2,试卷类型3,试卷类型4")
private String questionTypeId;
注意:下拉选项的字段必须是字符串类型
/**
* 成绩录入
*
* @param file
* @return
* @throws Exception
*/
@ApiOperation("试题录入")
@PostMapping("/common/scoreEntry")
public AjaxResult scoreEntry(MultipartFile file) throws Exception {
ExcelUtil<ExamQuestion> util = new ExcelUtil<>(ExamQuestion.class);
List<ExamQuestion> userList = util.importExcel(file.getInputStream());
// String message = bkRegistrationInfoService.importExcel(userList,updateSupport);
return AjaxResult.success(JSONUtil.toJsonStr(userList));
}
/**
* 导出试题模版
*/
@PreAuthorize("@ss.hasPermi('system:info:export')")
@Log(title = "导出试题模版", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response) {
List<ExamQuestion> list = new ArrayList<>();
ExcelUtil<ExamQuestion> util = new ExcelUtil<>(ExamQuestion.class);
util.exportExcel(response, list, "报名信息数据");
}