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

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.workbench.SyncLibraryMarketMaterialDO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;

/**
 * 同步库市场主材设备 Mapper
 *
 * @author yhy
 */
@Mapper
public interface SyncLibraryMarketMaterialMapper extends BaseMapperX<SyncLibraryMarketMaterialDO> {

    /**
     * 根据同步库分部分项ID查询
     */
    default List<SyncLibraryMarketMaterialDO> selectListBySyncDivisionId(Long syncDivisionId) {
        return selectList(new LambdaQueryWrapperX<SyncLibraryMarketMaterialDO>()
                .eq(SyncLibraryMarketMaterialDO::getSyncDivisionId, syncDivisionId)
                .orderByAsc(SyncLibraryMarketMaterialDO::getSortOrder));
    }

    /**
     * 根据同步库分部分项ID列表批量查询
     */
    default List<SyncLibraryMarketMaterialDO> selectListBySyncDivisionIds(List<Long> syncDivisionIds) {
        return selectList(new LambdaQueryWrapperX<SyncLibraryMarketMaterialDO>()
                .in(SyncLibraryMarketMaterialDO::getSyncDivisionId, syncDivisionIds)
                .orderByAsc(SyncLibraryMarketMaterialDO::getSortOrder));
    }

    /**
     * 根据同步库分部分项ID删除
     */
    default int deleteBySyncDivisionId(Long syncDivisionId) {
        return delete(new LambdaQueryWrapperX<SyncLibraryMarketMaterialDO>()
                .eq(SyncLibraryMarketMaterialDO::getSyncDivisionId, syncDivisionId));
    }

    /**
     * 根据同步库分部分项ID列表批量删除
     */
    default int deleteBySyncDivisionIds(List<Long> syncDivisionIds) {
        return delete(new LambdaQueryWrapperX<SyncLibraryMarketMaterialDO>()
                .in(SyncLibraryMarketMaterialDO::getSyncDivisionId, syncDivisionIds));
    }
}
