package cn.hnthyy.thmz.mapper.thmz;


import cn.hnthyy.thmz.entity.thmz.Token;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 门诊系统token记录表
 */
public interface TokenMapper {
    /**
     * 新增Token记录
     * @param token
     * @return
     */
    @Insert("INSERT INTO t_token(token, dead_time, create_time) VALUES (#{token,jdbcType=VARCHAR},  #{deadTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int insertToken(Token token);


    /**
     * 查询所有的token记录
     * @return
     */
    @Select("select id,token,dead_time,create_time from t_token")
    List<Token> selectAll();

    /**
     * 删除记录
     * @param id 主键
     * @return
     */
    @Delete("delete from t_token where  id = #{id}")
    int deleteById(@Param("id") Long id);
}
