个人中心,班级列表

hehai
mzh820631607 4 years ago
parent a00f395013
commit e97c3a89f7
  1. 3
      src/main/java/com/msdw/tms/api/ClassTeachingApi.java
  2. 42
      src/main/java/com/msdw/tms/controller/ClassTeachingController.java
  3. 15
      src/main/java/com/msdw/tms/dao/ExperimentalStudentDao.java
  4. 21
      src/main/java/com/msdw/tms/entity/ExperimentalStudentEntity.java
  5. 12
      src/main/java/com/msdw/tms/service/ExperimentalStudentService.java
  6. 28
      src/main/java/com/msdw/tms/service/impl/ExperimentalStudentServiceImpl.java
  7. 7
      src/main/resources/mapper/tms/ClassTeachingDao.xml
  8. 12
      src/main/resources/mapper/tms/ExperimentalStudentDao.xml
  9. 3
      src/main/resources/mapper/tms/UserDao.xml

@ -19,4 +19,7 @@ public interface ClassTeachingApi {
@ApiOperation(value = "查看虚拟仿真课程列表",notes = "查看虚拟仿真课程列表")
R querySimulationPlayList(Integer page,Integer size);
@ApiOperation(value = "校验是否需要邀请码",notes = "校验是否需要邀请码")
R check(Integer userId,Integer projectId);
}

@ -4,10 +4,13 @@ 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.BroadcastEntity;
import com.msdw.tms.entity.ExperimentalStudentEntity;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.vo.ProjectRecordVo;
import com.msdw.tms.service.ClassTeachingService;
import com.msdw.tms.service.ExperimentalStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@ -19,6 +22,8 @@ public class ClassTeachingController implements ClassTeachingApi {
@Autowired
private ClassTeachingService classTeachingService;
@Autowired
private ExperimentalStudentService experimentalStudentService;
/**
* 用户端查看班级实验列表
@ -58,27 +63,49 @@ public class ClassTeachingController implements ClassTeachingApi {
return R.ok().put("page", page1);
}
/**
* 校验是否需要输入邀请码
* @param userId
* @param projectId
* @return
*/
@Override
@GetMapping("/checkInvitationCode")
public R check(@RequestParam Integer userId,@RequestParam Integer projectId){
List o = experimentalStudentService.queryIsCode(userId,projectId);
if (o.size()>0){
return R.ok();
}else{
return R.error(200,"false");
}
}
/**
* 通过邀请码进入实验
* @param
* @return
*/
@Override
@Transactional
@PostMapping("/joinPractice")
public R joinPractice(@RequestBody ExperimentalTeachingEntity entity1){
//获取参数
Integer isCode = entity1.getIsCode();
Integer projectId = entity1.getProjectId();
Integer invitationCode = entity1.getInvitationCode();
Integer userId = entity1.getUserId();
//用于接受参数
ExperimentalStudentEntity studentEntity = new ExperimentalStudentEntity();
ExperimentalTeachingEntity entity = new ExperimentalTeachingEntity();
if (isCode==0){
// Integer ICode = experimentalStudentService.queryIsCode(userId);//获取iscode信息,
//if (isCode==0)
if (invitationCode!=null){
entity.setIsCode(isCode).setProjectId(projectId);
entity.setProjectId(projectId);
ExperimentalTeachingEntity result= classTeachingService.queryInvitationcode(entity);//邀请码唯一
Integer code = result.getInvitationCode();
if (invitationCode.equals(code)==true){
ExperimentalStudentEntity student = studentEntity.setUserId(userId).setProjectId(projectId);
experimentalStudentService.saveCode(student);
return R.ok();
}else{
return R.error("邀请码错误,验证失败!!!");
@ -86,10 +113,11 @@ public class ClassTeachingController implements ClassTeachingApi {
}else{
return R.error(400,"邀请码格式错误!!!");
}
}else{
return R.error("输入有误,无需邀请码");
}
}
// else{
// return R.error("输入有误,无需邀请码");
// }
// }
//查看成绩
@Override

@ -0,0 +1,15 @@
package com.msdw.tms.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.msdw.tms.entity.ExperimentalStudentEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ExperimentalStudentDao extends BaseMapper<ExperimentalStudentEntity> {
List queryIsCode(Integer userId, Integer projectId);
void saveCode(ExperimentalStudentEntity student);
}

@ -0,0 +1,21 @@
package com.msdw.tms.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("tms_experimental_student")
public class ExperimentalStudentEntity {
@TableId(type = IdType.AUTO)
private Integer id;
//绑定用户id
private Integer userId;
//绑定项目id
private Integer projectId;
}

@ -0,0 +1,12 @@
package com.msdw.tms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.msdw.tms.entity.ExperimentalStudentEntity;
import java.util.List;
public interface ExperimentalStudentService extends IService<ExperimentalStudentEntity> {
List queryIsCode(Integer userId, Integer projectId);
void saveCode(ExperimentalStudentEntity student);
}

@ -0,0 +1,28 @@
package com.msdw.tms.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.msdw.tms.dao.ExperimentalStudentDao;
import com.msdw.tms.entity.ExperimentalStudentEntity;
import com.msdw.tms.service.ExperimentalStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("tms_experimental_student")
public class ExperimentalStudentServiceImpl extends ServiceImpl<ExperimentalStudentDao, ExperimentalStudentEntity> implements ExperimentalStudentService {
@Autowired
private ExperimentalStudentDao experimentalStudentDao;
@Override
public List queryIsCode(Integer userId, Integer projectId) {
List o = experimentalStudentDao.queryIsCode(userId,projectId);
return o;
}
@Override
public void saveCode(ExperimentalStudentEntity student){
experimentalStudentDao.saveCode(student);
}
}

@ -3,7 +3,7 @@
<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 invitation_code from tms_experimental_teaching where project_id = #{projectId}
</select>
<select id="getByClassRecord" resultType="com.msdw.tms.entity.ExperimentalTeachingEntity">
@ -17,7 +17,9 @@
start_time,
stop_time,
`status`,
project_id
project_id,
is_code,
creation_time
FROM
tms_experimental_teaching
WHERE
@ -28,6 +30,7 @@
<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(creation_time)</if>
ORDER BY creation_time DESC
</select>
<update id="updateSurplusTime" parameterType="com.msdw.tms.entity.ExperimentalTeachingEntity">

@ -0,0 +1,12 @@
<?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.ExperimentalStudentDao">
<select id="queryIsCode" resultType="Map">
SELECT userId FROM tms_experimental_student WHERE userId = #{userId} AND projectId = #{projectId}
</select>
<insert id="saveCode" parameterType="com.msdw.tms.entity.ExperimentalStudentEntity">
INSERT INTO tms_experimental_student(projectId,userId) VALUES (#{projectId},#{userId})
</insert>
</mapper>

@ -111,9 +111,6 @@
per.userId = #{userId}
AND
per.personalFileId = #{personalFileId}
AND
per.schoolId = s.schoolId
</update>
<insert id="insertPersonalInfo" useGeneratedKeys="true">

Loading…
Cancel
Save