| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?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.dz.mapper.DzSubjectMapper">
- <resultMap type="DzSubject" id="DzSubjectResult">
- <result property="subjectId" column="subject_id" />
- <result property="subjectName" column="subject_name" />
- <result property="pinyin" column="pinyin" />
- <result property="sort" column="sort" />
- <result property="locations" column="locations" />
- <result property="examTypes" column="exam_types" />
- <result property="groupName" column="group_name" />
- </resultMap>
- <sql id="selectDzSubjectVo">
- select subject_id, subject_name, pinyin, sort, locations, exam_types, group_name from dz_subject
- </sql>
- <select id="selectDzSubjectBySubjectIds" resultMap="DzSubjectResult">
- <include refid="selectDzSubjectVo"/>
- where subject_id in <foreach item="subjectId" collection="array" open="(" separator="," close=")">#{subjectId}</foreach>
- </select>
- <select id="selectWrongSubjectList" parameterType="Long" resultMap="DzSubjectResult">
- SELECT s.subject_id, s.subject_name FROM `learn_wrong_book` wb JOIN dz_subject s ON wb.`subject_id` = s.`subject_id`
- WHERE wb.`student_id` = #{studentId}
- </select>
- <select id="selectDzSubjectList" parameterType="DzSubject" resultMap="DzSubjectResult">
- <include refid="selectDzSubjectVo"/>
- <where>
- <if test="subjectName != null and subjectName != ''"> and subject_name like concat('%', #{subjectName}, '%')</if>
- <if test="pinyin != null and pinyin != ''"> and pinyin = #{pinyin}</if>
- <if test="sort != null "> and sort = #{sort}</if>
- <if test="locations != null and locations != ''"> and locations = #{locations}</if>
- <if test="examTypes != null and examTypes != ''"> and exam_types like concat('%', #{examTypes}, '%') </if>
- </where>
- order by `sort`, subject_id
- </select>
- <select id="selectDzSubjectBySubjectId" parameterType="Long" resultMap="DzSubjectResult">
- <include refid="selectDzSubjectVo"/>
- where subject_id = #{subjectId}
- </select>
- <insert id="insertDzSubject" parameterType="DzSubject">
- insert into dz_subject
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="subjectId != null">subject_id,</if>
- <if test="subjectName != null">subject_name,</if>
- <if test="pinyin != null">pinyin,</if>
- <if test="sort != null">sort,</if>
- <if test="locations != null">locations,</if>
- <if test="examTypes != null">exam_types,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="subjectId != null">#{subjectId},</if>
- <if test="subjectName != null">#{subjectName},</if>
- <if test="pinyin != null">#{pinyin},</if>
- <if test="sort != null">#{sort},</if>
- <if test="locations != null">#{locations},</if>
- <if test="examTypes != null">#{examTypes},</if>
- </trim>
- </insert>
- <update id="updateDzSubject" parameterType="DzSubject">
- update dz_subject
- <trim prefix="SET" suffixOverrides=",">
- <if test="subjectName != null">subject_name = #{subjectName},</if>
- <if test="pinyin != null">pinyin = #{pinyin},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="locations != null">locations = #{locations},</if>
- <if test="examTypes != null">exam_types = #{examTypes},</if>
- </trim>
- where subject_id = #{subjectId}
- </update>
- <delete id="deleteDzSubjectBySubjectId" parameterType="Long">
- delete from dz_subject where subject_id = #{subjectId}
- </delete>
- <delete id="deleteDzSubjectBySubjectIds" parameterType="String">
- delete from dz_subject where subject_id in
- <foreach item="subjectId" collection="array" open="(" separator="," close=")">
- #{subjectId}
- </foreach>
- </delete>
- </mapper>
|