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

import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.yhy.module.core.dal.dataobject.workbench.WbUnitFeeSettingDO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;

/**
 * 单位工程取费项设定 Mapper
 */
@Mapper
public interface WbUnitFeeSettingMapper extends BaseMapperX<WbUnitFeeSettingDO> {

    /**
     * 根据分部分项节点ID查询取费项设定列表
     */
    default List<WbUnitFeeSettingDO> selectByDivisionId(Long divisionId) {
        return selectList(WbUnitFeeSettingDO::getDivisionId, divisionId);
    }

    /**
     * 根据分部分项节点ID和取费项ID查询
     */
    default WbUnitFeeSettingDO selectByDivisionIdAndFeeItemId(Long divisionId, Long feeItemId) {
        return selectOne(WbUnitFeeSettingDO::getDivisionId, divisionId,
                WbUnitFeeSettingDO::getSourceFeeItemId, feeItemId);
    }

    /**
     * 根据分部分项节点ID删除所有取费项设定
     */
    default int deleteByDivisionId(Long divisionId) {
        return delete(WbUnitFeeSettingDO::getDivisionId, divisionId);
    }

    /**
     * 根据单位工程ID查询取费项设定列表
     */
    default List<WbUnitFeeSettingDO> selectByUnitId(Long unitId) {
        return selectList(WbUnitFeeSettingDO::getUnitId, unitId);
    }
}
