增加详情接口
This commit is contained in:
13
src/rest/custom/detail.js
Normal file
13
src/rest/custom/detail.js
Normal 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 || ""})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,5 +70,8 @@ module.exports = {
|
|||||||
ids = ids?.split(",")?.map(e => `'${e}'`)?.toString()
|
ids = ids?.split(",")?.map(e => `'${e}'`)?.toString()
|
||||||
return query(`delete from ${table} where id in (${ids})`)
|
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(" ")
|
format: args => args.map(e => `${e.prop}`).join(" ")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user