| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <?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.ruoyi.learn.mapper.LearnTestPaperMapper">
- <resultMap type="LearnTestPaper" id="LearnTestPaperResult">
- <result property="id" column="id" />
- <result property="batchId" column="batch_id" />
- <result property="buildType" column="build_type" />
- <result property="subjectId" column="subject_id" />
- <result property="examType" column="exam_type" />
- <result property="teacherId" column="teacher_id" />
- <result property="universityId" column="university_id" />
- <result property="directKey" column="direct_key" />
- <result property="paperId" column="paper_id" />
- <result property="conditions" column="conditions" />
- <result property="creatorId" column="creator_id" />
- <result property="createTime" column="create_time" />
- </resultMap>
- <sql id="selectLearnTestPaperVo">
- select id, batch_id, build_type, subject_id, exam_type, teacher_id, university_id, direct_key, paper_id, conditions, creator_id, create_time from learn_test_paper
- </sql>
- <select id="selectLearnTestPaperList" parameterType="LearnTestPaper" resultMap="LearnTestPaperResult">
- <include refid="selectLearnTestPaperVo"/>
- <where>
- <if test="batchId != null "> and batch_id = #{batchId}</if>
- <if test="buildType != null "> and build_type = #{buildType}</if>
- <if test="subjectId != null "> and subject_id = #{subjectId}</if>
- <if test="examType != null "> and exam_type = #{examType}</if>
- <if test="teacherId != null "> and teacher_id = #{teacherId}</if>
- <if test="universityId != null "> and university_id = #{universityId}</if>
- <if test="directKey != null and directKey != ''"> and direct_key = #{directKey}</if>
- <if test="paperId != null "> and paper_id = #{paperId}</if>
- <if test="conditions != null and conditions != ''"> and conditions = #{conditions}</if>
- <if test="creatorId != null "> and creator_id = #{creatorId}</if>
- </where>
- </select>
- <select id="selectByBatchAndUniversityIds" resultMap="LearnTestPaperResult">
- <include refid="selectLearnTestPaperVo"/>
- <where> batch_id = #{batchId} and build_type = #{buildType} and subject_id = #{subjectId}
- <if test="null != teacherId">and teacher_id = #{teacherId}</if>
- <if test="null != universityIds">and university_id in <foreach item="id" collection="universityIds" open="(" separator="," close=")">#{id}</foreach></if>
- </where>
- </select>
- <select id="selectLearnTestPaperById" parameterType="String" resultMap="LearnTestPaperResult">
- <include refid="selectLearnTestPaperVo"/>
- where id = #{id}
- </select>
- <select id="selectLearnTestPaperByPaperId" parameterType="Long" resultMap="LearnTestPaperResult">
- <include refid="selectLearnTestPaperVo"/>
- where paper_id = #{paperId}
- </select>
- <insert id="insertLearnTestPaper" parameterType="LearnTestPaper" useGeneratedKeys="true" keyProperty="id">
- insert into learn_test_paper
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="batchId != null">batch_id,</if>
- <if test="buildType != null">build_type,</if>
- <if test="subjectId != null">subject_id,</if>
- <if test="examType != null">exam_type,</if>
- <if test="teacherId != null">teacher_id,</if>
- <if test="universityId != null">university_id,</if>
- <if test="directKey != null ">direct_key,</if>
- <if test="paperId != null">paper_id,</if>
- <if test="conditions != null">conditions,</if>
- <if test="creatorId != null">creator_id,</if>
- <if test="createTime != null">create_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="batchId != null">#{batchId},</if>
- <if test="buildType != null">#{buildType},</if>
- <if test="subjectId != null">#{subjectId},</if>
- <if test="examType != null">#{examType},</if>
- <if test="teacherId != null">#{teacherId},</if>
- <if test="universityId != null">#{universityId},</if>
- <if test="directKey != null">#{directKey},</if>
- <if test="paperId != null">#{paperId},</if>
- <if test="conditions != null">#{conditions},</if>
- <if test="creatorId != null">#{creatorId},</if>
- <if test="createTime != null">#{createTime},</if>
- </trim>
- </insert>
- <update id="updateLearnTestPaper" parameterType="LearnTestPaper">
- update learn_test_paper
- <trim prefix="SET" suffixOverrides=",">
- <if test="batchId != null">batch_id = #{batchId},</if>
- <if test="buildType != null">build_type = #{buildType},</if>
- <if test="subjectId != null">subject_id = #{subjectId},</if>
- <if test="examType != null">exam_type = #{examType},</if>
- <if test="teacherId != null">teacher_id = #{teacherId},</if>
- <if test="universityId != null">university_id = #{universityId},</if>
- <if test="directKey != null">direct_key = #{directKey},</if>
- <if test="paperId != null">paper_id = #{paperId},</if>
- <if test="conditions != null">conditions = #{conditions},</if>
- <if test="creatorId != null">creator_id = #{creatorId},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteLearnTestPaperById" parameterType="String">
- delete from learn_test_paper where id = #{id}
- </delete>
- <delete id="deleteLearnTestPaperByIds" parameterType="String">
- delete from learn_test_paper where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="selectPapers" parameterType="java.util.Map" resultType="com.alibaba.fastjson2.JSONObject">
- SELECT
- t1.id,
- t1.batch_id batchId,
- t3.name batchName,
- t3.year batchYear,
- t1.build_type buildType,
- t1.subject_id subjectId,
- ds.subject_name subjectName,
- t1.exam_type examType,
- t1.teacher_id teacherId,
- t1.university_id universityId,
- t1.direct_key directKey,
- t1.paper_id paperId,
- t1.creator_id creatorId,
- t1.create_time createTime,
- t2.paperName,
- t2.year,
- t2.paperType,
- t2.number,
- t2.fenshu totalScore,
- t2.direct_key paperDirectKey,
- t2.paper_info paperInfo,
- t2.relate_id relateId
- FROM learn_test_paper t1
- JOIN learn_paper t2 ON t1.paper_id = t2.id
- JOIN dz_subject ds ON ds.subject_id = t1.subject_id
- JOIN learn_test t3 ON t1.batch_id = t3.batch_id
- WHERE 1=1
- <if test="creatorId != null and creatorId != ''">
- AND t1.creator_id = #{creatorId}
- </if>
- <if test="batchId != null and batchId != ''">
- AND t1.batch_id = #{batchId}
- </if>
- <if test="buildType != null and buildType != ''">
- AND t1.build_type = #{buildType}
- </if>
- <if test="examType != null and examType != ''">
- AND t1.exam_type = #{examType}
- </if>
- ORDER BY t1.create_time DESC
- </select>
- </mapper>
|