1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using ProjectBase.Data.BaseDAL;
- using ProjectBase.Data.Logs;
- using SIMDP.DAL.IDALSQL;
- using SIMDP.Model;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SIMDP.BLL
- {
- public class BlRoleRight : BaseBLL<MoRoleRight>
- {
- private IDalRoleRight dalRoleRight;
- /// <summary>
- /// 构造函数
- /// </summary>
- public BlRoleRight() : base()
- {
- base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
- dalRoleRight = baseDal as IDalRoleRight;
- dalRoleRight.OnOperationLog += new OperationLogEventHandler(BlLogOperation.OnOperationLog);
- }
- public bool Function(string userId, string functionId)
- {
- List<MoRoleRight> MoList = null;
- try
- {
- // string sql = "select role_id, right_id, right_type from role_right b where b.role_id in " +
- //"(select a.role_id from user_role a where a.user_id = '" + userId +
- //"') and b.right_id = '" + functionId + "' UNION select role_id, right_id, right_type from role_right b where b.role_id in " +
- //"( select c.menu_function_id as right_id from menu c" +
- //" where c.menu_function_id = '" + functionId + "' and c.menu_delete = 0 and c.menu_visible = 1)";
- string sql = "select role_id, right_id, right_type from role_right b where b.role_id in " +
- "(select a.role_id from user_role a where a.user_id = '" + userId +
- "') and b.right_id = '" + functionId + "' and b.right_id in ( select c.menu_function_id as right_id from menu c" +
- " where c.menu_function_id = '" + functionId + "' and c.menu_delete = 0 and c.menu_visible = 1)";
- MoList = dalRoleRight.GetList(sql);
- }
- catch (Exception ex)
- {
- LogHelper.log.Error(functionId + "功能菜单验证失败 原因是{0}", ex);
- return false;
- }
- if (MoList == null || MoList.Count == 0)
- return false;
- else
- return true;
- }
- }
- }
|