增加考试人数、考试次数接口

newBigdata
yz 11 months ago
parent 3619e728b2
commit 2f2e7ed67b

@ -11,6 +11,7 @@ import com.sztzjy.financial_bigdata.config.security.TokenProvider;
import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuUserDto;
import com.sztzjy.financial_bigdata.mapper.StuClassMapper;
import com.sztzjy.financial_bigdata.mapper.StuStudentExamMapper;
import com.sztzjy.financial_bigdata.mapper.StuUserMapper;
import com.sztzjy.financial_bigdata.mapper.SysLoginLogMapper;
import com.sztzjy.financial_bigdata.service.tea.ITeaUserService;
@ -55,6 +56,8 @@ public class UserController {
private SysLoginLogMapper sysLoginLogMapper;
@Resource
private AuthenticationManagerBuilder authenticationManagerBuilder;
@Autowired
private StuStudentExamMapper studentExamMapper;
// 用户登录时记录的信息
private static LocalDateTime loginTime;
@ -476,4 +479,22 @@ public class UserController {
@RequestParam(required = false) String classId) {
userService.logExport(response, schoolId, studentId, classId);
}
@AnonymousAccess
@GetMapping("/getStudentExamPeopleCountAndStudentExamTime")
@ApiOperation("考试人数和考试次数")
public ResultEntity<Map<Long,Long>> getStudentExamCountAndStudentCount(String schoolId){
StuUserExample stuUserExample = new StuUserExample();
stuUserExample.createCriteria().andSchoolIdEqualTo(schoolId).andExamStatusEqualTo("true");
//考试人数
long examPeopleCount= stuUserMapper.countByExample(stuUserExample);
StuStudentExamExample stuStudentExamExample = new StuStudentExamExample();
//考试次数
long examTime = studentExamMapper.countByExample(stuStudentExamExample);
HashMap<Long, Long> countMap = new HashMap<>();
countMap.put(examPeopleCount,examTime);
return new ResultEntity<>(HttpStatus.OK, "考试人数和考试次数查询成功", countMap);
}
}

@ -37,7 +37,7 @@ public class StuUser {
@ApiModelProperty("专业")
private String major;
@ApiModelProperty("角色ID 学生0老师1")
@ApiModelProperty("3教师 4学生")
private Integer roleId;
@ApiModelProperty("创建时间")
@ -52,6 +52,9 @@ public class StuUser {
@ApiModelProperty("状态 0未删除 1删除")
private Integer status;
@ApiModelProperty("是否参加过考试")
private String examStatus;
public String getUserid() {
return userid;
}
@ -163,4 +166,12 @@ public class StuUser {
public void setStatus(Integer status) {
this.status = status;
}
public String getExamStatus() {
return examStatus;
}
public void setExamStatus(String examStatus) {
this.examStatus = examStatus == null ? null : examStatus.trim();
}
}

@ -1054,6 +1054,76 @@ public class StuUserExample {
addCriterion("status not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andExamStatusIsNull() {
addCriterion("exam_status is null");
return (Criteria) this;
}
public Criteria andExamStatusIsNotNull() {
addCriterion("exam_status is not null");
return (Criteria) this;
}
public Criteria andExamStatusEqualTo(String value) {
addCriterion("exam_status =", value, "examStatus");
return (Criteria) this;
}
public Criteria andExamStatusNotEqualTo(String value) {
addCriterion("exam_status <>", value, "examStatus");
return (Criteria) this;
}
public Criteria andExamStatusGreaterThan(String value) {
addCriterion("exam_status >", value, "examStatus");
return (Criteria) this;
}
public Criteria andExamStatusGreaterThanOrEqualTo(String value) {
addCriterion("exam_status >=", value, "examStatus");
return (Criteria) this;
}
public Criteria andExamStatusLessThan(String value) {
addCriterion("exam_status <", value, "examStatus");
return (Criteria) this;
}
public Criteria andExamStatusLessThanOrEqualTo(String value) {
addCriterion("exam_status <=", value, "examStatus");
return (Criteria) this;
}
public Criteria andExamStatusLike(String value) {
addCriterion("exam_status like", value, "examStatus");
return (Criteria) this;
}
public Criteria andExamStatusNotLike(String value) {
addCriterion("exam_status not like", value, "examStatus");
return (Criteria) this;
}
public Criteria andExamStatusIn(List<String> values) {
addCriterion("exam_status in", values, "examStatus");
return (Criteria) this;
}
public Criteria andExamStatusNotIn(List<String> values) {
addCriterion("exam_status not in", values, "examStatus");
return (Criteria) this;
}
public Criteria andExamStatusBetween(String value1, String value2) {
addCriterion("exam_status between", value1, value2, "examStatus");
return (Criteria) this;
}
public Criteria andExamStatusNotBetween(String value1, String value2) {
addCriterion("exam_status not between", value1, value2, "examStatus");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

@ -5,6 +5,7 @@ import com.sztzjy.financial_bigdata.entity.stu_dto.StuCommitCaseExamDto;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto;
import com.sztzjy.financial_bigdata.mapper.*;
import com.sztzjy.financial_bigdata.service.stu.IExamService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -23,6 +24,8 @@ public class ExamServiceImpl implements IExamService {
SysCaseQuestionStepMapper stepMapper;
@Autowired
StuExamCaseMapper stuExamCaseMapper;
@Autowired
StuUserMapper userMapper;
//如果学生考试表查询不到 则新增一条数据
//根据examManageId 查询该考试的题目idlist 再通过idlist查询题目信息进行返回
@ -49,6 +52,14 @@ public class ExamServiceImpl implements IExamService {
stuExam.setStartTime(new Date());
studentExamMapper.insert(stuExam);
List<SysObjectiveQuestion> objectiveQuestionList = GenerateExam(examManageId);
//查询userinfo表 修改考试状态
StuUser stuUser = userMapper.selectByPrimaryKey(userId);
if(StringUtils.isBlank(stuUser.getExamStatus())){
stuUser.setExamStatus("true");
userMapper.updateByPrimaryKey(stuUser);
}
return objectiveQuestionList;
}else {
StuStudentExamWithBLOBs stuExam = stuStudentExams.get(0);
@ -128,6 +139,7 @@ public class ExamServiceImpl implements IExamService {
//案例开始答题
//先查询考试stustudentexam数据是否生成
//先查询当前时间是否在考试时间之内
//在考试时间外 返回不在考试时间内
//考试时间内
@ -135,14 +147,40 @@ public class ExamServiceImpl implements IExamService {
//根据casestepid、userid、exammanageid 查询该案例的数据 如果有 代表之前提交过 则替换返回的答案 没有 则返回上一步查询的数据 并设置答案为null
@Override
public List<SysCaseQuestionStep> startCase(String examManageId, String userId, String classId,String caseId) {
public List<SysCaseQuestionStep> startCase(String examManageId, String userId, String classId,String caseId){
StuStudentExamExample stuExamexample = new StuStudentExamExample();
stuExamexample.createCriteria().andUseridEqualTo(userId).andExamManageIdEqualTo(examManageId);
List<StuStudentExamWithBLOBs> stuStudentExams = studentExamMapper.selectByExampleWithBLOBs(stuExamexample);
if(stuStudentExams==null || stuStudentExams.size()==0){
StuStudentExamWithBLOBs stuExam = new StuStudentExamWithBLOBs();
stuExam.setStudentExamId(String.valueOf(UUID.randomUUID()));
stuExam.setExamManageId(examManageId);
stuExam.setUserid(userId);
stuExam.setClassId(classId);
stuExam.setStartTime(new Date());
studentExamMapper.insert(stuExam);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
//查询userinfo表 修改考试状态
StuUser stuUser = userMapper.selectByPrimaryKey(userId);
if(StringUtils.isBlank(stuUser.getExamStatus())){
stuUser.setExamStatus("true");
userMapper.updateByPrimaryKey(stuUser);
}
}
TeaExamManageWithBLOBs manage = examManageMapper.selectByPrimaryKey(examManageId);
Date endTime = manage.getEndTime();
if(endTime.before(new Date())){
return null;
}else {
String caseIdlist = manage.getCaseIdlist();
List<String> caseIdList = Arrays.asList(caseIdlist.split(", "));
List<String> caseIdList = Arrays.asList(caseIdlist.split(","));
SysCaseQuestionStepExample example = new SysCaseQuestionStepExample();
if(caseId.equals("first")){
String caseIdFirst = caseIdList.get(0);
@ -195,7 +233,7 @@ public class ExamServiceImpl implements IExamService {
SysCaseQuestionStep sysCaseQuestionStep = stepMapper.selectByPrimaryKey(caseStepId);
if(stuExamCases==null || stuExamCases.size()==0){
StuExamCase stuExamCase = new StuExamCase();
stuExamCase.setCaseId(String.valueOf(UUID.randomUUID()));
stuExamCase.setExamCaseId(String.valueOf(UUID.randomUUID()));
stuExamCase.setExamManageId(commitCaseExamDto.getExamManageId());
stuExamCase.setCaseId(commitCaseExamDto.getCaseId());
stuExamCase.setStudentAnswer(commitCaseExamDto.getStuAnswer());

@ -52,7 +52,7 @@ public class ExerciseServiceImpl implements IExerciseService {
return dtos;
}else {
StuTrainingWithBLOBs bloBs = stuTrainingWithBLOBs.get(0);
if (bloBs.getLearningEvalIdlist().isEmpty()) {
if (bloBs==null || bloBs.getLearningEvalIdlist().isEmpty()) {
List<SysObjectiveQuestion> objectiveQuestionList = objectiveService.selectObjectQuestionListByChapterId(chapterId);
for (int i = 0; i < objectiveQuestionList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionList.get(i);

@ -1,362 +1,372 @@
<?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.sztzjy.financial_bigdata.mapper.StuUserMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.StuUser">
<id column="userid" jdbcType="VARCHAR" property="userid"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="student_id" jdbcType="VARCHAR" property="studentId"/>
<result column="class_id" jdbcType="VARCHAR" property="classId"/>
<result column="username" jdbcType="VARCHAR" property="username"/>
<result column="password" jdbcType="VARCHAR" property="password"/>
<result column="phone" jdbcType="VARCHAR" property="phone"/>
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="major" jdbcType="VARCHAR" property="major"/>
<result column="role_id" jdbcType="INTEGER" property="roleId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="school_id" jdbcType="VARCHAR" property="schoolId"/>
<result column="school_name" jdbcType="VARCHAR" property="schoolName"/>
<result column="status" jdbcType="INTEGER" property="status"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
<resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.StuUser">
<id column="userid" jdbcType="VARCHAR" property="userid" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="student_id" jdbcType="VARCHAR" property="studentId" />
<result column="class_id" jdbcType="VARCHAR" property="classId" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="major" jdbcType="VARCHAR" property="major" />
<result column="role_id" jdbcType="INTEGER" property="roleId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="school_id" jdbcType="VARCHAR" property="schoolId" />
<result column="school_name" jdbcType="VARCHAR" property="schoolName" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="exam_status" jdbcType="VARCHAR" property="examStatus" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
userid
, name, student_id, class_id, username, password, phone, email, major, role_id,
create_time, school_id, school_name, status
</sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuUserExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from stu_userinfo
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from stu_userinfo
where userid = #{userid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete
from stu_userinfo
where userid = #{userid,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuUserExample">
delete from stu_userinfo
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.StuUser">
insert into stu_userinfo (userid, name, student_id,
class_id, username, password,
phone, email, major,
role_id, create_time, school_id,
school_name, status)
values (#{userid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{studentId,jdbcType=VARCHAR},
#{classId,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{major,jdbcType=VARCHAR},
#{roleId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{schoolId,jdbcType=VARCHAR},
#{schoolName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.StuUser">
insert into stu_userinfo
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userid != null">
userid,
</if>
<if test="name != null">
name,
</if>
<if test="studentId != null">
student_id,
</if>
<if test="classId != null">
class_id,
</if>
<if test="username != null">
username,
</if>
<if test="password != null">
password,
</if>
<if test="phone != null">
phone,
</if>
<if test="email != null">
email,
</if>
<if test="major != null">
major,
</if>
<if test="roleId != null">
role_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="schoolId != null">
school_id,
</if>
<if test="schoolName != null">
school_name,
</if>
<if test="status != null">
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userid != null">
#{userid,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="studentId != null">
#{studentId,jdbcType=VARCHAR},
</if>
<if test="classId != null">
#{classId,jdbcType=VARCHAR},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="major != null">
#{major,jdbcType=VARCHAR},
</if>
<if test="roleId != null">
#{roleId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="schoolId != null">
#{schoolId,jdbcType=VARCHAR},
</if>
<if test="schoolName != null">
#{schoolName,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuUserExample"
resultType="java.lang.Long">
select count(*) from stu_userinfo
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</trim>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update stu_userinfo
<set>
<if test="record.userid != null">
userid = #{record.userid,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.studentId != null">
student_id = #{record.studentId,jdbcType=VARCHAR},
</if>
<if test="record.classId != null">
class_id = #{record.classId,jdbcType=VARCHAR},
</if>
<if test="record.username != null">
username = #{record.username,jdbcType=VARCHAR},
</if>
<if test="record.password != null">
password = #{record.password,jdbcType=VARCHAR},
</if>
<if test="record.phone != null">
phone = #{record.phone,jdbcType=VARCHAR},
</if>
<if test="record.email != null">
email = #{record.email,jdbcType=VARCHAR},
</if>
<if test="record.major != null">
major = #{record.major,jdbcType=VARCHAR},
</if>
<if test="record.roleId != null">
role_id = #{record.roleId,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.schoolId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR},
</if>
<if test="record.schoolName != null">
school_name = #{record.schoolName,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</update>
<update id="updateByExample" parameterType="map">
update stu_userinfo
set userid = #{record.userid,jdbcType=VARCHAR},
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
userid, name, student_id, class_id, username, password, phone, email, major, role_id,
create_time, school_id, school_name, status, exam_status
</sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuUserExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from stu_userinfo
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from stu_userinfo
where userid = #{userid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from stu_userinfo
where userid = #{userid,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuUserExample">
delete from stu_userinfo
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.StuUser">
insert into stu_userinfo (userid, name, student_id,
class_id, username, password,
phone, email, major,
role_id, create_time, school_id,
school_name, status, exam_status
)
values (#{userid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{studentId,jdbcType=VARCHAR},
#{classId,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{major,jdbcType=VARCHAR},
#{roleId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{schoolId,jdbcType=VARCHAR},
#{schoolName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{examStatus,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.StuUser">
insert into stu_userinfo
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userid != null">
userid,
</if>
<if test="name != null">
name,
</if>
<if test="studentId != null">
student_id,
</if>
<if test="classId != null">
class_id,
</if>
<if test="username != null">
username,
</if>
<if test="password != null">
password,
</if>
<if test="phone != null">
phone,
</if>
<if test="email != null">
email,
</if>
<if test="major != null">
major,
</if>
<if test="roleId != null">
role_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="schoolId != null">
school_id,
</if>
<if test="schoolName != null">
school_name,
</if>
<if test="status != null">
status,
</if>
<if test="examStatus != null">
exam_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userid != null">
#{userid,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="studentId != null">
#{studentId,jdbcType=VARCHAR},
</if>
<if test="classId != null">
#{classId,jdbcType=VARCHAR},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="major != null">
#{major,jdbcType=VARCHAR},
</if>
<if test="roleId != null">
#{roleId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="schoolId != null">
#{schoolId,jdbcType=VARCHAR},
</if>
<if test="schoolName != null">
#{schoolName,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="examStatus != null">
#{examStatus,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuUserExample" resultType="java.lang.Long">
select count(*) from stu_userinfo
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update stu_userinfo
<set>
<if test="record.userid != null">
userid = #{record.userid,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.studentId != null">
student_id = #{record.studentId,jdbcType=VARCHAR},
</if>
<if test="record.classId != null">
class_id = #{record.classId,jdbcType=VARCHAR},
</if>
<if test="record.username != null">
username = #{record.username,jdbcType=VARCHAR},
</if>
<if test="record.password != null">
password = #{record.password,jdbcType=VARCHAR},
</if>
<if test="record.phone != null">
phone = #{record.phone,jdbcType=VARCHAR},
</if>
<if test="record.email != null">
email = #{record.email,jdbcType=VARCHAR},
</if>
<if test="record.major != null">
major = #{record.major,jdbcType=VARCHAR},
</if>
<if test="record.roleId != null">
role_id = #{record.roleId,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.schoolId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR},
</if>
<if test="record.schoolName != null">
school_name = #{record.schoolName,jdbcType=VARCHAR},
status = #{record.status,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.StuUser">
update stu_userinfo
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="studentId != null">
student_id = #{studentId,jdbcType=VARCHAR},
</if>
<if test="classId != null">
class_id = #{classId,jdbcType=VARCHAR},
</if>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="major != null">
major = #{major,jdbcType=VARCHAR},
</if>
<if test="roleId != null">
role_id = #{roleId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="schoolId != null">
school_id = #{schoolId,jdbcType=VARCHAR},
</if>
<if test="schoolName != null">
school_name = #{schoolName,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
</set>
where userid = #{userid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.StuUser">
update stu_userinfo
set name = #{name,jdbcType=VARCHAR},
student_id = #{studentId,jdbcType=VARCHAR},
class_id = #{classId,jdbcType=VARCHAR},
username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
major = #{major,jdbcType=VARCHAR},
role_id = #{roleId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
school_id = #{schoolId,jdbcType=VARCHAR},
school_name = #{schoolName,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER}
where userid = #{userid,jdbcType=VARCHAR}
</update>
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.examStatus != null">
exam_status = #{record.examStatus,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update stu_userinfo
set userid = #{record.userid,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
student_id = #{record.studentId,jdbcType=VARCHAR},
class_id = #{record.classId,jdbcType=VARCHAR},
username = #{record.username,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
phone = #{record.phone,jdbcType=VARCHAR},
email = #{record.email,jdbcType=VARCHAR},
major = #{record.major,jdbcType=VARCHAR},
role_id = #{record.roleId,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
school_id = #{record.schoolId,jdbcType=VARCHAR},
school_name = #{record.schoolName,jdbcType=VARCHAR},
status = #{record.status,jdbcType=INTEGER},
exam_status = #{record.examStatus,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.StuUser">
update stu_userinfo
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="studentId != null">
student_id = #{studentId,jdbcType=VARCHAR},
</if>
<if test="classId != null">
class_id = #{classId,jdbcType=VARCHAR},
</if>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="major != null">
major = #{major,jdbcType=VARCHAR},
</if>
<if test="roleId != null">
role_id = #{roleId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="schoolId != null">
school_id = #{schoolId,jdbcType=VARCHAR},
</if>
<if test="schoolName != null">
school_name = #{schoolName,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="examStatus != null">
exam_status = #{examStatus,jdbcType=VARCHAR},
</if>
</set>
where userid = #{userid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.StuUser">
update stu_userinfo
set name = #{name,jdbcType=VARCHAR},
student_id = #{studentId,jdbcType=VARCHAR},
class_id = #{classId,jdbcType=VARCHAR},
username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
major = #{major,jdbcType=VARCHAR},
role_id = #{roleId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
school_id = #{schoolId,jdbcType=VARCHAR},
school_name = #{schoolName,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
exam_status = #{examStatus,jdbcType=VARCHAR}
where userid = #{userid,jdbcType=VARCHAR}
</update>
<insert id="batchInsertStudents" parameterType="java.util.List">
INSERT INTO stu_userinfo (userid, name, student_id, class_id, username, password, phone,
school_name,email,major,
@ -370,15 +380,15 @@
<resultMap id="UserDtoMap" type="com.sztzjy.financial_bigdata.entity.stu_dto.StuUserDto">
<result column="school_name" jdbcType="VARCHAR" property="schoolName"/>
<result column="class_name" jdbcType="VARCHAR" property="className"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="student_id" jdbcType="VARCHAR" property="studentId"/>
<result column="phone" jdbcType="VARCHAR" property="phone"/>
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="score" jdbcType="VARCHAR" property="score"/>
<result column="chapter_name" jdbcType="VARCHAR" property="chapterName"/>
<result column="report_id" jdbcType="VARCHAR" property="reportId"/>
<result column="school_name" jdbcType="VARCHAR" property="schoolName" />
<result column="class_name" jdbcType="VARCHAR" property="className" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="student_id" jdbcType="VARCHAR" property="studentId" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="score" jdbcType="VARCHAR" property="score" />
<result column="chapter_name" jdbcType="VARCHAR" property="chapterName" />
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
</resultMap>
<select id="selectByCondition" resultMap="UserDtoMap">
@ -409,9 +419,11 @@
WHERE class_id IN (SELECT class_id
FROM tea_and_student_exam
WHERE exam_manage_id = #{examManageId}
<if test='classId != null and classId != ""'>
<if test="classId != null and classId != &quot;&quot;">
AND class_id = #{classId}
</if>
)GROUP BY class_id ) AS subquery;
</select>
</mapper>
Loading…
Cancel
Save