<?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="org.dromara.system.mapper.RegisterTeacherMapper">
    <resultMap type="org.dromara.system.domain.vo.RegisterTeacherVo" id="RegisterTeacherResult">
        <result property="id"    column="id"    />
        <result property="openId"    column="open_id"    />
        <result property="schoolId"    column="school_id"    />
        <result property="schoolName"    column="school_name"    />
        <result property="userName"    column="user_name"    />
        <result property="userPhone"    column="user_phone"    />
        <result property="isPass"    column="is_pass"    />
        <result property="auditId"    column="audit_id"    />
        <result property="auditUser"    column="audit_user"    />
        <result property="opinion"    column="opinion"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectRegisterTeacherVo">
        select id,open_id, school_id, school_name, user_name, user_phone, is_pass,audit_id,audit_user,opinion, create_by, create_time, update_by, update_time, remark from register_teacher
    </sql>

    <select id="selectRegisterTeacherByOppenId" resultMap="RegisterTeacherResult" parameterType="java.lang.String">
        <include refid="selectRegisterTeacherVo"/>
        where  open_id = #{openId} limit 1
    </select>

    <select id="selectListZ" resultMap="RegisterTeacherResult">
        <include refid="selectRegisterTeacherVo"/>
        ${ew.getCustomSqlSegment}
    </select>

    <select id="selectRegisterTeacherByPhonenumber" resultMap="RegisterTeacherResult">
        <include refid="selectRegisterTeacherVo"/>
        where  user_phone = #{phonenumber} limit 1
    </select>

    <select id="selectRegisterTeacherListByTime" resultMap="RegisterTeacherResult">
        <include refid="selectRegisterTeacherVo"/>
        where date_format(create_time,'%Y%m') = date_format(#{monthFirst},'%Y%m')
        and school_id = #{deptId}
    </select>

</mapper>
