调整接口

This commit is contained in:
aixianling
2023-02-10 19:33:57 +08:00
parent 46287ac2f5
commit 0a928d8231
2 changed files with 26 additions and 4 deletions

View File

@@ -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}) => {