using OASystem.Domain; using OASystem.Domain.Dtos.UserDto; using OASystem.Domain.Entities.System; using OASystem.Domain.ViewModels.System; namespace OASystem.Infrastructure.Repositories.System { public class SetDataRepository : BaseRepository { public SetDataRepository(SqlSugarClient sqlSugar) : base(sqlSugar) { } /// /// 获取所有系统模块 /// /// /// public async Task GetSySDefultModule() { Result result = new Result(); string sql = "select * from Sys_SetData where STid = 5 and isdel = 0"; var DBdata = await GetListBySqlWithNolockAsync(sql); if (DBdata == null || DBdata.Count == 0) { return result; } result.Data = DBdata.Select(x=> new SetDataView { Name = x.Name, STid = x.STid, Id = x.Id, }); result.Code = 0; result.Msg = "成功!"; return result; } /// /// 获取类型Data By STId /// /// /// public async Task GetSetDataBySTId(SetDataRepository _SetData,int stId) { Result result = new Result(); string sql = string.Format(@"select * from Sys_SetData where STid = {0} and isdel = 0",stId); var DBdata = await _SetData.GetListBySqlWithNolockAsync(sql); if (DBdata == null || DBdata.Count == 0) { return result; } result.Data = DBdata.Select(x => new SetDataInfoView { Name = x.Name, Id = x.Id, }); result.Code = 0; result.Msg = "成功!"; return result; } public async Task GetSetDataAndPageInfoBySTId(int stId = 5) { Result result = new Result(); List ViewList = _sqlSugar.SqlQueryable($@" select a.id as modulid,a.Name as modulName,a.STid,a.Remark as modulRemark, b.Id as pageid, b.Name as pageName, b.IsEnable as PageIsEnable ,b.phoneIsEnable as PagePhoneIsEnable,b.SystemMenuCode,b.webUrl,b.androidUrl, b.iosUrl,b.icon ,b.Remark as PageRemark from Sys_SetData a , Sys_SystemMenuPermission b where STid = {stId} and a.isdel = 0 and b.Mid = a.Id and b.IsDel = 0 ").ToList(); result.Data = ViewList; result.Code = 0; result.Msg = "成功!"; if (ViewList == null || ViewList.Count == 0) { result.Msg = "无数据!"; result.Code = -1; } return result; } } }