You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
498 lines
22 KiB
XML
498 lines
22 KiB
XML
<?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.resource_center.mapper.SysObjectiveQuestionsMapper">
|
|
<resultMap id="BaseResultMap" type="com.sztzjy.resource_center.entity.SysObjectiveQuestions">
|
|
<id column="objective_id" jdbcType="VARCHAR" property="objectiveId"/>
|
|
<result column="source" jdbcType="VARCHAR" property="source"/>
|
|
<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="score" jdbcType="DECIMAL" property="score"/>
|
|
<result column="answer" jdbcType="VARCHAR" property="answer"/>
|
|
<result column="analysis" jdbcType="VARCHAR" property="analysis"/>
|
|
<result column="type" jdbcType="VARCHAR" property="type"/>
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
<result column="is_delete" jdbcType="BIT" property="isDelete"/>
|
|
</resultMap>
|
|
<sql id="Example_Where_Clause">
|
|
<where>
|
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
|
<if test="criteria.valid">
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<foreach collection="criteria.criteria" item="criterion">
|
|
<choose>
|
|
<when test="criterion.noValue">
|
|
and ${criterion.condition}
|
|
</when>
|
|
<when test="criterion.singleValue">
|
|
and ${criterion.condition} #{criterion.value}
|
|
</when>
|
|
<when test="criterion.betweenValue">
|
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
</when>
|
|
<when test="criterion.listValue">
|
|
and ${criterion.condition}
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
|
separator=",">
|
|
#{listItem}
|
|
</foreach>
|
|
</when>
|
|
</choose>
|
|
</foreach>
|
|
</trim>
|
|
</if>
|
|
</foreach>
|
|
</where>
|
|
</sql>
|
|
<sql id="Update_By_Example_Where_Clause">
|
|
<where>
|
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
|
<if test="criteria.valid">
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<foreach collection="criteria.criteria" item="criterion">
|
|
<choose>
|
|
<when test="criterion.noValue">
|
|
and ${criterion.condition}
|
|
</when>
|
|
<when test="criterion.singleValue">
|
|
and ${criterion.condition} #{criterion.value}
|
|
</when>
|
|
<when test="criterion.betweenValue">
|
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
</when>
|
|
<when test="criterion.listValue">
|
|
and ${criterion.condition}
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
|
separator=",">
|
|
#{listItem}
|
|
</foreach>
|
|
</when>
|
|
</choose>
|
|
</foreach>
|
|
</trim>
|
|
</if>
|
|
</foreach>
|
|
</where>
|
|
</sql>
|
|
<sql id="Base_Column_List">
|
|
objective_id
|
|
, source, content, question_a, question_b, question_c, question_d, question_e,
|
|
score, answer, analysis, type, create_time, update_time, is_delete
|
|
</sql>
|
|
<select id="selectByExample" parameterType="com.sztzjy.resource_center.entity.SysObjectiveQuestionsExample"
|
|
resultMap="BaseResultMap">
|
|
select
|
|
<if test="distinct">
|
|
distinct
|
|
</if>
|
|
<include refid="Base_Column_List"/>
|
|
from sys_objective_questions
|
|
<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_questions
|
|
where objective_id = #{objectiveId,jdbcType=VARCHAR}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
delete
|
|
from sys_objective_questions
|
|
where objective_id = #{objectiveId,jdbcType=VARCHAR}
|
|
</delete>
|
|
<delete id="deleteByExample" parameterType="com.sztzjy.resource_center.entity.SysObjectiveQuestionsExample">
|
|
delete from sys_objective_questions
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause"/>
|
|
</if>
|
|
</delete>
|
|
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.SysObjectiveQuestions">
|
|
insert into sys_objective_questions (objective_id, source, content,
|
|
question_a, question_b, question_c,
|
|
question_d, question_e, score,
|
|
answer, analysis, type,
|
|
create_time, update_time, is_delete)
|
|
values (#{objectiveId,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
|
|
#{questionA,jdbcType=VARCHAR}, #{questionB,jdbcType=VARCHAR}, #{questionC,jdbcType=VARCHAR},
|
|
#{questionD,jdbcType=VARCHAR}, #{questionE,jdbcType=VARCHAR}, #{score,jdbcType=DECIMAL},
|
|
#{answer,jdbcType=VARCHAR}, #{analysis,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
|
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isDelete,jdbcType=BIT})
|
|
</insert>
|
|
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.SysObjectiveQuestions">
|
|
insert into sys_objective_questions
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="objectiveId != null">
|
|
objective_id,
|
|
</if>
|
|
<if test="source != null">
|
|
source,
|
|
</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="score != null">
|
|
score,
|
|
</if>
|
|
<if test="answer != null">
|
|
answer,
|
|
</if>
|
|
<if test="analysis != null">
|
|
analysis,
|
|
</if>
|
|
<if test="type != null">
|
|
type,
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time,
|
|
</if>
|
|
<if test="updateTime != null">
|
|
update_time,
|
|
</if>
|
|
<if test="isDelete != null">
|
|
is_delete,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="objectiveId != null">
|
|
#{objectiveId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="source != null">
|
|
#{source,jdbcType=VARCHAR},
|
|
</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="score != null">
|
|
#{score,jdbcType=DECIMAL},
|
|
</if>
|
|
<if test="answer != null">
|
|
#{answer,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="analysis != null">
|
|
#{analysis,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="type != null">
|
|
#{type,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createTime != null">
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
#{updateTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="isDelete != null">
|
|
#{isDelete,jdbcType=BIT},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<select id="countByExample" parameterType="com.sztzjy.resource_center.entity.SysObjectiveQuestionsExample"
|
|
resultType="java.lang.Long">
|
|
select count(*) from sys_objective_questions
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause"/>
|
|
</if>
|
|
</select>
|
|
<update id="updateByExampleSelective" parameterType="map">
|
|
update sys_objective_questions
|
|
<set>
|
|
<if test="record.objectiveId != null">
|
|
objective_id = #{record.objectiveId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.source != null">
|
|
source = #{record.source,jdbcType=VARCHAR},
|
|
</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.score != null">
|
|
score = #{record.score,jdbcType=DECIMAL},
|
|
</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.type != null">
|
|
type = #{record.type,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.createTime != null">
|
|
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="record.updateTime != null">
|
|
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="record.isDelete != null">
|
|
is_delete = #{record.isDelete,jdbcType=BIT},
|
|
</if>
|
|
</set>
|
|
<if test="_parameter != null">
|
|
<include refid="Update_By_Example_Where_Clause"/>
|
|
</if>
|
|
</update>
|
|
<update id="updateByExample" parameterType="map">
|
|
update sys_objective_questions
|
|
set objective_id = #{record.objectiveId,jdbcType=VARCHAR},
|
|
source = #{record.source,jdbcType=VARCHAR},
|
|
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},
|
|
score = #{record.score,jdbcType=DECIMAL},
|
|
answer = #{record.answer,jdbcType=VARCHAR},
|
|
analysis = #{record.analysis,jdbcType=VARCHAR},
|
|
type = #{record.type,jdbcType=VARCHAR},
|
|
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
|
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
|
is_delete = #{record.isDelete,jdbcType=BIT}
|
|
<if test="_parameter != null">
|
|
<include refid="Update_By_Example_Where_Clause"/>
|
|
</if>
|
|
</update>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.resource_center.entity.SysObjectiveQuestions">
|
|
update sys_objective_questions
|
|
<set>
|
|
<if test="source != null">
|
|
source = #{source,jdbcType=VARCHAR},
|
|
</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="score != null">
|
|
score = #{score,jdbcType=DECIMAL},
|
|
</if>
|
|
<if test="answer != null">
|
|
answer = #{answer,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="analysis != null">
|
|
analysis = #{analysis,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="type != null">
|
|
type = #{type,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="isDelete != null">
|
|
is_delete = #{isDelete,jdbcType=BIT},
|
|
</if>
|
|
</set>
|
|
where objective_id = #{objectiveId,jdbcType=VARCHAR}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.SysObjectiveQuestions">
|
|
update sys_objective_questions
|
|
set source = #{source,jdbcType=VARCHAR},
|
|
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},
|
|
score = #{score,jdbcType=DECIMAL},
|
|
answer = #{answer,jdbcType=VARCHAR},
|
|
analysis = #{analysis,jdbcType=VARCHAR},
|
|
type = #{type,jdbcType=VARCHAR},
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
is_delete = #{isDelete,jdbcType=BIT}
|
|
where objective_id = #{objectiveId,jdbcType=VARCHAR}
|
|
</update>
|
|
|
|
<resultMap id="DtoMap" type="com.sztzjy.resource_center.entity.dto.SysObjectiveQuestionsDto">
|
|
<id column="objective_id" jdbcType="VARCHAR" property="objectiveId"/>
|
|
<id column="id" jdbcType="VARCHAR" property="topicAndCourseId"/>
|
|
<result column="source" jdbcType="VARCHAR" property="source"/>
|
|
<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="score" jdbcType="DECIMAL" property="score"/>
|
|
<result column="answer" jdbcType="VARCHAR" property="answer"/>
|
|
<result column="analysis" jdbcType="VARCHAR" property="analysis"/>
|
|
<result column="type" jdbcType="VARCHAR" property="type"/>
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
<result column="one_id" jdbcType="VARCHAR" property="oneID"/>
|
|
<result column="two_id" jdbcType="VARCHAR" property="twoID"/>
|
|
<result column="three_id" jdbcType="VARCHAR" property="threeID"/>
|
|
<result column="one_name" jdbcType="VARCHAR" property="oneName"/>
|
|
<result column="two_name" jdbcType="VARCHAR" property="twoName"/>
|
|
<result column="three_name" jdbcType="VARCHAR" property="threeName"/>
|
|
</resultMap>
|
|
|
|
<!-- 条件查询-->
|
|
<select id="selectTopicByConditions" parameterType="java.lang.String" resultMap="DtoMap">
|
|
SELECT/* sb.*,st.one_id,st.two_id,st.three_id,st.id,st.one_name,st.two_name,st.three_name*/
|
|
sb.*, st.*
|
|
FROM sys_objective_questions sb
|
|
left JOIN sys_topic_and_course st
|
|
on sb.objective_id = st.topic_id
|
|
<where>
|
|
<if test="oneID != null and oneID != ''">
|
|
st.one_id = #{oneID}
|
|
</if>
|
|
<if test="twoID != null and twoID != ''">
|
|
and st.two_id = #{twoID}
|
|
</if>
|
|
<if test="threeID != null and threeID != '' ">
|
|
and st.three_id = #{threeID}
|
|
</if>
|
|
<if test="type != null and type != '' ">
|
|
and sb.type = #{type}
|
|
</if>
|
|
<if test="content != null and content != ''">
|
|
and sb.content LIKE CONCAT('%', #{content}, '%')
|
|
</if>
|
|
</where>
|
|
order by sb.create_time
|
|
</select>
|
|
|
|
|
|
<!-- 条件查询-->
|
|
<select id="getTopicByConfig" parameterType="java.lang.String" resultMap="DtoMap">
|
|
SELECT sb.*,st.one_id,st.two_id,st.three_id,st.id,st.one_name,st.two_name,st.three_name
|
|
FROM sys_objective_questions sb
|
|
LEFT JOIN sys_topic_and_course st
|
|
on sb.objective_id = st.topic_id
|
|
<where>
|
|
<if test="oneID != null and oneID != ''">
|
|
st.one_id = #{oneID}
|
|
</if>
|
|
<if test="twoID != null and twoID != ''">
|
|
and st.two_id = #{twoID}
|
|
</if>
|
|
<if test="threeID != null and threeID != '' ">
|
|
and st.three_id = #{threeID}
|
|
</if>
|
|
<if test="type != null and type != '' ">
|
|
and sb.type = #{type}
|
|
</if>
|
|
<if test="content != null and content != ''">
|
|
and sb.content LIKE CONCAT('%', #{content}, '%')
|
|
</if>
|
|
<if test="schoolId != null and schoolId != ''">
|
|
and sb.source in (#{schoolId},'管理员')
|
|
</if>
|
|
and sb.is_delete = FALSE
|
|
</where>
|
|
order by sb.create_time
|
|
</select>
|
|
|
|
|
|
<insert id="insertBatch" parameterType="java.util.List">
|
|
INSERT INTO sys_objective_questions (
|
|
objective_id, source, content, question_a, question_b, question_c, question_d, question_e, score, answer,
|
|
analysis, type, create_time, update_time, is_delete
|
|
) VALUES
|
|
<foreach collection="objectiveQuestionList" item="item" index="index" separator=",">
|
|
(
|
|
#{item.objectiveId}, #{item.source}, #{item.content}, #{item.questionA}, #{item.questionB},
|
|
#{item.questionC}, #{item.questionD}, #{item.questionE}, #{item.score}, #{item.answer}, #{item.analysis},
|
|
#{item.type}, #{item.createTime}, #{item.updateTime}, #{item.isDelete}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<delete id="batchDelete" parameterType="java.util.List">
|
|
DELETE FROM sys_objective_questions
|
|
WHERE objective_id IN
|
|
<foreach collection="list" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="getChooseObjCountAndSorce" parameterType="java.util.List" resultType="java.util.Map">
|
|
SELECT count(*),sum(score)FROM sys_objective_questions
|
|
WHERE objective_id IN
|
|
<foreach collection="list" separator="," item="id" open="(" close=")">
|
|
#{id}
|
|
</foreach>
|
|
and is_delete = false
|
|
</select>
|
|
|
|
|
|
<select id="selectObjByType" parameterType="java.lang.String" resultMap="DtoMap">
|
|
SELECT s.objective_id, s.content, sc.two_name, three_name
|
|
FROM sys_objective_questions s
|
|
JOIN sys_topic_and_course sc on s.objective_id = sc.topic_id
|
|
WHERE s.source in ('管理员', #{schoolId})
|
|
and s.is_delete = FALSE
|
|
and s.type = #{type}
|
|
</select>
|
|
</mapper> |