Skip to content

Commit

Permalink
Fix the version comparison query SQL. (#12858)
Browse files Browse the repository at this point in the history
Fix the version comparison query SQL.
  • Loading branch information
MatthewAden authored Nov 18, 2024
1 parent fb68b7e commit aeaaded
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ default MapperResult findConfigHistoryFetchRows(MapperContext context) {
*/
default MapperResult detailPreviousConfigHistory(MapperContext context) {
return new MapperResult(
"SELECT nid,data_id,group_id,tenant_id,app_name,content,md5,src_user,src_ip,op_type,gmt_create,gmt_modified,encrypted_data_key "
+ "FROM his_config_info WHERE nid = (SELECT max(nid) FROM his_config_info WHERE id = ?)",
"SELECT nid,data_id,group_id,tenant_id,app_name,content,md5,src_user,src_ip,op_type,publish_type,ext_info,gmt_create"
+ ",gmt_modified,encrypted_data_key FROM his_config_info WHERE nid = (SELECT max(nid) FROM his_config_info WHERE id = ?)",
Collections.singletonList(context.getWhereParameter(FieldConstant.ID)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ void testDetailPreviousConfigHistory() {
Object id = "1";
context.putWhereParameter(FieldConstant.ID, id);
MapperResult mapperResult = historyConfigInfoMapperByDerby.detailPreviousConfigHistory(context);
assertEquals(mapperResult.getSql(), "SELECT nid,data_id,group_id,tenant_id,app_name,content,md5,src_user,src_ip,op_type,gmt_create,"
+ "gmt_modified,encrypted_data_key FROM his_config_info WHERE nid = (SELECT max(nid) FROM his_config_info WHERE id = ?)");
assertEquals(mapperResult.getSql(), "SELECT nid,data_id,group_id,tenant_id,app_name,content,md5,src_user,src_ip,op_type,publish_type"
+ ",ext_info,gmt_create,gmt_modified,encrypted_data_key "
+ "FROM his_config_info WHERE nid = (SELECT max(nid) FROM his_config_info WHERE id = ?)");
assertArrayEquals(new Object[] {id}, mapperResult.getParamList().toArray());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ void testDetailPreviousConfigHistory() {
Object id = "1";
context.putWhereParameter(FieldConstant.ID, id);
MapperResult mapperResult = historyConfigInfoMapperByMySql.detailPreviousConfigHistory(context);
assertEquals(mapperResult.getSql(), "SELECT nid,data_id,group_id,tenant_id,app_name,content,md5,src_user,src_ip,op_type,gmt_create,"
+ "gmt_modified,encrypted_data_key FROM his_config_info WHERE nid = (SELECT max(nid) FROM his_config_info WHERE id = ?)");
assertEquals(mapperResult.getSql(), "SELECT nid,data_id,group_id,tenant_id,app_name,content,md5,src_user,src_ip,op_type,publish_type"
+ ",ext_info,gmt_create,gmt_modified,encrypted_data_key "
+ "FROM his_config_info WHERE nid = (SELECT max(nid) FROM his_config_info WHERE id = ?)");
assertArrayEquals(new Object[] {id}, mapperResult.getParamList().toArray());
}

Expand Down

0 comments on commit aeaaded

Please sign in to comment.