parent
347af0631d
commit
616300740e
10 changed files with 237 additions and 73 deletions
@ -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("输入有误,无需邀请码"); |
||||
} |
||||
} |
||||
} |
@ -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 { |
||||
|
||||
|
||||
} |
@ -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…
Reference in new issue