fuliqi
2024-10-17 8546b3d285af4235a0ef615a0c6e89486ae2c806
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
66
67
68
69
70
71
72
73
74
75
76
77
78
<?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.ycl.jxkg.mapper.MeetMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.entity.Meet">
        <result column="meet_name" property="meetName" />
        <result column="meet_cover" property="meetCover" />
        <result column="classes_id" property="classesId" />
        <result column="create_user" property="createUser" />
        <result column="start_time" property="startTime" />
        <result column="end_time" property="endTime" />
        <result column="status" property="status" />
    </resultMap>
 
 
    <select id="getById" resultMap="BaseResultMap">
        SELECT
            TM.meet_name,
            TM.meet_cover,
            TM.classes_id,
            TM.create_user,
            TM.start_time,
            TM.end_time,
            TM.status,
            TM.id
        FROM
            t_meet TM
        WHERE
            TM.id = #{id} AND TM.deleted = 0
    </select>
 
 
    <select id="getPage" resultType="com.ycl.jxkg.domain.vo.MeetVO">
        SELECT
            TM.meet_name,
            TM.meet_cover,
            TM.classes_id,
            TM.create_user,
            TU.user_name as teacherName,
            TM.start_time,
            TM.end_time,
            TM.status,
            TM.id
        FROM
            t_meet TM left join t_user TU on TM.create_user = TU.id
        <where>
            TM.deleted = 0
            <if test="query.classesIds !=null">
                and classes_id in
                <foreach collection="query.classesIds" item="classesId" open="(" close=")" separator=",">
                    #{classesId}
                </foreach>
            </if>
            <if test="query.teacherId!=null">
                and TM.create_user = #{query.teacherId}
            </if>
            <if test="query.status!=null">
                and TM.status = #{query.status}
            </if>
            <if test="query.meetName !=null and query.meetName!='' ">
                and TM.meet_name like concat ('%',#{query.meetName},'%')
            </if>
        </where>
    </select>
 
    <select id="getStudentList" resultType="com.ycl.jxkg.domain.vo.StudentSimpleVO">
        SELECT
            s.real_name, s.id
        FROM
            t_meet m
        INNER JOIN t_classes c ON m.classes_id = c.id AND m.id = #{meetId} AND c.deleted = 0 AND m.deleted = 0
        INNER JOIN t_classes_user cu ON cu.classes_id = c.id AND cu.deleted = 0
        INNER JOIN t_user s ON s.id = cu.user_id AND s.deleted = 0
        <if test="keyword != null and keyword != ''">AND s.real_name like concat('%', #{keyword}, '%')</if>
    </select>
 
</mapper>