feat: 变更计算方式
This commit is contained in:
@@ -40,11 +40,13 @@ class DataFujian(db.Model, Model, BaseModelMixin):
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def get_query(cls, year=None, month=None, name=None, spec=None, name_in=None, region='福州'):
|
||||
def get_query(cls, year=None, month=None, name=None, spec=None, name_in=None, region='福州', number=None):
|
||||
query = cls.query
|
||||
if year and month:
|
||||
query = query.filter(cls.year == year)
|
||||
query = query.filter(cls.month == month)
|
||||
if number:
|
||||
query = query.filter(cls.number == number)
|
||||
if name:
|
||||
query = query.filter(cls.name == name)
|
||||
if name_in:
|
||||
|
@@ -41,12 +41,14 @@ class DataNetwork(db.Model, Model, BaseModelMixin):
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def get_query(cls, year, month, name=None, spec=None, region="福州"):
|
||||
def get_query(cls, year, month, name=None, spec=None, region="福州", material_id=None):
|
||||
start_date = datetime.date(year, month, 1)
|
||||
end_date = start_date + relativedelta(months=1)
|
||||
query = cls.query
|
||||
query = query.filter(cls.date >= start_date)
|
||||
query = query.filter(cls.date < end_date)
|
||||
if material_id:
|
||||
query = query.filter(cls.material_id == material_id)
|
||||
if name:
|
||||
query = query.filter(cls.name.like(f'%{name}%'))
|
||||
if spec:
|
||||
|
@@ -36,7 +36,7 @@ class FujianSurvey(db.Model, Model, BaseModelMixin):
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def get_query(cls, year=None, month=None, name=None, spec=None, name_in=None, region='福州'):
|
||||
def get_query(cls, year=None, month=None, name=None, spec=None, name_in=None, region='福州', material_id=None):
|
||||
query = cls.query
|
||||
if year and month:
|
||||
start_date = datetime.date(year, month, 1)
|
||||
@@ -45,6 +45,8 @@ class FujianSurvey(db.Model, Model, BaseModelMixin):
|
||||
query = query.filter(cls.date < end_date)
|
||||
if name:
|
||||
query = query.filter(cls.name == name)
|
||||
if material_id:
|
||||
query = query.filter(cls.material_id == material_id)
|
||||
if name_in:
|
||||
query = query.filter(cls.name.in_(name_in))
|
||||
if spec:
|
||||
|
@@ -35,7 +35,7 @@ class FuzhouHighwayBureau(db.Model, Model, BaseModelMixin):
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def get_query(cls, year, month, name, spec=None, region='福州'):
|
||||
def get_query(cls, year, month, name=None, spec=None, region='福州', material_id=None):
|
||||
start_date = datetime.date(year, month, 1)
|
||||
end_date = start_date + relativedelta(months=1)
|
||||
query = cls.query
|
||||
@@ -45,6 +45,8 @@ class FuzhouHighwayBureau(db.Model, Model, BaseModelMixin):
|
||||
query = query.filter(cls.name == name)
|
||||
if spec:
|
||||
query = query.filter(cls.spec == spec)
|
||||
if material_id:
|
||||
query = query.filter(cls.material_id == material_id)
|
||||
if region:
|
||||
query = query.filter(cls.region.like(f'%{region}%'))
|
||||
return query
|
||||
|
@@ -35,7 +35,7 @@ class FuzhouTransportationBureau(db.Model, Model, BaseModelMixin):
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def get_query(cls, year, month, name, spec=None, region='福州'):
|
||||
def get_query(cls, year, month, name=None, spec=None, region='福州', material_id=None):
|
||||
start_date = datetime.date(year, month, 1)
|
||||
end_date = start_date + relativedelta(months=1)
|
||||
query = cls.query
|
||||
@@ -47,4 +47,6 @@ class FuzhouTransportationBureau(db.Model, Model, BaseModelMixin):
|
||||
query = query.filter(cls.spec.like(f'%{spec}%'))
|
||||
if region:
|
||||
query = query.filter(cls.region.like(f'%{region}%'))
|
||||
if material_id:
|
||||
query = query.filter(cls.material_id == material_id)
|
||||
return query
|
||||
|
@@ -29,6 +29,11 @@ class PriceResult(db.Model, Model, OperationTrackMixin, BaseModelMixin):
|
||||
fluctuating_recommend = Column('FLUCTUATING_RECOMMEND', Numeric(16, 4), default=0, comment='推荐浮动')
|
||||
price_fujian = Column('PRICE_FUJIAN', Numeric(16, 4), default=0, comment='住建厅价格')
|
||||
fluctuating_fujian = Column('FLUCTUATING_FUJIAN', Numeric(16, 4), default=0, comment='住建厅浮动')
|
||||
weight_ftb = Column('WEIGHT_FTB', Numeric(16, 4), default=0, comment='')
|
||||
weight_ss = Column('WEIGHT_SS', Numeric(16, 4), default=0, comment='')
|
||||
weight_fhb = Column('WEIGHT_FHB', Numeric(16, 4), default=0, comment='')
|
||||
weight_network = Column('WEIGHT_NETWORK', Numeric(16, 4), default=0, comment='')
|
||||
weight_survey = Column('WEIGHT_SURVEY', Numeric(16, 4), default=0, comment='')
|
||||
spec = Column('SPEC', String(128), default='', comment='规格')
|
||||
unit = Column('UNIT', String(128), default='', comment='单位')
|
||||
|
||||
|
Reference in New Issue
Block a user