潘志宝
2024-12-25 8a6b19bf5c50ebb54e965645a9366f6cfea02351
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.infra.dal.mysql.demo.demo02;
H 2
3 import com.iailab.framework.mybatis.core.mapper.BaseMapperX;
4 import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
5 import com.iailab.module.infra.controller.admin.demo.demo02.vo.Demo02CategoryListReqVO;
6 import com.iailab.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
7 import org.apache.ibatis.annotations.Mapper;
8
9 import java.util.List;
10
11 /**
12  * 示例分类 Mapper
13  *
14  * @author iailab
15  */
16 @Mapper
17 public interface Demo02CategoryMapper extends BaseMapperX<Demo02CategoryDO> {
18
19     default List<Demo02CategoryDO> selectList(Demo02CategoryListReqVO reqVO) {
20         return selectList(new LambdaQueryWrapperX<Demo02CategoryDO>()
21                 .likeIfPresent(Demo02CategoryDO::getName, reqVO.getName())
22                 .eqIfPresent(Demo02CategoryDO::getParentId, reqVO.getParentId())
23                 .betweenIfPresent(Demo02CategoryDO::getCreateTime, reqVO.getCreateTime())
24                 .orderByDesc(Demo02CategoryDO::getId));
25     }
26
27     default Demo02CategoryDO selectByParentIdAndName(Long parentId, String name) {
28         return selectOne(Demo02CategoryDO::getParentId, parentId, Demo02CategoryDO::getName, name);
29     }
30
31     default Long selectCountByParentId(Long parentId) {
32         return selectCount(Demo02CategoryDO::getParentId, parentId);
33     }
34
35 }