fix:项目菜单

This commit is contained in:
geh
2025-05-13 11:04:14 +08:00
parent 846933e9e7
commit 5d8f6ee65e
4 changed files with 520 additions and 8 deletions
+487 -1
View File
@@ -1128,7 +1128,7 @@ namespace WebAPI.Controllers
string url = Request.RequestUri.Scheme + "://" + Request.RequestUri.Host + ":" +
Request.RequestUri.Port +
"/JT/" + reUrl;
"/SUBQHSE/" + reUrl;
responeData.data = new {IDCard = APIIDCardInfoService.ReadIDCardInfo(url), IDCardUrl = reUrl,URL=url};
}
@@ -1275,5 +1275,491 @@ namespace WebAPI.Controllers
#endregion
#region
public Model.ResponeData getSql()
{
var responeData = new Model.ResponeData();
try
{
var PersonList = (from x in Funs.DB.Sys_Menu
where x.MenuType == "Menu_Person"
select x).ToList();
var HSSEList = (from x in Funs.DB.Sys_Menu
where x.MenuType == "Menu_HSSE"
select x).ToList();
var CQMSList = (from x in Funs.DB.Sys_Menu
where x.MenuType == "Menu_CQMS"
select x).ToList();
var DeviceList = (from x in Funs.DB.Sys_Menu
where x.MenuType == "Menu_Device"
select x).ToList();
var DigitalSiteList = (from x in Funs.DB.Sys_Menu
where x.MenuType == "Menu_DigitalSite"
select x).ToList();
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int e = 0;
Dictionary<string, string> amap = new Dictionary<string, string>();
Dictionary<string, string> aamap = new Dictionary<string, string>();
Dictionary<string, string> bmap = new Dictionary<string, string>();
Dictionary<string, string> bbmap = new Dictionary<string, string>();
Dictionary<string, string> bbbmap = new Dictionary<string, string>();
Dictionary<string, string> cmap = new Dictionary<string, string>();
Dictionary<string, string> ccmap = new Dictionary<string, string>();
Dictionary<string, string> dmap = new Dictionary<string, string>();
Dictionary<string, string> ddmap = new Dictionary<string, string>();
Dictionary<string, string> emap = new Dictionary<string, string>();
Dictionary<string, string> eemap = new Dictionary<string, string>();
Model.SUBQHSEDB db = Funs.DB;
if (PersonList.Count > 0)
{
var qq = PersonList.Where(x => x.SuperMenu == "0");
foreach (var q in qq)
{
var id = SQLHelper.GetNewID();
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = q.MenuName,
Icon = q.Icon,
Url = q.Url,
SortIndex = q.SortIndex,
SuperMenu = "0",
MenuType = "Menu_Person_P",
IsOffice = q.IsOffice,
IsEnd = q.IsEnd,
IsUsed = q.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
amap.Add(q.MenuId, id);
a = a++;
}
var nqq = PersonList.Where(x => x.SuperMenu != "0");
foreach (var nq in nqq)
{
var id = SQLHelper.GetNewID();
if (amap.TryGetValue(nq.SuperMenu, out string value))
{
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = nq.MenuName,
Icon = nq.Icon,
Url = nq.Url,
SortIndex = nq.SortIndex,
SuperMenu = value,
MenuType = "Menu_Person_P",
IsOffice = nq.IsOffice,
IsEnd = nq.IsEnd,
IsUsed = nq.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
aamap.Add(nq.MenuId,id);
a = a++;
}
}
if (aamap.Count > 0)
{
foreach (var nq in nqq)
{
var id = SQLHelper.GetNewID();
if (aamap.TryGetValue(nq.SuperMenu, out string value))
{
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = nq.MenuName,
Icon = nq.Icon,
Url = nq.Url,
SortIndex = nq.SortIndex,
SuperMenu = value,
MenuType = "Menu_Person_P",
IsOffice = nq.IsOffice,
IsEnd = nq.IsEnd,
IsUsed = nq.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
a = a++;
}
}
}
}
if (HSSEList.Count > 0)
{
var qq = HSSEList.Where(x => x.SuperMenu == "0");
foreach (var q in qq)
{
var id = SQLHelper.GetNewID();
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = q.MenuName,
Icon = q.Icon,
Url = q.Url,
SortIndex = q.SortIndex,
SuperMenu = "0",
MenuType = "Menu_HSSE_P",
IsOffice = q.IsOffice,
IsEnd = q.IsEnd,
IsUsed = q.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
bmap.Add(q.MenuId, id);
b = b++;
}
var nqq = HSSEList.Where(x => x.SuperMenu != "0");
foreach (var nq in nqq)
{
var id = SQLHelper.GetNewID();
if (bmap.TryGetValue(nq.SuperMenu, out string value))
{
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = nq.MenuName,
Icon = nq.Icon,
Url = nq.Url,
SortIndex = nq.SortIndex,
SuperMenu = value,
MenuType = "Menu_HSSE_P",
IsOffice = nq.IsOffice,
IsEnd = nq.IsEnd,
IsUsed = nq.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
bbmap.Add(nq.MenuId,id);
b = b++;
}
}
if (bbmap.Count>0)
{
foreach (var nq in nqq)
{
var id = SQLHelper.GetNewID();
if (bbmap.TryGetValue(nq.SuperMenu, out string value))
{
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = nq.MenuName,
Icon = nq.Icon,
Url = nq.Url,
SortIndex = nq.SortIndex,
SuperMenu = value,
MenuType = "Menu_HSSE_P",
IsOffice = nq.IsOffice,
IsEnd = nq.IsEnd,
IsUsed = nq.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
bbbmap.Add(nq.MenuId,id);
b = b++;
}
}
}
if (bbbmap.Count>0)
{
foreach (var nq in nqq)
{
var id = SQLHelper.GetNewID();
if (bbbmap.TryGetValue(nq.SuperMenu, out string value))
{
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = nq.MenuName,
Icon = nq.Icon,
Url = nq.Url,
SortIndex = nq.SortIndex,
SuperMenu = value,
MenuType = "Menu_HSSE_P",
IsOffice = nq.IsOffice,
IsEnd = nq.IsEnd,
IsUsed = nq.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
}
}
}
}
if (CQMSList.Count > 0)
{
var qq = CQMSList.Where(x => x.SuperMenu == "0");
foreach (var q in qq)
{
var id = SQLHelper.GetNewID();
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = q.MenuName,
Icon = q.Icon,
Url = q.Url,
SortIndex = q.SortIndex,
SuperMenu = "0",
MenuType = "Menu_CQMS_P",
IsOffice = q.IsOffice,
IsEnd = q.IsEnd,
IsUsed = q.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
cmap.Add(q.MenuId, id);
c = c++;
}
var nqq = CQMSList.Where(x => x.SuperMenu != "0");
foreach (var nq in nqq)
{
var id = SQLHelper.GetNewID();
if (cmap.TryGetValue(nq.SuperMenu, out string value))
{
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = nq.MenuName,
Icon = nq.Icon,
Url = nq.Url,
SortIndex = nq.SortIndex,
SuperMenu = value,
MenuType = "Menu_CQMS_P",
IsOffice = nq.IsOffice,
IsEnd = nq.IsEnd,
IsUsed = nq.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
ccmap.Add(nq.MenuId,id);
c = c++;
}
}
if (ccmap.Count>0)
{
foreach (var nq in nqq)
{
var id = SQLHelper.GetNewID();
if (ccmap.TryGetValue(nq.SuperMenu, out string value))
{
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = nq.MenuName,
Icon = nq.Icon,
Url = nq.Url,
SortIndex = nq.SortIndex,
SuperMenu = value,
MenuType = "Menu_CQMS_P",
IsOffice = nq.IsOffice,
IsEnd = nq.IsEnd,
IsUsed = nq.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
}
}
}
}
if (DeviceList.Count > 0)
{
var qq = DeviceList.Where(x => x.SuperMenu == "0");
foreach (var q in qq)
{
var id = SQLHelper.GetNewID();
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = q.MenuName,
Icon = q.Icon,
Url = q.Url,
SortIndex = q.SortIndex,
SuperMenu = "0",
MenuType = "Menu_Device_P",
IsOffice = q.IsOffice,
IsEnd = q.IsEnd,
IsUsed = q.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
dmap.Add(q.MenuId, id);
d = d++;
}
var nqq = DeviceList.Where(x => x.SuperMenu != "0");
foreach (var nq in nqq)
{
var id = SQLHelper.GetNewID();
if (dmap.TryGetValue(nq.SuperMenu, out string value))
{
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = nq.MenuName,
Icon = nq.Icon,
Url = nq.Url,
SortIndex = nq.SortIndex,
SuperMenu = value,
MenuType = "Menu_Device_P",
IsOffice = nq.IsOffice,
IsEnd = nq.IsEnd,
IsUsed = nq.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
ddmap.Add(nq.MenuId,id);
d = d++;
}
}
if (ddmap.Count>0)
{
foreach (var nq in nqq)
{
var id = SQLHelper.GetNewID();
if (ddmap.TryGetValue(nq.SuperMenu, out string value))
{
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = nq.MenuName,
Icon = nq.Icon,
Url = nq.Url,
SortIndex = nq.SortIndex,
SuperMenu = value,
MenuType = "Menu_Device_P",
IsOffice = nq.IsOffice,
IsEnd = nq.IsEnd,
IsUsed = nq.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
}
}
}
}
if (DigitalSiteList.Count > 0)
{
var qq = DigitalSiteList.Where(x => x.SuperMenu == "0");
foreach (var q in qq)
{
var id = SQLHelper.GetNewID();
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = q.MenuName,
Icon = q.Icon,
Url = q.Url,
SortIndex = q.SortIndex,
SuperMenu = "0",
MenuType = "Menu_DigitalSite_P",
IsOffice = q.IsOffice,
IsEnd = q.IsEnd,
IsUsed = q.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
emap.Add(q.MenuId, id);
e = e++;
}
var nqq = DigitalSiteList.Where(x => x.SuperMenu != "0");
foreach (var nq in nqq)
{
var id = SQLHelper.GetNewID();
if (emap.TryGetValue(nq.SuperMenu, out string value))
{
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = nq.MenuName,
Icon = nq.Icon,
Url = nq.Url,
SortIndex = nq.SortIndex,
SuperMenu = value,
MenuType = "Menu_DigitalSite_P",
IsOffice = nq.IsOffice,
IsEnd = nq.IsEnd,
IsUsed = nq.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
eemap.Add(nq.MenuId,id);
e = e++;
}
}
if (eemap.Count>0)
{
foreach (var nq in nqq)
{
var id = SQLHelper.GetNewID();
if (eemap.TryGetValue(nq.SuperMenu, out string value))
{
Model.Sys_Menu newmMenu = new Model.Sys_Menu
{
MenuId = id,
MenuName = nq.MenuName,
Icon = nq.Icon,
Url = nq.Url,
SortIndex = nq.SortIndex,
SuperMenu = value,
MenuType = "Menu_DigitalSite_P",
IsOffice = nq.IsOffice,
IsEnd = nq.IsEnd,
IsUsed = nq.IsUsed,
};
db.Sys_Menu.InsertOnSubmit(newmMenu);
db.SubmitChanges();
}
}
}
}
responeData.data = new { a=a,b=b,c=c,d=d,e=e };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}