works_model.js 604 B

12345678910111213141516171819202122232425
  1. const CheckDbBaseModel = require('../CheckDbBaseModel')
  2. class works_model extends CheckDbBaseModel {
  3. constructor() {
  4. super('works'); //表名
  5. }
  6. async findBycp_work_id(cp_work_id) {
  7. return await this.findOne({ cp_work_id });
  8. }
  9. async createWorkData(tableData) {
  10. return await this.transaction(async (connection) => {
  11. const id = await this.create(tableData);
  12. return id;
  13. });
  14. }
  15. async updateWorkData(id, profileData) {
  16. return await this.update({ id: id }, profileData);
  17. }
  18. }
  19. module.exports = new works_model();