lintry

调整对省的查询条件位置

1 +"use strict";
2 +/**
3 + * SARS统计数据
4 + */
5 +module.exports = function (sequelize, DataTypes) {
6 + const
7 + AbstractPO = require('kml-po-abstract'),
8 + _ = require('lodash');
9 +
10 + let option = AbstractPO.RawOption({
11 + tableName: 'tb_mf_sars'
12 + });
13 +
14 + let entity = _.merge({
15 + "report_date": {
16 + "type": DataTypes.STRING(40),
17 + "comment": "report_date",
18 + "field": "report_date",
19 + "allowNull": false,
20 + "primaryKey": true
21 + },
22 + "confirmed": {
23 + "type": DataTypes.BIGINT,
24 + "comment": "确认人数",
25 + "field": "confirmed"
26 + },
27 + "suspected": {
28 + "type": DataTypes.BIGINT,
29 + "comment": "疑似人数",
30 + "field": "suspected"
31 + },
32 + "dead": {
33 + "type": DataTypes.BIGINT,
34 + "comment": "死亡人数",
35 + "field": "dead"
36 + },
37 + "comment": {
38 + "type": DataTypes.STRING(200),
39 + "comment": "注释",
40 + "field": "comment"
41 + },
42 + "country": {
43 + "type": DataTypes.STRING(40),
44 + "comment": "国家",
45 + "field": "country"
46 + }
47 + });
48 +
49 + return sequelize.define('sars', entity, option);
50 +};
...@@ -48,7 +48,6 @@ module.exports = function (dbo) { ...@@ -48,7 +48,6 @@ module.exports = function (dbo) {
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 country notnull 50 where country notnull
51 - and province ~ :province
52 order by 1,2,3 51 order by 1,2,3
53 ) 52 )
54 , pr as ( 53 , pr as (
...@@ -76,6 +75,7 @@ module.exports = function (dbo) { ...@@ -76,6 +75,7 @@ module.exports = function (dbo) {
76 jsonb_agg(increase order by today) increase, 75 jsonb_agg(increase order by today) increase,
77 max(confirmed_sum) confirmed_sum 76 max(confirmed_sum) confirmed_sum
78 from ( select *, sum(confirmed_count) over(partition by country, today) confirmed_sum from rpt 77 from ( select *, sum(confirmed_count) over(partition by country, today) confirmed_sum from rpt
78 + where province ~ :province
79 ) t 79 ) t
80 group by 1,2 80 group by 1,2
81 union all 81 union all
......