package com.chushang.system.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chushang.common.core.web.AjaxResult;
import com.chushang.common.mybatis.page.CommonParam;
import com.chushang.common.mybatis.utils.PageResult;
import com.chushang.system.entity.dto.ListLoginLogDTO;
import com.chushang.system.entity.po.SysDictType;
import com.chushang.system.entity.po.SysLoginInfo;
import com.chushang.system.entity.po.SysPost;

public interface SysLoginInfoService extends IService<SysLoginInfo> {

    default AjaxResult saveLoginInfo(SysLoginInfo sysLogininfo) {
        return save(sysLogininfo) ? AjaxResult.success() : AjaxResult.error();
    }

    LambdaQueryWrapper<SysLoginInfo> buildWrapper(SysLoginInfo loginInfo, CommonParam commonParam);

    default PageResult pagePostList(SysLoginInfo loginInfo, CommonParam commonParam) {
        IPage<SysLoginInfo> page = this.page(
                new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
                buildWrapper(loginInfo, commonParam)
        );
        return new PageResult(page);
    }
}
