自动生成配置文件和mapper xml

newBigdata
xiaoCJ 11 months ago
parent 2f2e7ed67b
commit cedae41074

@ -210,10 +210,10 @@ public class TeaExamManageController {
List<StuUser> stuUsers = studentExamMapper.getUsersByExamID(examId, keyWord, status); List<StuUser> stuUsers = studentExamMapper.getUsersByExamID(examId, keyWord, status);
if (!stuUsers.isEmpty()) { if (!stuUsers.isEmpty()) {
for (StuUser stuUser : stuUsers) { for (StuUser stuUser : stuUsers) {
if (stuUser.getPhone().equals("true") && stuUser.getEmail().equals("true")) { if (StringUtils.isBlank(stuUser.getPhone()) || stuUser.getPhone().equals("false")) {
stuUser.setMajor("已提交");
} else {
stuUser.setMajor("未提交"); stuUser.setMajor("未提交");
} else {
stuUser.setMajor("已提交");
} }
} }
} }
@ -221,11 +221,11 @@ public class TeaExamManageController {
return new ResultEntity<>(pageInfo); return new ResultEntity<>(pageInfo);
} }
@AnonymousAccess @AnonymousAccess
@PostMapping("/reloadExamById") @PostMapping("/reloadExamById")
@ApiOperation("考试管理--指定人重考") @ApiOperation("考试管理--指定人重考")
public ResultEntity<String> reloadExamById(@ApiParam("考试管理ID") @RequestParam String examId, @RequestParam String userId) { public ResultEntity<String> reloadExamById (@ApiParam("考试管理ID") @RequestParam String
examId, @RequestParam String userId){
StuStudentExamExample studentExamExample = new StuStudentExamExample(); StuStudentExamExample studentExamExample = new StuStudentExamExample();
studentExamExample.createCriteria().andUseridEqualTo(userId).andExamManageIdEqualTo(examId); studentExamExample.createCriteria().andUseridEqualTo(userId).andExamManageIdEqualTo(examId);
List<StuStudentExamWithBLOBs> stuStudentExamWithBLOBs = studentExamMapper.selectByExampleWithBLOBs(studentExamExample); List<StuStudentExamWithBLOBs> stuStudentExamWithBLOBs = studentExamMapper.selectByExampleWithBLOBs(studentExamExample);

@ -215,23 +215,27 @@ public class TeaGradeManageController {
@AnonymousAccess @AnonymousAccess
@PostMapping("/getGradeReportCase") @PostMapping("/getGradeReportCase")
@ApiOperation("考试模式--成绩报告案例题questionOriginal所属章节contentOriginal为考核点数量") //TODO 案例题正确率字段暂无 @ApiOperation("考试模式--成绩报告案例题questionOriginal所属章节contentOriginal为考核点数量,Sort为序号") //TODO 案例题正确率字段暂无
public ResultEntity<PageInfo<SysCaseQuestion>> getGradeReportCase(@RequestParam Integer index, public ResultEntity<PageInfo<SysCaseQuestion>> getGradeReportCase(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@RequestParam String examManageId) { @RequestParam String examManageId) {
TeaExamManageWithBLOBs teaExamManageWithBLOBs = teaExamManageMapper.selectByPrimaryKey(examManageId); TeaExamManageWithBLOBs teaExamManageWithBLOBs = teaExamManageMapper.selectByPrimaryKey(examManageId);
String caseIdList = teaExamManageWithBLOBs.getCaseIdlist(); String caseIdList = teaExamManageWithBLOBs.getCaseIdlist();
List<String> list = Arrays.asList(caseIdList.split(",")); List<String> list = Arrays.asList(caseIdList.split(","));
PageHelper.startPage(index, size); List<SysCaseQuestionStep> resultList = sysCaseQuestionStepMapper.getGradeReportCase(list);
List<SysCaseQuestion> resultList = sysCaseQuestionStepMapper.getGradeReportCase(list); int i = 1;
PageInfo pageInfo = new PageInfo(resultList); for (SysCaseQuestionStep sysCaseQuestionStep : resultList) {
sysCaseQuestionStep.setSort(i);
i++;
}
PageInfo pageInfo = PageUtil.pageHelper(resultList, index, size);
return new ResultEntity(pageInfo); return new ResultEntity(pageInfo);
} }
@AnonymousAccess @AnonymousAccess
@PostMapping("/getGradeReportObjective") @PostMapping("/getGradeReportObjective")
@ApiOperation("考试模式--成绩报告客观题") //TODO 客观题正确率字段暂无 @ApiOperation("考试模式--成绩报告客观题ObjectiveId为序号") //TODO 客观题正确率字段暂无
public ResultEntity<PageInfo<SysCaseQuestion>> getGradeReportObjective(@RequestParam Integer index, public ResultEntity<PageInfo<SysCaseQuestion>> getGradeReportObjective(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@RequestParam String examManageId) { @RequestParam String examManageId) {
@ -239,7 +243,7 @@ public class TeaGradeManageController {
if (teaExamManageWithBLOBs == null) { if (teaExamManageWithBLOBs == null) {
return null; return null;
} }
List<String> list = new ArrayList(); List<String> list = new ArrayList<>();
if (StringUtils.isNotBlank(teaExamManageWithBLOBs.getSingleIdlist())) { if (StringUtils.isNotBlank(teaExamManageWithBLOBs.getSingleIdlist())) {
String singleIdList = teaExamManageWithBLOBs.getSingleIdlist(); String singleIdList = teaExamManageWithBLOBs.getSingleIdlist();
String[] split = singleIdList.split(","); String[] split = singleIdList.split(",");
@ -256,9 +260,16 @@ public class TeaGradeManageController {
list.addAll(Arrays.asList(split)); list.addAll(Arrays.asList(split));
} }
PageHelper.startPage(index, size); List<SysObjectiveQuestion> resultList = sysObjectiveQuestionMapper.getGradeReportObjective(list);
List<SysCaseQuestion> resultList = sysObjectiveQuestionMapper.getGradeReportObjective(list); if (!resultList.isEmpty()){
PageInfo pageInfo = new PageInfo(resultList); int i =0;
for (SysObjectiveQuestion sysObjectiveQuestion : resultList) {
i++;
sysObjectiveQuestion.setObjectiveId(Integer.toString(i));
}
}
PageInfo pageInfo = PageUtil.pageHelper(resultList, index, size);
return new ResultEntity(pageInfo); return new ResultEntity(pageInfo);
} }

@ -0,0 +1,17 @@
package com.sztzjy.financial_bigdata.entity.stu_dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @Author xcj
* @Date 2024/4/28
*/
@Data
@NoArgsConstructor
public class ReceiveDto {
private BigDecimal totalScore;
private BigDecimal stuScore;
}

@ -33,6 +33,6 @@ public interface SysCaseQuestionStepMapper {
int updateByPrimaryKey(SysCaseQuestionStep record); int updateByPrimaryKey(SysCaseQuestionStep record);
List<SysCaseQuestion> getGradeReportCase(@Param("list") List<String> list); List<SysCaseQuestionStep> getGradeReportCase(@Param("list") List<String> list);
} }

@ -49,5 +49,5 @@ public interface SysObjectiveQuestionMapper {
List<SysObjectiveQuestion> selectRandomObjectiveJudge(); List<SysObjectiveQuestion> selectRandomObjectiveJudge();
List<SysCaseQuestion> getGradeReportObjective(@Param("list") List<String> list); List<SysObjectiveQuestion> getGradeReportObjective(@Param("list") List<String> list);
} }

@ -8,6 +8,7 @@ import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.sztzjy.financial_bigdata.entity.stu_dto.ReceiveDto;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
@ -53,8 +54,5 @@ public interface TeaExamManageMapper {
@Select("select exam_name,exam_manage_id from tea_exam_manage where school_id =#{schoolId}") @Select("select exam_name,exam_manage_id from tea_exam_manage where school_id =#{schoolId}")
List<Map<String, String>> selectNameAndIdBySchoolId(@Param("schoolId")String schoolId); List<Map<String, String>> selectNameAndIdBySchoolId(@Param("schoolId")String schoolId);
@Select("select sse.total_score,sum(tam.case_score+tam.single_score+tam.many_score+tam.judge_score) " + ReceiveDto getLastExamScore(@Param("userId")String userId);
"FROM tea_exam_manage tam JOIN stu_student_exam sse ON tam.exam_manage_id = sse.exam_manage_id" +
" GROUP BY sse.total_score ORDER BY MAX(tam.end_time) limit 1")
Map<BigDecimal,BigDecimal> getLastEaxmScore();
} }

@ -2,12 +2,15 @@ package com.sztzjy.financial_bigdata.service.stu.impl;
import com.sztzjy.financial_bigdata.config.Constant; import com.sztzjy.financial_bigdata.config.Constant;
import com.sztzjy.financial_bigdata.entity.*; import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.stu_dto.ReceiveDto;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryIndexInfoDto; import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryIndexInfoDto;
import com.sztzjy.financial_bigdata.mapper.*; import com.sztzjy.financial_bigdata.mapper.*;
import com.sztzjy.financial_bigdata.service.stu.StuIndexService; import com.sztzjy.financial_bigdata.service.stu.StuIndexService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -68,7 +71,13 @@ public class StuIndexServiceImpl implements StuIndexService {
int examSize = stuStudentExamWithBLOBs.size(); //参与考核次数 int examSize = stuStudentExamWithBLOBs.size(); //参与考核次数
stuTheoryIndexInfoDto.setTaskNum(examSize); stuTheoryIndexInfoDto.setTaskNum(examSize);
// Map<BD>teaExamManageMapper.getLastEaxmScore();//拿到最近考试的得分和 老师设置的题目总分 // TODO 最近一次考核正确率 ReceiveDto receiveDto = teaExamManageMapper.getLastExamScore(userId);//拿到最近考试的得分和 老师设置的题目总分
BigDecimal totalScore = receiveDto.getTotalScore();
BigDecimal stuScore = receiveDto.getStuScore();
if (totalScore.intValue()!=0&&stuScore.intValue()!=0){
BigDecimal bigDecimal = totalScore.divide(stuScore,2,RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); //学生得分 / 总分 * 100
stuTheoryIndexInfoDto.setLastTaskAccuracy(bigDecimal); //最近一次考核正确率
}
int lastRank = studentExamMapper.selectLastExamRank(userId); // 最近一次考核排名 int lastRank = studentExamMapper.selectLastExamRank(userId); // 最近一次考核排名

@ -113,16 +113,17 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
} else { } else {
teaExaminationDetailsDto.setExamActualNum(stuStudentExamWithBLOBs.size()); //否则为集合的长度 teaExaminationDetailsDto.setExamActualNum(stuStudentExamWithBLOBs.size()); //否则为集合的长度
for (StuStudentExamWithBLOBs stuStudentExamWithBLOB : stuStudentExamWithBLOBs) { //不为就求分数 for (StuStudentExamWithBLOBs stuStudentExamWithBLOB : stuStudentExamWithBLOBs) { //不为就求分数
if (stuStudentExamWithBLOB.getTotalScore()==null){
continue;
}
BigDecimal score = stuStudentExamWithBLOB.getTotalScore(); BigDecimal score = stuStudentExamWithBLOB.getTotalScore();
int passThreshold = 60; // 60是及格分数 int passThreshold = 60; // 60是及格分数
int totalStudents = stuStudentExamWithBLOBs.size(); int totalStudents = stuStudentExamWithBLOBs.size();
int totalScore = 0; int totalScore = 0;
totalScore += score.intValue(); totalScore += score.intValue();
if (score.intValue() >= passThreshold) { if (score.intValue() >= passThreshold) {
passNum++; passNum++;
} }
// 更新最高分和最低分 // 更新最高分和最低分
if (score.intValue() > topScore) { if (score.intValue() > topScore) {
topScore = score.intValue(); topScore = score.intValue();

@ -411,7 +411,6 @@
<result column="class_name" jdbcType="VARCHAR" property="classId"/> <result column="class_name" jdbcType="VARCHAR" property="classId"/>
<result column="name" jdbcType="VARCHAR" property="name"/> <result column="name" jdbcType="VARCHAR" property="name"/>
<result column="exam_end_status" jdbcType="VARCHAR" property="phone"/> <result column="exam_end_status" jdbcType="VARCHAR" property="phone"/>
<result column="case_end_status" jdbcType="VARCHAR" property="email"/>
</resultMap> </resultMap>
<select id="getUsersByExamID" parameterType="java.lang.String" resultMap="UserMap"> <select id="getUsersByExamID" parameterType="java.lang.String" resultMap="UserMap">
@ -427,10 +426,10 @@
AND (su.name LIKE CONCAT('%', #{keyWord}, '%') OR su.student_id LIKE CONCAT('%', #{keyWord}, '%')) AND (su.name LIKE CONCAT('%', #{keyWord}, '%') OR su.student_id LIKE CONCAT('%', #{keyWord}, '%'))
</if> </if>
<if test="status == 'true'"> <if test="status == 'true'">
AND sse.case_end_status = 'true' and sse.exam_end_status = 'true' AND sse.exam_end_status = 'true'
</if> </if>
<if test="status == 'false'"> <if test="status == 'false'">
AND (sse.case_end_status != 'true' OR sse.exam_end_status != 'true') AND sse.exam_end_status != 'true'
</if> </if>
</where> </where>
</select> </select>

@ -17,7 +17,8 @@
<result column="judge_score" jdbcType="DECIMAL" property="judgeScore"/> <result column="judge_score" jdbcType="DECIMAL" property="judgeScore"/>
<result column="case_score" jdbcType="DECIMAL" property="caseScore"/> <result column="case_score" jdbcType="DECIMAL" property="caseScore"/>
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs"
type="com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs">
<result column="single_idList" jdbcType="LONGVARCHAR" property="singleIdlist"/> <result column="single_idList" jdbcType="LONGVARCHAR" property="singleIdlist"/>
<result column="many_idList" jdbcType="LONGVARCHAR" property="manyIdlist"/> <result column="many_idList" jdbcType="LONGVARCHAR" property="manyIdlist"/>
<result column="judge_idList" jdbcType="LONGVARCHAR" property="judgeIdlist"/> <result column="judge_idList" jdbcType="LONGVARCHAR" property="judgeIdlist"/>
@ -44,7 +45,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -73,7 +75,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -85,15 +88,18 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
exam_manage_id, school_id, user_id, exam_name, start_time, end_time, logo_address, exam_manage_id
, school_id, user_id, exam_name, start_time, end_time, logo_address,
exam_Description, Objective_weight, case_weight, single_score, many_score, judge_score, exam_Description, Objective_weight, case_weight, single_score, many_score, judge_score,
case_score case_score
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
single_idList, many_idList, judge_idList, case_idList, single_answer, many_answer, single_idList
, many_idList, judge_idList, case_idList, single_answer, many_answer,
judge_answer judge_answer
</sql> </sql>
<select id="selectByExampleWithBLOBs" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageExample" resultMap="ResultMapWithBLOBs"> <select id="selectByExampleWithBLOBs" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageExample"
resultMap="ResultMapWithBLOBs">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
@ -109,7 +115,8 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageExample"
resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
@ -132,7 +139,8 @@
where exam_manage_id = #{examManageId,jdbcType=VARCHAR} where exam_manage_id = #{examManageId,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tea_exam_manage delete
from tea_exam_manage
where exam_manage_id = #{examManageId,jdbcType=VARCHAR} where exam_manage_id = #{examManageId,jdbcType=VARCHAR}
</delete> </delete>
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageExample"> <delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageExample">
@ -148,16 +156,17 @@
case_weight, single_score, many_score, case_weight, single_score, many_score,
judge_score, case_score, single_idList, judge_score, case_score, single_idList,
many_idList, judge_idList, case_idList, many_idList, judge_idList, case_idList,
single_answer, many_answer, judge_answer single_answer, many_answer, judge_answer)
)
values (#{examManageId,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, values (#{examManageId,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{examName,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{examName,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
#{logoAddress,jdbcType=VARCHAR}, #{examDescription,jdbcType=VARCHAR}, #{objectiveWeight,jdbcType=DECIMAL}, #{logoAddress,jdbcType=VARCHAR}, #{examDescription,jdbcType=VARCHAR},
#{objectiveWeight,jdbcType=DECIMAL},
#{caseWeight,jdbcType=DECIMAL}, #{singleScore,jdbcType=DECIMAL}, #{manyScore,jdbcType=DECIMAL}, #{caseWeight,jdbcType=DECIMAL}, #{singleScore,jdbcType=DECIMAL}, #{manyScore,jdbcType=DECIMAL},
#{judgeScore,jdbcType=DECIMAL}, #{caseScore,jdbcType=DECIMAL}, #{singleIdlist,jdbcType=LONGVARCHAR}, #{judgeScore,jdbcType=DECIMAL}, #{caseScore,jdbcType=DECIMAL}, #{singleIdlist,jdbcType=LONGVARCHAR},
#{manyIdlist,jdbcType=LONGVARCHAR}, #{judgeIdlist,jdbcType=LONGVARCHAR}, #{caseIdlist,jdbcType=LONGVARCHAR}, #{manyIdlist,jdbcType=LONGVARCHAR}, #{judgeIdlist,jdbcType=LONGVARCHAR},
#{singleAnswer,jdbcType=LONGVARCHAR}, #{manyAnswer,jdbcType=LONGVARCHAR}, #{judgeAnswer,jdbcType=LONGVARCHAR} #{caseIdlist,jdbcType=LONGVARCHAR},
) #{singleAnswer,jdbcType=LONGVARCHAR}, #{manyAnswer,jdbcType=LONGVARCHAR},
#{judgeAnswer,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs"> <insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs">
insert into tea_exam_manage insert into tea_exam_manage
@ -292,7 +301,8 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.TeaExamManageExample"
resultType="java.lang.Long">
select count(*) from tea_exam_manage select count(*) from tea_exam_manage
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
@ -525,11 +535,27 @@
</update> </update>
<select id="selectBySchoolId" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs"> <select id="selectBySchoolId" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tea_exam_manage from tea_exam_manage
where school_id = #{schoolId,jdbcType=VARCHAR} where school_id = #{schoolId,jdbcType=VARCHAR}
</select> </select>
<resultMap id="ReceiveDto" type="com.sztzjy.financial_bigdata.entity.stu_dto.ReceiveDto">
<result column="total_score" jdbcType="DECIMAL" property="totalScore"/>
<result column="stuScore" jdbcType="DECIMAL" property="stuScore"/>
</resultMap>
<select id="getLastExamScore" parameterType="java.lang.String" resultMap="ReceiveDto">
select sse.total_score, sum(tam.case_score + tam.single_score + tam.many_score + tam.judge_score) AS stuScore
FROM tea_exam_manage tam
JOIN stu_student_exam sse ON tam.exam_manage_id = sse.exam_manage_id
WHERE userid = #{userId}
and tam.end_time &lt; NOW()
GROUP BY sse.total_score, sse.userid
ORDER BY MAX(tam.end_time) limit 1
</select>
</mapper> </mapper>
Loading…
Cancel
Save