informationMapper.xml 3.42 KB
<?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 &gt;  NOW())
        ORDER BY t.`start_dt`

    </select>
    <select id="categoryDetail" resultType="java.util.HashMap">
       SELECT
            i.id,
            i.title,
            i.icon_url AS iconUrl
        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
        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>