<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hdkj.lt.si.dao.CityFeederTopoMapper">


    <select id="getCityCodeByLine" resultType="com.hdkj.lt.modle.dto.svg.CityFeederInfo">
        select
        ifnull(s.dict_label,f.city) city,f.psr_id lineId
        from dwd_shb_ds_feeder_base f
        left join sys_dict_data s on f.city = s.dict_value
        left join sys_dict_type t on s. = t.dict_type and t.dict_type = 'custom_storage'
        where f.psr_id in
        <foreach item="item" collection="lineIds" open="(" separator="," close=")">
            #{item, jdbcType=BIGINT}
        </foreach>
    </select>
    <select id="getAllLineFileByVersion" resultType="com.hdkj.lt.modle.dto.svg.CityFeederInfo">
        select mf.id, mf.line_id, file_id, file_type, df.city, df.city_name,mf.create_time
        from fhzg_dist_mapping_file mf
        inner join T_PSR_DS_FEEDER df on mf.line_id=df.psr_id and df.pub_priv_flag='0'
        <where> df.psr_state='20'
            <if test="topoVersion != null and topoVersion !=''">
                and mf.topo_version = #{topoVersion}
                and file_type ='1'
            </if>
            <if test="cityIds != null and cityIds.size()>0">
                and file_type in ('1','2')
                and df.city in
                <foreach item="item" collection="cityIds" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        </where>
    </select>
</mapper>
