import { mysqlModelMap } from "../model/sqlModelBind";

/**
 * 添加数据
 * @param tableModel 
 * @param data 
 * @returns 
 */
export async function addData(tableName:string, data:any) {
    let tableModel = mysqlModelMap[tableName];
    let dataArray = [];
    if (!Array.isArray(data)) {
        dataArray.push(data);
    } else dataArray = data;
    
    await tableModel.bulkCreate(dataArray);
    
    return { isSuccess:true };
}