修改三个导出功能,和首页考核列表查询功能

master
xiaoCJ
parent 678e1dfd93
commit ff476f9192

@ -93,25 +93,32 @@ public class TeaGradeManageController {
return null; return null;
} }
List<TeaExamManageCountDto> teaExamManageCountDtos = new ArrayList<>(); List<TeaExamManageCountDto> teaExamManageCountDtos = new ArrayList<>();
Map<Integer, StuUser> userMap = new HashMap<>(); Map<String, StuUser> userMap = new HashMap<>();
List<Integer> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
for (TeaExamManage teaExamManage : teaExamManages) { for (TeaExamManage teaExamManage : teaExamManages) {
Integer zyUserId = Integer.parseInt(teaExamManage.getUserId()); //这里是智云 zyUserId userIds.add(teaExamManage.getUserId());
userIds.add(zyUserId);
} }
//存储用户信息 //存储用户信息
StuUserExample example = new StuUserExample(); StuUserExample example = new StuUserExample();
example.createCriteria().andSystemOnwerEqualTo(systemOwner).andZyUseridIn(userIds); example.createCriteria().andSystemOnwerEqualTo(systemOwner).andUseridIn(userIds);
List<StuUser> stuUsers = userMapper.selectByExample(example); List<StuUser> stuUsers = userMapper.selectByExample(example);
for (StuUser stuUser : stuUsers) { for (StuUser stuUser : stuUsers) {
userMap.put(stuUser.getZyUserid(), stuUser); userMap.put(stuUser.getUserid(), stuUser);
} }
for (TeaExamManage teaExamManage : teaExamManages) { for (TeaExamManage teaExamManage : teaExamManages) {
TeaExamManageCountDto copyexamManageWithBLOBs = new TeaExamManageCountDto(); TeaExamManageCountDto copyexamManageWithBLOBs = new TeaExamManageCountDto();
String userId = teaExamManage.getUserId();
StuUser stuUser = userMap.get(userId);
if (stuUser==null){
continue;
}
copyexamManageWithBLOBs.setName(stuUser.getName()); //发布人
teaExamManageCountDtos.add(copyexamManageWithBLOBs);
//获取班级和考试人数 //获取班级和考试人数
TeaAndStudentExam teaAndStudentExam = teaAndStudentExamMapper.selectByExamMangeId(teaExamManage.getExamManageId()); TeaAndStudentExam teaAndStudentExam = teaAndStudentExamMapper.selectByExamMangeId(teaExamManage.getExamManageId());
@ -139,10 +146,6 @@ public class TeaGradeManageController {
String concatenatedTimeString = startTime + " -- " + endTime; String concatenatedTimeString = startTime + " -- " + endTime;
copyexamManageWithBLOBs.setExamTime(concatenatedTimeString); //考试时间 copyexamManageWithBLOBs.setExamTime(concatenatedTimeString); //考试时间
String userId = teaExamManage.getUserId();
StuUser stuUser = userMap.get(Integer.parseInt(userId));
copyexamManageWithBLOBs.setName(stuUser.getName()); //发布人
teaExamManageCountDtos.add(copyexamManageWithBLOBs);
} }
PageInfo pageInfo = PageUtil.pageHelper(teaExamManageCountDtos, index, size); PageInfo pageInfo = PageUtil.pageHelper(teaExamManageCountDtos, index, size);
return new ResultEntity<>(pageInfo); return new ResultEntity<>(pageInfo);
@ -644,8 +647,9 @@ public class TeaGradeManageController {
@ApiOperation("理论考试--导出理论考试信息") @ApiOperation("理论考试--导出理论考试信息")
public void exportTheoryExamInfo(HttpServletResponse response, public void exportTheoryExamInfo(HttpServletResponse response,
@ApiParam("不选择班级就是学习全部导出") @RequestParam(required = false) String classId, @ApiParam("不选择班级就是学习全部导出") @RequestParam(required = false) String classId,
@RequestParam String schoolId) { @RequestParam String schoolId,
iTeaGradeManageService.exportTheoryExamInfo(response, classId, schoolId); @RequestParam String systemOwner) {
iTeaGradeManageService.exportTheoryExamInfo(response, classId, schoolId,systemOwner);
} }

@ -33,4 +33,9 @@ public interface StuTheoryRecordMapper {
int updateByPrimaryKey(StuTheoryRecord record); int updateByPrimaryKey(StuTheoryRecord record);
StuTheoryIndexInfoDto selectTheoryInfo(@Param("userId") String userId); StuTheoryIndexInfoDto selectTheoryInfo(@Param("userId") String userId);
List<StuTheoryRecord> selectConditions(@Param("schoolId") String schoolId,
@Param("classId") String classId,
@Param("keyWord") String keyWord,
@Param("systemOwner") String systemOwner);
} }

@ -31,7 +31,7 @@ public interface ITeaGradeManageService {
PageInfo<StuTheoryRecord> getTheoryInfo(Integer index, Integer size, String schoolId, String classId, String keyWord, String systemOwner); PageInfo<StuTheoryRecord> getTheoryInfo(Integer index, Integer size, String schoolId, String classId, String keyWord, String systemOwner);
void exportTheoryExamInfo(HttpServletResponse response, String classId, String schoolId); void exportTheoryExamInfo(HttpServletResponse response, String classId, String schoolId,String systemOwner);
SysWeight getSysWeightResultEntity(String courseId, String schoolId, String systemOwner); SysWeight getSysWeightResultEntity(String courseId, String schoolId, String systemOwner);
} }

@ -272,37 +272,38 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
@Override @Override
public PageInfo<StuTheoryRecord> getTheoryInfo(Integer index, Integer size, String schoolId, String classId, String keyWord, String systemOwner) { public PageInfo<StuTheoryRecord> getTheoryInfo(Integer index, Integer size, String schoolId, String classId, String keyWord, String systemOwner) {
PageHelper.startPage(index, size); PageHelper.startPage(index, size);
List<StuTheoryRecord> list = getStuTheoryRecordPageInfo(schoolId, classId, keyWord, systemOwner); // List<StuTheoryRecord> list = getStuTheoryRecordPageInfo(schoolId, classId, keyWord, systemOwner);
List<StuTheoryRecord> list = stuTheoryRecordMapper.selectConditions(schoolId, classId, keyWord, systemOwner);
PageInfo<StuTheoryRecord> pageInfo = new PageInfo<>(list); PageInfo<StuTheoryRecord> pageInfo = new PageInfo<>(list);
return pageInfo; return pageInfo;
} }
//查询方法 // //查询方法
private List<StuTheoryRecord> getStuTheoryRecordPageInfo(String schoolId, String classId, String keyWord, String systemOwner) { // private List<StuTheoryRecord> getStuTheoryRecordPageInfo(String schoolId, String classId, String keyWord, String systemOwner) {
StuTheoryRecordExample s = new StuTheoryRecordExample(); // StuTheoryRecordExample s = new StuTheoryRecordExample();
StuTheoryRecordExample.Criteria criteria = s.createCriteria(); // StuTheoryRecordExample.Criteria criteria = s.createCriteria();
StuTheoryRecordExample.Criteria orCriteria = s.createCriteria(); // StuTheoryRecordExample.Criteria orCriteria = s.createCriteria();
criteria.andSchoolIdEqualTo(schoolId).andSystemOwnerEqualTo(systemOwner); // criteria.andSchoolIdEqualTo(schoolId).andSystemOwnerEqualTo(systemOwner);
orCriteria.andSchoolIdEqualTo(schoolId).andSystemOwnerEqualTo(systemOwner); // orCriteria.andSchoolIdEqualTo(schoolId).andSystemOwnerEqualTo(systemOwner);
if (StringUtils.isNotBlank(classId)) { // if (StringUtils.isNotBlank(classId)) {
criteria.andClassIdEqualTo(classId); // criteria.andClassIdEqualTo(classId);
orCriteria.andClassIdEqualTo(classId); // orCriteria.andClassIdEqualTo(classId);
} // }
if (StringUtils.isNotBlank(keyWord)) { // if (StringUtils.isNotBlank(keyWord)) {
criteria.andStudentIdEqualTo(keyWord); // criteria.andStudentIdEqualTo(keyWord);
orCriteria.andNameEqualTo(keyWord); // orCriteria.andNameEqualTo(keyWord);
} // }
s.or(orCriteria); // s.or(orCriteria);
s.setOrderByClause("average_score ASC"); // s.setOrderByClause("average_score ASC");
return stuTheoryRecordMapper.selectByExample(s); // return stuTheoryRecordMapper.selectByExample(s);
} // }
@Override @Override
public void exportTheoryExamInfo(HttpServletResponse response, String classId, String schoolId) { public void exportTheoryExamInfo(HttpServletResponse response, String classId, String schoolId, String systemOwner) {
StuTheoryRecordExample s = new StuTheoryRecordExample(); StuTheoryRecordExample s = new StuTheoryRecordExample();
StuTheoryRecordExample.Criteria criteria = s.createCriteria(); StuTheoryRecordExample.Criteria criteria = s.createCriteria();
criteria.andSchoolIdEqualTo(schoolId); criteria.andSchoolIdEqualTo(schoolId).andSystemOwnerEqualTo(systemOwner);
if (StringUtils.isNotBlank(classId)) { if (StringUtils.isNotBlank(classId)) {
criteria.andClassIdEqualTo(classId); criteria.andClassIdEqualTo(classId);
} }

@ -1,340 +1,366 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.StuTheoryRecordMapper"> <mapper namespace="com.sztzjy.financial_bigdata.mapper.StuTheoryRecordMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.StuTheoryRecord"> <resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.StuTheoryRecord">
<id column="user_id" jdbcType="VARCHAR" property="userId" /> <id column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="school_id" jdbcType="VARCHAR" property="schoolId" /> <result column="school_id" jdbcType="VARCHAR" property="schoolId"/>
<result column="class_id" jdbcType="VARCHAR" property="classId" /> <result column="class_id" jdbcType="VARCHAR" property="classId"/>
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name"/>
<result column="student_id" jdbcType="VARCHAR" property="studentId" /> <result column="student_id" jdbcType="VARCHAR" property="studentId"/>
<result column="exam_count" jdbcType="INTEGER" property="examCount" /> <result column="exam_count" jdbcType="INTEGER" property="examCount"/>
<result column="highest_score" jdbcType="DECIMAL" property="highestScore" /> <result column="highest_score" jdbcType="DECIMAL" property="highestScore"/>
<result column="lowest_score" jdbcType="DECIMAL" property="lowestScore" /> <result column="lowest_score" jdbcType="DECIMAL" property="lowestScore"/>
<result column="total_duration" jdbcType="INTEGER" property="totalDuration" /> <result column="total_duration" jdbcType="INTEGER" property="totalDuration"/>
<result column="average_score" jdbcType="DECIMAL" property="averageScore" /> <result column="average_score" jdbcType="DECIMAL" property="averageScore"/>
<result column="system_owner" jdbcType="VARCHAR" property="systemOwner" /> <result column="system_owner" jdbcType="VARCHAR" property="systemOwner"/>
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
<foreach collection="oredCriteria" item="criteria" separator="or"> <foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid"> <if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")"> <trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion"> <foreach collection="criteria.criteria" item="criterion">
<choose> <choose>
<when test="criterion.noValue"> <when test="criterion.noValue">
and ${criterion.condition} and ${criterion.condition}
</when> </when>
<when test="criterion.singleValue"> <when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</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="("
#{listItem} separator=",">
</foreach> #{listItem}
</when> </foreach>
</choose> </when>
</choose>
</foreach>
</trim>
</if>
</foreach> </foreach>
</trim> </where>
</if> </sql>
</foreach> <sql id="Update_By_Example_Where_Clause">
</where> <where>
</sql> <foreach collection="example.oredCriteria" item="criteria" separator="or">
<sql id="Update_By_Example_Where_Clause"> <if test="criteria.valid">
<where> <trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="example.oredCriteria" item="criteria" separator="or"> <foreach collection="criteria.criteria" item="criterion">
<if test="criteria.valid"> <choose>
<trim prefix="(" prefixOverrides="and" suffix=")"> <when test="criterion.noValue">
<foreach collection="criteria.criteria" item="criterion"> and ${criterion.condition}
<choose> </when>
<when test="criterion.noValue"> <when test="criterion.singleValue">
and ${criterion.condition} and ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.singleValue"> <when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.listValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition}
</when> <foreach close=")" collection="criterion.value" item="listItem" open="("
<when test="criterion.listValue"> separator=",">
and ${criterion.condition} #{listItem}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> </foreach>
#{listItem} </when>
</foreach> </choose>
</when> </foreach>
</choose> </trim>
</if>
</foreach> </foreach>
</trim> </where>
</if> </sql>
</foreach> <sql id="Base_Column_List">
</where> user_id
</sql> , school_id, class_id, name, student_id, exam_count, highest_score, lowest_score,
<sql id="Base_Column_List">
user_id, school_id, class_id, name, student_id, exam_count, highest_score, lowest_score,
total_duration, average_score, system_owner total_duration, average_score, system_owner
</sql> </sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample"
select resultMap="BaseResultMap">
<if test="distinct"> select
distinct <if test="distinct">
</if> distinct
<include refid="Base_Column_List" /> </if>
from stu_theory_record <include refid="Base_Column_List"/>
<if test="_parameter != null"> from stu_theory_record
<include refid="Example_Where_Clause" /> <if test="_parameter != null">
</if> <include refid="Example_Where_Clause"/>
<if test="orderByClause != null"> </if>
order by ${orderByClause} <if test="orderByClause != null">
</if> order by ${orderByClause}
</select> </if>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> </select>
select <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
<include refid="Base_Column_List" /> select
from stu_theory_record <include refid="Base_Column_List"/>
where user_id = #{userId,jdbcType=VARCHAR} from stu_theory_record
</select> where user_id = #{userId,jdbcType=VARCHAR}
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> </select>
delete from stu_theory_record <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
where user_id = #{userId,jdbcType=VARCHAR} delete
</delete> from stu_theory_record
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample"> where user_id = #{userId,jdbcType=VARCHAR}
delete from stu_theory_record </delete>
<if test="_parameter != null"> <delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample">
<include refid="Example_Where_Clause" /> delete from stu_theory_record
</if> <if test="_parameter != null">
</delete> <include refid="Example_Where_Clause"/>
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecord"> </if>
insert into stu_theory_record (user_id, school_id, class_id, </delete>
name, student_id, exam_count, <insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecord">
highest_score, lowest_score, total_duration, insert into stu_theory_record (user_id, school_id, class_id,
average_score, system_owner) name, student_id, exam_count,
values (#{userId,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}, #{classId,jdbcType=VARCHAR}, highest_score, lowest_score, total_duration,
#{name,jdbcType=VARCHAR}, #{studentId,jdbcType=VARCHAR}, #{examCount,jdbcType=INTEGER}, average_score, system_owner)
#{highestScore,jdbcType=DECIMAL}, #{lowestScore,jdbcType=DECIMAL}, #{totalDuration,jdbcType=INTEGER}, values (#{userId,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}, #{classId,jdbcType=VARCHAR},
#{averageScore,jdbcType=DECIMAL}, #{systemOwner,jdbcType=VARCHAR}) #{name,jdbcType=VARCHAR}, #{studentId,jdbcType=VARCHAR}, #{examCount,jdbcType=INTEGER},
</insert> #{highestScore,jdbcType=DECIMAL}, #{lowestScore,jdbcType=DECIMAL}, #{totalDuration,jdbcType=INTEGER},
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecord"> #{averageScore,jdbcType=DECIMAL}, #{systemOwner,jdbcType=VARCHAR})
insert into stu_theory_record </insert>
<trim prefix="(" suffix=")" suffixOverrides=","> <insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecord">
<if test="userId != null"> insert into stu_theory_record
user_id, <trim prefix="(" suffix=")" suffixOverrides=",">
</if> <if test="userId != null">
<if test="schoolId != null"> user_id,
school_id, </if>
</if> <if test="schoolId != null">
<if test="classId != null"> school_id,
class_id, </if>
</if> <if test="classId != null">
<if test="name != null"> class_id,
name, </if>
</if> <if test="name != null">
<if test="studentId != null"> name,
student_id, </if>
</if> <if test="studentId != null">
<if test="examCount != null"> student_id,
exam_count, </if>
</if> <if test="examCount != null">
<if test="highestScore != null"> exam_count,
highest_score, </if>
</if> <if test="highestScore != null">
<if test="lowestScore != null"> highest_score,
lowest_score, </if>
</if> <if test="lowestScore != null">
<if test="totalDuration != null"> lowest_score,
total_duration, </if>
</if> <if test="totalDuration != null">
<if test="averageScore != null"> total_duration,
average_score, </if>
</if> <if test="averageScore != null">
<if test="systemOwner != null"> average_score,
system_owner, </if>
</if> <if test="systemOwner != null">
</trim> system_owner,
<trim prefix="values (" suffix=")" suffixOverrides=","> </if>
<if test="userId != null"> </trim>
#{userId,jdbcType=VARCHAR}, <trim prefix="values (" suffix=")" suffixOverrides=",">
</if> <if test="userId != null">
<if test="schoolId != null"> #{userId,jdbcType=VARCHAR},
#{schoolId,jdbcType=VARCHAR}, </if>
</if> <if test="schoolId != null">
<if test="classId != null"> #{schoolId,jdbcType=VARCHAR},
#{classId,jdbcType=VARCHAR}, </if>
</if> <if test="classId != null">
<if test="name != null"> #{classId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, </if>
</if> <if test="name != null">
<if test="studentId != null"> #{name,jdbcType=VARCHAR},
#{studentId,jdbcType=VARCHAR}, </if>
</if> <if test="studentId != null">
<if test="examCount != null"> #{studentId,jdbcType=VARCHAR},
#{examCount,jdbcType=INTEGER}, </if>
</if> <if test="examCount != null">
<if test="highestScore != null"> #{examCount,jdbcType=INTEGER},
#{highestScore,jdbcType=DECIMAL}, </if>
</if> <if test="highestScore != null">
<if test="lowestScore != null"> #{highestScore,jdbcType=DECIMAL},
#{lowestScore,jdbcType=DECIMAL}, </if>
</if> <if test="lowestScore != null">
<if test="totalDuration != null"> #{lowestScore,jdbcType=DECIMAL},
#{totalDuration,jdbcType=INTEGER}, </if>
</if> <if test="totalDuration != null">
<if test="averageScore != null"> #{totalDuration,jdbcType=INTEGER},
#{averageScore,jdbcType=DECIMAL}, </if>
</if> <if test="averageScore != null">
<if test="systemOwner != null"> #{averageScore,jdbcType=DECIMAL},
#{systemOwner,jdbcType=VARCHAR}, </if>
</if> <if test="systemOwner != null">
</trim> #{systemOwner,jdbcType=VARCHAR},
</insert> </if>
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample" resultType="java.lang.Long"> </trim>
select count(*) from stu_theory_record </insert>
<if test="_parameter != null"> <select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample"
<include refid="Example_Where_Clause" /> resultType="java.lang.Long">
</if> select count(*) from stu_theory_record
</select> <if test="_parameter != null">
<update id="updateByExampleSelective" parameterType="map"> <include refid="Example_Where_Clause"/>
update stu_theory_record </if>
<set> </select>
<if test="record.userId != null"> <update id="updateByExampleSelective" parameterType="map">
user_id = #{record.userId,jdbcType=VARCHAR}, update stu_theory_record
</if> <set>
<if test="record.schoolId != null"> <if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.schoolId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR},
</if>
<if test="record.classId != null">
class_id = #{record.classId,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.examCount != null">
exam_count = #{record.examCount,jdbcType=INTEGER},
</if>
<if test="record.highestScore != null">
highest_score = #{record.highestScore,jdbcType=DECIMAL},
</if>
<if test="record.lowestScore != null">
lowest_score = #{record.lowestScore,jdbcType=DECIMAL},
</if>
<if test="record.totalDuration != null">
total_duration = #{record.totalDuration,jdbcType=INTEGER},
</if>
<if test="record.averageScore != null">
average_score = #{record.averageScore,jdbcType=DECIMAL},
</if>
<if test="record.systemOwner != null">
system_owner = #{record.systemOwner,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update stu_theory_record
set user_id = #{record.userId,jdbcType=VARCHAR},
school_id = #{record.schoolId,jdbcType=VARCHAR}, school_id = #{record.schoolId,jdbcType=VARCHAR},
</if>
<if test="record.classId != null">
class_id = #{record.classId,jdbcType=VARCHAR}, class_id = #{record.classId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR}, name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.studentId != null">
student_id = #{record.studentId,jdbcType=VARCHAR}, student_id = #{record.studentId,jdbcType=VARCHAR},
</if>
<if test="record.examCount != null">
exam_count = #{record.examCount,jdbcType=INTEGER}, exam_count = #{record.examCount,jdbcType=INTEGER},
</if>
<if test="record.highestScore != null">
highest_score = #{record.highestScore,jdbcType=DECIMAL}, highest_score = #{record.highestScore,jdbcType=DECIMAL},
</if>
<if test="record.lowestScore != null">
lowest_score = #{record.lowestScore,jdbcType=DECIMAL}, lowest_score = #{record.lowestScore,jdbcType=DECIMAL},
</if>
<if test="record.totalDuration != null">
total_duration = #{record.totalDuration,jdbcType=INTEGER}, total_duration = #{record.totalDuration,jdbcType=INTEGER},
</if>
<if test="record.averageScore != null">
average_score = #{record.averageScore,jdbcType=DECIMAL}, average_score = #{record.averageScore,jdbcType=DECIMAL},
</if> system_owner = #{record.systemOwner,jdbcType=VARCHAR}
<if test="record.systemOwner != null"> <if test="_parameter != null">
system_owner = #{record.systemOwner,jdbcType=VARCHAR}, <include refid="Update_By_Example_Where_Clause"/>
</if> </if>
</set> </update>
<if test="_parameter != null"> <update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecord">
<include refid="Update_By_Example_Where_Clause" /> update stu_theory_record
</if> <set>
</update> <if test="schoolId != null">
<update id="updateByExample" parameterType="map"> school_id = #{schoolId,jdbcType=VARCHAR},
update stu_theory_record </if>
set user_id = #{record.userId,jdbcType=VARCHAR}, <if test="classId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR}, class_id = #{classId,jdbcType=VARCHAR},
class_id = #{record.classId,jdbcType=VARCHAR}, </if>
name = #{record.name,jdbcType=VARCHAR}, <if test="name != null">
student_id = #{record.studentId,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR},
exam_count = #{record.examCount,jdbcType=INTEGER}, </if>
highest_score = #{record.highestScore,jdbcType=DECIMAL}, <if test="studentId != null">
lowest_score = #{record.lowestScore,jdbcType=DECIMAL}, student_id = #{studentId,jdbcType=VARCHAR},
total_duration = #{record.totalDuration,jdbcType=INTEGER}, </if>
average_score = #{record.averageScore,jdbcType=DECIMAL}, <if test="examCount != null">
system_owner = #{record.systemOwner,jdbcType=VARCHAR} exam_count = #{examCount,jdbcType=INTEGER},
<if test="_parameter != null"> </if>
<include refid="Update_By_Example_Where_Clause" /> <if test="highestScore != null">
</if> highest_score = #{highestScore,jdbcType=DECIMAL},
</update> </if>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecord"> <if test="lowestScore != null">
update stu_theory_record lowest_score = #{lowestScore,jdbcType=DECIMAL},
<set> </if>
<if test="schoolId != null"> <if test="totalDuration != null">
school_id = #{schoolId,jdbcType=VARCHAR}, total_duration = #{totalDuration,jdbcType=INTEGER},
</if> </if>
<if test="classId != null"> <if test="averageScore != null">
class_id = #{classId,jdbcType=VARCHAR}, average_score = #{averageScore,jdbcType=DECIMAL},
</if> </if>
<if test="name != null"> <if test="systemOwner != null">
name = #{name,jdbcType=VARCHAR}, system_owner = #{systemOwner,jdbcType=VARCHAR},
</if> </if>
<if test="studentId != null"> </set>
student_id = #{studentId,jdbcType=VARCHAR}, where user_id = #{userId,jdbcType=VARCHAR}
</if> </update>
<if test="examCount != null"> <update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecord">
exam_count = #{examCount,jdbcType=INTEGER}, update stu_theory_record
</if> set school_id = #{schoolId,jdbcType=VARCHAR},
<if test="highestScore != null"> class_id = #{classId,jdbcType=VARCHAR},
highest_score = #{highestScore,jdbcType=DECIMAL}, name = #{name,jdbcType=VARCHAR},
</if> student_id = #{studentId,jdbcType=VARCHAR},
<if test="lowestScore != null"> exam_count = #{examCount,jdbcType=INTEGER},
lowest_score = #{lowestScore,jdbcType=DECIMAL}, highest_score = #{highestScore,jdbcType=DECIMAL},
</if> lowest_score = #{lowestScore,jdbcType=DECIMAL},
<if test="totalDuration != null"> total_duration = #{totalDuration,jdbcType=INTEGER},
total_duration = #{totalDuration,jdbcType=INTEGER}, average_score = #{averageScore,jdbcType=DECIMAL},
</if> system_owner = #{systemOwner,jdbcType=VARCHAR}
<if test="averageScore != null"> where user_id = #{userId,jdbcType=VARCHAR}
average_score = #{averageScore,jdbcType=DECIMAL}, </update>
</if>
<if test="systemOwner != null">
system_owner = #{systemOwner,jdbcType=VARCHAR},
</if>
</set>
where user_id = #{userId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecord">
update stu_theory_record
set school_id = #{schoolId,jdbcType=VARCHAR},
class_id = #{classId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
student_id = #{studentId,jdbcType=VARCHAR},
exam_count = #{examCount,jdbcType=INTEGER},
highest_score = #{highestScore,jdbcType=DECIMAL},
lowest_score = #{lowestScore,jdbcType=DECIMAL},
total_duration = #{totalDuration,jdbcType=INTEGER},
average_score = #{averageScore,jdbcType=DECIMAL},
system_owner = #{systemOwner,jdbcType=VARCHAR}
where user_id = #{userId,jdbcType=VARCHAR}
</update>
<resultMap id="DtoMap" type="com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryIndexInfoDto"> <resultMap id="DtoMap" type="com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryIndexInfoDto">
<result column="score" jdbcType="DECIMAL" property="lastTaskScore" /> <result column="score" jdbcType="DECIMAL" property="lastTaskScore"/>
<result column="total_duration" jdbcType="INTEGER" property="theoryTotalDuration" /> <result column="total_duration" jdbcType="INTEGER" property="theoryTotalDuration"/>
<result column="exam_count" jdbcType="INTEGER" property="theoryNum" /> <result column="exam_count" jdbcType="INTEGER" property="theoryNum"/>
<result column="rank" jdbcType="INTEGER" property="theoryLastRank" /> <result column="rank" jdbcType="INTEGER" property="theoryLastRank"/>
</resultMap> </resultMap>
<select id="selectTheoryInfo" parameterType="com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryIndexInfoDto" resultMap="DtoMap"> <select id="selectTheoryInfo" parameterType="com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryIndexInfoDto"
SELECT ste.score, str.total_duration,str.exam_count, ( resultMap="DtoMap">
SELECT COUNT(*) AS `rank` SELECT ste.score,
FROM stu_theory_exam str.total_duration,
WHERE accuracy &gt;= ( str.exam_count,
SELECT accuracy (
FROM stu_theory_exam SELECT COUNT(*) AS `rank`
WHERE user_id = 4 FROM stu_theory_exam
ORDER BY exam_time DESC WHERE accuracy &gt;= (
LIMIT 1 SELECT accuracy
) FROM stu_theory_exam
WHERE user_id = 4
ORDER BY exam_time DESC
LIMIT 1 )
) AS `rank` ) AS `rank`
FROM stu_theory_exam ste FROM stu_theory_exam ste
JOIN stu_theory_record str ON ste.user_id = str.user_id JOIN stu_theory_record str
WHERE ste.user_id = 4 ON ste.user_id = str.user_id
AND ste.answered = 1 WHERE ste.user_id = 4
AND ste.accuracy &gt;= ( AND ste.answered = 1
SELECT accuracy AND ste.accuracy &gt;= (
FROM stu_theory_exam SELECT accuracy
WHERE user_id = 4 FROM stu_theory_exam
ORDER BY exam_time DESC WHERE user_id = 4
LIMIT 1 ORDER BY exam_time DESC
) LIMIT 1
ORDER BY ste.exam_time DESC )
LIMIT 1; ORDER BY ste.exam_time DESC
</select> LIMIT 1;
</select>
<select id="selectConditions" resultMap="BaseResultMap">
select *
from stu_theory_record
<where>
system_owner = #{systemOwner}
AND school_id = #{schoolId}
<if test="classId != null and classId != ''">
AND class_id = #{classId}
</if>
<if test="keyWord != null and keyWord != ''">
AND (student_id like CONCAT ('%',#{keyWord},'%') or name like CONCAT ('%',#{keyWord},'%'))
</if>
</where>
</select>
</mapper> </mapper>
Loading…
Cancel
Save