#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Date:2022/08/01 15:36:46 ''' import sys sys.path.append('.') from db_logic.db_base import Repository from models.power_models import EntityModule from Common.Utils import Utils class BllModule(Repository): def __init__(self, entityType=EntityModule): return super().__init__(entityType) """ module_id = Column(String(50), primary_key=True, comment="模块ID") module_type = Column(String(50), comment="模块类型") module_code = Column(String(50), comment="") module_name = Column(String(50), comment="模块名称") icon = Column(String(50), comment="图片") url_address = Column(String(50), comment="图片地址") sort_index = Column(Integer, comment="排序下标") module_weight = Column(Integer, comment="模块权重") parent_id = Column(String(50), comment="父id") is_enabled = Column(Integer, comment="是否启用") description = Column(String(50), comment="备注") create_date = Column(String(50), comment="创建时间") create_user_id = Column(String(50), comment="创建用户id") create_user_name = Column(String(50), comment="创建用户名") is_add = Column(Integer, comment="") """ def inster_info_list(self): obj_list = [] from demo import data_list for i in data_list: obj = EntityModule( module_type=i.get("ModuleType"), module_name=i.get("ModuleName"), module_code=i.get("ModuleCode"), sort_index=i.get("SortIndex"), module_weight=i.get("SortIndex"), parent_id=0, is_enabled=1, create_date=Utils.get_str_datetime(), create_user_id='4cea74ee-0d8b-11ed-943e-f47b094925e1', create_user_name="admin", ) obj_list.append(obj) self.insert_many(obj_list) if __name__ == '__main__': from Common.Utils import Utils aaa = BllModule().inster_info_list() # aaa_list = Utils.msyql_table_model(aaa) print(aaa)