class JdbcLogServiceImpl implements LogService {

    @Override
    public CommonPager<LogVO> listByPage(final ConditionQuery query) {
        final String tableName = RepositoryPathUtils.buildDbTableName(query.getApplicationName());
        final PageParameter pageParameter = query.getPageParameter();
        StringBuilder sqlBuilder = new StringBuilder();
        sqlBuilder.append("select trans_id,target_class,target_method,"
                + " retried_count,create_time,last_time,version,error_msg from ")
                .append(tableName).append(" where 1= 1 ");

        if (StringUtils.isNoneBlank(query.getTransId())) {
            sqlBuilder.append(" and trans_id = ").append(query.getTransId());
        }
        final String sql = buildPageSql(sqlBuilder.toString(), pageParameter);
        CommonPager<LogVO> pager = new CommonPager<>();
        final List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
        if (CollectionUtils.isNotEmpty(mapList)) {
            pager.setDataList(mapList.stream().map(this::buildByMap).collect(Collectors.toList()));
        }
        final Integer totalCount =
                jdbcTemplate.queryForObject(String.format("select count(1) from %s", tableName), Integer.class);
        pager.setPage(PageHelper.buildPage(pageParameter, totalCount));
        return pager;
    }

}

class JdbcLogServiceImplTest {

    @Autowired
    private LogService logService;

    @Test
    public void listByPage() throws Exception {

        ConditionQuery query = new ConditionQuery();

        PageParameter pageParameter = new PageParameter(1, 10);

        query.setPageParameter(pageParameter);
        query.setApplicationName("account-service");

        final CommonPager<LogVO> pager = logService.listByPage(query);

        Assert.assertNotNull(pager.getDataList());


    }

}