<?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.hc.business.mapper.ZccmClassConfigMapper">

    <resultMap type="zccmclassConfig" id="ClassConfigMap">
        <result property="classConfigId" column="class_config_id" jdbcType="INTEGER"/>
        <result property="className" column="class_name" jdbcType="VARCHAR"/>
        <result property="classDesc" column="class_desc" jdbcType="VARCHAR"/>
        <result property="classType" column="class_type" jdbcType="INTEGER"/>
        <result property="classLogo" column="class_logo" jdbcType="VARCHAR"/>
        <result property="areaId" column="area_id" jdbcType="INTEGER"/>
        <result property="bxHours" column="bx_hours" jdbcType="FLOAT"/>
        <result property="xxHours" column="xx_hours" jdbcType="FLOAT"/>
        <result property="paperHours" column="paper_hours" jdbcType="FLOAT"/>
        <result property="paperId" column="paper_id" jdbcType="INTEGER"/>
        <result property="createTime" column="create_time" jdbcType="INTEGER"/>
        <result property="years" column="years" jdbcType="VARCHAR"/>
        <result property="price" column="price" jdbcType="NUMERIC"/>
        <result property="applyStartTime" column="apply_start_time" jdbcType="INTEGER"/>
        <result property="applyEndTime" column="apply_end_time" jdbcType="INTEGER"/>
        <result property="studyStartTime" column="study_start_time" jdbcType="INTEGER"/>
        <result property="studyEndTime" column="study_end_time" jdbcType="INTEGER"/>
        <result property="paperStartTime" column="paper_start_time" jdbcType="INTEGER"/>
        <result property="paperEndTime" column="paper_end_time" jdbcType="INTEGER"/>
        <result property="certStartTime" column="cert_start_time" jdbcType="INTEGER"/>
        <result property="certEndTime" column="cert_end_time" jdbcType="INTEGER"/>
        <result property="needPaper" column="need_paper" jdbcType="INTEGER"/>
        <result property="valid" column="valid" jdbcType="INTEGER"/>
        <result property="classContent" column="class_content" jdbcType="VARCHAR"/>
        <result property="classMobileContent" column="class_mobile_content" jdbcType="VARCHAR"/>
        <result property="signTime" column="sign_time" jdbcType="BIGINT"/>
        <result property="prefix" column="prefix" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        class_config_id,
           class_name,
           class_desc,
           class_type,
           class_logo,
           class_content,
           class_mobile_content,
           area_id,
           bx_hours,
           xx_hours,
           paper_hours,
           paper_id,
           create_time,
           years,
           price,
           apply_start_time,
           apply_end_time,
           study_start_time,
           study_end_time,
           paper_start_time,
           paper_end_time,
           cert_start_time,
           cert_end_time,
           need_paper,
           valid,
           sign_time,
           prefix
    </sql>

    <select id="queryByValid" resultMap="ClassConfigMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM zccm_class_config
        WHERE valid = #{valid}
        ORDER BY create_time DESC
    </select>

    <select id="queryByAreaId" resultMap="ClassConfigMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM zccm_class_config
        WHERE area_id = #{areaId}
        ORDER BY class_config_id DESC
    </select>

    <select id="queryByTime" resultMap="ClassConfigMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM zccm_class_config
        WHERE study_start_time = #{studyStartTime}
        ORDER BY class_config_id DESC
    </select>

    <select id="queryByClassName" resultMap="ClassConfigMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM zccm_class_config
        WHERE class_name LIKE "%"#{name}"%"
        ORDER BY class_config_id DESC
    </select>

    <select id="queryAll" resultMap="ClassConfigMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM zccm_class_config
        ORDER BY class_config_id DESC
    </select>

</mapper>