班级实验列表

hehai
mzh820631607 4 years ago
parent 347af0631d
commit 616300740e
  1. 12
      src/main/java/com/msdw/tms/api/ClassTeachingApi.java
  2. 82
      src/main/java/com/msdw/tms/controller/ClassTeachingController.java
  3. 68
      src/main/java/com/msdw/tms/controller/ProjectRecordController.java
  4. 15
      src/main/java/com/msdw/tms/dao/ClassTeachingDao.java
  5. 49
      src/main/java/com/msdw/tms/entity/ExperimentalTeachingEntity.java
  6. 11
      src/main/java/com/msdw/tms/entity/vo/ClassTeachingVo.java
  7. 10
      src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java
  8. 12
      src/main/java/com/msdw/tms/service/ClassTeachingService.java
  9. 35
      src/main/java/com/msdw/tms/service/impl/ClassTeachingServiceImpl.java
  10. 14
      src/main/resources/mapper/tms/ClassTeachingDao.xml

@ -0,0 +1,12 @@
package com.msdw.tms.api;
import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api(value = "用户端班级实验", tags = "用户端班级实验信息")
public interface ClassTeachingApi {
@ApiOperation(value = "通过邀请码进入实验",notes = "通过邀请码进入实验")
R joinPractice(Integer invitationCode,Integer isCode,Integer projectId);
}

@ -0,0 +1,82 @@
package com.msdw.tms.controller;
import com.msdw.tms.api.ClassTeachingApi;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.vo.ProjectRecordVo;
import com.msdw.tms.service.ClassTeachingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("tms/classTech")
public class ClassTeachingController implements ClassTeachingApi {
@Autowired
private ClassTeachingService classTeachingService;
/**
* 用户端查看班级实验列表
* @param page
* @param size
* @param month
* @param startTime
* @param endTime
* @param status
* @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){
ProjectRecordVo recordVo = new ProjectRecordVo();
ExperimentalTeachingEntity entity = new ExperimentalTeachingEntity();
if (status!=0) {//不限定实验状态
recordVo.setStatus(status);
}
if(!StringUtils.isEmpty(condition)){
recordVo.setCondition(condition);
}
if(!StringUtils.isEmpty(month)) {
recordVo.setMonth(month);
}else {
if(!StringUtils.isEmpty(startTime)) {
recordVo.setStartTime(startTime);
}if(!StringUtils.isEmpty(endTime)) {
recordVo.setEndTime(endTime);
}
}
PageUtils page1 = classTeachingService.queryClassRecord(page,size,recordVo);
return R.ok().put("page", page1);
}
/**
* 通过邀请码进入实验
* @param
* @return
*/
@Override
@PostMapping("/joinPractice")
public R joinPractice(@RequestBody Integer invitationCode, Integer isCode, Integer projectId){
ExperimentalTeachingEntity entity = new ExperimentalTeachingEntity();
if (isCode==0){
if (invitationCode!=null){
entity.setIsCode(isCode).setProjectId(projectId);
ExperimentalTeachingEntity result= classTeachingService.queryInvitationcode(entity);
Integer code = result.getInvitationCode();
if (invitationCode.equals(code)==true){
return R.ok();
}else{
return R.error("邀请码错误,验证失败!!!");
}
}else{
return R.error(400,"邀请码格式错误!!!");
}
}else{
return R.error("输入有误,无需邀请码");
}
}
}

@ -50,74 +50,6 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
return R.ok().put("page", page1);
}
// /**
// * 用户端查看班级实验列表
// * @param page
// * @param size
// * @param month
// * @param startTime
// * @param endTime
// * @param experimentStartus
// * @param condition
// * @return
// */
// @GetMapping("user/Record")
// public R userList(@RequestParam Integer page, @RequestParam Integer size, @RequestParam Integer month,@RequestParam String startTime,@RequestParam String endTime,
// @RequestParam String condition, @RequestParam Integer experimentStartus){
// ProjectRecordVo recordVo = new ProjectRecordVo();
// if (experimentStartus==0){//不限定
// if(!StringUtils.isEmpty(month)) {
// recordVo.setMonth(month);
// }if(!StringUtils.isEmpty(startTime)) {
// recordVo.setStartTime(startTime);
// }if(!StringUtils.isEmpty(endTime)) {
// recordVo.setEndTime(endTime);
// }if(!StringUtils.isEmpty(condition)){
// recordVo.setCondition(condition);
// }
// PageUtils page1 = projectRecordService.queryUserRecord(page,size,recordVo);
// }if (experimentStartus==1){//实验未发布
// recordVo.setProjectstate(1);
// if(!StringUtils.isEmpty(condition)){
// recordVo.setCondition(condition);
// }
// PageUtils page1 = projectRecordService.queryUserRecord(page,size,recordVo);
// }if (experimentStartus==2){//实验进行中
// if(!StringUtils.isEmpty(month)) {
// recordVo.setMonth(month);
// }if(!StringUtils.isEmpty(condition)){
// recordVo.setCondition(condition);
// }
// recordVo.setStartTime(startTime);
// recordVo.setEndtime(null);
// PageUtils page1 = projectRecordService.queryUserRecord(page,size,recordVo);
// }if (experimentStartus==3){//实验已完成
// if(!StringUtils.isEmpty(month)) {
// recordVo.setMonth(month);
// }if(!StringUtils.isEmpty(startTime)){
// recordVo.setStartTime(startTime);
// }if(!StringUtils.isEmpty(endTime)) {
// recordVo.setEndTime(endTime);
// }if(!StringUtils.isEmpty(condition)){
// recordVo.setCondition(condition);
// }
// PageUtils page1 = projectRecordService.queryUserRecord(page,size,recordVo);
// }
// if(!StringUtils.isEmpty(month)) {
// recordVo.setMonth(month);
// }if(!StringUtils.isEmpty(startTime)) {
// recordVo.setStartTime(startTime);
// }if(!StringUtils.isEmpty(endTime)) {
// recordVo.setEndTime(endTime);
// }if(!StringUtils.isEmpty(condition)){
// recordVo.setCondition(condition);
// }
// PageUtils page1 = projectRecordService.queryUserRecord(page,size,recordVo);
//
//
// return R.ok().put("page", page1);
// }
/**
* 用户实验记录
* @param page

@ -0,0 +1,15 @@
package com.msdw.tms.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.vo.ProjectRecordVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface ClassTeachingDao {
ExperimentalTeachingEntity queryInvitationCode(ExperimentalTeachingEntity experimentEntity);
IPage<ProjectRecordVo> getByClassRecord(Page page1, @Param("cla") ProjectRecordVo recordVo);
}

@ -0,0 +1,49 @@
package com.msdw.tms.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 实验教学实体
*
* @author Ning
*/
@Data
@TableName("tms_experimental_teaching")
@Accessors(chain = true)
public class ExperimentalTeachingEntity {
//实验教学主键ID
@TableId
private Integer id;
//实验班级名称
private String experimentalClassName;
//实验名称
private String experimentalName;
//绑定项目id
private Integer projectId;
//绑定项目名称
private String projectName;
//实验人数
private Integer experimentalNumber;
//实验时长
private String experimentDuration;
//发布类型
private Integer type;
//启动时间
private String startTime;
//结束时间
private String stopTime;
//状态
private Integer status;
//邀请码
// private String invitationCode;
private Integer invitationCode;
//是否启用邀请码
private Integer isCode;
//绑定用户Id
private Integer userId;
}

@ -0,0 +1,11 @@
package com.msdw.tms.entity.vo;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class ClassTeachingVo {
}

@ -2,10 +2,12 @@ package com.msdw.tms.entity.vo;
import com.msdw.tms.entity.ProjectRecordEntity;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@Accessors(chain = true)
public class ProjectRecordVo extends ProjectRecordEntity implements Serializable {
/**
@ -59,6 +61,10 @@ public class ProjectRecordVo extends ProjectRecordEntity implements Serializable
/** 记录状态(0 未修改,1 已修改)*/
private Integer recordState;
// =====================================记录实验项目信息
/**
* 实验状态(1待开始 2进行中 3已结束)
*/
private Integer status;
// /**
// * 班级实验状态,0 不限,1 未发布,2 进行中,3 已完成
// */
@ -88,8 +94,4 @@ public class ProjectRecordVo extends ProjectRecordEntity implements Serializable
// * 实验提示
// */
// private String projecttips;
// /**
// * 实验状态(0已发布 1未发布)
// */
// private Integer projectstate;
}

@ -0,0 +1,12 @@
package com.msdw.tms.service;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.vo.ProjectRecordVo;
public interface ClassTeachingService {
ExperimentalTeachingEntity queryInvitationcode(ExperimentalTeachingEntity experimentalTeachingEntity);
PageUtils queryClassRecord(Integer page, Integer size, ProjectRecordVo recordVo);
}

@ -0,0 +1,35 @@
package com.msdw.tms.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.msdw.tms.common.utils.Constant;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.dao.ClassTeachingDao;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.vo.ProjectRecordVo;
import com.msdw.tms.service.ClassTeachingService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ClassTeachingServiceImpl implements ClassTeachingService {
@Autowired
private ClassTeachingDao classMapper;
@Override
public ExperimentalTeachingEntity queryInvitationcode(ExperimentalTeachingEntity experimentEntity) {
ExperimentalTeachingEntity ex = classMapper.queryInvitationCode(experimentEntity);
return ex;
}
@Override
public PageUtils queryClassRecord(Integer page, Integer size, ProjectRecordVo recordVo) {
//分页对象
Page<T> page1 = new Page<>(page, size);
recordVo.setIsdel(Constant.IsDel.NOT_DEL.getType());
IPage<ProjectRecordVo> schoolRecord = this.classMapper.getByClassRecord(page1, recordVo);
PageUtils pageUtils = new PageUtils(schoolRecord);
return pageUtils;
}
}

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.msdw.tms.dao.ClassTeachingDao">
<select id="queryInvitationCode" resultType="com.msdw.tms.entity.ExperimentalTeachingEntity">
select invitation_code from tms_experimental_teaching where project_id = #{projectId} and is_code = #{isCode}
</select>
<!-- <select id="getByClassRecord" resultType="com.msdw.tms.entity.ExperimentalTeachingEntity">-->
<!-- select -->
<!-- </select>-->
</mapper>
Loading…
Cancel
Save