增加详情接口

This commit is contained in:
aixianling
2022-07-04 10:01:33 +08:00
parent 5b437886eb
commit 3334a68f06
2 changed files with 16 additions and 0 deletions

13
src/rest/custom/detail.js Normal file
View File

@@ -0,0 +1,13 @@
const dbUtils = require("../../utils/dbUitls");
module.exports = {
action: "/node/custom/addOrUpdate",
method: "post",
execute: (request, response) => {
let {id} = request.query
dbUtils.detail({table: 'node_custom_config', id}).then(data => {
response.send({code: 0, data})
}).catch(err => {
response.send({code: 1, err: err?.sqlMessage || err || ""})
})
}
}

View File

@@ -70,5 +70,8 @@ module.exports = {
ids = ids?.split(",")?.map(e => `'${e}'`)?.toString()
return query(`delete from ${table} where id in (${ids})`)
},
detail: ({table, id}) => {
return query(`select * from ${table} where id='${id}' limit 0,1`)
},
format: args => args.map(e => `${e.prop}`).join(" ")
}