garyvv /
node-sharp
| 1 | View Code Duplication | const DB = require('../../libraries/db') |
|
|
0 ignored issues
–
show
Duplication
introduced
by
Loading history...
|
|||
| 2 | const ModelBase = require('../../model/base') |
||
| 3 | |||
| 4 | const table = 'mist_desk' |
||
| 5 | |||
| 6 | module.exports = { |
||
| 7 | add: async function (data) { |
||
| 8 | let res = await ModelBase.execInsert(table, data) |
||
| 9 | return res; |
||
| 10 | }, |
||
| 11 | |||
| 12 | list: async function (storeId) { |
||
| 13 | |||
| 14 | let result = await DB.readMysql.select( |
||
| 15 | '*' |
||
| 16 | ) |
||
| 17 | .from(table) |
||
| 18 | .where('store_id', storeId) |
||
| 19 | .where('status', '!=', -1) |
||
| 20 | |||
| 21 | return result |
||
| 22 | |||
| 23 | }, |
||
| 24 | |||
| 25 | first: async function (id) { |
||
| 26 | |||
| 27 | let result = await DB.readMysql.first( |
||
| 28 | '*' |
||
| 29 | ) |
||
| 30 | .from(table) |
||
| 31 | .where('id', id) |
||
| 32 | |||
| 33 | return result |
||
| 34 | |||
| 35 | }, |
||
| 36 | |||
| 37 | edit: async function (data, where, notWhere = {}) { |
||
| 38 | let result = await ModelBase.execUpdate(table, data, where, notWhere) |
||
| 39 | |||
| 40 | return result |
||
| 41 | } |
||
| 42 | |||
| 43 | } |
||
| 44 |