主页面设置与查询
parent
c933ccd4c3
commit
9e480eecbf
|
|
@ -11,7 +11,6 @@ using OpenAuth.App.ServiceApp.GoView.Response;
|
|||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using OpenAuth.Repository.Domain.GoView;
|
||||
using Org.BouncyCastle.Ocsp;
|
||||
using SqlSugar;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.GoView;
|
||||
|
|
@ -82,7 +81,7 @@ public class GoViewProjectApp : SqlSugarBaseApp<GoviewProject, SugarDbContext>
|
|||
{
|
||||
RefAsync<int> total = 0;
|
||||
var list = await Repository.AsQueryable()
|
||||
.WhereIF(page.state != null,a=>a.State == page.state)
|
||||
.WhereIF(page.state != null, a => a.State == page.state)
|
||||
.ToPageListAsync(page.page, page.limit, total);
|
||||
return new Response<PageInfo<List<GoviewProject>>>()
|
||||
{
|
||||
|
|
@ -360,7 +359,7 @@ public class GoViewProjectApp : SqlSugarBaseApp<GoviewProject, SugarDbContext>
|
|||
var list = Repository.ChangeRepository<SugarRepositiry<SysUploadFile>>()
|
||||
.AsQueryable()
|
||||
.InnerJoin<GoviewImage>((a, b) => a.Id.Equals(b.FileId))
|
||||
.WhereIF(!string.IsNullOrEmpty(req.GroupName),(a,b)=>b.GroupName.Equals(req.GroupName))
|
||||
.WhereIF(!string.IsNullOrEmpty(req.GroupName), (a, b) => b.GroupName.Equals(req.GroupName))
|
||||
.Select<SysUploadFile>()
|
||||
.ToList();
|
||||
return list;
|
||||
|
|
@ -398,4 +397,26 @@ public class GoViewProjectApp : SqlSugarBaseApp<GoviewProject, SugarDbContext>
|
|||
Result = list
|
||||
};
|
||||
}
|
||||
|
||||
public string GetParamByKey(string key)
|
||||
{
|
||||
var result = Repository.ChangeRepository<SugarRepositiry<GoViewParam>>()
|
||||
.AsQueryable()
|
||||
.Where(a => a.ParamName.Equals(key))
|
||||
.Select(a => a.ParamValue)
|
||||
.Single();
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool AddParam(string key, string mainPage)
|
||||
{
|
||||
var result = new GoViewParam
|
||||
{
|
||||
ParamName = key,
|
||||
ParamValue = mainPage,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
|
||||
return Repository.ChangeRepository<SugarRepositiry<GoViewParam>>().InsertOrUpdate(result);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using SqlSugar;
|
||||
|
||||
namespace OpenAuth.Repository.Domain.GoView;
|
||||
|
||||
/// <summary>
|
||||
/// 项目数据模型类
|
||||
/// </summary>
|
||||
[SugarTable("t_goview_param")]
|
||||
public class GoViewParam
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true,ColumnName = "param_name")]
|
||||
public string ParamName { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "param_value")]
|
||||
public string ParamValue { get; set; }
|
||||
|
||||
[SugarColumn(IsNullable = true, ColumnName = "create_time")]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
using Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.App.ServiceApp.GoView;
|
||||
using OpenAuth.App.ServiceApp.GoView.Request;
|
||||
using OpenAuth.App.ServiceApp.GoView.Response;
|
||||
|
|
@ -213,4 +212,44 @@ public class GoViewProjectController : ControllerBase
|
|||
Result = _app.DeleteImage(ids)
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// 取得主页面
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("mainPage/get")]
|
||||
public Response<string> GetMainPage()
|
||||
{
|
||||
var result = new Response<string>();
|
||||
try
|
||||
{
|
||||
var temp = _app.GetParamByKey("mainPage");
|
||||
result.Result = temp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.Code = 500;
|
||||
result.Message = ex.Message;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置主页面
|
||||
/// </summary>
|
||||
/// <param name="mainPage"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("mainPage/set")]
|
||||
public Response<bool> SetMainPage(string mainPage)
|
||||
{
|
||||
var result = new Response<bool>();
|
||||
try
|
||||
{
|
||||
result.Result = _app.AddParam("mainPage", mainPage);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.Code = 500;
|
||||
result.Message = ex.Message;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue