調整query語法

This commit is contained in:
jasonchenwork 2025-05-20 14:03:03 +08:00
parent 81fa9b8a4e
commit 34b73c3513
6 changed files with 7 additions and 14 deletions

View File

@ -63,7 +63,7 @@ namespace DualScreenDemo
/* 清空搜尋欄 */ /* 清空搜尋欄 */
ResetinputBox(); ResetinputBox();
int songLimit = ReadHotSongLimit(); int songLimit = ReadHotSongLimit();
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `song_id` DESC LIMIT {songLimit}"; string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `song_counts` DESC LIMIT {songLimit}";
var guoYuSongs = SearchSongs_Mysql(query); var guoYuSongs = SearchSongs_Mysql(query);
UpdateSongList(guoYuSongs); UpdateSongList(guoYuSongs);
@ -92,7 +92,7 @@ namespace DualScreenDemo
UpdateHotSongButtons(activeButton, activeBackground); UpdateHotSongButtons(activeButton, activeBackground);
int songLimit = ReadHotSongLimit(); int songLimit = ReadHotSongLimit();
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY `song_id` DESC LIMIT {songLimit}"; string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY `song_counts` DESC LIMIT {songLimit}";
var selectedSongs = SearchSongs_Mysql(query); var selectedSongs = SearchSongs_Mysql(query);
UpdateSongList(selectedSongs); UpdateSongList(selectedSongs);

View File

@ -8,7 +8,7 @@ namespace DualScreenDemo
UpdateHotSongButtons(guoYuNewSongButtonHotSong, guoYuNewSongHotSongActiveBackground); UpdateHotSongButtons(guoYuNewSongButtonHotSong, guoYuNewSongHotSongActiveBackground);
int songLimit = ReadHotSongLimit(); int songLimit = ReadHotSongLimit();
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `add_date` DESC LIMIT {songLimit}"; string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `add_date` DESC, `song_counts` DESC LIMIT {songLimit}";
var selectedSongs = PrimaryForm.Instance.SearchSongs_Mysql(query); var selectedSongs = PrimaryForm.Instance.SearchSongs_Mysql(query);
currentPage = 0; currentPage = 0;

View File

@ -9,7 +9,7 @@ namespace DualScreenDemo
int songLimit = ReadHotSongLimit(); int songLimit = ReadHotSongLimit();
string query = $"SELECT * FROM song_library_cache WHERE language_name = '台語' ORDER BY `add_date` DESC LIMIT {songLimit}"; string query = $"SELECT * FROM song_library_cache WHERE language_name = '台語' ORDER BY `add_date` DESC, `song_counts` DESC LIMIT {songLimit}";
var selectedSongs = SearchSongs_Mysql(query); var selectedSongs = SearchSongs_Mysql(query);
currentPage = 0; currentPage = 0;

View File

@ -75,7 +75,7 @@ namespace DualScreenDemo
/* 清空搜尋欄 */ /* 清空搜尋欄 */
ResetinputBox(); ResetinputBox();
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_id DESC LIMIT 100"; string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_counts DESC LIMIT 100";
var guoYuSongs = SearchSongs_Mysql(query); var guoYuSongs = SearchSongs_Mysql(query);
currentPage = 0; currentPage = 0;
currentSongList = guoYuSongs; currentSongList = guoYuSongs;
@ -123,7 +123,7 @@ namespace DualScreenDemo
activeButton.BackgroundImage = activeBackground; activeButton.BackgroundImage = activeBackground;
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY song_id DESC LIMIT 100"; string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY song_counts DESC LIMIT 100";
var selectedSongs = SearchSongs_Mysql(query); var selectedSongs = SearchSongs_Mysql(query);
/*var selectedSongs = allSongs.Where(song => song.Category == category) /*var selectedSongs = allSongs.Where(song => song.Category == category)
.OrderByDescending(song => song.Plays) .OrderByDescending(song => song.Plays)

View File

@ -273,7 +273,7 @@ namespace DualScreenDemo
string searchText = inputBoxEnglishSingers.Text; string searchText = inputBoxEnglishSingers.Text;
string query = string.IsNullOrWhiteSpace(searchText) string query = string.IsNullOrWhiteSpace(searchText)
? "SELECT * FROM artists LIMIT 50;" ? "SELECT * FROM artists LIMIT 50;"
: $"SELECT * FROM artists WHERE `name` LIKE '{searchText}%';"; : $"SELECT * FROM artists WHERE `name` LIKE '%{searchText}%';";
//string query = $"SELECT * FROM ArtistLibrary WHERE `歌手姓名` LIKE '{searchText}%' "; //string query = $"SELECT * FROM ArtistLibrary WHERE `歌手姓名` LIKE '{searchText}%' ";
var searchResults = SearchSingers_Mysql(query); var searchResults = SearchSingers_Mysql(query);

View File

@ -1,7 +0,0 @@
namespace DualScreenDemo
{
public partial class PrimaryForm
{
}
}