#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Date:2022/09/08 13:42:28 ''' import sys sys.path.append('.') from db_logic.module import BllModule from models.power_models import EntityModule from Common.Utils import Utils data_list = BllModule().execute("select * from rms_module_copy1 where module_type=2 order by sort_index").fetchall() data_list = Utils.msyql_table_model(data_list) obj_list = [] a = 65 for i in data_list: module_code = i["module_code"] if "Drug" in module_code: module_code = str(module_code).replace("Drug", "Instrument") module_name = i["module_name"] if "试剂" in module_name: module_name = str(module_name).replace("试剂", "仪器") obj = EntityModule( module_type=5, module_code=module_code, module_name=module_name, sort_index=a, module_weight=a, parent_id=0, is_enabled=i['is_enabled'], create_date=Utils.get_str_datetime() ) a += 1 obj_list.append(obj) BllModule().insert_many(obj_list) print(a) # print(data_list)