<?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.koobietech.eas.dao.mapper.UserProFileMapper">

    <update id="updateUserProFile" parameterType="com.koobietech.eas.dao.pojo.UserProFilePojo">
        UPDATE eas_sys_userinfo SET
            relname = #{name},
            email = #{email},
        <if test="passwd != null">
            passwd = #{passwd},
        </if>
            phone = #{phone}
        WHERE id = #{id}
    </update>

    <select id="getUserProFile" resultType="com.koobietech.eas.dao.pojo.UserProFilePojo">
        SELECT
            id,
            relname AS `name`,
            email,
            phone
        FROM
            eas_sys_userinfo
        WHERE id = #{uid}
    </select>

    <select id="getStudentProFile" resultType="com.koobietech.eas.dao.pojo.UserProFilePojo">
        SELECT
            id,
            student_name AS `name`,
            email,
            phone
        FROM
            eas_sys_student
        WHERE id = #{uid}
    </select>

    <update id="updateStudentProFile" parameterType="com.koobietech.eas.dao.pojo.UserProFilePojo">
        UPDATE eas_sys_student SET
            student_name = #{name},
            email = #{email},
        <if test="passwd != null">
            passwd = #{passwd},
        </if>
            phone = #{phone}
        WHERE id = #{id}
    </update>

</mapper>