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