| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <?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.LearnPaperMapper">
- <resultMap type="LearnPaper" id="LearnPaperResult">
- <result property="id" column="id" />
- <result property="subjectId" column="subjectId" />
- <result property="paperName" column="paperName" />
- <result property="year" column="year" />
- <result property="paperType" column="paperType" />
- <result property="status" column="status" />
- <result property="number" column="number" />
- <result property="fenshu" column="fenshu" />
- <result property="paperSource" column="paperSource" />
- <result property="directKey" column="direct_key" />
- <result property="tiid" column="tiid" />
- <result property="osspath" column="osspath" />
- <result property="filename" column="filename" />
- <result property="relateId" column="relate_id" />
- <result property="locations" column="locations" />
- <result property="examineeTypes" column="examineeTypes" />
- <result property="createTime" column="createTime" />
- </resultMap>
- <sql id="selectLearnPaperVo">
- select id, subjectId, paperName, year, paperType, number, fenshu, paperSource, direct_key, tiid, osspath, filename, relate_id, locations, examineeTypes, createTime from learn_paper
- </sql>
- <select id="selectLearnPaperList" parameterType="LearnPaper" resultMap="LearnPaperResult">
- <include refid="selectLearnPaperVo"/>
- <where>
- <if test="subjectId != null "> and subjectId = #{subjectId}</if>
- <if test="paperName != null and paperName != ''"> and paperName like concat('%', #{paperName}, '%')</if>
- <if test="year != null "> and year = #{year}</if>
- <if test="paperType != null and paperType != ''"> and paperType = #{paperType}</if>
- <if test="status != null"> and status = #{status}</if>
- <if test="number != null and number != ''"> and number = #{number}</if>
- <if test="fenshu != null "> and fenshu = #{fenshu}</if>
- <if test="paperSource != null "> and paperSource = #{paperSource}</if>
- <if test="directKey != null and directKey != ''"> and direct_key = #{directKey}</if>
- <if test="tiid != null and tiid != ''"> and tiid = #{tiid}</if>
- <if test="osspath != null and osspath != ''"> and osspath = #{osspath}</if>
- <if test="filename != null and filename != ''"> and filename like concat('%', #{filename}, '%')</if>
- <if test="relateId != null "> and relate_id = #{relateId}</if>
- <if test="locations != null and locations != ''"> and locations = #{locations}</if>
- <if test="examineeTypes != null and examineeTypes != ''"> and examineeTypes = #{examineeTypes}</if>
- <if test="createTime != null "> and createTime = #{createTime}</if>
- </where>
- </select>
- <select id="selectLearnPaperForStudent" resultMap="LearnPaperResult">
- SELECT p.*
- FROM `learn_test_student` ts JOIN `learn_paper` p on ts.paper_id = p.id
- <where> ts.student_id = #{studentId}
- <if test="status != null "> and ts.status = #{status}</if>
- </where>
- </select>
- <select id="selectLearnPaperById" parameterType="Long" resultMap="LearnPaperResult">
- <include refid="selectLearnPaperVo"/>
- where id = #{id}
- </select>
- <insert id="insertLearnPaper" parameterType="LearnPaper" useGeneratedKeys="true" keyProperty="id">
- insert into learn_paper
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="subjectId != null">subjectId,</if>
- <if test="paperName != null">paperName,</if>
- <if test="year != null">year,</if>
- <if test="paperType != null">paperType,</if>
- <if test="status != null">status,</if>
- <if test="number != null">number,</if>
- <if test="fenshu != null">fenshu,</if>
- <if test="paperSource != null">paperSource,</if>
- <if test="directKey != null and directKey != ''">direct_key,</if>
- <if test="tiid != null">tiid,</if>
- <if test="osspath != null">osspath,</if>
- <if test="filename != null">filename,</if>
- <if test="relateId != null">relate_id,</if>
- <if test="locations != null">locations,</if>
- <if test="examineeTypes != null">examineeTypes,</if>
- <if test="createTime != null">createTime,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="subjectId != null">#{subjectId},</if>
- <if test="paperName != null">#{paperName},</if>
- <if test="year != null">#{year},</if>
- <if test="paperType != null">#{paperType},</if>
- <if test="status != null">#{status},</if>
- <if test="number != null">#{number},</if>
- <if test="fenshu != null">#{fenshu},</if>
- <if test="paperSource != null">#{paperSource},</if>
- <if test="directKey != null and directKey != ''">#{directKey},</if>
- <if test="tiid != null">#{tiid},</if>
- <if test="osspath != null">#{osspath},</if>
- <if test="filename != null">#{filename},</if>
- <if test="relateId != null">#{relateId},</if>
- <if test="locations != null">#{locations},</if>
- <if test="examineeTypes != null">#{examineeTypes},</if>
- <if test="createTime != null">#{createTime},</if>
- </trim>
- </insert>
- <update id="updateLearnPaper" parameterType="LearnPaper">
- update learn_paper
- <trim prefix="SET" suffixOverrides=",">
- <if test="subjectId != null">subjectId = #{subjectId},</if>
- <if test="paperName != null">paperName = #{paperName},</if>
- <if test="year != null">year = #{year},</if>
- <if test="paperType != null">paperType = #{paperType},</if>
- <if test="status != null">status = #{status},</if>
- <if test="number != null">number = #{number},</if>
- <if test="fenshu != null">fenshu = #{fenshu},</if>
- <if test="paperSource != null">paperSource = #{paperSource},</if>
- <if test="directKey != null and directKey != ''">direct_key = #{directKey},</if>
- <if test="tiid != null">tiid = #{tiid},</if>
- <if test="osspath != null">osspath = #{osspath},</if>
- <if test="filename != null">filename = #{filename},</if>
- <if test="relateId != null">relate_id = #{relateId},</if>
- <if test="locations != null">locations = #{locations},</if>
- <if test="examineeTypes != null">examineeTypes = #{examineeTypes},</if>
- <if test="createTime != null">createTime = #{createTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteLearnPaperById" parameterType="Long">
- delete from learn_paper where id = #{id}
- </delete>
- <delete id="deleteLearnPaperByIds" parameterType="String">
- delete from learn_paper where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="selectPapersListFromFavorites" parameterType="LearnPaper" resultMap="LearnPaperResult">
- select p.*,0 readNum from b_customer_favorites f
- left join learn_paper p on f.refId = p.id
- where f.type = 'paper' and f.customercode = #{examineeId} and f.course = #{subjectId} <if test="collect "> and f.status = 1</if>
- </select>
- </mapper>
|