<?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.yzt.airconditionersystem.mapper.UserMapper">

    <resultMap id="BaseResultMap" type="com.yzt.airconditionersystem.bean.User">
            <id property="id" column="id" jdbcType="VARCHAR"/>
            <result property="username" column="username" jdbcType="VARCHAR"/>
            <result property="password" column="password" jdbcType="VARCHAR"/>
            <result property="roleId" column="role_id" jdbcType="INTEGER"/>
            <result property="companyId" column="company_id" jdbcType="INTEGER"/>
    </resultMap>

    <sql id="Base_Column_List">
        id,username,password,
        role_id,company_id
    </sql>
    <select id="selectOneByUsernameAndPassword" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from user
        where
        username = #{username,jdbcType=VARCHAR}
        AND password = #{password,jdbcType=VARCHAR}
    </select>
    <select id="selectOneByUsername" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from user
        where
        username = #{username,jdbcType=VARCHAR}
    </select>
</mapper>
