sysMenuController.js 1020 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'use strict';
  2. const Controller = require('../extend/baseController');
  3. class SysMenuController extends Controller {
  4. tag() {
  5. return this.ctx.service.sysMenuService;
  6. }
  7. async listSortAsc() {
  8. const { ctx } = this;
  9. ctx.setOrder();
  10. const result = await this.tag().list(ctx.query);
  11. ctx.success(result);
  12. }
  13. async listForPageSortWithNameR() {
  14. const { ctx } = this;
  15. ctx.setRegexMongoSql('queryName', 'name');
  16. ctx.setOrder();
  17. const result = await this.tag().listForPage(ctx.query);
  18. ctx.success(result);
  19. }
  20. async loginerRoleMenu() {
  21. const { ctx } = this;
  22. const user = ctx.user;
  23. const result = await this.tag().loginerRoleMenu(user._id);
  24. ctx.logic(result, '获取角色菜单失败');
  25. }
  26. async deleteWithSub() {
  27. const { ctx } = this;
  28. const query = ctx.query;
  29. const { id } = query;
  30. const result = await this.tag().deleteWithSub(id);
  31. ctx.logic(result, '删除失败,该菜单存在子元素');
  32. }
  33. }
  34. module.exports = SysMenuController;