diff --git a/Bootstrap.DataAccess.MySQL/Menu.cs b/Bootstrap.DataAccess.MySQL/Menu.cs
index 5360cc30..1b3e3ac2 100644
--- a/Bootstrap.DataAccess.MySQL/Menu.cs
+++ b/Bootstrap.DataAccess.MySQL/Menu.cs
@@ -51,38 +51,6 @@ namespace Bootstrap.DataAccess.MySQL
return menus;
}
- ///
- /// 删除菜单信息
- ///
- ///
- public override bool DeleteMenu(IEnumerable value)
- {
- bool ret = false;
- var ids = string.Join(",", value);
- using (TransactionPackage transaction = DbAccessManager.DBAccess.BeginTransaction())
- {
- using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, $"delete from NavigationRole where NavigationID in ({ids})"))
- {
- try
- {
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- cmd.CommandText = $"delete from Navigations where ID in ({ids})";
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- transaction.CommitTransaction();
- ret = true;
- }
- catch (Exception ex)
- {
- transaction.RollbackTransaction();
- throw ex;
- }
- }
- }
- return ret;
- }
-
///
///
/// 通过角色ID保存当前授权菜单
diff --git a/Bootstrap.DataAccess.SQLite/Menu.cs b/Bootstrap.DataAccess.SQLite/Menu.cs
index 8da7ba2d..abbf093b 100644
--- a/Bootstrap.DataAccess.SQLite/Menu.cs
+++ b/Bootstrap.DataAccess.SQLite/Menu.cs
@@ -12,38 +12,6 @@ namespace Bootstrap.DataAccess.SQLite
///
public class Menu : DataAccess.Menu
{
- ///
- /// 删除菜单信息
- ///
- ///
- public override bool DeleteMenu(IEnumerable value)
- {
- bool ret = false;
- var ids = string.Join(",", value);
- using (TransactionPackage transaction = DbAccessManager.DBAccess.BeginTransaction())
- {
- using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, $"delete from NavigationRole where NavigationID in ({ids})"))
- {
- try
- {
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- cmd.CommandText = $"delete from Navigations where ID in ({ids})";
- DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
-
- transaction.CommitTransaction();
- ret = true;
- }
- catch (Exception ex)
- {
- transaction.RollbackTransaction();
- throw ex;
- }
- }
- }
- return ret;
- }
-
///
///
/// 通过角色ID保存当前授权菜单
@@ -66,7 +34,7 @@ namespace Bootstrap.DataAccess.SQLite
//批插入菜单角色表
menuIds.ToList().ForEach(mId =>
{
- cmd.CommandText = $"Insert Into NavigationRole (NavigationID, RoleID) Values ( {mId}, {roleId})";
+ cmd.CommandText = $"Insert Into NavigationRole (NavigationID, RoleID) Values ({mId}, {roleId})";
DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
});
transaction.CommitTransaction();
diff --git a/Bootstrap.DataAccess/Menu.cs b/Bootstrap.DataAccess/Menu.cs
index 785f3b2c..7bfd7452 100644
--- a/Bootstrap.DataAccess/Menu.cs
+++ b/Bootstrap.DataAccess/Menu.cs
@@ -23,10 +23,26 @@ namespace Bootstrap.DataAccess
{
bool ret = false;
var ids = string.Join(",", value);
- using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.StoredProcedure, "Proc_DeleteMenus"))
+ using (TransactionPackage transaction = DbAccessManager.DBAccess.BeginTransaction())
{
- cmd.Parameters.Add(DbAccessManager.DBAccess.CreateParameter("@ids", ids));
- ret = DbAccessManager.DBAccess.ExecuteNonQuery(cmd) == -1;
+ using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, $"delete from NavigationRole where NavigationID in ({ids})"))
+ {
+ try
+ {
+ DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
+
+ cmd.CommandText = $"delete from Navigations where ID in ({ids})";
+ DbAccessManager.DBAccess.ExecuteNonQuery(cmd, transaction);
+
+ transaction.CommitTransaction();
+ ret = true;
+ }
+ catch (Exception ex)
+ {
+ transaction.RollbackTransaction();
+ throw ex;
+ }
+ }
}
return ret;
}