feat: 导入福州历史数据
This commit is contained in:
@@ -3,10 +3,12 @@ import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from sqlalchemy import Column, Integer, String, Date, UniqueConstraint, Numeric
|
||||
|
||||
from commons.models.mixin.base import BaseModelMixin
|
||||
from commons.models.model import Model
|
||||
from core.extensions import db
|
||||
|
||||
|
||||
class FuzhouHighwayBureau(db.Model):
|
||||
class FuzhouHighwayBureau(db.Model, Model, BaseModelMixin):
|
||||
__tablename__ = 'FUZHOU_HIGHWAY_BUREAU'
|
||||
id = Column('ID', Integer, primary_key=True)
|
||||
name = Column('NAME', String(128), default='', comment='名称')
|
||||
@@ -23,6 +25,15 @@ class FuzhouHighwayBureau(db.Model):
|
||||
{'comment': '福州公路局'},
|
||||
)
|
||||
|
||||
def find_by_key(self):
|
||||
query = FuzhouHighwayBureau.query
|
||||
query = query.filter(FuzhouHighwayBureau.name == self.name)
|
||||
query = query.filter(FuzhouHighwayBureau.spec == self.spec)
|
||||
query = query.filter(FuzhouHighwayBureau.region == self.region)
|
||||
query = query.filter(FuzhouHighwayBureau.date == self.date)
|
||||
result = query.one_or_none()
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def get_query(cls, year, month, name, spec=None, region='福州'):
|
||||
start_date = datetime.date(year, month, 1)
|
||||
|
Reference in New Issue
Block a user