父级区域编码为2位或4位情况
select
CONCAT_WS("",
(select name
from t_info_region
where code = LEFT(#{code,jdbcType=BIGINT}, 2)
),
(select name
from t_info_region
where code = LEFT(#{code,jdbcType=BIGINT}, 4)
),
name ) as name
from t_info_region
WHERE code = #{code,jdbcType=BIGINT}
全部区域编码都为六位情况
select
CONCAT_WS("",
(select name
from t_info_region
where code = concat(LEFT(#{code,jdbcType=BIGINT}, 2)),'0000')
),
(select name
from t_info_region
where code = concat(LEFT(#{code,jdbcType=BIGINT}, 4),'00')
),
name ) as name
from t_info_region
WHERE code = #{code,jdbcType=BIGINT}