优化代码新增xml

newBigdata
xiaoCJ 11 months ago
parent 3e34331f8b
commit 9999ae5511

@ -3,7 +3,6 @@ package com.sztzjy.financial_bigdata.controller.tea;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.config.Constant;
import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageDto;
@ -22,7 +21,10 @@ import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @Author xcj
@ -54,15 +56,8 @@ public class TeaExamManageController {
@PostMapping("/getSelectCountAndScore")
@ApiOperation("新增考试--获取选题量和分数")
public ResultEntity<Map<Integer, BigDecimal>> getsingleId(@RequestBody @ApiParam("所有ID用,隔开一次传过来") List<String> ids) {
Map<Integer, BigDecimal> map = new HashMap<>();
int i = 0;
BigDecimal score = BigDecimal.ZERO;
for (String id : ids) {
SysObjectiveQuestion sysObjectiveQuestion = sysObjectiveQuestionMapper.selectByPrimaryKey(id);
i++;
score = sysObjectiveQuestion.getScore().add(score);
}
map.put(i, score);
List<String> list = new ArrayList<>(ids);
Map<Integer, BigDecimal> map = sysObjectiveQuestionMapper.selectByList(list);
return new ResultEntity<>(map);
}
@ -78,13 +73,9 @@ public class TeaExamManageController {
@PostMapping("/selectObjectivityByType")
@ApiOperation("新增考试--选择客观题时展示")
public ResultEntity<List<SysObjectiveQuestion>> selectObjectivityByType(@ApiParam("0单选 1多选 2判断") @RequestParam String type,
@RequestParam String schoolId) {
SysObjectiveQuestionExample sysObjectiveQuestionExample = new SysObjectiveQuestionExample();
List<String> l = new ArrayList<>();
l.add(schoolId);
l.add(Constant.BUILT_IN_SCHOOL_ID);
sysObjectiveQuestionExample.createCriteria().andTypeEqualTo(type).andSchoolIdIn(l);
return new ResultEntity<List<SysObjectiveQuestion>>(sysObjectiveQuestionMapper.selectByExample(sysObjectiveQuestionExample));
@RequestParam String schoolId) {
List<SysObjectiveQuestion> list = sysObjectiveQuestionMapper.selectObjectivityByType(type, schoolId);
return new ResultEntity<>(list);
}
@ -217,27 +208,27 @@ public class TeaExamManageController {
}
}
}
PageInfo pageInfo = new PageInfo(stuUsers);
return new ResultEntity<>(pageInfo);
PageInfo pageInfo = new PageInfo(stuUsers);
return new ResultEntity<>(pageInfo);
}
@AnonymousAccess
@PostMapping("/reloadExamById")
@ApiOperation("考试管理--指定人重考")
public ResultEntity<String> reloadExamById (@ApiParam("考试管理ID") @RequestParam String
examId, @RequestParam String userId){
StuStudentExamExample studentExamExample = new StuStudentExamExample();
studentExamExample.createCriteria().andUseridEqualTo(userId).andExamManageIdEqualTo(examId);
List<StuStudentExamWithBLOBs> stuStudentExamWithBLOBs = studentExamMapper.selectByExampleWithBLOBs(studentExamExample);
if (stuStudentExamWithBLOBs.isEmpty()) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "学生暂未考试,无需重考");
} else {
StuStudentExamWithBLOBs stuStudentExamWithBLOBs1 = stuStudentExamWithBLOBs.get(0);
studentExamMapper.deleteByPrimaryKey(stuStudentExamWithBLOBs1.getStudentExamId());
return new ResultEntity(HttpStatus.OK, "指定重考成功!");
}
@AnonymousAccess
@PostMapping("/reloadExamById")
@ApiOperation("考试管理--指定人重考")
public ResultEntity<String> reloadExamById(@ApiParam("考试管理ID") @RequestParam String
examId, @RequestParam String userId) {
StuStudentExamExample studentExamExample = new StuStudentExamExample();
studentExamExample.createCriteria().andUseridEqualTo(userId).andExamManageIdEqualTo(examId);
List<StuStudentExamWithBLOBs> stuStudentExamWithBLOBs = studentExamMapper.selectByExampleWithBLOBs(studentExamExample);
if (stuStudentExamWithBLOBs.isEmpty()) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "学生暂未考试,无需重考");
} else {
StuStudentExamWithBLOBs stuStudentExamWithBLOBs1 = stuStudentExamWithBLOBs.get(0);
studentExamMapper.deleteByPrimaryKey(stuStudentExamWithBLOBs1.getStudentExamId());
return new ResultEntity(HttpStatus.OK, "指定重考成功!");
}
}
}

@ -3,7 +3,10 @@ package com.sztzjy.financial_bigdata.mapper;
import com.sztzjy.financial_bigdata.entity.SysCaseQuestion;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto;
import org.apache.ibatis.annotations.Mapper;
@ -50,4 +53,8 @@ public interface SysObjectiveQuestionMapper {
List<SysObjectiveQuestion> selectRandomObjectiveJudge();
List<SysObjectiveQuestion> getGradeReportObjective(@Param("list") List<String> list);
Map<Integer, BigDecimal> selectByList(@Param("list") List<String> list);
List<SysObjectiveQuestion> selectObjectivityByType(@Param("type")String type, @Param("schoolId")String schoolId);
}

@ -1,462 +1,495 @@
<?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.SysObjectiveQuestionMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
<id column="objective_id" jdbcType="VARCHAR" property="objectiveId" />
<result column="course_id" jdbcType="VARCHAR" property="courseId" />
<result column="course_name" jdbcType="VARCHAR" property="courseName" />
<result column="chapter_id" jdbcType="VARCHAR" property="chapterId" />
<result column="chapter_name" jdbcType="VARCHAR" property="chapterName" />
<result column="input_type" jdbcType="VARCHAR" property="inputType" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="score" jdbcType="DECIMAL" property="score" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="question_a" jdbcType="VARCHAR" property="questionA" />
<result column="question_b" jdbcType="VARCHAR" property="questionB" />
<result column="question_c" jdbcType="VARCHAR" property="questionC" />
<result column="question_d" jdbcType="VARCHAR" property="questionD" />
<result column="question_e" jdbcType="VARCHAR" property="questionE" />
<result column="answer" jdbcType="VARCHAR" property="answer" />
<result column="analysis" jdbcType="VARCHAR" property="analysis" />
<result column="school_id" jdbcType="VARCHAR" property="schoolId" />
</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>
<resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
<id column="objective_id" jdbcType="VARCHAR" property="objectiveId"/>
<result column="course_id" jdbcType="VARCHAR" property="courseId"/>
<result column="course_name" jdbcType="VARCHAR" property="courseName"/>
<result column="chapter_id" jdbcType="VARCHAR" property="chapterId"/>
<result column="chapter_name" jdbcType="VARCHAR" property="chapterName"/>
<result column="input_type" jdbcType="VARCHAR" property="inputType"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="score" jdbcType="DECIMAL" property="score"/>
<result column="content" jdbcType="VARCHAR" property="content"/>
<result column="question_a" jdbcType="VARCHAR" property="questionA"/>
<result column="question_b" jdbcType="VARCHAR" property="questionB"/>
<result column="question_c" jdbcType="VARCHAR" property="questionC"/>
<result column="question_d" jdbcType="VARCHAR" property="questionD"/>
<result column="question_e" jdbcType="VARCHAR" property="questionE"/>
<result column="answer" jdbcType="VARCHAR" property="answer"/>
<result column="analysis" jdbcType="VARCHAR" property="analysis"/>
<result column="school_id" jdbcType="VARCHAR" property="schoolId"/>
</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>
</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>
</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>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
objective_id, course_id, course_name, chapter_id, chapter_name, input_type, type,
</where>
</sql>
<sql id="Base_Column_List">
objective_id
, course_id, course_name, chapter_id, chapter_name, input_type, type,
score, content, question_a, question_b, question_c, question_d, question_e, answer,
analysis, school_id
</sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_objective_question
<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 sys_objective_question
where objective_id = #{objectiveId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from sys_objective_question
where objective_id = #{objectiveId,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample">
delete from sys_objective_question
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
insert into sys_objective_question (objective_id, course_id, course_name,
chapter_id, chapter_name, input_type,
type, score, content,
question_a, question_b, question_c,
question_d, question_e, answer,
analysis, school_id)
values (#{objectiveId,jdbcType=VARCHAR}, #{courseId,jdbcType=VARCHAR}, #{courseName,jdbcType=VARCHAR},
#{chapterId,jdbcType=VARCHAR}, #{chapterName,jdbcType=VARCHAR}, #{inputType,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{score,jdbcType=DECIMAL}, #{content,jdbcType=VARCHAR},
#{questionA,jdbcType=VARCHAR}, #{questionB,jdbcType=VARCHAR}, #{questionC,jdbcType=VARCHAR},
#{questionD,jdbcType=VARCHAR}, #{questionE,jdbcType=VARCHAR}, #{answer,jdbcType=VARCHAR},
#{analysis,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
insert into sys_objective_question
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objectiveId != null">
objective_id,
</if>
<if test="courseId != null">
course_id,
</if>
<if test="courseName != null">
course_name,
</if>
<if test="chapterId != null">
chapter_id,
</if>
<if test="chapterName != null">
chapter_name,
</if>
<if test="inputType != null">
input_type,
</if>
<if test="type != null">
type,
</if>
<if test="score != null">
score,
</if>
<if test="content != null">
content,
</if>
<if test="questionA != null">
question_a,
</if>
<if test="questionB != null">
question_b,
</if>
<if test="questionC != null">
question_c,
</if>
<if test="questionD != null">
question_d,
</if>
<if test="questionE != null">
question_e,
</if>
<if test="answer != null">
answer,
</if>
<if test="analysis != null">
analysis,
</if>
<if test="schoolId != null">
school_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objectiveId != null">
#{objectiveId,jdbcType=VARCHAR},
</if>
<if test="courseId != null">
#{courseId,jdbcType=VARCHAR},
</if>
<if test="courseName != null">
#{courseName,jdbcType=VARCHAR},
</if>
<if test="chapterId != null">
#{chapterId,jdbcType=VARCHAR},
</if>
<if test="chapterName != null">
#{chapterName,jdbcType=VARCHAR},
</if>
<if test="inputType != null">
#{inputType,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="score != null">
#{score,jdbcType=DECIMAL},
</if>
<if test="content != null">
#{content,jdbcType=VARCHAR},
</if>
<if test="questionA != null">
#{questionA,jdbcType=VARCHAR},
</if>
<if test="questionB != null">
#{questionB,jdbcType=VARCHAR},
</if>
<if test="questionC != null">
#{questionC,jdbcType=VARCHAR},
</if>
<if test="questionD != null">
#{questionD,jdbcType=VARCHAR},
</if>
<if test="questionE != null">
#{questionE,jdbcType=VARCHAR},
</if>
<if test="answer != null">
#{answer,jdbcType=VARCHAR},
</if>
<if test="analysis != null">
#{analysis,jdbcType=VARCHAR},
</if>
<if test="schoolId != null">
#{schoolId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample" resultType="java.lang.Long">
select count(*) from sys_objective_question
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_objective_question
<set>
<if test="record.objectiveId != null">
objective_id = #{record.objectiveId,jdbcType=VARCHAR},
</if>
<if test="record.courseId != null">
</sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from sys_objective_question
<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 sys_objective_question
where objective_id = #{objectiveId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete
from sys_objective_question
where objective_id = #{objectiveId,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample">
delete from sys_objective_question
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
insert into sys_objective_question (objective_id, course_id, course_name,
chapter_id, chapter_name, input_type,
type, score, content,
question_a, question_b, question_c,
question_d, question_e, answer,
analysis, school_id)
values (#{objectiveId,jdbcType=VARCHAR}, #{courseId,jdbcType=VARCHAR}, #{courseName,jdbcType=VARCHAR},
#{chapterId,jdbcType=VARCHAR}, #{chapterName,jdbcType=VARCHAR}, #{inputType,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{score,jdbcType=DECIMAL}, #{content,jdbcType=VARCHAR},
#{questionA,jdbcType=VARCHAR}, #{questionB,jdbcType=VARCHAR}, #{questionC,jdbcType=VARCHAR},
#{questionD,jdbcType=VARCHAR}, #{questionE,jdbcType=VARCHAR}, #{answer,jdbcType=VARCHAR},
#{analysis,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
insert into sys_objective_question
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objectiveId != null">
objective_id,
</if>
<if test="courseId != null">
course_id,
</if>
<if test="courseName != null">
course_name,
</if>
<if test="chapterId != null">
chapter_id,
</if>
<if test="chapterName != null">
chapter_name,
</if>
<if test="inputType != null">
input_type,
</if>
<if test="type != null">
type,
</if>
<if test="score != null">
score,
</if>
<if test="content != null">
content,
</if>
<if test="questionA != null">
question_a,
</if>
<if test="questionB != null">
question_b,
</if>
<if test="questionC != null">
question_c,
</if>
<if test="questionD != null">
question_d,
</if>
<if test="questionE != null">
question_e,
</if>
<if test="answer != null">
answer,
</if>
<if test="analysis != null">
analysis,
</if>
<if test="schoolId != null">
school_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objectiveId != null">
#{objectiveId,jdbcType=VARCHAR},
</if>
<if test="courseId != null">
#{courseId,jdbcType=VARCHAR},
</if>
<if test="courseName != null">
#{courseName,jdbcType=VARCHAR},
</if>
<if test="chapterId != null">
#{chapterId,jdbcType=VARCHAR},
</if>
<if test="chapterName != null">
#{chapterName,jdbcType=VARCHAR},
</if>
<if test="inputType != null">
#{inputType,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="score != null">
#{score,jdbcType=DECIMAL},
</if>
<if test="content != null">
#{content,jdbcType=VARCHAR},
</if>
<if test="questionA != null">
#{questionA,jdbcType=VARCHAR},
</if>
<if test="questionB != null">
#{questionB,jdbcType=VARCHAR},
</if>
<if test="questionC != null">
#{questionC,jdbcType=VARCHAR},
</if>
<if test="questionD != null">
#{questionD,jdbcType=VARCHAR},
</if>
<if test="questionE != null">
#{questionE,jdbcType=VARCHAR},
</if>
<if test="answer != null">
#{answer,jdbcType=VARCHAR},
</if>
<if test="analysis != null">
#{analysis,jdbcType=VARCHAR},
</if>
<if test="schoolId != null">
#{schoolId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample"
resultType="java.lang.Long">
select count(*) from sys_objective_question
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_objective_question
<set>
<if test="record.objectiveId != null">
objective_id = #{record.objectiveId,jdbcType=VARCHAR},
</if>
<if test="record.courseId != null">
course_id = #{record.courseId,jdbcType=VARCHAR},
</if>
<if test="record.courseName != null">
course_name = #{record.courseName,jdbcType=VARCHAR},
</if>
<if test="record.chapterId != null">
chapter_id = #{record.chapterId,jdbcType=VARCHAR},
</if>
<if test="record.chapterName != null">
chapter_name = #{record.chapterName,jdbcType=VARCHAR},
</if>
<if test="record.inputType != null">
input_type = #{record.inputType,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
type = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.score != null">
score = #{record.score,jdbcType=DECIMAL},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=VARCHAR},
</if>
<if test="record.questionA != null">
question_a = #{record.questionA,jdbcType=VARCHAR},
</if>
<if test="record.questionB != null">
question_b = #{record.questionB,jdbcType=VARCHAR},
</if>
<if test="record.questionC != null">
question_c = #{record.questionC,jdbcType=VARCHAR},
</if>
<if test="record.questionD != null">
question_d = #{record.questionD,jdbcType=VARCHAR},
</if>
<if test="record.questionE != null">
question_e = #{record.questionE,jdbcType=VARCHAR},
</if>
<if test="record.answer != null">
answer = #{record.answer,jdbcType=VARCHAR},
</if>
<if test="record.analysis != null">
analysis = #{record.analysis,jdbcType=VARCHAR},
</if>
<if test="record.schoolId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_objective_question
set objective_id = #{record.objectiveId,jdbcType=VARCHAR},
course_id = #{record.courseId,jdbcType=VARCHAR},
</if>
<if test="record.courseName != null">
course_name = #{record.courseName,jdbcType=VARCHAR},
</if>
<if test="record.chapterId != null">
chapter_id = #{record.chapterId,jdbcType=VARCHAR},
</if>
<if test="record.chapterName != null">
chapter_name = #{record.chapterName,jdbcType=VARCHAR},
</if>
<if test="record.inputType != null">
input_type = #{record.inputType,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
type = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.score != null">
score = #{record.score,jdbcType=DECIMAL},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=VARCHAR},
</if>
<if test="record.questionA != null">
question_a = #{record.questionA,jdbcType=VARCHAR},
</if>
<if test="record.questionB != null">
question_b = #{record.questionB,jdbcType=VARCHAR},
</if>
<if test="record.questionC != null">
question_c = #{record.questionC,jdbcType=VARCHAR},
</if>
<if test="record.questionD != null">
question_d = #{record.questionD,jdbcType=VARCHAR},
</if>
<if test="record.questionE != null">
question_e = #{record.questionE,jdbcType=VARCHAR},
</if>
<if test="record.answer != null">
answer = #{record.answer,jdbcType=VARCHAR},
</if>
<if test="record.analysis != null">
analysis = #{record.analysis,jdbcType=VARCHAR},
</if>
<if test="record.schoolId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_objective_question
set objective_id = #{record.objectiveId,jdbcType=VARCHAR},
course_id = #{record.courseId,jdbcType=VARCHAR},
course_name = #{record.courseName,jdbcType=VARCHAR},
chapter_id = #{record.chapterId,jdbcType=VARCHAR},
chapter_name = #{record.chapterName,jdbcType=VARCHAR},
input_type = #{record.inputType,jdbcType=VARCHAR},
type = #{record.type,jdbcType=VARCHAR},
score = #{record.score,jdbcType=DECIMAL},
content = #{record.content,jdbcType=VARCHAR},
question_a = #{record.questionA,jdbcType=VARCHAR},
question_b = #{record.questionB,jdbcType=VARCHAR},
question_c = #{record.questionC,jdbcType=VARCHAR},
question_d = #{record.questionD,jdbcType=VARCHAR},
question_e = #{record.questionE,jdbcType=VARCHAR},
answer = #{record.answer,jdbcType=VARCHAR},
analysis = #{record.analysis,jdbcType=VARCHAR},
school_id = #{record.schoolId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
update sys_objective_question
<set>
<if test="courseId != null">
course_id = #{courseId,jdbcType=VARCHAR},
</if>
<if test="courseName != null">
course_name = #{courseName,jdbcType=VARCHAR},
</if>
<if test="chapterId != null">
chapter_id = #{chapterId,jdbcType=VARCHAR},
</if>
<if test="chapterName != null">
chapter_name = #{chapterName,jdbcType=VARCHAR},
</if>
<if test="inputType != null">
input_type = #{inputType,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,jdbcType=VARCHAR},
</if>
<if test="score != null">
score = #{score,jdbcType=DECIMAL},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="questionA != null">
question_a = #{questionA,jdbcType=VARCHAR},
</if>
<if test="questionB != null">
question_b = #{questionB,jdbcType=VARCHAR},
</if>
<if test="questionC != null">
question_c = #{questionC,jdbcType=VARCHAR},
</if>
<if test="questionD != null">
question_d = #{questionD,jdbcType=VARCHAR},
</if>
<if test="questionE != null">
question_e = #{questionE,jdbcType=VARCHAR},
</if>
<if test="answer != null">
answer = #{answer,jdbcType=VARCHAR},
</if>
<if test="analysis != null">
analysis = #{analysis,jdbcType=VARCHAR},
</if>
<if test="schoolId != null">
school_id = #{schoolId,jdbcType=VARCHAR},
</if>
</set>
where objective_id = #{objectiveId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
update sys_objective_question
set course_id = #{courseId,jdbcType=VARCHAR},
course_name = #{courseName,jdbcType=VARCHAR},
chapter_id = #{chapterId,jdbcType=VARCHAR},
chapter_name = #{chapterName,jdbcType=VARCHAR},
input_type = #{inputType,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR},
score = #{score,jdbcType=DECIMAL},
content = #{content,jdbcType=VARCHAR},
question_a = #{questionA,jdbcType=VARCHAR},
question_b = #{questionB,jdbcType=VARCHAR},
question_c = #{questionC,jdbcType=VARCHAR},
question_d = #{questionD,jdbcType=VARCHAR},
question_e = #{questionE,jdbcType=VARCHAR},
answer = #{answer,jdbcType=VARCHAR},
analysis = #{analysis,jdbcType=VARCHAR},
school_id = #{schoolId,jdbcType=VARCHAR}
where objective_id = #{objectiveId,jdbcType=VARCHAR}
</update>
school_id = #{record.schoolId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
update sys_objective_question
<set>
<if test="courseId != null">
course_id = #{courseId,jdbcType=VARCHAR},
</if>
<if test="courseName != null">
course_name = #{courseName,jdbcType=VARCHAR},
</if>
<if test="chapterId != null">
chapter_id = #{chapterId,jdbcType=VARCHAR},
</if>
<if test="chapterName != null">
chapter_name = #{chapterName,jdbcType=VARCHAR},
</if>
<if test="inputType != null">
input_type = #{inputType,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,jdbcType=VARCHAR},
</if>
<if test="score != null">
score = #{score,jdbcType=DECIMAL},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="questionA != null">
question_a = #{questionA,jdbcType=VARCHAR},
</if>
<if test="questionB != null">
question_b = #{questionB,jdbcType=VARCHAR},
</if>
<if test="questionC != null">
question_c = #{questionC,jdbcType=VARCHAR},
</if>
<if test="questionD != null">
question_d = #{questionD,jdbcType=VARCHAR},
</if>
<if test="questionE != null">
question_e = #{questionE,jdbcType=VARCHAR},
</if>
<if test="answer != null">
answer = #{answer,jdbcType=VARCHAR},
</if>
<if test="analysis != null">
analysis = #{analysis,jdbcType=VARCHAR},
</if>
<if test="schoolId != null">
school_id = #{schoolId,jdbcType=VARCHAR},
</if>
</set>
where objective_id = #{objectiveId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
update sys_objective_question
set course_id = #{courseId,jdbcType=VARCHAR},
course_name = #{courseName,jdbcType=VARCHAR},
chapter_id = #{chapterId,jdbcType=VARCHAR},
chapter_name = #{chapterName,jdbcType=VARCHAR},
input_type = #{inputType,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR},
score = #{score,jdbcType=DECIMAL},
content = #{content,jdbcType=VARCHAR},
question_a = #{questionA,jdbcType=VARCHAR},
question_b = #{questionB,jdbcType=VARCHAR},
question_c = #{questionC,jdbcType=VARCHAR},
question_d = #{questionD,jdbcType=VARCHAR},
question_e = #{questionE,jdbcType=VARCHAR},
answer = #{answer,jdbcType=VARCHAR},
analysis = #{analysis,jdbcType=VARCHAR},
school_id = #{schoolId,jdbcType=VARCHAR}
where objective_id = #{objectiveId,jdbcType=VARCHAR}
</update>
<select id="selectRandomObjective" parameterType="map" resultMap="BaseResultMap">
SELECT objective_id,
course_id,
course_name,
chapter_id,
chapter_name,
input_type,
type,
score,
content,
question_a,
question_b,
question_c,
question_d,
question_e,
answer,
school_id
FROM sys_objective_question
WHERE chapter_id = #{chapterId,jdbcType=VARCHAR}
ORDER BY RAND() LIMIT 10
</select>
<select id="selectRandomObjectiveSingle" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
sys_objective_question
WHERE
type = 0 AND input_type = 1
ORDER BY
RAND()
LIMIT
35
</select>
<select id="selectRandomObjective" parameterType="map" resultMap="BaseResultMap">
SELECT
objective_id, course_id, course_name, chapter_id, chapter_name, input_type, type,
score, content, question_a, question_b, question_c, question_d, question_e, answer, school_id
FROM sys_objective_question
WHERE chapter_id = #{chapterId,jdbcType=VARCHAR}
ORDER BY RAND()
LIMIT 10
</select>
<select id="selectRandomObjectiveMany" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
sys_objective_question
WHERE
type = 1 AND input_type = 1
ORDER BY
RAND()
LIMIT
5
</select>
<select id="selectRandomObjectiveJudge" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
sys_objective_question
WHERE
type = 2 AND input_type = 1
ORDER BY
RAND()
LIMIT
10
</select>
<select id="selectRandomObjectiveSingle" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM
sys_objective_question
WHERE
type = 0 AND input_type = 1
ORDER BY
RAND()
LIMIT
35
</select>
<select id="selectRandomObjectiveMany" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM
sys_objective_question
WHERE
type = 1 AND input_type = 1
ORDER BY
RAND()
LIMIT
5
</select>
<select id="getGradeReportObjective" parameterType="java.util.List" resultMap="BaseResultMap">
SELECT content, chapter_name,answer,`type`
from sys_objective_question
WHERE objective_id IN
<foreach collection="list" separator="," item="id" open="(" close=")">
#{id}
</foreach>
</select>
<select id="selectRandomObjectiveJudge" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM
sys_objective_question
WHERE
type = 2 AND input_type = 1
ORDER BY
RAND()
LIMIT
10
</select>
<select id="selectByList" parameterType="java.util.List" resultType="java.util.Map">
SELECT count(*),sum(score)FROM sys_objective_question
WHERE objective_id IN
<foreach collection="list" separator="," item="id" open="(" close=")">
#{id}
</foreach>
</select>
<select id="getGradeReportObjective" parameterType="java.util.List" resultMap="BaseResultMap">
SELECT content, chapter_name,answer,`type`
from sys_objective_question
WHERE objective_id IN
<foreach collection="list" separator="," item="id" open="(" close=")">
#{id}
</foreach>
</select>
<select id="selectObjectivityByType" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT objective_id,content,chapter_name,course_name FROM sys_objective_question
WHERE school_id IN(#{schoolId},'999999999')
AND type = #{type}
</select>
</mapper>
Loading…
Cancel
Save