<?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.template.mapper.SmartVisitorParentsConfigMapper">

    <select id="getClassIdPage" resultType="com.template.model.vo.SmartVisitorParentsConfigVo">
        SELECT
        svpc.id,
        svpc.class_id as classId,
        svpc.app_audit_config as appAuditConfig,
        svpc.app_push_config as appPushConfig,
        svpc.app_cancel_config as appCancelConfig,
        svpc.screen_audit_config as screenAuditConfig,
        svpc.screen_push_config as screenPushConfig,
        svpc.screen_cancel_config as screenCancelConfig,
        svpc.access_config as accessConfig,
        svpc.car_config as carConfig,
        svpc.create_time as createTime,
        sc.`name` as className,
        sg.`name` as gradeName
        FROM
        `smart_visitor_parents_config` svpc
        LEFT JOIN smart_class sc ON svpc.class_id = sc.id
        LEFT JOIN smart_grade sg ON sc.grade_id = sg.id
        WHERE svpc.deleted=0
        <if test="classId != null and classId != '' and classId != 0 ">
            and svpc.class_id = #{classId}
        </if>
        <if test="gradeId != null and gradeId != '' and gradeId != 0 ">
            and sc.grade_id=#{gradeId}
        </if>
    </select>

    <select id="getClassId" resultType="com.template.model.vo.SmartVisitorParentsConfigVo">
        SELECT svpc.id,
               svpc.class_id             as classId,
               svpc.app_audit_config     as appAuditConfig,
               svpc.app_push_config      as appPushConfig,
               svpc.app_cancel_config    as appCancelConfig,
               svpc.screen_audit_config  as screenAuditConfig,
               svpc.screen_push_config   as screenPushConfig,
               svpc.screen_cancel_config as screenCancelConfig,
               svpc.access_config        as accessConfig,
               svpc.car_config           as carConfig,
               svpc.create_time          as createTime,
               sc.`name`                 as className,
               sg.`name`                 as gradeName
        FROM `smart_visitor_parents_config` svpc
                 LEFT JOIN smart_class sc ON svpc.class_id = sc.id
                 LEFT JOIN smart_grade sg ON sc.grade_id = sg.id
        WHERE svpc.deleted = 0
          and svpc.class_id = #{schoolClass}
    </select>
</mapper>
