12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 'use strict';
- const Controller = require('../extend/baseController');
- class SysMenuController extends Controller {
- tag() {
- return this.ctx.service.sysMenuService;
- }
- async listSortAsc() {
- const { ctx } = this;
- ctx.setOrder();
- const result = await this.tag().list(ctx.query);
- ctx.success(result);
- }
- async listForPageSortWithNameR() {
- const { ctx } = this;
- ctx.setRegexMongoSql('queryName', 'name');
- ctx.setOrder();
- const result = await this.tag().listForPage(ctx.query);
- ctx.success(result);
- }
- async loginerRoleMenu() {
- const { ctx } = this;
- const user = ctx.user;
- const result = await this.tag().loginerRoleMenu(user._id);
- ctx.logic(result, '获取角色菜单失败');
- }
- async deleteWithSub() {
- const { ctx } = this;
- const query = ctx.query;
- const { id } = query;
- const result = await this.tag().deleteWithSub(id);
- ctx.logic(result, '删除失败,该菜单存在子元素');
- }
- }
- module.exports = SysMenuController;
|