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

This commit is contained in:
shijianquan 2025-09-29 13:48:32 +08:00
parent 79f70475b9
commit 5f1a4dabd3

View File

@ -334,10 +334,10 @@ void CTrendInfoManage::loadDevGroupInfo(CDbApi *pReadDb)
QString sqlSequenceQuery = QStringLiteral("select tag_name, description, location_id from dev_group where sub_system > 3 "); 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(" and %1 order by dev_group_no asc;").arg(strLoctionFilter)); sqlSequenceQuery.append(QString(" and %1 order by location_id , rtu_no , dev_group_no asc ,tag_name;").arg(strLoctionFilter));
}else }else
{ {
sqlSequenceQuery.append(QStringLiteral(" order by dev_group_no asc;")); sqlSequenceQuery.append(QStringLiteral(" order by location_id , rtu_no , dev_group_no asc ,tag_name;"));
} }
query.setForwardOnly(true); query.setForwardOnly(true);
pReadDb->execute(sqlSequenceQuery, query); pReadDb->execute(sqlSequenceQuery, query);
@ -371,8 +371,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 location_id, tag_name;");
query.setForwardOnly(true); query.setForwardOnly(true);
pReadDb->execute(sqlSequenceQuery, query); pReadDb->execute(sqlSequenceQuery, query);
while(query.next()) while(query.next())