From 0ee077793446b62e32a8b8e36e221f7420edea2f Mon Sep 17 00:00:00 2001 From: mzh820631607 Date: Wed, 23 Sep 2020 11:15:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E5=AE=9E=E9=AA=8C=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/msdw/tms/api/ClassTeachingApi.java | 11 ++++- .../controller/ClassTeachingController.java | 42 ++++++++++++++----- .../msdw/tms/entity/vo/ProjectRecordVo.java | 7 ++++ .../resources/mapper/tms/ClassTeachingDao.xml | 23 ++++++++-- 4 files changed, 68 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/msdw/tms/api/ClassTeachingApi.java b/src/main/java/com/msdw/tms/api/ClassTeachingApi.java index 555b316..d0efeda 100644 --- a/src/main/java/com/msdw/tms/api/ClassTeachingApi.java +++ b/src/main/java/com/msdw/tms/api/ClassTeachingApi.java @@ -2,11 +2,20 @@ package com.msdw.tms.api; import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.ExperimentalTeachingEntity; +import com.msdw.tms.entity.vo.ProjectRecordVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.RequestParam; @Api(value = "用户端班级实验", tags = "用户端班级实验信息") public interface ClassTeachingApi { @ApiOperation(value = "通过邀请码进入实验",notes = "通过邀请码进入实验") - R joinPractice(Integer invitationCode,Integer isCode,Integer projectId); + R joinPractice(ExperimentalTeachingEntity entity1); + + @ApiOperation(value = "查询班级实验列表信息",notes = "查询班级实验列表信息") + R queryTestRecord(Integer page, Integer size, Integer month, String startTime, String endTime, + String condition, Integer status, Integer isCode); + + @ApiOperation(value = "查看成绩",notes = "查看成绩") + R queryAchievement(); } diff --git a/src/main/java/com/msdw/tms/controller/ClassTeachingController.java b/src/main/java/com/msdw/tms/controller/ClassTeachingController.java index a1d4798..6fd451d 100644 --- a/src/main/java/com/msdw/tms/controller/ClassTeachingController.java +++ b/src/main/java/com/msdw/tms/controller/ClassTeachingController.java @@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; +import java.util.List; + @RestController @RequestMapping("tms/classTech") public class ClassTeachingController implements ClassTeachingApi { @@ -17,7 +19,7 @@ public class ClassTeachingController implements ClassTeachingApi { @Autowired private ClassTeachingService classTeachingService; - /** + /** * 用户端查看班级实验列表 * @param page * @param size @@ -28,29 +30,36 @@ public class ClassTeachingController implements ClassTeachingApi { * @param condition * @return */ - @GetMapping("user/Record") - public R queryTestRecord(@RequestParam Integer page, @RequestParam Integer size, @RequestParam Integer month,@RequestParam String startTime,@RequestParam String endTime, - @RequestParam String condition, @RequestParam Integer status){ + @Override + @GetMapping("userRecord") + public R queryTestRecord(@RequestParam Integer page, @RequestParam Integer size, Integer month,@RequestParam String startTime,@RequestParam String endTime, + String condition, @RequestParam Integer status,@RequestParam Integer isCode){ ProjectRecordVo recordVo = new ProjectRecordVo(); ExperimentalTeachingEntity entity = new ExperimentalTeachingEntity(); - - if (status!=0) {//不限定实验状态 - recordVo.setStatus(status); - } + if (isCode==0){ + if (status!=0) {//不限定实验状态 + recordVo.setStatus(status); + } if(!StringUtils.isEmpty(condition)){ recordVo.setCondition(condition); } if(!StringUtils.isEmpty(month)) { recordVo.setMonth(month); }else { + recordVo.setMonth(0); if(!StringUtils.isEmpty(startTime)) { recordVo.setStartTime(startTime); }if(!StringUtils.isEmpty(endTime)) { - recordVo.setEndTime(endTime); + recordVo.setEndTime(endTime); } } + recordVo.setIsCode(isCode); PageUtils page1 = classTeachingService.queryClassRecord(page,size,recordVo); return R.ok().put("page", page1); + }else if (isCode==1){ + return R.error("无需邀请码"); + } + return R.error("错误操作,isCode 不能为空"); } /** @@ -60,7 +69,13 @@ public class ClassTeachingController implements ClassTeachingApi { */ @Override @PostMapping("/joinPractice") - public R joinPractice(@RequestBody Integer invitationCode, Integer isCode, Integer projectId){ + public R joinPractice(@RequestBody ExperimentalTeachingEntity entity1){ + //获取参数 + Integer isCode = entity1.getIsCode(); + Integer projectId = entity1.getProjectId(); + Integer invitationCode = entity1.getInvitationCode(); + + //用于接受参数 ExperimentalTeachingEntity entity = new ExperimentalTeachingEntity(); if (isCode==0){ if (invitationCode!=null){ @@ -79,4 +94,11 @@ public class ClassTeachingController implements ClassTeachingApi { return R.error("输入有误,无需邀请码"); } } + + //查看成绩 + @Override + @GetMapping("/queryAchievement") + public R queryAchievement(){ + return R.ok(); + } } diff --git a/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java b/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java index 99c08fa..4b1e237 100644 --- a/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java +++ b/src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java @@ -1,10 +1,12 @@ package com.msdw.tms.entity.vo; +import com.msdw.tms.entity.ExperimentalTeachingEntity; import com.msdw.tms.entity.ProjectRecordEntity; import lombok.Data; import lombok.experimental.Accessors; import java.io.Serializable; +import java.util.List; @Data @Accessors(chain = true) @@ -65,6 +67,11 @@ public class ProjectRecordVo extends ProjectRecordEntity implements Serializable * 实验状态(1待开始 2进行中 3已结束) */ private Integer status; + /** + * 是否启用邀请码 + */ + private Integer isCode; + // /** // * 班级实验状态,0 不限,1 未发布,2 进行中,3 已完成 // */ diff --git a/src/main/resources/mapper/tms/ClassTeachingDao.xml b/src/main/resources/mapper/tms/ClassTeachingDao.xml index cec2eee..7327f7b 100644 --- a/src/main/resources/mapper/tms/ClassTeachingDao.xml +++ b/src/main/resources/mapper/tms/ClassTeachingDao.xml @@ -6,9 +6,24 @@ select invitation_code from tms_experimental_teaching where project_id = #{projectId} and is_code = #{isCode} - - - - + \ No newline at end of file