informationMapper.xml
3.48 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?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.server.web.common.mapping.InformationMapper">
    <select id="livingCourse" parameterType="java.util.HashMap" resultType="java.util.HashMap">
        SELECT
        t.`pic_url` as picUrl,
        t.`course_name` as courseName,
        t.`start_dt` AS startDt,
        t.`end_dt` AS endDt,
        t.id
        FROM
        t_kzy_course t
        WHERE t.`is_delete` = 0
        AND t.`is_up` = 1
        AND t.`course_type`=1
        AND (t.end_dt is null or t.end_dt >  NOW())
        ORDER BY t.`start_dt`
    </select>
    <select id="categoryDetail" resultType="java.util.HashMap">
       SELECT
            i.id,
            i.title,
            i.icon_url AS iconUrl,
            i.is_file AS isFile
        FROM
            t_kzy_relation_class rc
        LEFT JOIN t_kzy_information i ON rc.relation_id = i.id
        WHERE
            i.is_delete = 0 AND rc.type=2
        AND rc.first_class_id = #{firstId,jdbcType=BIGINT}
        GROUP BY i.id
        ORDER BY
            i.id DESC
        LIMIT 0,
         2
    </select>
    <select id="secondClassDetailInformation" resultType="java.util.HashMap">
      SELECT
            i.id,
            i.title,
            i.icon_url AS iconUrl,
            i.create_dt AS createDt,
            1 AS classType,
            i.is_file AS isFile
        FROM
            t_kzy_relation_class rc
        LEFT JOIN t_kzy_information i ON rc.relation_id = i.id
        LEFT JOIN t_base_second_class sc ON rc.second_class_id = sc.id AND sc.type = 1
        WHERE
            i.is_delete = 0
            AND sc.type = 1
        AND rc.second_class_id = #{secondId,jdbcType=BIGINT}
        ORDER BY
            i.id DESC
        LIMIT ${start},${pageSize}
    </select>
    <select id="secondClassDetailInformationTotal" resultType="java.lang.Integer">
      SELECT
            count(i.id)
        FROM
            t_kzy_relation_class rc
        LEFT JOIN t_kzy_information i ON rc.relation_id = i.id
        LEFT JOIN t_base_second_class sc ON rc.second_class_id = sc.id AND sc.type = 1
        WHERE
            i.is_delete = 0
            AND sc.type = 1
        AND rc.second_class_id = #{secondId,jdbcType=BIGINT}
    </select>
    <select id="secondClassDetailCourse" resultType="java.util.HashMap">
       SELECT
	        c.id,
            c.course_name AS title,
            c.pic_url AS iconUrl,
            c.create_dt AS createDt,
            2 AS classType,
            c.course_type AS courseType
        FROM
            t_kzy_relation_class rc
        LEFT JOIN t_kzy_course c ON rc.relation_id = c.id
        LEFT JOIN t_base_second_class sc ON rc.second_class_id = sc.id
        WHERE
            c.is_delete = 0
            AND sc.type <![CDATA[ >= ]]> 2
            AND c.is_up = 1
        AND rc.second_class_id = #{secondId,jdbcType=BIGINT}
        ORDER BY
            c.id DESC
        LIMIT ${start},${pageSize}
    </select>
    <select id="secondClassDetailCourseTotal" resultType="java.lang.Integer">
       SELECT
	        count(c.id)
        FROM
            t_kzy_relation_class rc
        LEFT JOIN t_kzy_course c ON rc.relation_id = c.id
        LEFT JOIN t_base_second_class sc ON rc.second_class_id = sc.id
        WHERE
            c.is_delete = 0
            AND sc.type <![CDATA[ >= ]]> 2
            AND c.is_up = 1
        AND rc.second_class_id = #{secondId,jdbcType=BIGINT}
    </select>
</mapper>