|
@@ -3,6 +3,8 @@ package com.ynfy.buss.exam.examuserstatistics.controller;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.ynfy.buss.exam.exam.entity.Exam;
|
|
|
+import com.ynfy.buss.exam.exam.service.IExamService;
|
|
|
import com.ynfy.buss.exam.examuserstatistics.entity.ExamUserStatistics;
|
|
|
import com.ynfy.buss.exam.examuserstatistics.service.IExamUserStatisticsService;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -21,138 +23,143 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
- /**
|
|
|
+/**
|
|
|
* @Description: 考试用户统计
|
|
|
* @Author: jeecg-boot
|
|
|
- * @Date: 2023-03-20
|
|
|
+ * @Date: 2023-03-20
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
-@Api(tags="考试用户统计")
|
|
|
+@Api(tags = "考试用户统计")
|
|
|
@RestController
|
|
|
@RequestMapping("/examUserStatistics")
|
|
|
@Slf4j
|
|
|
public class ExamUserStatisticsController extends JeecgController<ExamUserStatistics, IExamUserStatisticsService> {
|
|
|
- @Autowired
|
|
|
- private IExamUserStatisticsService examUserStatisticsService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 分页列表查询
|
|
|
- *
|
|
|
- * @param examUserStatistics
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value="考试用户统计-分页列表查询", notes="考试用户统计-分页列表查询")
|
|
|
- @RequiresPermissions("examUserStatistics:list")
|
|
|
- @GetMapping(value = "/list")
|
|
|
- public Result<IPage<ExamUserStatistics>> queryPageList(ExamUserStatistics examUserStatistics,
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
- QueryWrapper<ExamUserStatistics> queryWrapper = QueryGenerator.initQueryWrapper(examUserStatistics, req.getParameterMap());
|
|
|
- Page<ExamUserStatistics> page = new Page<ExamUserStatistics>(pageNo, pageSize);
|
|
|
- IPage<ExamUserStatistics> pageList = examUserStatisticsService.page(page, queryWrapper);
|
|
|
- return Result.OK(pageList);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加
|
|
|
- *
|
|
|
- * @param examUserStatistics
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "考试用户统计-添加")
|
|
|
- @ApiOperation(value="考试用户统计-添加", notes="考试用户统计-添加")
|
|
|
- //@RequiresPermissions("examUserStatistics:add")
|
|
|
- @PostMapping(value = "/add")
|
|
|
- public Result<String> add(@RequestBody ExamUserStatistics examUserStatistics) {
|
|
|
- examUserStatisticsService.save(examUserStatistics);
|
|
|
- return Result.OK("添加成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 编辑
|
|
|
- *
|
|
|
- * @param examUserStatistics
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "考试用户统计-编辑")
|
|
|
- @ApiOperation(value="考试用户统计-编辑", notes="考试用户统计-编辑")
|
|
|
- //@RequiresPermissions("examUserStatistics:edit")
|
|
|
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
- public Result<String> edit(@RequestBody ExamUserStatistics examUserStatistics) {
|
|
|
- examUserStatisticsService.updateById(examUserStatistics);
|
|
|
- return Result.OK("编辑成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id删除
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "考试用户统计-通过id删除")
|
|
|
- @ApiOperation(value="考试用户统计-通过id删除", notes="考试用户统计-通过id删除")
|
|
|
- //@RequiresPermissions("examUserStatistics:delete")
|
|
|
- @DeleteMapping(value = "/delete")
|
|
|
- public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
- examUserStatisticsService.removeById(id);
|
|
|
- return Result.OK("删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量删除
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "考试用户统计-批量删除")
|
|
|
- @ApiOperation(value="考试用户统计-批量删除", notes="考试用户统计-批量删除")
|
|
|
- //@RequiresPermissions("examUserStatistics:deleteBatch")
|
|
|
- @DeleteMapping(value = "/deleteBatch")
|
|
|
- public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
- this.examUserStatisticsService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
- return Result.OK("批量删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id查询
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "考试用户统计-通过id查询")
|
|
|
- @ApiOperation(value="考试用户统计-通过id查询", notes="考试用户统计-通过id查询")
|
|
|
- @GetMapping(value = "/queryById")
|
|
|
- public Result<ExamUserStatistics> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
- ExamUserStatistics examUserStatistics = examUserStatisticsService.getById(id);
|
|
|
- if(examUserStatistics==null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
- return Result.OK(examUserStatistics);
|
|
|
- }
|
|
|
+ @Autowired
|
|
|
+ private IExamUserStatisticsService examUserStatisticsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IExamService examService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页列表查询
|
|
|
+ *
|
|
|
+ * @param examUserStatistics
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "考试用户统计-分页列表查询", notes = "考试用户统计-分页列表查询")
|
|
|
+ @RequiresPermissions("examUserStatistics:list")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public Result<IPage<ExamUserStatistics>> queryPageList(ExamUserStatistics examUserStatistics,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ QueryWrapper<ExamUserStatistics> queryWrapper = QueryGenerator.initQueryWrapper(examUserStatistics, req.getParameterMap());
|
|
|
+ Page<ExamUserStatistics> page = new Page<ExamUserStatistics>(pageNo, pageSize);
|
|
|
+ IPage<ExamUserStatistics> pageList = examUserStatisticsService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param examUserStatistics
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "考试用户统计-添加")
|
|
|
+ @ApiOperation(value = "考试用户统计-添加", notes = "考试用户统计-添加")
|
|
|
+ //@RequiresPermissions("examUserStatistics:add")
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Result<String> add(@RequestBody ExamUserStatistics examUserStatistics) {
|
|
|
+ examUserStatisticsService.save(examUserStatistics);
|
|
|
+ return Result.OK("添加成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑
|
|
|
+ *
|
|
|
+ * @param examUserStatistics
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "考试用户统计-编辑")
|
|
|
+ @ApiOperation(value = "考试用户统计-编辑", notes = "考试用户统计-编辑")
|
|
|
+ //@RequiresPermissions("examUserStatistics:edit")
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
|
+ public Result<String> edit(@RequestBody ExamUserStatistics examUserStatistics) {
|
|
|
+ examUserStatisticsService.updateById(examUserStatistics);
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id删除
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "考试用户统计-通过id删除")
|
|
|
+ @ApiOperation(value = "考试用户统计-通过id删除", notes = "考试用户统计-通过id删除")
|
|
|
+ //@RequiresPermissions("examUserStatistics:delete")
|
|
|
+ @RequestMapping(value = "/delete", method = RequestMethod.POST)
|
|
|
+ public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ examUserStatisticsService.removeById(id);
|
|
|
+ return Result.OK("删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "考试用户统计-批量删除")
|
|
|
+ @ApiOperation(value = "考试用户统计-批量删除", notes = "考试用户统计-批量删除")
|
|
|
+ //@RequiresPermissions("examUserStatistics:deleteBatch")
|
|
|
+ @RequestMapping(value = "/deleteBatch", method = RequestMethod.POST)
|
|
|
+ public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+ this.examUserStatisticsService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
+ return Result.OK("批量删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "考试用户统计-通过id查询")
|
|
|
+ @ApiOperation(value = "考试用户统计-通过id查询", notes = "考试用户统计-通过id查询")
|
|
|
+ @GetMapping(value = "/queryById")
|
|
|
+ public Result<ExamUserStatistics> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ ExamUserStatistics examUserStatistics = examUserStatisticsService.getById(id);
|
|
|
+ if (examUserStatistics == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ return Result.OK(examUserStatistics);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * 导出excel
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param examUserStatistics
|
|
|
- */
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param examUserStatistics
|
|
|
+ */
|
|
|
//@RequiresPermissions("examUserStatistics:exportXls")
|
|
|
@RequestMapping(value = "/exportXls")
|
|
|
public ModelAndView exportXls(HttpServletRequest request, ExamUserStatistics examUserStatistics) {
|
|
|
- return super.exportXls(request, examUserStatistics, ExamUserStatistics.class, "考试用户统计");
|
|
|
+ String examId = request.getParameter("examId");
|
|
|
+ Exam exam = examService.getById(examId);
|
|
|
+ return super.exportXls(request, examUserStatistics, ExamUserStatistics.class, exam.getTitle() + "考试用户成绩统计");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 通过excel导入数据
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @return
|
|
|
- */
|
|
|
+ * 通过excel导入数据
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
//@RequiresPermissions("examUserStatistics:importExcel")
|
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|