lintry

调整字段名

...@@ -37,55 +37,55 @@ module.exports = function (dbo) { ...@@ -37,55 +37,55 @@ module.exports = function (dbo) {
37 ) 37 )
38 , ta as ( 38 , ta as (
39 select * from ( 39 select * from (
40 - select countryName, province_short_name province, update_time::date, confirmed_count, 40 + select country_name, province_short_name province, update_time::date, confirmed_count,
41 - row_number() over(partition by countryName, province_short_name, update_time::date order by update_time desc) rn 41 + row_number() over(partition by country_name, province_short_name, update_time::date order by update_time desc) rn
42 from tb_mf_timeline_area 42 from tb_mf_timeline_area
43 ) t 43 ) t
44 where rn = 1 44 where rn = 1
45 ) 45 )
46 , stats as ( 46 , stats as (
47 - select countryName, ta.province, d.today, confirmed_count 47 + select country_name, ta.province, d.today, confirmed_count
48 from days d 48 from days d
49 left join ta on ta.update_time = d.today 49 left join ta on ta.update_time = d.today
50 - where countryName notnull 50 + where country_name notnull
51 order by 1,2,3 51 order by 1,2,3
52 ) 52 )
53 , pr as ( 53 , pr as (
54 - select countryName, province from stats group by 1,2 54 + select country_name, province from stats group by 1,2
55 ) 55 )
56 , dat as( 56 , dat as(
57 - select pr.countryName, pr.province, d.today, COALESCE(st.confirmed_count, max(st.confirmed_count) over(partition by pr.province order by d.today)) confirmed_count 57 + select pr.country_name, pr.province, d.today, COALESCE(st.confirmed_count, max(st.confirmed_count) over(partition by pr.province order by d.today)) confirmed_count
58 from pr 58 from pr
59 cross join days d 59 cross join days d
60 left join stats st on st.province = pr.province and st.today = d.today 60 left join stats st on st.province = pr.province and st.today = d.today
61 order by 1,2,3 61 order by 1,2,3
62 ) 62 )
63 , rpt as ( 63 , rpt as (
64 - select countryName, province, today, confirmed_count, confirmed_count - COALESCE(lag(confirmed_count) over(partition by countryName, province order by today), 0) increase 64 + select country_name, province, today, confirmed_count, confirmed_count - COALESCE(lag(confirmed_count) over(partition by country_name, province order by today), 0) increase
65 from dat 65 from dat
66 order by 1,2,3 66 order by 1,2,3
67 ) 67 )
68 , summ as ( 68 , summ as (
69 - select countryName, today, sum(confirmed_count) confirmed_sum, sum(increase) increase 69 + select country_name, today, sum(confirmed_count) confirmed_sum, sum(increase) increase
70 from rpt 70 from rpt
71 group by 1,2 71 group by 1,2
72 - order by countryName, confirmed_sum desc 72 + order by country_name, confirmed_sum desc
73 ) 73 )
74 - select countryName, province, max(confirmed_count) max_count, jsonb_agg(today order by today) days, jsonb_agg(confirmed_count order by today) confirmed_counts, 74 + select country_name, province, max(confirmed_count) max_count, jsonb_agg(today order by today) days, jsonb_agg(confirmed_count order by today) confirmed_counts,
75 jsonb_agg(increase order by today) increase, 75 jsonb_agg(increase order by today) increase,
76 max(confirmed_sum) confirmed_sum 76 max(confirmed_sum) confirmed_sum
77 - from ( select *, sum(confirmed_count) over(partition by countryName, today) confirmed_sum from rpt 77 + from ( select *, sum(confirmed_count) over(partition by country_name, today) confirmed_sum from rpt
78 where province ~ :province 78 where province ~ :province
79 ) t 79 ) t
80 group by 1,2 80 group by 1,2
81 union all 81 union all
82 - select countryName, '全国' province, max(confirmed_sum) max_count, jsonb_agg(today order by today) days, jsonb_agg(confirmed_sum order by today) confirmed_counts, 82 + select country_name, '全国' province, max(confirmed_sum) max_count, jsonb_agg(today order by today) days, jsonb_agg(confirmed_sum order by today) confirmed_counts,
83 jsonb_agg(increase order by today) increase, 83 jsonb_agg(increase order by today) increase,
84 max(confirmed_sum) 84 max(confirmed_sum)
85 from summ 85 from summ
86 - where countryName = '中国' 86 + where country_name = '中国'
87 group by 1 87 group by 1
88 - order by countryName, max_count desc 88 + order by country_name, max_count desc
89 `, {replacements: {province}, type: dbo.QueryTypes.SELECT}); 89 `, {replacements: {province}, type: dbo.QueryTypes.SELECT});
90 90
91 return Result.Ok('成功!', result); 91 return Result.Ok('成功!', result);
...@@ -111,12 +111,12 @@ module.exports = function (dbo) { ...@@ -111,12 +111,12 @@ module.exports = function (dbo) {
111 // 代码逻辑区域 111 // 代码逻辑区域
112 let result = await dbo.query(` 112 let result = await dbo.query(`
113 with t as ( 113 with t as (
114 - select update_time, province_short_name province, confirmed_count, suspected_count, cured_count, dead_count, "comment", cities, countryName, row_number() over(partition by province_short_name order by update_time desc) rn 114 + select update_time, province_short_name province, confirmed_count, suspected_count, cured_count, dead_count, "comment", cities, country_name, row_number() over(partition by province_short_name order by update_time desc) rn
115 from tb_mf_timeline_area 115 from tb_mf_timeline_area
116 where update_time::date = :date 116 where update_time::date = :date
117 and province_name ~ :province 117 and province_name ~ :province
118 ) 118 )
119 - select update_time, province, confirmed_count, suspected_count, cured_count, dead_count, "comment", cities, countryName 119 + select update_time, province, confirmed_count, suspected_count, cured_count, dead_count, "comment", cities, country_name
120 from t 120 from t
121 where rn = 1 121 where rn = 1
122 order by confirmed_count desc 122 order by confirmed_count desc
......