龚焕茏
2024-07-03 3ec909b27b3eba956aa9d00cc7a94c179bd04bbf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?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.mindskip.xzs.repository.SelfPracticeMapper">
 
 
    <insert id="add" keyColumn="id" useGeneratedKeys="true" parameterType="com.mindskip.xzs.domain.SelfPractice">
        INSERT INTO
            t_self_practice(user_id, remark, subjects, practice_type, create_time, update_time, question_type, deleted, practice_mode)
        VALUE
            (#{userId}, #{remark}, #{subjects}, #{practiceType}, #{createTime}, #{updateTime}, #{questionType}, #{deleted}, #{practiceMode})
    </insert>
 
    <select id="page" resultType="com.mindskip.xzs.domain.vo.SelfPracticeVO">
        SELECT
               id,
               user_id as userId,
               remark,
               subjects as subjectString,
               practice_type as practiceType,
               create_time createTime,
               update_time as updateTime,
               question_type as questionType,
               practice_mode as practiceMode
        FROM
             t_self_practice
        <where>
            <if test="query.userId != null">
                AND user_id = #{query.userId}
            </if>
            AND deleted = 0
        </where>
        ORDER BY create_time DESC
    </select>
 
    <update id="remove">
        UPDATE
            t_self_practice
        SET deleted = 1
        WHERE
              id IN <foreach collection="ids" open="(" separator="," close=")" item="id">#{id}</foreach>
    </update>
 
    <select id="selectById" resultType="com.mindskip.xzs.domain.SelfPractice">
        SELECT
            id,
            user_id as userId,
            remark,
            subjects as subjects,
            practice_type as practiceType,
            create_time createTime,
            update_time as updateTime,
            question_type as questionType,
            practice_mode as practiceMode
        FROM
             t_self_practice
        WHERE
              id = #{id}
    </select>
 
    <update id="setQuestionIds">
        UPDATE t_self_practice SET question_ids = #{questionIds} WHERE id = #{id}
    </update>
 
 
</mapper>