<?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="userLoginSqlMapper">

<!--mybatis ehcache缓存配置  -->
<!-- 以下两个<cache>标签二选一,第一个可以输出日志,第二个不输出日志 
<cache type="org.mybatis.caches.ehcache.LoggingEhcache" />-->
<!-- <cache type="org.mybatis.caches.ehcache.EhcacheCache"/> -->
	<!-- 以下与实体类的中字段一致 -->
	<sql id="selectId">
		loginId,
		userId,
		userName,
		loginTime,
		loginIP
	</sql>
	
	<!--resultType="Account" 每返回一条结果封装到Account里 -->
	<select id="query" resultType="com.cloudcross.ssp.model.UserLogin" parameterType="java.util.HashMap">
		select
		<include refid="selectId" />
		from t_userloginlist where 1=1
		
	</select>
	
	<select id="getById" resultType="com.cloudcross.ssp.model.UserLogin" parameterType="String">
		select
		loginId,
		userId,
		userName,
		max(loginTime) as loginTime,
		loginIP
		from t_userloginlist where 1=1
		and t_userloginlist.userId = #{id}
	</select>
	<!-- 增加用户 -->
	<insert id="add" parameterType="com.cloudcross.ssp.model.UserLogin">
		insert into t_userloginlist ( userId,userName,
		loginIP)
		values (#{userId},#{userName},
		#{loginIP})
	</insert>

	
</mapper>