package org.nl.acs.route.service.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.nl.acs.common.base.CommonMapper;
import org.nl.acs.route.domain.RouteLine;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* @author jiaolm
* @date 2023-05-09
*/
@Repository
public interface RouteLineMapper extends CommonMapper<RouteLine> {
    String querySql = "SELECT " +
            " line.*, " +
            " plan.plan_name AS plan_name " +
            "FROM " +
            " acs_route_line line " +
            " LEFT JOIN acs_route_plan plan ON line.route_plan_id = plan.plan_uuid";
    String wrapperSql =  querySql + " ${ew.customSqlSegment}";

    String queryRlSql = "SELECT " +
            " *  " +
            "FROM " +
            " acs_route_line line " +
            " LEFT JOIN acs_route_plan plan ON plan.plan_uuid = line.route_plan_id ";
    String wrapperRlSql =  queryRlSql + " ${ew.customSqlSegment}";
    /**
     * 分页查询
     */
    @Select(wrapperSql)
    <P extends IPage<RouteLine>> P queryPage(P page, @Param("ew") Wrapper<RouteLine> queryWrapper);

    @Select(wrapperRlSql)
    List<RouteLine> selectRouteLineList(@Param("ew") Wrapper<RouteLine> queryWrapper);
}
