package com.JN.demo.zmquotation.mapper;

import com.JN.demo.zmquotation.dto.RegionDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName RegionMapper
 * @Description TODO
 * @Author JIAL
 * @Date 2024/2/19 10:47
 * @Version 1.0
 */
@Mapper
public interface RegionMapper {
    @Select("with temp as(\n" +
            "select pz_place_uid_0,price_0t_5t,price_5t_10t,price_10t_25t,price_25t_100t,price_100t from c_pz_price where date_0=(select max(date_0) from c_pz_price) \n" +
            ") select distinct a.sheng_0 as province,a.shi_0 as city,a.qu_0 as district,a.km_0 as kilometers,\n" +
            "b.price_0t_5t as price_01,b.price_5t_10t as price_02,b.price_10t_25t as price_03,b.price_25t_100t as price_04,b.price_100t as price_05\n" +
            "from c_pz_place2019 a left join temp b on a.id_0 = b.pz_place_uid_0 where a.qu_0 not in \n" +
            "('江阴市','金坛区','溧阳市','宜兴市') and (sheng_0 like '%${regionName}%' or shi_0 like '%${regionName}%' or qu_0 like '%${regionName}%')")
    List<RegionDto> queryRegionListByName(String regionName);
}
