班级实验实现

hehai
mzh820631607 4 years ago
parent 616300740e
commit 0ee0777934
  1. 11
      src/main/java/com/msdw/tms/api/ClassTeachingApi.java
  2. 42
      src/main/java/com/msdw/tms/controller/ClassTeachingController.java
  3. 7
      src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java
  4. 23
      src/main/resources/mapper/tms/ClassTeachingDao.xml

@ -2,11 +2,20 @@ package com.msdw.tms.api;
import com.msdw.tms.common.utils.R; import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.ExperimentalTeachingEntity; import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.vo.ProjectRecordVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestParam;
@Api(value = "用户端班级实验", tags = "用户端班级实验信息") @Api(value = "用户端班级实验", tags = "用户端班级实验信息")
public interface ClassTeachingApi { public interface ClassTeachingApi {
@ApiOperation(value = "通过邀请码进入实验",notes = "通过邀请码进入实验") @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();
} }

@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController @RestController
@RequestMapping("tms/classTech") @RequestMapping("tms/classTech")
public class ClassTeachingController implements ClassTeachingApi { public class ClassTeachingController implements ClassTeachingApi {
@ -17,7 +19,7 @@ public class ClassTeachingController implements ClassTeachingApi {
@Autowired @Autowired
private ClassTeachingService classTeachingService; private ClassTeachingService classTeachingService;
/** /**
* 用户端查看班级实验列表 * 用户端查看班级实验列表
* @param page * @param page
* @param size * @param size
@ -28,29 +30,36 @@ public class ClassTeachingController implements ClassTeachingApi {
* @param condition * @param condition
* @return * @return
*/ */
@GetMapping("user/Record") @Override
public R queryTestRecord(@RequestParam Integer page, @RequestParam Integer size, @RequestParam Integer month,@RequestParam String startTime,@RequestParam String endTime, @GetMapping("userRecord")
@RequestParam String condition, @RequestParam Integer status){ 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(); ProjectRecordVo recordVo = new ProjectRecordVo();
ExperimentalTeachingEntity entity = new ExperimentalTeachingEntity(); ExperimentalTeachingEntity entity = new ExperimentalTeachingEntity();
if (isCode==0){
if (status!=0) {//不限定实验状态 if (status!=0) {//不限定实验状态
recordVo.setStatus(status); recordVo.setStatus(status);
} }
if(!StringUtils.isEmpty(condition)){ if(!StringUtils.isEmpty(condition)){
recordVo.setCondition(condition); recordVo.setCondition(condition);
} }
if(!StringUtils.isEmpty(month)) { if(!StringUtils.isEmpty(month)) {
recordVo.setMonth(month); recordVo.setMonth(month);
}else { }else {
recordVo.setMonth(0);
if(!StringUtils.isEmpty(startTime)) { if(!StringUtils.isEmpty(startTime)) {
recordVo.setStartTime(startTime); recordVo.setStartTime(startTime);
}if(!StringUtils.isEmpty(endTime)) { }if(!StringUtils.isEmpty(endTime)) {
recordVo.setEndTime(endTime); recordVo.setEndTime(endTime);
} }
} }
recordVo.setIsCode(isCode);
PageUtils page1 = classTeachingService.queryClassRecord(page,size,recordVo); PageUtils page1 = classTeachingService.queryClassRecord(page,size,recordVo);
return R.ok().put("page", page1); 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 @Override
@PostMapping("/joinPractice") @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(); ExperimentalTeachingEntity entity = new ExperimentalTeachingEntity();
if (isCode==0){ if (isCode==0){
if (invitationCode!=null){ if (invitationCode!=null){
@ -79,4 +94,11 @@ public class ClassTeachingController implements ClassTeachingApi {
return R.error("输入有误,无需邀请码"); return R.error("输入有误,无需邀请码");
} }
} }
//查看成绩
@Override
@GetMapping("/queryAchievement")
public R queryAchievement(){
return R.ok();
}
} }

@ -1,10 +1,12 @@
package com.msdw.tms.entity.vo; package com.msdw.tms.entity.vo;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.ProjectRecordEntity; import com.msdw.tms.entity.ProjectRecordEntity;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@ -65,6 +67,11 @@ public class ProjectRecordVo extends ProjectRecordEntity implements Serializable
* 实验状态(1待开始 2进行中 3已结束) * 实验状态(1待开始 2进行中 3已结束)
*/ */
private Integer status; private Integer status;
/**
* 是否启用邀请码
*/
private Integer isCode;
// /** // /**
// * 班级实验状态,0 不限,1 未发布,2 进行中,3 已完成 // * 班级实验状态,0 不限,1 未发布,2 进行中,3 已完成
// */ // */

@ -6,9 +6,24 @@
select invitation_code from tms_experimental_teaching where project_id = #{projectId} and is_code = #{isCode} select invitation_code from tms_experimental_teaching where project_id = #{projectId} and is_code = #{isCode}
</select> </select>
<!-- <select id="getByClassRecord" resultType="com.msdw.tms.entity.ExperimentalTeachingEntity">--> <select id="getByClassRecord" resultType="com.msdw.tms.entity.ExperimentalTeachingEntity">
<!-- select --> SELECT
id,
<!-- </select>--> experimental_class_name,
experiment_duration,
experimental_name,
experimental_number,
start_time,
stop_time,
`status`
FROM
tms_experimental_teaching
WHERE
`status` = #{cla.status}
and is_code = #{cla.isCode}
<if test="cla.condition!=null">and ( project_name like concat('%',#{cla.condition},'%') or experimental_class_name like concat('%',#{cla.condition},'%') )</if>
<if test="cla.startTime!=null and cla.endTime!=null">and stop_time between #{cla.endTime} and #{cla.startTime}</if>
<if test="cla.month!=null">and DATE_SUB(CURDATE(), INTERVAL #{cla.month} month ) &lt;= date(stop_time)</if>
</select>
</mapper> </mapper>
Loading…
Cancel
Save