Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HistoryConfigInfoMapperBySqlServer 第47行语法错误,导致历史配置查看不了 #42

Open
tanzb2013 opened this issue Jul 3, 2024 · 1 comment

Comments

@tanzb2013
Copy link

缺少一个OFFSET

@chanhang
Copy link

chanhang commented Aug 2, 2024

補充
`
public class HistoryConfigInfoMapperByPostgresql extends HistoryConfigInfoMapperByMySql {

@Override
public MapperResult removeConfigHistory(MapperContext context) {
    String sql = "WITH temp_table as (SELECT id FROM his_config_info WHERE gmt_modified < ? LIMIT ? ) "
            + "DELETE FROM his_config_info WHERE id in (SELECT id FROM temp_table) ";
    return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.START_TIME),
            context.getWhereParameter(FieldConstant.LIMIT_SIZE)));
}

@Override
public MapperResult pageFindConfigHistoryFetchRows(MapperContext context) {
    String sql =
            "SELECT nid,data_id,group_id,tenant_id,app_name,src_ip,src_user,op_type,gmt_create,gmt_modified FROM his_config_info "
                    + "WHERE data_id = ? AND group_id = ? AND tenant_id = ? ORDER BY nid DESC  LIMIT "
                    + context.getPageSize() + " OFFSET " +  context.getStartRow();
    return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.DATA_ID),
            context.getWhereParameter(FieldConstant.GROUP_ID), context.getWhereParameter(FieldConstant.TENANT_ID)));
}

@Override
public String getDataSource() {
    return DatabaseTypeConstant.POSTGRESQL;
}

}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants