package com.autumnframework.common.dao.bomapper;

import com.autumnframework.common.model.po.LoginInfo;
import com.autumnframework.common.model.vo.AreaView;
import com.autumnframework.common.model.vo.ChartsView;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface LoginInfoMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table af_logininfo
     *
     * @mbg.generated Tue Oct 31 19:49:31 CST 2017
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table af_logininfo
     *
     * @mbg.generated Tue Oct 31 19:49:31 CST 2017
     */
    int insert(LoginInfo record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table af_logininfo
     *
     * @mbg.generated Tue Oct 31 19:49:31 CST 2017
     */
    int insertSelective(LoginInfo record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table af_logininfo
     *
     * @mbg.generated Tue Oct 31 19:49:31 CST 2017
     */
    LoginInfo selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table af_logininfo
     *
     * @mbg.generated Tue Oct 31 19:49:31 CST 2017
     */
    int updateByPrimaryKeySelective(LoginInfo record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table af_logininfo
     *
     * @mbg.generated Tue Oct 31 19:49:31 CST 2017
     */
    int updateByPrimaryKey(LoginInfo record);
    /**
     * 获取所有登录信息
     * @param start
     * @param limit
     * @return
     */
    List<LoginInfo> selectAllLoginInfo(@Param("start") int start, @Param("limit") int limit);

    /**
     * 获取某用户登录信息
     * @param username
     * @param start
     * @param limit
     * @return
     */
    List<LoginInfo> selectLoginInfoByUserName(@Param("username") String username, @Param("start") int start, @Param("limit") int limit);

    int getAllLoginInfoConut();
    int getUserLoginInfoConut(@Param("username") String username);
    List<ChartsView> getLoginInfoCharts();


    /**
     * 获得今日的访问量
     * @return
     */
    int getNowCount();

    /**
     * 获得昨日访问量
     * @return
     */
    int getYesterdayCount();

    /**
     * 获取用户访问信息地域分布
     * @return
     */
    List<AreaView> getLoginInfoArea();

}