using System.Collections.Generic; using System.Threading.Tasks; using Dapper; using Datory; using GxPress.Result.Navigation; namespace GxPress.Service.Implement.AppHomePage { public partial class AppHomePageService { /// /// 获取搜索作者 /// /// public async Task> GetNavigationSearchResultAysnc(int categoryId) { var result = new List(); var database = new Database(DatabaseType.MySql, Common.Tools.ConfigHelper.GetValue("Database:ConnectionString")); var connection = database.GetConnection(); var sql = $"SELECT TeacherId,Author,count(1) as Count FROM tede_media where id in(select MediaId from tede_system_lable_media where TypeValue=1) and Author is not null group by Author,TeacherId"; if (categoryId > 0) sql = $"SELECT TeacherId,Author,count(1) as Count FROM tede_media where id in(select MediaId from tede_system_lable_media where TypeValue=1 and lableId={categoryId}) and Author is not null group by Author,TeacherId"; return await connection.QueryAsync(sql); } /// /// 获取出版社 /// /// /// public async Task> GetNavigationPressAsync(int categoryId) { var sql = "SELECT Press FROM tede_media where id in(select MediaId from tede_system_lable_media where TypeValue=1) and Press is not null group by Press"; if (categoryId > 0) sql = "SELECT Press FROM tede_media where id in(select MediaId from tede_system_lable_media where TypeValue=1 and lableId={categoryId}) and Press is not null group by Press"; var result = new List(); var database = new Database(DatabaseType.MySql, Common.Tools.ConfigHelper.GetValue("Database:ConnectionString")); var connection = database.GetConnection(); return await connection.QueryAsync(sql); } } }