package com.yhy.module.core.dal.mysql.resource;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yhy.module.core.dal.dataobject.resource.ResourceCategoryTreeMappingDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 工料机机类树与类别字典关联 Mapper
 *
 * @author yihuiyong
 */
@Mapper
public interface ResourceCategoryTreeMappingMapper extends BaseMapperX<ResourceCategoryTreeMappingDO> {

    /**
     * 根据机类树节点ID查询映射
     */
    default List<ResourceCategoryTreeMappingDO> selectByCategoryTreeId(Long categoryTreeId) {
        return selectList(new LambdaQueryWrapperX<ResourceCategoryTreeMappingDO>()
                .eq(ResourceCategoryTreeMappingDO::getCategoryTreeId, categoryTreeId)
                .orderByAsc(ResourceCategoryTreeMappingDO::getSortOrder));
    }
}
