<?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.miaxis.school.mapper.SchoolClassTypeMapper">

    <resultMap type="SchoolClassType" id="SchoolClassTypeResult">
        <result property="id"    column="id"    />
        <result property="inscode"    column="inscode"    />
        <result property="className"    column="class_name"    />
        <result property="totalPrice"    column="total_price"    />
        <result property="train"    column="train"    />
        <result property="pxcx"    column="pxcx"    />
        <result property="payType"    column="pay_type"    />
        <result property="minPrice"    column="min_price"    />
        <result property="oneTime"    column="one_time"    />
        <result property="twoTime"    column="two_time"    />
        <result property="threeSimulationTime"    column="three_simulation_time"    />
        <result property="threePracticeTime"    column="three_practice_time"    />
        <result property="threeTheoryTime"    column="three_theory_time"    />
        <result property="photoUrl"    column="photo_url"    />
        <result property="regionId"    column="region_id"    />
        <result property="pdfUrl"    column="pdf_url"    />
        <result property="contractEndTime"    column="contract_end_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>


    <!--pc班型查询列表-->
    <select id="queryList" resultType="com.miaxis.school.vo.SchoolClassTypePcVO">
        SELECT
        sc.`id`,
        sc.`class_name` as className,
        sc.`total_price` as totalPrice,
        sc.`train`,
        sc.`pxcx`,
        sc.`pay_type` AS payType,
        sc.`create_time` as createTime
        FROM
        school_class_type sc
        JOIN school_info s ON s.inscode = sc.inscode
        <where>
            <if test="className != null  and className != ''"> and sc.`class_name` like concat('%', #{className}, '%')</if>
            <if test="totalPrice != null  and totalPrice != ''"> and sc.total_price = #{totalPrice}</if>
            <if test="train != null  and train != ''"> and sc.train = #{train}</if>
            <if test="payType != null  and payType != ''"> and sc.pay_type = #{payType}</if>
            <if test="pxcx != null  and pxcx != ''"> and sc.pxcx = #{pxcx}</if>
        </where>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
    </select>

</mapper>
