sysRoleController.js 640 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. const Controller = require('../extend/baseController');
  3. class SysRoleController extends Controller {
  4. tag() {
  5. return this.ctx.service.sysRoleService;
  6. }
  7. async listForPageWithNameR() {
  8. const { ctx } = this;
  9. ctx.setRegexMongoSql('queryName', 'name');
  10. const result = await this.tag().listForPage(ctx.query);
  11. ctx.success(result);
  12. }
  13. async deleteWithSub() {
  14. const { ctx } = this;
  15. const query = ctx.query;
  16. const { id } = query;
  17. const result = await this.tag().deleteWithSub(id);
  18. ctx.logic(result, '删除失败,该角色存在用户');
  19. }
  20. }
  21. module.exports = SysRoleController;