diff --git a/.sqlx/query-6d37bb24a9ca5baf4e8a2f10541bba7ffe68e37521cd251559517e0a2aeaee79.json b/.sqlx/query-46dad5b37ff8c762c6a2a653a9627fb96a7dd2bf31452dfa5ed04bf19772ba6d.json similarity index 69% rename from .sqlx/query-6d37bb24a9ca5baf4e8a2f10541bba7ffe68e37521cd251559517e0a2aeaee79.json rename to .sqlx/query-46dad5b37ff8c762c6a2a653a9627fb96a7dd2bf31452dfa5ed04bf19772ba6d.json index 7bbd7911..428063cb 100644 --- a/.sqlx/query-6d37bb24a9ca5baf4e8a2f10541bba7ffe68e37521cd251559517e0a2aeaee79.json +++ b/.sqlx/query-46dad5b37ff8c762c6a2a653a9627fb96a7dd2bf31452dfa5ed04bf19772ba6d.json @@ -1,6 +1,6 @@ { "db_name": "MySQL", - "query": "WITH\n from_cte AS (\n SELECT\n s.station_cd,\n s.line_cd\n FROM\n stations AS s\n WHERE\n s.station_g_cd = ?\n ),\n to_cte AS (\n SELECT\n s.station_cd,\n s.line_cd\n FROM\n stations AS s\n WHERE\n s.station_g_cd = ?\n ),\n local_cte AS (\n SELECT\n s.*\n FROM\n `stations` AS s\n JOIN `lines` AS l ON l.line_cd IN (\n SELECT\n line_cd\n FROM\n `stations`\n WHERE\n station_g_cd = ?\n )\n AND l.line_cd IN (\n (\n SELECT\n line_cd\n FROM\n `stations`\n WHERE\n station_g_cd = ?\n )\n )\n WHERE\n s.line_cd = l.line_cd\n ),\n sst_cte_c1 AS (\n SELECT\n sst.line_group_cd\n FROM\n station_station_types AS sst\n JOIN from_cte\n WHERE\n sst.station_cd = from_cte.station_cd\n AND sst.pass <> 1\n ),\n sst_cte_c2 AS (\n SELECT\n sst.line_group_cd\n FROM\n station_station_types AS sst\n JOIN to_cte\n WHERE\n sst.station_cd = to_cte.station_cd\n AND sst.pass <> 1\n ),\n sst_cte AS (\n SELECT\n sst.*\n FROM\n `station_station_types` AS sst\n JOIN sst_cte_c1\n JOIN sst_cte_c2\n WHERE\n sst.line_group_cd = sst_cte_c1.line_group_cd\n AND sst.line_group_cd = sst_cte_c2.line_group_cd\n ) (\n SELECT\n sta.*,\n lin.company_cd,\n lin.line_type,\n lin.line_symbol_primary,\n lin.line_symbol_secondary,\n lin.line_symbol_extra,\n lin.line_symbol_primary_color,\n lin.line_symbol_secondary_color,\n lin.line_symbol_extra_color,\n lin.line_symbol_primary_shape,\n lin.line_symbol_secondary_shape,\n lin.line_symbol_extra_shape,\n IFNULL (lin.average_distance, 0.0) AS average_distance,\n sst.id AS sst_id,\n sst.type_cd,\n sst.line_group_cd,\n sst.pass,\n COALESCE(a.line_name, lin.line_name) AS line_name,\n COALESCE(a.line_name_k, lin.line_name_k) AS line_name_k,\n COALESCE(a.line_name_h, lin.line_name_h) AS line_name_h,\n COALESCE(a.line_name_r, lin.line_name_r) AS line_name_r,\n COALESCE(a.line_name_zh, lin.line_name_zh) AS line_name_zh,\n COALESCE(a.line_name_ko, lin.line_name_ko) AS line_name_ko,\n COALESCE(a.line_color_c, lin.line_color_c) AS line_color_c,\n 1 AS has_train_types,\n tt.id AS type_id,\n tt.type_name,\n tt.type_name_k,\n tt.type_name_r,\n tt.type_name_zh,\n tt.type_name_ko,\n tt.color,\n tt.direction,\n tt.kind\n FROM\n stations AS sta\n LEFT JOIN `sst_cte` AS sst ON sst.station_cd = sta.station_cd\n LEFT JOIN `types` AS tt ON tt.type_cd = sst.type_cd\n LEFT JOIN `line_aliases` AS la ON la.station_cd = sta.station_cd\n LEFT JOIN `aliases` AS a ON la.alias_cd = a.id\n LEFT JOIN `lines` AS lin ON lin.line_cd = sta.line_cd\n WHERE\n sta.station_cd = sst.station_cd\n AND sta.e_status = 0\n ORDER BY\n sst.id\n )\n UNION ALL\n (\n SELECT\n sta.*,\n lin.company_cd,\n lin.line_type,\n lin.line_symbol_primary,\n lin.line_symbol_secondary,\n lin.line_symbol_extra,\n lin.line_symbol_primary_color,\n lin.line_symbol_secondary_color,\n lin.line_symbol_extra_color,\n lin.line_symbol_primary_shape,\n lin.line_symbol_secondary_shape,\n lin.line_symbol_extra_shape,\n IFNULL (lin.average_distance, 0.0) AS average_distance,\n sst.id AS sst_id,\n sst.type_cd,\n sst.line_group_cd,\n sst.pass,\n COALESCE(a.line_name, lin.line_name) AS line_name,\n COALESCE(a.line_name_k, lin.line_name_k) AS line_name_k,\n COALESCE(a.line_name_h, lin.line_name_h) AS line_name_h,\n COALESCE(a.line_name_r, lin.line_name_r) AS line_name_r,\n COALESCE(a.line_name_zh, lin.line_name_zh) AS line_name_zh,\n COALESCE(a.line_name_ko, lin.line_name_ko) AS line_name_ko,\n COALESCE(a.line_color_c, lin.line_color_c) AS line_color_c,\n 0 AS has_train_types,\n tt.id AS type_id,\n tt.type_name,\n tt.type_name_k,\n tt.type_name_r,\n tt.type_name_zh,\n tt.type_name_ko,\n tt.color,\n tt.direction,\n tt.kind\n FROM\n local_cte AS sta\n LEFT JOIN `sst_cte` AS sst ON sst.station_cd = sta.station_cd\n LEFT JOIN `types` AS tt ON tt.type_cd = sst.type_cd\n LEFT JOIN `line_aliases` AS la ON la.station_cd = sta.station_cd\n LEFT JOIN `aliases` AS a ON la.alias_cd = a.id\n JOIN `lines` AS lin ON lin.line_cd = sta.line_cd\n WHERE\n sst.line_group_cd IS NULL\n AND sta.e_status = 0\n ORDER BY\n sta.e_sort,\n sta.station_cd\n )", + "query": "WITH\n from_cte AS (\n SELECT\n s.station_cd,\n s.line_cd\n FROM\n stations AS s\n WHERE\n s.station_g_cd = ?\n ),\n to_cte AS (\n SELECT\n s.station_cd,\n s.line_cd\n FROM\n stations AS s\n WHERE\n s.station_g_cd = ?\n ),\n local_cte AS (\n SELECT\n s.*\n FROM\n `stations` AS s\n JOIN `lines` AS l ON l.line_cd IN (\n SELECT\n line_cd\n FROM\n `stations`\n WHERE\n station_g_cd = ?\n )\n AND l.line_cd IN (\n (\n SELECT\n line_cd\n FROM\n `stations`\n WHERE\n station_g_cd = ?\n )\n )\n WHERE\n s.line_cd = l.line_cd\n ORDER BY s.e_sort, s.station_cd\n ),\n sst_cte_c1 AS (\n SELECT\n sst.line_group_cd\n FROM\n station_station_types AS sst\n JOIN from_cte\n WHERE\n sst.station_cd = from_cte.station_cd\n AND sst.pass <> 1\n ),\n sst_cte_c2 AS (\n SELECT\n sst.line_group_cd\n FROM\n station_station_types AS sst\n JOIN to_cte\n WHERE\n sst.station_cd = to_cte.station_cd\n AND sst.pass <> 1\n ),\n sst_cte AS (\n SELECT\n sst.*\n FROM\n `station_station_types` AS sst\n JOIN sst_cte_c1\n JOIN sst_cte_c2\n WHERE\n sst.line_group_cd = sst_cte_c1.line_group_cd\n AND sst.line_group_cd = sst_cte_c2.line_group_cd\n ) (\n SELECT\n sta.*,\n lin.company_cd,\n lin.line_type,\n lin.line_symbol_primary,\n lin.line_symbol_secondary,\n lin.line_symbol_extra,\n lin.line_symbol_primary_color,\n lin.line_symbol_secondary_color,\n lin.line_symbol_extra_color,\n lin.line_symbol_primary_shape,\n lin.line_symbol_secondary_shape,\n lin.line_symbol_extra_shape,\n IFNULL (lin.average_distance, 0.0) AS average_distance,\n sst.id AS sst_id,\n sst.type_cd,\n sst.line_group_cd,\n sst.pass,\n COALESCE(a.line_name, lin.line_name) AS line_name,\n COALESCE(a.line_name_k, lin.line_name_k) AS line_name_k,\n COALESCE(a.line_name_h, lin.line_name_h) AS line_name_h,\n COALESCE(a.line_name_r, lin.line_name_r) AS line_name_r,\n COALESCE(a.line_name_zh, lin.line_name_zh) AS line_name_zh,\n COALESCE(a.line_name_ko, lin.line_name_ko) AS line_name_ko,\n COALESCE(a.line_color_c, lin.line_color_c) AS line_color_c,\n 1 AS has_train_types,\n tt.id AS type_id,\n tt.type_name,\n tt.type_name_k,\n tt.type_name_r,\n tt.type_name_zh,\n tt.type_name_ko,\n tt.color,\n tt.direction,\n tt.kind\n FROM\n stations AS sta\n LEFT JOIN `sst_cte` AS sst ON sst.station_cd = sta.station_cd\n LEFT JOIN `types` AS tt ON tt.type_cd = sst.type_cd\n LEFT JOIN `line_aliases` AS la ON la.station_cd = sta.station_cd\n LEFT JOIN `aliases` AS a ON la.alias_cd = a.id\n JOIN `lines` AS lin ON lin.line_cd = sta.line_cd\n WHERE\n sta.station_cd = sst.station_cd\n AND sta.e_status = 0\n ORDER BY\n sst.id\n )\n UNION ALL\n (\n SELECT\n sta.*,\n lin.company_cd,\n lin.line_type,\n lin.line_symbol_primary,\n lin.line_symbol_secondary,\n lin.line_symbol_extra,\n lin.line_symbol_primary_color,\n lin.line_symbol_secondary_color,\n lin.line_symbol_extra_color,\n lin.line_symbol_primary_shape,\n lin.line_symbol_secondary_shape,\n lin.line_symbol_extra_shape,\n IFNULL (lin.average_distance, 0.0) AS average_distance,\n sst.id AS sst_id,\n sst.type_cd,\n sst.line_group_cd,\n sst.pass,\n COALESCE(a.line_name, lin.line_name) AS line_name,\n COALESCE(a.line_name_k, lin.line_name_k) AS line_name_k,\n COALESCE(a.line_name_h, lin.line_name_h) AS line_name_h,\n COALESCE(a.line_name_r, lin.line_name_r) AS line_name_r,\n COALESCE(a.line_name_zh, lin.line_name_zh) AS line_name_zh,\n COALESCE(a.line_name_ko, lin.line_name_ko) AS line_name_ko,\n COALESCE(a.line_color_c, lin.line_color_c) AS line_color_c,\n 0 AS has_train_types,\n tt.id AS type_id,\n tt.type_name,\n tt.type_name_k,\n tt.type_name_r,\n tt.type_name_zh,\n tt.type_name_ko,\n tt.color,\n tt.direction,\n tt.kind\n FROM\n local_cte AS sta\n LEFT JOIN `sst_cte` AS sst ON sst.station_cd = sta.station_cd\n LEFT JOIN `types` AS tt ON tt.type_cd = sst.type_cd\n LEFT JOIN `line_aliases` AS la ON la.station_cd = sta.station_cd\n LEFT JOIN `aliases` AS a ON la.alias_cd = a.id\n JOIN `lines` AS lin ON lin.line_cd = sta.line_cd\n WHERE\n sst.line_group_cd IS NULL\n AND sta.e_status = 0\n )", "describe": { "columns": [ { @@ -218,7 +218,7 @@ "name": "company_cd", "type_info": { "type": "Long", - "flags": "UNSIGNED", + "flags": "NOT_NULL | UNSIGNED", "char_set": 63, "max_size": 10 } @@ -228,7 +228,7 @@ "name": "line_type", "type_info": { "type": "Long", - "flags": "UNSIGNED", + "flags": "NOT_NULL | UNSIGNED", "char_set": 63, "max_size": 10 } @@ -569,8 +569,8 @@ false, false, false, - true, - true, + false, + false, true, true, true, @@ -604,5 +604,5 @@ true ] }, - "hash": "6d37bb24a9ca5baf4e8a2f10541bba7ffe68e37521cd251559517e0a2aeaee79" + "hash": "46dad5b37ff8c762c6a2a653a9627fb96a7dd2bf31452dfa5ed04bf19772ba6d" } diff --git a/stationapi/src/infrastructure/station_repository.rs b/stationapi/src/infrastructure/station_repository.rs index a0b22525..e0ae4a30 100644 --- a/stationapi/src/infrastructure/station_repository.rs +++ b/stationapi/src/infrastructure/station_repository.rs @@ -1031,6 +1031,7 @@ impl InternalStationRepository { ) WHERE s.line_cd = l.line_cd + ORDER BY s.e_sort, s.station_cd ), sst_cte_c1 AS ( SELECT @@ -1104,7 +1105,7 @@ impl InternalStationRepository { LEFT JOIN `types` AS tt ON tt.type_cd = sst.type_cd LEFT JOIN `line_aliases` AS la ON la.station_cd = sta.station_cd LEFT JOIN `aliases` AS a ON la.alias_cd = a.id - LEFT JOIN `lines` AS lin ON lin.line_cd = sta.line_cd + JOIN `lines` AS lin ON lin.line_cd = sta.line_cd WHERE sta.station_cd = sst.station_cd AND sta.e_status = 0 @@ -1158,9 +1159,6 @@ impl InternalStationRepository { WHERE sst.line_group_cd IS NULL AND sta.e_status = 0 - ORDER BY - sta.e_sort, - sta.station_cd )", from_station_id, to_station_id,