From ce909e567e28e439feb2a90d07c2f8837f6e3e55 Mon Sep 17 00:00:00 2001 From: Twelveeee Date: Mon, 4 Dec 2023 16:34:26 +0800 Subject: [PATCH] feat:contact order by pingying --- app/DataBase/micro_msg.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/DataBase/micro_msg.py b/app/DataBase/micro_msg.py index 5f00bd2..f36cec8 100644 --- a/app/DataBase/micro_msg.py +++ b/app/DataBase/micro_msg.py @@ -46,10 +46,16 @@ class MicroMsg: return None try: lock.acquire(True) - sql = '''select UserName,Alias,Type,Remark,NickName,PYInitial,RemarkPYInitial,ContactHeadImgUrl.smallHeadImgUrl,ContactHeadImgUrl.bigHeadImgUrl - from Contact inner join ContactHeadImgUrl on Contact.UserName = ContactHeadImgUrl.usrName - where Type%2=1 and Alias is not null - order by PYInitial + sql = '''SELECT UserName, Alias, Type, Remark, NickName, PYInitial, RemarkPYInitial, ContactHeadImgUrl.smallHeadImgUrl, ContactHeadImgUrl.bigHeadImgUrl + FROM Contact + INNER JOIN ContactHeadImgUrl ON Contact.UserName = ContactHeadImgUrl.usrName + WHERE Type % 2 = 1 + AND NickName != '' + ORDER BY + CASE + WHEN RemarkPYInitial = '' THEN PYInitial + ELSE RemarkPYInitial + END ASC ''' self.cursor.execute(sql) result = self.cursor.fetchall()