houzhongjian
2024-10-16 7da8f196dee8e3c526c009a4bc7f5983ece6bb97
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.system.dal.mysql.logger;
H 2
3 import com.iailab.framework.common.pojo.PageResult;
4 import com.iailab.framework.mybatis.core.mapper.BaseMapperX;
5 import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
6 import com.iailab.module.system.controller.admin.logger.vo.loginlog.LoginLogPageReqVO;
7 import com.iailab.module.system.dal.dataobject.logger.LoginLogDO;
8 import com.iailab.module.system.enums.logger.LoginResultEnum;
9 import org.apache.ibatis.annotations.Mapper;
10
11 @Mapper
12 public interface LoginLogMapper extends BaseMapperX<LoginLogDO> {
13
14     default PageResult<LoginLogDO> selectPage(LoginLogPageReqVO reqVO) {
15         LambdaQueryWrapperX<LoginLogDO> query = new LambdaQueryWrapperX<LoginLogDO>()
16                 .likeIfPresent(LoginLogDO::getUserIp, reqVO.getUserIp())
17                 .likeIfPresent(LoginLogDO::getUsername, reqVO.getUsername())
18                 .betweenIfPresent(LoginLogDO::getCreateTime, reqVO.getCreateTime());
19         if (Boolean.TRUE.equals(reqVO.getStatus())) {
20             query.eq(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
21         } else if (Boolean.FALSE.equals(reqVO.getStatus())) {
22             query.gt(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
23         }
24         query.orderByDesc(LoginLogDO::getId); // 降序
25         return selectPage(reqVO, query);
26     }
27
28 }