package com.huiju.estateagents.center.sysUser.service.impl;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huiju.estateagents.center.sysUser.entity.SysToken;
import com.huiju.estateagents.center.sysUser.mapper.SysTokenMapper;
import com.huiju.estateagents.center.sysUser.service.ISysTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 * 令牌表  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-09-11
 */
@Service
public class SysTokenServiceImpl extends ServiceImpl<SysTokenMapper, SysToken> implements ISysTokenService {
	
	@Autowired
	private SysTokenMapper sysTokenMapper;
	
	@Override
	public SysToken saveToken(String token) {
		SysToken sysToken = new SysToken();
		sysToken.setToken(token);
		sysToken.setExpDate(LocalDateTime.now().plusDays(7));
		sysTokenMapper.insert(sysToken);
		return sysToken;
	}
}
