|
|
|
@ -71,18 +71,54 @@ public class AlgoInstanceServiceApp : SqlSugarBaseApp<LasaAlgoInstance, SugarDbC
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<Response<PageInfo<List<LasaAlgoInstance>>>> GetAlgoInstanceList(AlgoInstancePageRequest req)
|
|
|
|
|
public async Task<Response<PageInfo<IEnumerable<dynamic>>>> GetAlgoInstanceList(AlgoInstancePageRequest req)
|
|
|
|
|
{
|
|
|
|
|
RefAsync<int> totalCount = 0;
|
|
|
|
|
var page = await Repository.AsQueryable()
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(req.key), x => x.Name.Contains(req.key))
|
|
|
|
|
.ToPageListAsync(req.page, req.limit, totalCount);
|
|
|
|
|
|
|
|
|
|
return new Response<PageInfo<List<LasaAlgoInstance>>>
|
|
|
|
|
var ids = page.Select(x => x.Id).ToList();
|
|
|
|
|
var sql = @$"SELECT
|
|
|
|
|
a.""Id"" as ""algoInstanceId"",
|
|
|
|
|
l.""Name"" as ""TagName"",
|
|
|
|
|
r.""Name"" as ""AlgoName""
|
|
|
|
|
FROM
|
|
|
|
|
lasa_algoinstance a
|
|
|
|
|
CROSS JOIN LATERAL UNNEST ( string_to_array( A.""Tags"", ',' ) ) AS TempB ( Tag )
|
|
|
|
|
left join lasa_modellabel l on l.""Id"" = TempB.Tag
|
|
|
|
|
left join lasa_algorithmsrepository r on r.""Id"" = l.""PId""
|
|
|
|
|
WHERE
|
|
|
|
|
a.""Id"" in ( {string.Join(",", ids.Select(id => $"'{id}'"))} )
|
|
|
|
|
";
|
|
|
|
|
var infos = await Repository.AsSugarClient().SqlQueryable<dynamic>(sql)
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
var result = page.Select(x => new
|
|
|
|
|
{
|
|
|
|
|
x.Id,
|
|
|
|
|
x.Name,
|
|
|
|
|
x.Cover,
|
|
|
|
|
x.DisplayScheme,
|
|
|
|
|
x.Description,
|
|
|
|
|
x.DisplayColor,
|
|
|
|
|
x.RecognitionX,
|
|
|
|
|
x.RecognitionY,
|
|
|
|
|
x.SpaceConstraint,
|
|
|
|
|
x.ExpansionDistance,
|
|
|
|
|
x.TemporalConstraints,
|
|
|
|
|
x.TcStartTime,
|
|
|
|
|
x.TcEndTime,
|
|
|
|
|
x.FlySpeed,
|
|
|
|
|
x.GimbalPitchDegree,
|
|
|
|
|
x.RecognitionCoverage,
|
|
|
|
|
x.Tags,
|
|
|
|
|
TagNames = infos.Where(y => y.algoInstanceId == x.Id).Select(y => y.TagName).ToArray(),
|
|
|
|
|
AlgoNames = infos.Where(y => y.algoInstanceId == x.Id).Select(y => y.AlgoName).ToList()
|
|
|
|
|
});
|
|
|
|
|
return new Response<PageInfo<IEnumerable<dynamic>>>
|
|
|
|
|
{
|
|
|
|
|
Result = new PageInfo<List<LasaAlgoInstance>>
|
|
|
|
|
Result = new PageInfo<IEnumerable<dynamic>>
|
|
|
|
|
{
|
|
|
|
|
Items = page,
|
|
|
|
|
Items = result,
|
|
|
|
|
Total = totalCount.Value
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -90,6 +126,7 @@ public class AlgoInstanceServiceApp : SqlSugarBaseApp<LasaAlgoInstance, SugarDbC
|
|
|
|
|
|
|
|
|
|
public async Task<Response<LasaAlgoInstance>> GetAlgoInstance(string id)
|
|
|
|
|
{
|
|
|
|
|
// 关于添加算法及标签信息
|
|
|
|
|
return new Response<LasaAlgoInstance>
|
|
|
|
|
{
|
|
|
|
|
Result = await Repository.GetByIdAsync(id)
|
|
|
|
|