123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
-
- 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<Sys_SetData, SetDataView>
- {
- public SetDataRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
- {
- }
- /// <summary>
- /// 获取所有系统模块
- /// </summary>
- /// <param name="_SetData"></param>
- /// <returns></returns>
- public async Task<Result> 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;
- }
- /// <summary>
- /// 获取类型Data By STId
- /// </summary>
- /// <param name="_SetData"></param>
- /// <returns></returns>
- public async Task<Result> 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<Result> GetSetDataAndPageInfoBySTId(int stId = 5)
- {
- Result result = new Result();
- List<SetDataAndPageInfoView> ViewList = _sqlSugar.SqlQueryable<SetDataAndPageInfoView>($@"
- 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;
- }
-
- }
- }
|