123456789101112131415161718192021222324252627 |
- 'use strict';
- const Service = require('../service/baseService');
- class SysMenuService extends Service {
- tag() {
- return this.ctx.model.SysMenuModel;
- }
- async loginerRoleMenu(id) {
- const { model } = this.ctx;
- const data = { sort: { order: 1 } };
- const dbMenuArr = await this.list(data);
- const dbUserOne = await model.SysUserModel.findById(id);
- const roleMenu = await model.SysRoleModel.findById(dbUserOne.role);
- return { dbMenuArr, roleMenu: JSON.parse(roleMenu.roleMenu) };
- }
- async deleteWithSub(id) {
- const dbMenuArr = await this.ctx.model.SysMenuModel.find({ fid: id });
- if (dbMenuArr.length > 0) {
- return null;
- }
- return await this.delete(id);
- }
- }
- module.exports = SysMenuService;
|