<?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.xinelu.applet.mapper.personappletlogin.PersonAppletLoginMapper">

    <select id="selectSysUser" resultType="com.xinelu.applet.vo.personappletlogin.UserAndRole">
        select su.user_id,
               su.phonenumber,
               sr.role_name,
               sr.role_key,
               su.nurse_station_ids
        from sys_user su
                 left join sys_user_role sur ON sur.user_id = su.user_id
                 left join sys_role sr ON sr.role_id = sur.role_id
        where su.phonenumber = #{phone}
          and su.del_flag = 0
    </select>

    <select id="getNurseStationPersonByPhone"
            resultType="com.xinelu.applet.vo.personappletlogin.PersonAppletVO">
        select id nurseStationPersonId,
        nurse_station_id,
        department_code,
        user_id,
        nurse_person_code,
        nurse_person_name,
        nurse_person_type,
        sex,
        phone,
        address,
        birth_date,
        openid,
        unionid,
        evaluate_star_count,
        positional_title_level,
        genius_item,
        total_revenue_amount,
        work_status,
        modify_check_status,
        positional_title_level_check,
        genius_item_check,
        modify_info_flag,
        create_by,
        create_time,
        update_by,
        update_time
        from nurse_station_person
        <where>
            <if test="phone != null and phone != ''">
                phone = #{phone}
            </if>
        </where>
    </select>
</mapper>