/// <summary> /// 为了提高撤销的运行速度 /// </summary> /// <param name="systemCode">资源权限读写器</param> /// <param name="roleId">角色主键</param> /// <param name="permissionId">权限主键</param> /// <returns>影响行数</returns> public int RevokeRole(string systemCode, string roleId, string permissionId) { var result = 0; var tableName = systemCode + "Permission"; var permissionManager = new BasePermissionManager(DbHelper, UserInfo, tableName); tableName = systemCode + "Role"; var parameters = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>(BasePermissionEntity.FieldResourceCategory, tableName), new KeyValuePair <string, object>(BasePermissionEntity.FieldResourceId, roleId), new KeyValuePair <string, object>(BasePermissionEntity.FieldPermissionId, permissionId) }; // 2015-09-21 吉日嘎拉 这里增加变更日志 tableName = systemCode + "RolePermission"; var sqlBuilder = new SqlBuilder(DbHelper); sqlBuilder.BeginInsert(BaseChangeLogEntity.CurrentTableName); sqlBuilder.SetValue(BaseChangeLogEntity.FieldTableName, tableName); if (DbHelper.CurrentDbType == CurrentDbType.Oracle) { sqlBuilder.SetFormula(BaseChangeLogEntity.FieldId, BaseChangeLogEntity.CurrentTableName + "_SEQ.NEXTVAL"); } sqlBuilder.SetValue(BaseChangeLogEntity.FieldRecordKey, roleId); sqlBuilder.SetValue(BaseChangeLogEntity.FieldColumnName, "撤销授权"); sqlBuilder.SetValue(BaseChangeLogEntity.FieldColumnDescription, new BaseModuleManager().GetNameByCache(systemCode, permissionId)); sqlBuilder.SetValue(BaseChangeLogEntity.FieldOldValue, "1"); sqlBuilder.SetValue(BaseChangeLogEntity.FieldNewValue, permissionId); sqlBuilder.EndInsert(); // 伪删除、数据有冗余,但是有历史记录 result = permissionManager.SetDeleted(parameters); // 真删除、执行效率高、但是没有历史记录 //result = permissionManager.Delete(parameters); return(result); }