package com.iailab.module.system.dal.mysql.user; import com.baomidou.dynamic.datasource.annotation.Master; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.mybatis.core.mapper.BaseMapperX; import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.system.controller.admin.user.vo.user.UserPageReqVO; import com.iailab.module.system.dal.dataobject.user.AdminUserDO; import org.apache.ibatis.annotations.Mapper; import java.util.Collection; import java.util.List; @Mapper @Master public interface AdminUserMapper extends BaseMapperX { default AdminUserDO selectByUsername(String username) { return selectOne(AdminUserDO::getUsername, username); } default AdminUserDO selectByEmail(String email) { return selectOne(AdminUserDO::getEmail, email); } default AdminUserDO selectByMobile(String mobile) { return selectOne(AdminUserDO::getMobile, mobile); } default PageResult selectPage(UserPageReqVO reqVO, Collection deptIds) { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername()) .likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile()) .eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus()) .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime()) .inIfPresent(AdminUserDO::getDeptId, deptIds) .orderByDesc(AdminUserDO::getId)); } default List selectListByNickname(String nickname) { return selectList(new LambdaQueryWrapperX().like(AdminUserDO::getNickname, nickname)); } default List selectListByStatus(Integer status) { return selectList(AdminUserDO::getStatus, status); } default List selectListByDeptIds(Collection deptIds) { return selectList(AdminUserDO::getDeptId, deptIds); } }