class UsersModel(db.Model, CRUD): __tablename__ = "users" __table_args__ = {'mysql_charset': 'utf8'} id = db.Column(db.String(32), default=get_uuid, primary_key=True) username = db.Column(db.String(128)) hash_password = db.Column(db.String(128)) roles = db.Column(db.String(32), default='user') status = db.Column(db.Integer, default=1) createtime = db.Column(db.DateTime, default=datetime.now) updatetime = db.Column(db.DateTime, default=datetime.now) def __init__(self, username, password): self.username = username self.password = password @property def password(self): raise AttributeError('password cannot be read') @password.setter def password(self, password): self.hash_password = generate_password_hash(password) def confirm_password(self, password): return check_password_hash(self.hash_password, password) @classmethod def find_by_username(cls, username): return cls.query.filter(cls.username == username).first() @classmethod def find_by_id(cls, id): return cls.query.filter(cls.id == id).first()
class ManualsModel(db.Model, CRUD): __tablename__ = "manuals" uuid = db.Column(db.String(32), default=get_uuid, primary_key=True) title = db.Column(db.String(256), default=None, unique=True) content = db.Column(db.Text, default=None) createtime = db.Column(db.DateTime, default=datetime.now) updatetime = db.Column(db.DateTime, default=None)
class OptionsModel(db.Model, CRUD): __tablename__ = "options" uuid = db.Column(db.String(32), default=get_uuid, primary_key=True) opt_key = db.Column(db.String(256), default=None, unique=True) opt_value = db.Column(db.Text, default=None) createtime = db.Column(db.DateTime, default=datetime.now) updatetime = db.Column(db.DateTime, default=None)
class OptionsModel(db.Model, CRUD): __tablename__ = "options" __table_args__ = {'mysql_charset': 'utf8'} uuid = db.Column(db.String(32), default=get_uuid, primary_key=True) opt_key = db.Column(db.String(256), default=None, unique=True) opt_value = db.Column(db.Text, default=None) remark = db.Column(db.Text, default=None) createtime = db.Column(db.DateTime, default=datetime.now) updatetime = db.Column(db.DateTime, default=datetime.now)
class BlocksetModel(db.Model, CRUD): __tablename__ = "blockset" uuid = db.Column(db.String(32), default=get_uuid, primary_key=True) title = db.Column(db.String(256), default=None, unique=True) description = db.Column(db.Text, default=None) coordinates = db.Column(db.Text, default=None) centroid = db.Column(db.Text, default=None) area = db.Column(db.String(32), default=None) createtime = db.Column(db.DateTime, default=datetime.now) updatetime = db.Column(db.DateTime, default=None)
class DatasetModel(db.Model, CRUD): __tablename__ = "dataset" uuid = db.Column(db.String(32), default=get_uuid, primary_key=True) title = db.Column(db.String(256), default=None, unique=True) catalog = db.Column(db.String(32), default=None) mode = db.Column(db.String(32), default=None) inc_area = db.Column(db.Boolean, default=False) tag = db.Column(db.String(32), default=None) headers = db.Column(db.Text, default=None) navigate = db.Column(db.Text, default=None) complete = db.Column(db.Boolean, default=False) createtime = db.Column(db.DateTime, default=datetime.now) updatetime = db.Column(db.DateTime, default=None)
class DatasetRoomModel(db.Model, CRUD): __tablename__ = "dataset_room" __table_args__ = { 'mysql_charset': 'utf8' } uuid = db.Column(db.String(32), default = get_uuid, primary_key = True, comment = u'价格索引') pro_uuid = db.Column(db.String(32), db.ForeignKey('projects.pro_uuid'), comment = u'外键,关联楼盘信息') city = db.Column(db.String(64), comment = u'所属省市') scope = db.Column(db.String(64), comment = u'所属区域') stattype = db.Column(db.String(32), comment = u'统计类型') statdate = db.Column(db.Date, comment = u'统计日期') datetype = db.Column(db.String(32), comment = u'日期类型') property = db.Column(db.String(32), comment = u'物业类型') intervals = db.Column(db.Integer, default = 0, comment = u'区间标记') area = db.Column(db.Float, default = 0, comment = u'面积') number = db.Column(db.Float, default = 0, comment = u'数量') amount = db.Column(db.Float, comment = u'统计数值')
class ProjectInfomationModel(db.Model, CRUD): __tablename__ = "t_project_info_data" __table_args__ = {'mysql_charset': 'utf8'} pro_uuid = db.Column(db.String(36), default=get_uuid, primary_key=True, comment=u'楼盘索引') pro_name = db.Column(db.String(512), comment=u'楼盘名称') pro_address = db.Column(db.String(512), comment=u'楼盘地址') pro_company = db.Column(db.String(512), comment=u'楼盘开发商') pro_ave_price = db.Column(db.Float, comment=u'楼盘平均价格') pro_sale_card = db.Column(db.String(512), comment=u'楼盘预售证') pro_sold_door = db.Column(db.Integer, default=0, comment=u'楼盘已售总套数') pro_market_door = db.Column(db.Integer, default=0, comment=u'楼盘上市总套数') pro_deal_door = db.Column(db.Integer, default=0, comment=u'楼盘成交总套数') pro_sold_area = db.Column(db.Float, default=0.0, comment=u'楼盘已售总面积') pro_market_area = db.Column(db.Float, default=0.0, comment=u'楼盘上市总面积') pro_deal_area = db.Column(db.Float, default=0.0, comment=u'楼盘成交总面积') pro_lng = db.Column(db.String(128), comment=u'楼盘经度') pro_lat = db.Column(db.String(128), comment=u'楼盘纬度') pro_sale_date = db.Column(db.DateTime, comment=u'楼盘开始售卖日期') pro_province_uuid = db.Column( db.String(36), db.ForeignKey('t_province_dict.province_uuid'), comment=u'外键,关联楼盘所属省份') pro_province = db.relationship('ProvinceModel', backref=db.backref('projects'), lazy='dynamic') pro_city_uuid = db.Column(db.String(36), db.ForeignKey('t_city_dict.city_uuid'), comment=u'外键,关联楼盘所属城市') pro_city = db.relationship('CityModel', backref=db.backref('projects'), lazy='dynamic') pro_district_uuid = db.Column( db.String(36), db.ForeignKey('t_district_dict.district_uuid'), comment=u'外键,关联楼盘所属区域') pro_district = db.relationship('DistrictModel', backref=db.backref('projects'), lazy='dynamic') #获取所有楼盘 @classmethod def GetInfoAll(cls): return cls.query.all() #根据省份获取楼盘 @classmethod def GetInfoByProvince(cls): pass #根据城市获取楼盘 @classmethod def GetInfoByCity(cls): pass #根据区域获取楼盘 @classmethod def GetInfoByDistrict(cls): pass #根据平均价获取楼盘 @classmethod def GetInfoByAvePrice(cls, start, end): pass