|
@@ -248,7 +248,36 @@ namespace GxPress.Repository.Implement.Media
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 根据IDs
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<PagedList<MediaCathedraResult>> GetMediaByLableIdAsync(MediaLableIdRequest request)
|
|
|
+ {
|
|
|
+ var result = new PagedList<MediaCathedraResult>();
|
|
|
+ if (request.Ids.Count > 0)
|
|
|
+ {
|
|
|
+ var str = "";
|
|
|
+ foreach (var item in request.Ids)
|
|
|
+ str += item + ",";
|
|
|
+ str = str.Remove(str.Length - 1, 1);
|
|
|
+ var sql = $@"SELECT
|
|
|
+ Id,ImageUrls,Title,Author,MediaType,ReadCount,CreatedDate
|
|
|
+ FROM
|
|
|
+ tede_media
|
|
|
+ WHERE
|
|
|
+ id IN ({str})
|
|
|
+ ORDER BY CreatedDate desc LIMIT {(request.Page - 1) * request.PerPage},{request.PerPage}";
|
|
|
|
|
|
+ var databaseType = _databaseTypestr.ToEnum<DatabaseType>(DatabaseType.MySql);
|
|
|
+ var database = new Database(databaseType, _connectionString);
|
|
|
+ var connection = database.GetConnection();
|
|
|
+ result.Items = await connection.QueryAsync<MediaCathedraResult>(sql);
|
|
|
+ sql = $@"SELECT count(1) FROM tede_media WHERE id IN ({str})";
|
|
|
+ result.Total = await connection.ExecuteScalarAsync<int>(sql);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
public async Task<bool> UpdateAsync(MediaResult result)
|
|
|
{
|
|
|
//var model = _mapper.Map<Entity.tede2.Media.Media>(result);
|