package com.cf.imes.module.infra.dal.mysql.demo;

import java.util.*;

import PageResult;
import LambdaQueryWrapperX;
import BaseMapperX;
import com.cf.imes.module.infra.dal.dataobject.demo.InfraCategoryDO;
import org.apache.ibatis.annotations.Mapper;
import com.cf.imes.module.infra.controller.admin.demo.vo.*;

/**
 * 分类 Mapper
 *
 * @author 晨丰科技
 */
@Mapper
public interface InfraCategoryMapper extends BaseMapperX<InfraCategoryDO> {

    default List<InfraCategoryDO> selectList(InfraCategoryListReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InfraCategoryDO>()
                .likeIfPresent(InfraCategoryDO::getName, reqVO.getName())
                .orderByDesc(InfraCategoryDO::getId));
    }

	default InfraCategoryDO selectByParentIdAndName(Long parentId, String name) {
	    return selectOne(InfraCategoryDO::getParentId, parentId, InfraCategoryDO::getName, name);
	}

    default Long selectCountByParentId(Long parentId) {
        return selectCount(InfraCategoryDO::getParentId, parentId);
    }

}
