<?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.lz.modules.sys.dao.SysUserTokenDao">


    <insert id="insertBySysUserTokenEntity" parameterType="SysUserTokenEntity" useGeneratedKeys="true" keyProperty="id">
        insert into sys_user_token(
        <if test="userId != null">user_id,</if>
        <if test="token != null">token,</if>
        <if test="expireTime != null">expire_time,</if>
        <if test="type != null">type,</if>
        <if test="tokenCode != null">token_code,</if>
        <if test="codeTime != null">code_time,</if>
        update_time
        )values(
        <if test="userId != null">#{userId},</if>
        <if test="token != null">#{token},</if>
        <if test="expireTime != null">#{expireTime},</if>
        <if test="type != null">#{type},</if>
        <if test="tokenCode != null">tokenCode,</if>
        <if test="codeTime != null">codeTime,</if>
        now()
        )
    </insert>


    <select id="queryByToken" resultType="com.lz.modules.sys.entity.SysUserTokenEntity">
		select * from sys_user_token where token = #{value}
	</select>

    <select id="getByTokenCode" resultType="com.lz.modules.sys.entity.SysUserTokenEntity">
		select * from sys_user_token where token_code = #{code}
	</select>

</mapper>
