优化代码新增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.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess; 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.*;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageDto; 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 org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; 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 * @Author xcj
@ -54,15 +56,8 @@ public class TeaExamManageController {
@PostMapping("/getSelectCountAndScore") @PostMapping("/getSelectCountAndScore")
@ApiOperation("新增考试--获取选题量和分数") @ApiOperation("新增考试--获取选题量和分数")
public ResultEntity<Map<Integer, BigDecimal>> getsingleId(@RequestBody @ApiParam("所有ID用,隔开一次传过来") List<String> ids) { public ResultEntity<Map<Integer, BigDecimal>> getsingleId(@RequestBody @ApiParam("所有ID用,隔开一次传过来") List<String> ids) {
Map<Integer, BigDecimal> map = new HashMap<>(); List<String> list = new ArrayList<>(ids);
int i = 0; Map<Integer, BigDecimal> map = sysObjectiveQuestionMapper.selectByList(list);
BigDecimal score = BigDecimal.ZERO;
for (String id : ids) {
SysObjectiveQuestion sysObjectiveQuestion = sysObjectiveQuestionMapper.selectByPrimaryKey(id);
i++;
score = sysObjectiveQuestion.getScore().add(score);
}
map.put(i, score);
return new ResultEntity<>(map); return new ResultEntity<>(map);
} }
@ -78,13 +73,9 @@ public class TeaExamManageController {
@PostMapping("/selectObjectivityByType") @PostMapping("/selectObjectivityByType")
@ApiOperation("新增考试--选择客观题时展示") @ApiOperation("新增考试--选择客观题时展示")
public ResultEntity<List<SysObjectiveQuestion>> selectObjectivityByType(@ApiParam("0单选 1多选 2判断") @RequestParam String type, public ResultEntity<List<SysObjectiveQuestion>> selectObjectivityByType(@ApiParam("0单选 1多选 2判断") @RequestParam String type,
@RequestParam String schoolId) { @RequestParam String schoolId) {
SysObjectiveQuestionExample sysObjectiveQuestionExample = new SysObjectiveQuestionExample(); List<SysObjectiveQuestion> list = sysObjectiveQuestionMapper.selectObjectivityByType(type, schoolId);
List<String> l = new ArrayList<>(); return new ResultEntity<>(list);
l.add(schoolId);
l.add(Constant.BUILT_IN_SCHOOL_ID);
sysObjectiveQuestionExample.createCriteria().andTypeEqualTo(type).andSchoolIdIn(l);
return new ResultEntity<List<SysObjectiveQuestion>>(sysObjectiveQuestionMapper.selectByExample(sysObjectiveQuestionExample));
} }
@ -217,27 +208,27 @@ public class TeaExamManageController {
} }
} }
} }
PageInfo pageInfo = new PageInfo(stuUsers); PageInfo pageInfo = new PageInfo(stuUsers);
return new ResultEntity<>(pageInfo); return new ResultEntity<>(pageInfo);
} }
@AnonymousAccess @AnonymousAccess
@PostMapping("/reloadExamById") @PostMapping("/reloadExamById")
@ApiOperation("考试管理--指定人重考") @ApiOperation("考试管理--指定人重考")
public ResultEntity<String> reloadExamById (@ApiParam("考试管理ID") @RequestParam String public ResultEntity<String> reloadExamById(@ApiParam("考试管理ID") @RequestParam String
examId, @RequestParam String userId){ 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);
if (stuStudentExamWithBLOBs.isEmpty()) { if (stuStudentExamWithBLOBs.isEmpty()) {
return new ResultEntity(HttpStatus.BAD_REQUEST, "学生暂未考试,无需重考"); return new ResultEntity(HttpStatus.BAD_REQUEST, "学生暂未考试,无需重考");
} else { } else {
StuStudentExamWithBLOBs stuStudentExamWithBLOBs1 = stuStudentExamWithBLOBs.get(0); StuStudentExamWithBLOBs stuStudentExamWithBLOBs1 = stuStudentExamWithBLOBs.get(0);
studentExamMapper.deleteByPrimaryKey(stuStudentExamWithBLOBs1.getStudentExamId()); studentExamMapper.deleteByPrimaryKey(stuStudentExamWithBLOBs1.getStudentExamId());
return new ResultEntity(HttpStatus.OK, "指定重考成功!"); 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.SysCaseQuestion;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion; import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample; import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -50,4 +53,8 @@ public interface SysObjectiveQuestionMapper {
List<SysObjectiveQuestion> selectRandomObjectiveJudge(); List<SysObjectiveQuestion> selectRandomObjectiveJudge();
List<SysObjectiveQuestion> getGradeReportObjective(@Param("list") List<String> list); 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"?> <?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.SysObjectiveQuestionMapper"> <mapper namespace="com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion"> <resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
<id column="objective_id" jdbcType="VARCHAR" property="objectiveId" /> <id column="objective_id" jdbcType="VARCHAR" property="objectiveId"/>
<result column="course_id" jdbcType="VARCHAR" property="courseId" /> <result column="course_id" jdbcType="VARCHAR" property="courseId"/>
<result column="course_name" jdbcType="VARCHAR" property="courseName" /> <result column="course_name" jdbcType="VARCHAR" property="courseName"/>
<result column="chapter_id" jdbcType="VARCHAR" property="chapterId" /> <result column="chapter_id" jdbcType="VARCHAR" property="chapterId"/>
<result column="chapter_name" jdbcType="VARCHAR" property="chapterName" /> <result column="chapter_name" jdbcType="VARCHAR" property="chapterName"/>
<result column="input_type" jdbcType="VARCHAR" property="inputType" /> <result column="input_type" jdbcType="VARCHAR" property="inputType"/>
<result column="type" jdbcType="VARCHAR" property="type" /> <result column="type" jdbcType="VARCHAR" property="type"/>
<result column="score" jdbcType="DECIMAL" property="score" /> <result column="score" jdbcType="DECIMAL" property="score"/>
<result column="content" jdbcType="VARCHAR" property="content" /> <result column="content" jdbcType="VARCHAR" property="content"/>
<result column="question_a" jdbcType="VARCHAR" property="questionA" /> <result column="question_a" jdbcType="VARCHAR" property="questionA"/>
<result column="question_b" jdbcType="VARCHAR" property="questionB" /> <result column="question_b" jdbcType="VARCHAR" property="questionB"/>
<result column="question_c" jdbcType="VARCHAR" property="questionC" /> <result column="question_c" jdbcType="VARCHAR" property="questionC"/>
<result column="question_d" jdbcType="VARCHAR" property="questionD" /> <result column="question_d" jdbcType="VARCHAR" property="questionD"/>
<result column="question_e" jdbcType="VARCHAR" property="questionE" /> <result column="question_e" jdbcType="VARCHAR" property="questionE"/>
<result column="answer" jdbcType="VARCHAR" property="answer" /> <result column="answer" jdbcType="VARCHAR" property="answer"/>
<result column="analysis" jdbcType="VARCHAR" property="analysis" /> <result column="analysis" jdbcType="VARCHAR" property="analysis"/>
<result column="school_id" jdbcType="VARCHAR" property="schoolId" /> <result column="school_id" jdbcType="VARCHAR" property="schoolId"/>
</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> objective_id
</sql> , course_id, course_name, chapter_id, chapter_name, input_type, type,
<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, score, content, question_a, question_b, question_c, question_d, question_e, answer,
analysis, school_id analysis, school_id
</sql> </sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample"
select resultMap="BaseResultMap">
<if test="distinct"> select
distinct <if test="distinct">
</if> distinct
<include refid="Base_Column_List" /> </if>
from sys_objective_question <include refid="Base_Column_List"/>
<if test="_parameter != null"> from sys_objective_question
<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 sys_objective_question <include refid="Base_Column_List"/>
where objective_id = #{objectiveId,jdbcType=VARCHAR} from sys_objective_question
</select> where objective_id = #{objectiveId,jdbcType=VARCHAR}
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> </select>
delete from sys_objective_question <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
where objective_id = #{objectiveId,jdbcType=VARCHAR} delete
</delete> from sys_objective_question
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample"> where objective_id = #{objectiveId,jdbcType=VARCHAR}
delete from sys_objective_question </delete>
<if test="_parameter != null"> <delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample">
<include refid="Example_Where_Clause" /> delete from sys_objective_question
</if> <if test="_parameter != null">
</delete> <include refid="Example_Where_Clause"/>
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion"> </if>
insert into sys_objective_question (objective_id, course_id, course_name, </delete>
chapter_id, chapter_name, input_type, <insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
type, score, content, insert into sys_objective_question (objective_id, course_id, course_name,
question_a, question_b, question_c, chapter_id, chapter_name, input_type,
question_d, question_e, answer, type, score, content,
analysis, school_id) question_a, question_b, question_c,
values (#{objectiveId,jdbcType=VARCHAR}, #{courseId,jdbcType=VARCHAR}, #{courseName,jdbcType=VARCHAR}, question_d, question_e, answer,
#{chapterId,jdbcType=VARCHAR}, #{chapterName,jdbcType=VARCHAR}, #{inputType,jdbcType=VARCHAR}, analysis, school_id)
#{type,jdbcType=VARCHAR}, #{score,jdbcType=DECIMAL}, #{content,jdbcType=VARCHAR}, values (#{objectiveId,jdbcType=VARCHAR}, #{courseId,jdbcType=VARCHAR}, #{courseName,jdbcType=VARCHAR},
#{questionA,jdbcType=VARCHAR}, #{questionB,jdbcType=VARCHAR}, #{questionC,jdbcType=VARCHAR}, #{chapterId,jdbcType=VARCHAR}, #{chapterName,jdbcType=VARCHAR}, #{inputType,jdbcType=VARCHAR},
#{questionD,jdbcType=VARCHAR}, #{questionE,jdbcType=VARCHAR}, #{answer,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{score,jdbcType=DECIMAL}, #{content,jdbcType=VARCHAR},
#{analysis,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}) #{questionA,jdbcType=VARCHAR}, #{questionB,jdbcType=VARCHAR}, #{questionC,jdbcType=VARCHAR},
</insert> #{questionD,jdbcType=VARCHAR}, #{questionE,jdbcType=VARCHAR}, #{answer,jdbcType=VARCHAR},
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion"> #{analysis,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR})
insert into sys_objective_question </insert>
<trim prefix="(" suffix=")" suffixOverrides=","> <insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
<if test="objectiveId != null"> insert into sys_objective_question
objective_id, <trim prefix="(" suffix=")" suffixOverrides=",">
</if> <if test="objectiveId != null">
<if test="courseId != null"> objective_id,
course_id, </if>
</if> <if test="courseId != null">
<if test="courseName != null"> course_id,
course_name, </if>
</if> <if test="courseName != null">
<if test="chapterId != null"> course_name,
chapter_id, </if>
</if> <if test="chapterId != null">
<if test="chapterName != null"> chapter_id,
chapter_name, </if>
</if> <if test="chapterName != null">
<if test="inputType != null"> chapter_name,
input_type, </if>
</if> <if test="inputType != null">
<if test="type != null"> input_type,
type, </if>
</if> <if test="type != null">
<if test="score != null"> type,
score, </if>
</if> <if test="score != null">
<if test="content != null"> score,
content, </if>
</if> <if test="content != null">
<if test="questionA != null"> content,
question_a, </if>
</if> <if test="questionA != null">
<if test="questionB != null"> question_a,
question_b, </if>
</if> <if test="questionB != null">
<if test="questionC != null"> question_b,
question_c, </if>
</if> <if test="questionC != null">
<if test="questionD != null"> question_c,
question_d, </if>
</if> <if test="questionD != null">
<if test="questionE != null"> question_d,
question_e, </if>
</if> <if test="questionE != null">
<if test="answer != null"> question_e,
answer, </if>
</if> <if test="answer != null">
<if test="analysis != null"> answer,
analysis, </if>
</if> <if test="analysis != null">
<if test="schoolId != null"> analysis,
school_id, </if>
</if> <if test="schoolId != null">
</trim> school_id,
<trim prefix="values (" suffix=")" suffixOverrides=","> </if>
<if test="objectiveId != null"> </trim>
#{objectiveId,jdbcType=VARCHAR}, <trim prefix="values (" suffix=")" suffixOverrides=",">
</if> <if test="objectiveId != null">
<if test="courseId != null"> #{objectiveId,jdbcType=VARCHAR},
#{courseId,jdbcType=VARCHAR}, </if>
</if> <if test="courseId != null">
<if test="courseName != null"> #{courseId,jdbcType=VARCHAR},
#{courseName,jdbcType=VARCHAR}, </if>
</if> <if test="courseName != null">
<if test="chapterId != null"> #{courseName,jdbcType=VARCHAR},
#{chapterId,jdbcType=VARCHAR}, </if>
</if> <if test="chapterId != null">
<if test="chapterName != null"> #{chapterId,jdbcType=VARCHAR},
#{chapterName,jdbcType=VARCHAR}, </if>
</if> <if test="chapterName != null">
<if test="inputType != null"> #{chapterName,jdbcType=VARCHAR},
#{inputType,jdbcType=VARCHAR}, </if>
</if> <if test="inputType != null">
<if test="type != null"> #{inputType,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, </if>
</if> <if test="type != null">
<if test="score != null"> #{type,jdbcType=VARCHAR},
#{score,jdbcType=DECIMAL}, </if>
</if> <if test="score != null">
<if test="content != null"> #{score,jdbcType=DECIMAL},
#{content,jdbcType=VARCHAR}, </if>
</if> <if test="content != null">
<if test="questionA != null"> #{content,jdbcType=VARCHAR},
#{questionA,jdbcType=VARCHAR}, </if>
</if> <if test="questionA != null">
<if test="questionB != null"> #{questionA,jdbcType=VARCHAR},
#{questionB,jdbcType=VARCHAR}, </if>
</if> <if test="questionB != null">
<if test="questionC != null"> #{questionB,jdbcType=VARCHAR},
#{questionC,jdbcType=VARCHAR}, </if>
</if> <if test="questionC != null">
<if test="questionD != null"> #{questionC,jdbcType=VARCHAR},
#{questionD,jdbcType=VARCHAR}, </if>
</if> <if test="questionD != null">
<if test="questionE != null"> #{questionD,jdbcType=VARCHAR},
#{questionE,jdbcType=VARCHAR}, </if>
</if> <if test="questionE != null">
<if test="answer != null"> #{questionE,jdbcType=VARCHAR},
#{answer,jdbcType=VARCHAR}, </if>
</if> <if test="answer != null">
<if test="analysis != null"> #{answer,jdbcType=VARCHAR},
#{analysis,jdbcType=VARCHAR}, </if>
</if> <if test="analysis != null">
<if test="schoolId != null"> #{analysis,jdbcType=VARCHAR},
#{schoolId,jdbcType=VARCHAR}, </if>
</if> <if test="schoolId != null">
</trim> #{schoolId,jdbcType=VARCHAR},
</insert> </if>
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample" resultType="java.lang.Long"> </trim>
select count(*) from sys_objective_question </insert>
<if test="_parameter != null"> <select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample"
<include refid="Example_Where_Clause" /> resultType="java.lang.Long">
</if> select count(*) from sys_objective_question
</select> <if test="_parameter != null">
<update id="updateByExampleSelective" parameterType="map"> <include refid="Example_Where_Clause"/>
update sys_objective_question </if>
<set> </select>
<if test="record.objectiveId != null"> <update id="updateByExampleSelective" parameterType="map">
objective_id = #{record.objectiveId,jdbcType=VARCHAR}, update sys_objective_question
</if> <set>
<if test="record.courseId != null"> <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}, course_id = #{record.courseId,jdbcType=VARCHAR},
</if>
<if test="record.courseName != null">
course_name = #{record.courseName,jdbcType=VARCHAR}, course_name = #{record.courseName,jdbcType=VARCHAR},
</if>
<if test="record.chapterId != null">
chapter_id = #{record.chapterId,jdbcType=VARCHAR}, chapter_id = #{record.chapterId,jdbcType=VARCHAR},
</if>
<if test="record.chapterName != null">
chapter_name = #{record.chapterName,jdbcType=VARCHAR}, chapter_name = #{record.chapterName,jdbcType=VARCHAR},
</if>
<if test="record.inputType != null">
input_type = #{record.inputType,jdbcType=VARCHAR}, input_type = #{record.inputType,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
type = #{record.type,jdbcType=VARCHAR}, type = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.score != null">
score = #{record.score,jdbcType=DECIMAL}, score = #{record.score,jdbcType=DECIMAL},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=VARCHAR}, content = #{record.content,jdbcType=VARCHAR},
</if>
<if test="record.questionA != null">
question_a = #{record.questionA,jdbcType=VARCHAR}, question_a = #{record.questionA,jdbcType=VARCHAR},
</if>
<if test="record.questionB != null">
question_b = #{record.questionB,jdbcType=VARCHAR}, question_b = #{record.questionB,jdbcType=VARCHAR},
</if>
<if test="record.questionC != null">
question_c = #{record.questionC,jdbcType=VARCHAR}, question_c = #{record.questionC,jdbcType=VARCHAR},
</if>
<if test="record.questionD != null">
question_d = #{record.questionD,jdbcType=VARCHAR}, question_d = #{record.questionD,jdbcType=VARCHAR},
</if>
<if test="record.questionE != null">
question_e = #{record.questionE,jdbcType=VARCHAR}, question_e = #{record.questionE,jdbcType=VARCHAR},
</if>
<if test="record.answer != null">
answer = #{record.answer,jdbcType=VARCHAR}, answer = #{record.answer,jdbcType=VARCHAR},
</if>
<if test="record.analysis != null">
analysis = #{record.analysis,jdbcType=VARCHAR}, analysis = #{record.analysis,jdbcType=VARCHAR},
</if> school_id = #{record.schoolId,jdbcType=VARCHAR}
<if test="record.schoolId != null"> <if test="_parameter != null">
school_id = #{record.schoolId,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.SysObjectiveQuestion">
<include refid="Update_By_Example_Where_Clause" /> update sys_objective_question
</if> <set>
</update> <if test="courseId != null">
<update id="updateByExample" parameterType="map"> course_id = #{courseId,jdbcType=VARCHAR},
update sys_objective_question </if>
set objective_id = #{record.objectiveId,jdbcType=VARCHAR}, <if test="courseName != null">
course_id = #{record.courseId,jdbcType=VARCHAR}, course_name = #{courseName,jdbcType=VARCHAR},
course_name = #{record.courseName,jdbcType=VARCHAR}, </if>
chapter_id = #{record.chapterId,jdbcType=VARCHAR}, <if test="chapterId != null">
chapter_name = #{record.chapterName,jdbcType=VARCHAR}, chapter_id = #{chapterId,jdbcType=VARCHAR},
input_type = #{record.inputType,jdbcType=VARCHAR}, </if>
type = #{record.type,jdbcType=VARCHAR}, <if test="chapterName != null">
score = #{record.score,jdbcType=DECIMAL}, chapter_name = #{chapterName,jdbcType=VARCHAR},
content = #{record.content,jdbcType=VARCHAR}, </if>
question_a = #{record.questionA,jdbcType=VARCHAR}, <if test="inputType != null">
question_b = #{record.questionB,jdbcType=VARCHAR}, input_type = #{inputType,jdbcType=VARCHAR},
question_c = #{record.questionC,jdbcType=VARCHAR}, </if>
question_d = #{record.questionD,jdbcType=VARCHAR}, <if test="type != null">
question_e = #{record.questionE,jdbcType=VARCHAR}, type = #{type,jdbcType=VARCHAR},
answer = #{record.answer,jdbcType=VARCHAR}, </if>
analysis = #{record.analysis,jdbcType=VARCHAR}, <if test="score != null">
school_id = #{record.schoolId,jdbcType=VARCHAR} score = #{score,jdbcType=DECIMAL},
<if test="_parameter != null"> </if>
<include refid="Update_By_Example_Where_Clause" /> <if test="content != null">
</if> content = #{content,jdbcType=VARCHAR},
</update> </if>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion"> <if test="questionA != null">
update sys_objective_question question_a = #{questionA,jdbcType=VARCHAR},
<set> </if>
<if test="courseId != null"> <if test="questionB != null">
course_id = #{courseId,jdbcType=VARCHAR}, question_b = #{questionB,jdbcType=VARCHAR},
</if> </if>
<if test="courseName != null"> <if test="questionC != null">
course_name = #{courseName,jdbcType=VARCHAR}, question_c = #{questionC,jdbcType=VARCHAR},
</if> </if>
<if test="chapterId != null"> <if test="questionD != null">
chapter_id = #{chapterId,jdbcType=VARCHAR}, question_d = #{questionD,jdbcType=VARCHAR},
</if> </if>
<if test="chapterName != null"> <if test="questionE != null">
chapter_name = #{chapterName,jdbcType=VARCHAR}, question_e = #{questionE,jdbcType=VARCHAR},
</if> </if>
<if test="inputType != null"> <if test="answer != null">
input_type = #{inputType,jdbcType=VARCHAR}, answer = #{answer,jdbcType=VARCHAR},
</if> </if>
<if test="type != null"> <if test="analysis != null">
type = #{type,jdbcType=VARCHAR}, analysis = #{analysis,jdbcType=VARCHAR},
</if> </if>
<if test="score != null"> <if test="schoolId != null">
score = #{score,jdbcType=DECIMAL}, school_id = #{schoolId,jdbcType=VARCHAR},
</if> </if>
<if test="content != null"> </set>
content = #{content,jdbcType=VARCHAR}, where objective_id = #{objectiveId,jdbcType=VARCHAR}
</if> </update>
<if test="questionA != null"> <update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
question_a = #{questionA,jdbcType=VARCHAR}, update sys_objective_question
</if> set course_id = #{courseId,jdbcType=VARCHAR},
<if test="questionB != null"> course_name = #{courseName,jdbcType=VARCHAR},
question_b = #{questionB,jdbcType=VARCHAR}, chapter_id = #{chapterId,jdbcType=VARCHAR},
</if> chapter_name = #{chapterName,jdbcType=VARCHAR},
<if test="questionC != null"> input_type = #{inputType,jdbcType=VARCHAR},
question_c = #{questionC,jdbcType=VARCHAR}, type = #{type,jdbcType=VARCHAR},
</if> score = #{score,jdbcType=DECIMAL},
<if test="questionD != null"> content = #{content,jdbcType=VARCHAR},
question_d = #{questionD,jdbcType=VARCHAR}, question_a = #{questionA,jdbcType=VARCHAR},
</if> question_b = #{questionB,jdbcType=VARCHAR},
<if test="questionE != null"> question_c = #{questionC,jdbcType=VARCHAR},
question_e = #{questionE,jdbcType=VARCHAR}, question_d = #{questionD,jdbcType=VARCHAR},
</if> question_e = #{questionE,jdbcType=VARCHAR},
<if test="answer != null"> answer = #{answer,jdbcType=VARCHAR},
answer = #{answer,jdbcType=VARCHAR}, analysis = #{analysis,jdbcType=VARCHAR},
</if> school_id = #{schoolId,jdbcType=VARCHAR}
<if test="analysis != null"> where objective_id = #{objectiveId,jdbcType=VARCHAR}
analysis = #{analysis,jdbcType=VARCHAR}, </update>
</if>
<if test="schoolId != null"> <select id="selectRandomObjective" parameterType="map" resultMap="BaseResultMap">
school_id = #{schoolId,jdbcType=VARCHAR}, SELECT objective_id,
</if> course_id,
</set> course_name,
where objective_id = #{objectiveId,jdbcType=VARCHAR} chapter_id,
</update> chapter_name,
<update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion"> input_type,
update sys_objective_question type,
set course_id = #{courseId,jdbcType=VARCHAR}, score,
course_name = #{courseName,jdbcType=VARCHAR}, content,
chapter_id = #{chapterId,jdbcType=VARCHAR}, question_a,
chapter_name = #{chapterName,jdbcType=VARCHAR}, question_b,
input_type = #{inputType,jdbcType=VARCHAR}, question_c,
type = #{type,jdbcType=VARCHAR}, question_d,
score = #{score,jdbcType=DECIMAL}, question_e,
content = #{content,jdbcType=VARCHAR}, answer,
question_a = #{questionA,jdbcType=VARCHAR}, school_id
question_b = #{questionB,jdbcType=VARCHAR}, FROM sys_objective_question
question_c = #{questionC,jdbcType=VARCHAR}, WHERE chapter_id = #{chapterId,jdbcType=VARCHAR}
question_d = #{questionD,jdbcType=VARCHAR}, ORDER BY RAND() LIMIT 10
question_e = #{questionE,jdbcType=VARCHAR}, </select>
answer = #{answer,jdbcType=VARCHAR},
analysis = #{analysis,jdbcType=VARCHAR},
school_id = #{schoolId,jdbcType=VARCHAR} <select id="selectRandomObjectiveSingle" resultMap="BaseResultMap">
where objective_id = #{objectiveId,jdbcType=VARCHAR} SELECT
</update> <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 id="selectRandomObjectiveMany" resultMap="BaseResultMap">
SELECT SELECT
objective_id, course_id, course_name, chapter_id, chapter_name, input_type, type, <include refid="Base_Column_List"/>
score, content, question_a, question_b, question_c, question_d, question_e, answer, school_id FROM
FROM sys_objective_question sys_objective_question
WHERE chapter_id = #{chapterId,jdbcType=VARCHAR} WHERE
ORDER BY RAND() type = 1 AND input_type = 1
LIMIT 10 ORDER BY
</select> 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 id="getGradeReportObjective" parameterType="java.util.List" resultMap="BaseResultMap">
SELECT SELECT content, chapter_name,answer,`type`
<include refid="Base_Column_List" /> from sys_objective_question
FROM WHERE objective_id IN
sys_objective_question <foreach collection="list" separator="," item="id" open="(" close=")">
WHERE #{id}
type = 1 AND input_type = 1 </foreach>
ORDER BY </select>
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="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 id="selectObjectivityByType" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT content, chapter_name,answer,`type` SELECT objective_id,content,chapter_name,course_name FROM sys_objective_question
from sys_objective_question WHERE school_id IN(#{schoolId},'999999999')
WHERE objective_id IN AND type = #{type}
<foreach collection="list" separator="," item="id" open="(" close=")"> </select>
#{id}
</foreach>
</select>
</mapper> </mapper>
Loading…
Cancel
Save