package com.yc.ship.module.resource.dal.mysql.routecost;

import java.util.*;

import com.yc.ship.framework.common.pojo.PageResult;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.module.resource.dal.dataobject.routecost.ResourceRouteCostDO;
import org.apache.ibatis.annotations.Mapper;
import com.yc.ship.module.resource.controller.admin.routecost.vo.*;

/**
 * 航线管理-费用包含 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ResourceRouteCostMapper extends BaseMapperX<ResourceRouteCostDO> {

    default PageResult<ResourceRouteCostDO> selectPage(ResourceRouteCostPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ResourceRouteCostDO>()
                .eqIfPresent(ResourceRouteCostDO::getRouteId, reqVO.getRouteId())
                .eqIfPresent(ResourceRouteCostDO::getType, reqVO.getType())
                .eqIfPresent(ResourceRouteCostDO::getInclude, reqVO.getInclude())
                .eqIfPresent(ResourceRouteCostDO::getNoInclude, reqVO.getNoInclude())
                .eqIfPresent(ResourceRouteCostDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ResourceRouteCostDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ResourceRouteCostDO::getId));
    }

    default void deleteByRouteId(Long routeId) {
        delete(new LambdaQueryWrapperX<ResourceRouteCostDO>().eq(ResourceRouteCostDO::getRouteId, routeId));
    }

    default List<ResourceRouteCostDO> selectByRouteId(Long routeId) {
        return selectList(new LambdaQueryWrapperX<ResourceRouteCostDO>().eq(ResourceRouteCostDO::getRouteId, routeId));
    }
}