1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using Bowin.Common.Utility;
- using YLShipBuildLandMap.Entity;
- using YLShipBuildLandMap.Entity.ViewModel.SystemSetting;
- using Microsoft.EntityFrameworkCore;
- using Newtonsoft.Json.Linq;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace YLShipBuildLandMap.Services.SystemSetting
- {
- public class FunctionCodeService : IFunctionCodeService
- {
- private YLShipBuildLandMapContext DbContext { get; set; }
-
- public FunctionCodeService(YLShipBuildLandMapContext dbContext)
- {
- DbContext = dbContext;
-
- }
- public List<string> GetUserFunctionCodes(Guid userID)
- {
-
- var sql = (from u in DbContext.SysUser.Where(x => x.UserId == userID)
- from r in u.SysUserSysRole
- from rf in r.Role.SysRoleSysFunctionCode
- select rf.FunctionCode).Distinct();
- return sql.ToList();
- }
- public List<FunctionCodeView> GetFunctionCodeList()
- {
- var sql = (from f in DbContext.SysFunctionCode
- select new FunctionCodeView {
- FunctionCode = f.FunctionCode,
- FunctionName = f.FunctionName,
- ParentFunctionCode = f.ParentFunctionCode ?? "",
- OrderNo = f.OrderNo
- });
- return sql.OrderBy(x => x.OrderNo).ToList();
- }
- public List<string> GetRoleFunctionCode(Guid roleID)
- {
- var sql = (from rf in DbContext.SysRoleSysFunctionCode.Where(x => x.RoleId == roleID)
- select rf.FunctionCode);
- return sql.ToList();
- }
- }
- }
|