You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
3.4 KiB
90 lines
3.4 KiB
using System.Data;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Logging;
|
|
using Tiobon.Core.Common;
|
|
using Tiobon.Core.Common.DB.Dapper;
|
|
using Tiobon.Core.IServices;
|
|
using Tiobon.Core.Model;
|
|
using Tiobon.Core.Services.BASE;
|
|
|
|
namespace Tiobon.Core.Services;
|
|
|
|
public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommonServices
|
|
{
|
|
IHttpContextAccessor _httpContextAccessor;
|
|
ILogger<PayServices> _logger;
|
|
public CommonServices(ILogger<PayServices> logger, IHttpContextAccessor httpContextAccessor)
|
|
{
|
|
_logger = logger;
|
|
_httpContextAccessor = httpContextAccessor;
|
|
}
|
|
#region 获取菜单
|
|
|
|
/// <summary>
|
|
/// 获取菜单
|
|
/// </summary>
|
|
/// <param name="param"></param>
|
|
/// <returns></returns>
|
|
public async Task<ServiceResult<MenuReturn>> GetMenuAsync([FromBody] MenuParam param)
|
|
{
|
|
var result = new MenuReturn();
|
|
string sql = "SELECT MenuID, MenuType FROM Ghrs_Menu WHERE IsEnable = 1 AND MenuNo = '{0}'";
|
|
sql = string.Format(sql, param.menuName);
|
|
DataTable dt = await DbAccess.GetDataTableAsync(sql);
|
|
|
|
int MenuID = 0;
|
|
string MenuType = string.Empty;
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
MenuID = int.Parse(dt.Rows[0]["MenuID"].ToString());
|
|
MenuType = dt.Rows[0]["MenuType"].ToString();
|
|
}
|
|
|
|
switch (MenuType)
|
|
{
|
|
case "MenuForm":
|
|
{
|
|
sql = @"SELECT MenuNo,
|
|
[dbo].[FLangKeyToValue] (MKey, {0}, MenuName) MenuName,
|
|
IconType,
|
|
MenuUrl,
|
|
[dbo].[FParaDetailNoToName] ('GHRPara',
|
|
'MenuGroupTitle',
|
|
MenuGroupTitle,
|
|
{0},
|
|
1) MenuGroupTitle
|
|
FROM Ghrs_Menu
|
|
WHERE ParentmenuID ='{1}'
|
|
AND IsEnable = 1
|
|
AND (SELECT count (1)
|
|
FROM Ghrs_UserRole
|
|
WHERE UserID = '{2}'
|
|
AND IsEnable = 1
|
|
AND dbo.Fs_GetMenuIsCheckByRole (RoleId, MenuID, '') > 0) >
|
|
0
|
|
ORDER BY SortNo";
|
|
sql = string.Format(sql, param.langId, MenuID, App.User.ID);
|
|
result.DT_SubMenu = await Db.Ado.SqlQueryAsync<DT_SubMenu>(sql);
|
|
|
|
sql = @"SELECT iif (MenuColDisplayType ! = 'Tile', 'Tab', 'Tile') MenuColType
|
|
FROM Ghrs_Menu
|
|
WHERE menuID = 120";
|
|
sql = string.Format(sql, MenuID);
|
|
result.DT_MenuColType = await Db.Ado.SqlQueryAsync<DT_MenuColType>(sql);
|
|
break;
|
|
}
|
|
|
|
default:
|
|
{
|
|
break;
|
|
|
|
}
|
|
}
|
|
|
|
return new ServiceResult<MenuReturn>() { Success = true, Message = "查询成功", Data = result, };
|
|
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
|