houzhongjian
2024-10-16 7da8f196dee8e3c526c009a4bc7f5983ece6bb97
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.system.dal.mysql.user;
H 2
818a01 3 import com.baomidou.dynamic.datasource.annotation.Master;
e7c126 4 import com.iailab.framework.common.pojo.PageResult;
H 5 import com.iailab.framework.mybatis.core.mapper.BaseMapperX;
6 import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
818a01 7 import com.iailab.framework.tenant.core.db.dynamic.TenantDS;
e7c126 8 import com.iailab.module.system.controller.admin.user.vo.user.UserPageReqVO;
H 9 import com.iailab.module.system.dal.dataobject.user.AdminUserDO;
10 import org.apache.ibatis.annotations.Mapper;
11
12 import java.util.Collection;
13 import java.util.List;
14
15 @Mapper
818a01 16 @Master
e7c126 17 public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
H 18
19     default AdminUserDO selectByUsername(String username) {
20         return selectOne(AdminUserDO::getUsername, username);
21     }
22
23     default AdminUserDO selectByEmail(String email) {
24         return selectOne(AdminUserDO::getEmail, email);
25     }
26
27     default AdminUserDO selectByMobile(String mobile) {
28         return selectOne(AdminUserDO::getMobile, mobile);
29     }
30
31     default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) {
32         return selectPage(reqVO, new LambdaQueryWrapperX<AdminUserDO>()
33                 .likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername())
34                 .likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile())
35                 .eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus())
36                 .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime())
37                 .inIfPresent(AdminUserDO::getDeptId, deptIds)
38                 .orderByDesc(AdminUserDO::getId));
39     }
40
41     default List<AdminUserDO> selectListByNickname(String nickname) {
42         return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getNickname, nickname));
43     }
44
45     default List<AdminUserDO> selectListByStatus(Integer status) {
46         return selectList(AdminUserDO::getStatus, status);
47     }
48
49     default List<AdminUserDO> selectListByDeptIds(Collection<Long> deptIds) {
50         return selectList(AdminUserDO::getDeptId, deptIds);
51     }
52
53 }