调整接口
This commit is contained in:
@@ -48,8 +48,7 @@ module.exports = {
|
||||
})
|
||||
}
|
||||
},
|
||||
addOrUpdate: ({table, form}) => {
|
||||
//新增和更新
|
||||
insert: ({table, form}) => {
|
||||
let sql
|
||||
if (form.id) {//编辑
|
||||
let arr = Object.keys(form).filter(e => form[e]).map(e => {
|
||||
@@ -66,8 +65,16 @@ module.exports = {
|
||||
arr.push(`'${form[e]}'`)
|
||||
}
|
||||
})
|
||||
sql = `insert into ${table} (id,createTime,${cols.join(",")}) values('${uuid()}','${dayjs().format("YYYY-MM-DD hh:mm:ss")}',${arr.join(",")})`
|
||||
sql = `insert into ${table} (id,createTime,${cols.join(",")}) values('${uuid()}','${dayjs().format("YYYY-MM-DD HH:mm:ss")}',${arr.join(",")})`
|
||||
}
|
||||
return sql
|
||||
},
|
||||
batchInsert({table, list}) {
|
||||
return query(list.map(e => this.insert({table, e})).join(";"))
|
||||
},
|
||||
addOrUpdate: ({table, form}) => {
|
||||
//新增和更新
|
||||
const sql = this.insert({table, form})
|
||||
return query(sql)
|
||||
},
|
||||
delete: ({table, ids}) => {
|
||||
|
||||
Reference in New Issue
Block a user