houzhongjian
2024-12-27 12db859ea1485e676b6e11927946cb50f79e27a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.iailab.module.system.dal.mysql.permission;
 
import com.iailab.framework.common.pojo.PageResult;
import com.iailab.framework.mybatis.core.dataobject.BaseDO;
import com.iailab.framework.mybatis.core.mapper.BaseMapperX;
import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.iailab.module.system.controller.admin.permission.vo.role.RolePageReqVO;
import com.iailab.module.system.dal.dataobject.permission.RoleDO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.lang.Nullable;
 
import java.util.Collection;
import java.util.List;
 
@Mapper
public interface RoleMapper extends BaseMapperX<RoleDO> {
 
    default PageResult<RoleDO> selectPage(RolePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RoleDO>()
                .likeIfPresent(RoleDO::getName, reqVO.getName())
                .likeIfPresent(RoleDO::getCode, reqVO.getCode())
                .eqIfPresent(RoleDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(BaseDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(RoleDO::getSort));
    }
 
    default RoleDO selectByName(String name) {
        return selectOne(RoleDO::getName, name);
    }
 
    default RoleDO selectByCode(String code) {
        return selectOne(RoleDO::getCode, code);
    }
 
    default List<RoleDO> selectListByStatus(@Nullable Collection<Integer> statuses) {
        return selectList(RoleDO::getStatus, statuses);
    }
 
}