diff --git a/db/versions/10936-wheatAnthurium/00-updateACL.sql b/db/versions/10936-wheatAnthurium/00-updateACL.sql index 35c81ce58..42cf734e7 100644 --- a/db/versions/10936-wheatAnthurium/00-updateACL.sql +++ b/db/versions/10936-wheatAnthurium/00-updateACL.sql @@ -1,4 +1,6 @@ INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES ('Ticket','itemLack','READ','ALLOW','ROLE','employee'), - ('Ticket','itemLackDetail','READ','ALLOW','ROLE','employee'); + ('Ticket','itemLackDetail','READ','ALLOW','ROLE','employee'), + ('Ticket','itemLackOrigin','READ','ALLOW','ROLE','employee'), + ('Ticket','negativeOrigin','READ','ALLOW','ROLE','employee'); diff --git a/modules/ticket/back/methods/ticket/negativeOrigin.js b/modules/ticket/back/methods/ticket/negativeOrigin.js new file mode 100644 index 000000000..ee251ff3e --- /dev/null +++ b/modules/ticket/back/methods/ticket/negativeOrigin.js @@ -0,0 +1,36 @@ + +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +module.exports = Self => { + Self.remoteMethod('negativeOrigin', { + description: 'Insert ticket negative into negativeOrigin', + accessType: 'READ', + accepts: [{ + arg: 'ctx', + type: 'Object', + http: {source: 'context'} + }], + returns: { + type: 'object', + root: true + }, + http: { + path: `/negativeOrigin`, + verb: 'GET' + } + }); + + Self.negativeOrigin = async(ctx, data, options) => { + const myOptions = {}; + if (typeof options == 'object') + Object.assign(myOptions, options); + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + const conn = Self.dataSource.connector; + const stmts = ['SELECT * FROM vn.negativeOrigin']; + const sql = ParameterizedSQL.join(stmts, ';'); + const result = await conn.executeStmt(sql, myOptions); + return result; + }; +}; diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js index b057e7ffd..88fdb435e 100644 --- a/modules/ticket/back/models/ticket-methods.js +++ b/modules/ticket/back/models/ticket-methods.js @@ -49,4 +49,5 @@ module.exports = function(Self) { require('../methods/ticket/itemLack')(Self); require('../methods/ticket/itemLackDetail')(Self); require('../methods/ticket/itemLackOrigin')(Self); + require('../methods/ticket/negativeOrigin')(Self); };