package com.mandi.system.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.mandi.system.persist.Login;


/** 
 * Function: TODO <br/> 
 * Date:     2017年1月11日 上午9:20:53 <br/> 
 * @author   guolq        
 */
public interface LoginMapper {
	@Insert("insert into fd_login_log(depart,departname,ipaddr,loginside,logintime,logouttime,macaddr,note,userid,username,sysDepartName,workername,sysDepartID,sdepartNo) values (#{depart},#{departname},#{ipaddr},#{loginside},#{logintime},#{logouttime},#{macaddr},#{note},#{userid},#{username},#{sysDepartName},#{workername},#{sysDepartID},#{sdepartNo})")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	public int insert(Login l);
	@Update("update fd_login_log set depart=#{depart},departname=#{departname},ipaddr=#{ipaddr},loginside=#{loginside},logintime=#{logintime},logouttime=#{logouttime},macaddr=#{macaddr},note=#{note},userid=#{userid},username=#{username},sysDepartName=#{sysDepartName},workername=#{workername},sysDepartID=#{sysDepartID},sdepartNo=#{sdepartNo} where id=#{id}")
	public int update(Login l);
	@Update("update fd_login_log set logouttime=getdate() where id=#{id}")
	public int logout(long id);
	@Select("select * from fd_login_log where id=#{id} ")
	public Login getbyId(long id);
	@Delete("delete from fd_login_log where id=#{id} ")
	public int delbyId(long id);
}