[M]修改排序方式,先按 站id 排序,再按rtu_no

This commit is contained in:
shijianquan 2025-09-29 14:03:04 +08:00
parent 4d96a37c11
commit 56ece09e5b

View File

@ -383,13 +383,13 @@ void CTrendInfoManage::loadDevGroupInfo(CDbApi *pReadDb)
{ {
return ; return ;
} }
QString sqlSequenceQuery = QStringLiteral("select tag_name, description, location_id from dev_group where sub_system > 3 order by "); QString sqlSequenceQuery = QStringLiteral("select tag_name, description, location_id from dev_group where sub_system > 3");
if(!strLoctionFilter.isEmpty()) if(!strLoctionFilter.isEmpty())
{ {
sqlSequenceQuery.append(QString(" rtu_no asc, %1 asc,dev_group_no asc,tag_name;").arg(strLoctionFilter)); sqlSequenceQuery.append(QString(" and %1 order by location_id , rtu_no , dev_group_no ,tag_name;").arg(strLoctionFilter));
}else }else
{ {
sqlSequenceQuery.append(QStringLiteral(" rtu_no asc, dev_group_no asc,tag_name;")); sqlSequenceQuery.append(QStringLiteral(" order by location_id , rtu_no , dev_group_no ,tag_name;"));
} }
query.setForwardOnly(true); query.setForwardOnly(true);
pReadDb->execute(sqlSequenceQuery, query); pReadDb->execute(sqlSequenceQuery, query);
@ -423,9 +423,10 @@ void CTrendInfoManage::loadDeviceInfo(CDbApi *pReadDb)
QString sqlSequenceQuery = QStringLiteral("select tag_name, description, group_tag_name, location_id from dev_info "); QString sqlSequenceQuery = QStringLiteral("select tag_name, description, group_tag_name, location_id from dev_info ");
if(!strLoctionFilter.isEmpty()) if(!strLoctionFilter.isEmpty())
{ {
sqlSequenceQuery.append(QString(" where %1;").arg(strLoctionFilter)); sqlSequenceQuery.append(QString(" where %1 ").arg(strLoctionFilter));
} }
sqlSequenceQuery.append(" order by tag_name"); sqlSequenceQuery.append(" order by location_id, tag_name;");
query.setForwardOnly(true); query.setForwardOnly(true);
pReadDb->execute(sqlSequenceQuery, query); pReadDb->execute(sqlSequenceQuery, query);
while(query.next()) while(query.next())