package cn.iocoder.yudao.module.system.dal.mysql.biz;

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.biz.MaterialCategoryDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface MaterialCategoryMapper extends BaseMapperX<MaterialCategoryDO> {

    default List<MaterialCategoryDO> selectListByTenantIds(Long[] tenantIds) {
        return selectList(new LambdaQueryWrapperX<MaterialCategoryDO>()
                .in(MaterialCategoryDO::getTenantId, (Object[]) tenantIds)
                .orderByDesc(MaterialCategoryDO::getId));
    }

    default MaterialCategoryDO selectByTenantAndNumber(Long tenantId, String categoryNumber) {
        return selectOne(new LambdaQueryWrapperX<MaterialCategoryDO>()
                .eq(MaterialCategoryDO::getTenantId, tenantId)
                .eq(MaterialCategoryDO::getCategoryNumber, categoryNumber));
    }
}
