108 lines
3.9 KiB
XML
108 lines
3.9 KiB
XML
<?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.lovenav.dao.LoginLogsDao">
|
|
<resultMap id="BaseResultMap" type="com.lovenav.entity.LoginLogs">
|
|
<id column="id" jdbcType="INTEGER" property="id" />
|
|
<result column="login_ip" jdbcType="VARCHAR" property="loginIp" />
|
|
<result column="user_id" jdbcType="INTEGER" property="userId" />
|
|
<result column="login_time" jdbcType="TIMESTAMP" property="loginTime" />
|
|
<result column="location" jdbcType="VARCHAR" property="location" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
id, login_ip, user_id, login_time, `location`
|
|
</sql>
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from ln_login_logs
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</select>
|
|
<select id="selectAlreadyExist" resultType="com.lovenav.entity.LoginLogs">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from ln_login_logs
|
|
where user_id = #{userId,jdbcType=INTEGER}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
delete from ln_login_logs
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</delete>
|
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.LoginLogs" useGeneratedKeys="true">
|
|
insert into ln_login_logs (login_ip, user_id, login_time,
|
|
`location`)
|
|
values (#{loginIp,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER}, #{loginTime,jdbcType=TIMESTAMP},
|
|
#{location,jdbcType=VARCHAR})
|
|
</insert>
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.LoginLogs" useGeneratedKeys="true">
|
|
insert into ln_login_logs
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="loginIp != null">
|
|
login_ip,
|
|
</if>
|
|
<if test="userId != null">
|
|
user_id,
|
|
</if>
|
|
<if test="loginTime != null">
|
|
login_time,
|
|
</if>
|
|
<if test="location != null">
|
|
`location`,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="loginIp != null">
|
|
#{loginIp,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userId != null">
|
|
#{userId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="loginTime != null">
|
|
#{loginTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="location != null">
|
|
#{location,jdbcType=VARCHAR},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.lovenav.entity.LoginLogs">
|
|
update ln_login_logs
|
|
<set>
|
|
<if test="loginIp != null">
|
|
login_ip = #{loginIp,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userId != null">
|
|
user_id = #{userId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="loginTime != null">
|
|
login_time = #{loginTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="location != null">
|
|
`location` = #{location,jdbcType=VARCHAR},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.lovenav.entity.LoginLogs">
|
|
update ln_login_logs
|
|
set login_ip = #{loginIp,jdbcType=VARCHAR},
|
|
user_id = #{userId,jdbcType=INTEGER},
|
|
login_time = #{loginTime,jdbcType=TIMESTAMP},
|
|
`location` = #{location,jdbcType=VARCHAR}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByUserId" parameterType="com.lovenav.entity.LoginLogs">
|
|
update ln_login_logs
|
|
<set>
|
|
<if test="loginIp != null">
|
|
login_ip = #{loginIp,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="loginTime != null">
|
|
login_time = #{loginTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="location != null">
|
|
`location` = #{location,jdbcType=VARCHAR},
|
|
</if>
|
|
</set>
|
|
where user_id = #{userId,jdbcType=INTEGER}
|
|
</update>
|
|
</mapper> |