package cn.iocoder.lyzsys.module.tjt.dal.mysql.specialtyrolesplit;

import cn.iocoder.lyzsys.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.lyzsys.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.lyzsys.module.tjt.dal.dataobject.specialtyrolesplit.SpecialtyRoleSplitDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * 页面 5 角色比例 Mapper
 *
 * @author Codex
 */
@Mapper
public interface SpecialtyRoleSplitMapper extends BaseMapperX<SpecialtyRoleSplitDO> {

    default List<SpecialtyRoleSplitDO> selectListByOutputSplitId(Long outputSplitId) {
        return selectList(new LambdaQueryWrapperX<SpecialtyRoleSplitDO>()
                .eq(SpecialtyRoleSplitDO::getOutputSplitId, outputSplitId)
                .orderByAsc(SpecialtyRoleSplitDO::getSortNo)
                .orderByAsc(SpecialtyRoleSplitDO::getId));
    }

    default List<SpecialtyRoleSplitDO> selectListByOutputSplitIds(Collection<Long> outputSplitIds) {
        if (outputSplitIds == null || outputSplitIds.isEmpty()) {
            return Collections.emptyList();
        }
        return selectList(new LambdaQueryWrapperX<SpecialtyRoleSplitDO>()
                .in(SpecialtyRoleSplitDO::getOutputSplitId, outputSplitIds)
                .orderByAsc(SpecialtyRoleSplitDO::getOutputSplitId)
                .orderByAsc(SpecialtyRoleSplitDO::getSortNo)
                .orderByAsc(SpecialtyRoleSplitDO::getId));
    }

}
