潘志宝
2024-08-21 c39abccd937de093fc067abffac5f66b758bc97b
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.system.dal.mysql.dept;
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.dept.vo.post.PostPageReqVO;
7 import com.iailab.module.system.dal.dataobject.dept.PostDO;
8 import org.apache.ibatis.annotations.Mapper;
9
10 import java.util.Collection;
11 import java.util.List;
12
13 @Mapper
14 public interface PostMapper extends BaseMapperX<PostDO> {
15
16     default List<PostDO> selectList(Collection<Long> ids, Collection<Integer> statuses) {
17         return selectList(new LambdaQueryWrapperX<PostDO>()
18                 .inIfPresent(PostDO::getId, ids)
19                 .inIfPresent(PostDO::getStatus, statuses));
20     }
21
22     default PageResult<PostDO> selectPage(PostPageReqVO reqVO) {
23         return selectPage(reqVO, new LambdaQueryWrapperX<PostDO>()
24                 .likeIfPresent(PostDO::getCode, reqVO.getCode())
25                 .likeIfPresent(PostDO::getName, reqVO.getName())
26                 .eqIfPresent(PostDO::getStatus, reqVO.getStatus())
27                 .orderByDesc(PostDO::getId));
28     }
29
30     default PostDO selectByName(String name) {
31         return selectOne(PostDO::getName, name);
32     }
33
34     default PostDO selectByCode(String code) {
35         return selectOne(PostDO::getCode, code);
36     }
37
38 }