fix:考试添加导出

pg_adapter
wangxy 8 months ago
parent 1e1f39a899
commit 9090ec8dc4

@ -1,9 +1,16 @@
package com.ruoyi.web.controller.exam;
import cn.hutool.core.convert.Convert;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.paper.dto.response.PaperListRespDTO;
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamExportDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO;
import com.ruoyi.web.controller.manager.UserExamManager;
import io.swagger.annotations.Api;
@ -54,6 +61,17 @@ public class UserExamController extends BaseController {
return getDataTable(list);
}
@Log(title = "考试详情", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(UserExamReqDTO reqDTO) {
List<UserExamRespDTO> list = userExamManager.selectExamList(reqDTO);
List<UserExamExportDTO> list1 = Convert.toList(UserExamExportDTO.class, list);
ExcelUtil<UserExamExportDTO> util = new ExcelUtil<UserExamExportDTO>(UserExamExportDTO.class);
return util.exportExcel(list1, "考试数据");
}
@ApiOperation("详情")
@GetMapping("/detail/{examId}/{userId}")
public String detail(@PathVariable("examId") String examId, @PathVariable("userId") Long userId, ModelMap mmap) {

@ -2,7 +2,9 @@ package com.ruoyi.web.controller.system.count;
import java.util.List;
import cn.hutool.core.convert.Convert;
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamExportDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO;
import com.ruoyi.web.controller.manager.UserExamManager;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -68,14 +70,14 @@ public class TdExamnumController extends BaseController
*
*/
@RequiresPermissions("system:examnum:export")
@Log(title = "考试结果", businessType = BusinessType.EXPORT)
@Log(title = "考试详情", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TdExamnum tdExamnum)
{
List<TdExamnum> list = tdExamnumService.selectTdExamnumList(tdExamnum);
ExcelUtil<TdExamnum> util = new ExcelUtil<TdExamnum>(TdExamnum.class);
return util.exportExcel(list, "考试结果数据");
public AjaxResult export(UserExamReqDTO reqDTO) {
List<UserExamRespDTO> list = userExamManager.selectExamList(reqDTO);
List<UserExamExportDTO> list1 = Convert.toList(UserExamExportDTO.class, list);
ExcelUtil<UserExamExportDTO> util = new ExcelUtil<UserExamExportDTO>(UserExamExportDTO.class);
return util.exportExcel(list1, "考试数据");
}

@ -27,7 +27,9 @@
<a class="btn btn-danger" onclick="closeItem()">
<i class="fa fa-reply-all"></i> 关闭
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
@ -42,6 +44,7 @@
var options = {
uniqueId: "id",
url: prefix + "/list",
exportUrl: prefix + "/export",
queryParams: queryParams,
modalName: "考试",
columns: [

@ -25,6 +25,10 @@
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:examnum:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
@ -40,6 +44,7 @@
var options = {
uniqueId: "id",
url: prefix + "/list",
exportUrl: prefix + "/export",
modalName: "考试",
columns: [
{

@ -0,0 +1,62 @@
package com.ruoyi.system.domain.userexam.dto.response;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* packageName com.ruoyi.system.domain.userexam.dto.response
*
* @author wangxy
* @version JDK 8
* @className UserExamExportDTO
* @date 2024/8/7
* @description
*/
@Data
@ApiModel(value="考试记录", description="考试记录")
public class UserExamExportDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "考试ID")
private String examId;
@ApiModelProperty(value = "考试名称")
@Excel(name = "考试名称")
private String title;
@ApiModelProperty(value = "人员名称")
@Excel(name = "人员名称")
private String userName;
@ApiModelProperty(value = "考试次数")
@Excel(name = "考试次数")
private Integer tryCount;
@ApiModelProperty(value = "最高分数")
@Excel(name = "最高分数")
private Integer maxScore;
@ApiModelProperty(value = "是否通过")
@Excel(name = "是否通过", readConverterExp = "false=未通过,true=通过")
private Boolean passed;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新时间")
@Excel(name = "最后考试时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}
Loading…
Cancel
Save