sysRoleService.js 419 B

1234567891011121314151617181920
  1. 'use strict';
  2. const Service = require('../service/baseService');
  3. class SysRoleService extends Service {
  4. tag() {
  5. return this.ctx.model.SysRoleModel;
  6. }
  7. async deleteWithSub(id) {
  8. const { model } = this.ctx;
  9. const dbUserArr = await model.SysUserModel.find({ role: id });
  10. if (dbUserArr.length > 0) {
  11. return null;
  12. }
  13. return await this.delete(id);
  14. }
  15. }
  16. module.exports = SysRoleService;