背景: 当我们项目上需要写原生sql语句的时候,但是写插入更新语句都很麻烦,这里就封装了一个方便调用的函数
//设置表的主键
const tablePrimaryKey = {
t_fund_trade_data: { fund_id: true, trade_time: true },
t_fund_value_discount: { fund_id: true, hist_dt: true },
t_fund_stock_list: { fund_id: true, asset_id: true },
t_funds: { fund_id: true, },
t_funds_idx: { idx_id: true },
t_fund_user_rel: { fund_id: true, user_id: true },
t_fund_user_ban_rel: { fund_id: true, user_id: true },
t_fund_users: { user_id: true, },
}
/**
* 给数据表新增数据
* table:表名
* data: 数据 ,数组或对象 ,传入数组可插入更新多条数据,传入对象只能插入更新一条
* deallimit: 默认 10:,由于单条sql语句执行长度有限制, 这里可以控制单次处理数据的条数,可根据单条sql语句长度设置
* 插入单条数据
*
* insertData({
* table:'t_funds',
* data:{
* fund_id:1,
* fund_nm:'名称',
* },
*
* })
* 插入多条数据,注意 多条数据中的,数据字段要一样
* inser