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

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.routelight.ResourceRouteLightDO;
import org.apache.ibatis.annotations.Mapper;
import com.yc.ship.module.resource.controller.admin.routelight.vo.*;

/**
 * 航线管理-行程亮点 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ResourceRouteLightMapper extends BaseMapperX<ResourceRouteLightDO> {

    default PageResult<ResourceRouteLightDO> selectPage(ResourceRouteLightPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ResourceRouteLightDO>()
                .eqIfPresent(ResourceRouteLightDO::getIcon, reqVO.getIcon())
                .eqIfPresent(ResourceRouteLightDO::getRouteId, reqVO.getRouteId())
                .likeIfPresent(ResourceRouteLightDO::getName, reqVO.getName())
                .eqIfPresent(ResourceRouteLightDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ResourceRouteLightDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ResourceRouteLightDO::getId));
    }

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

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