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

应用初次初始化,在没有插入数据,即没有用户,没有收藏的时候,出现的错误页面以及进不了首页的问题。 #16

Closed
souvc opened this issue Jun 12, 2017 · 2 comments

Comments

@souvc
Copy link

souvc commented Jun 12, 2017

  1. 问题:在没有插入数据,即没有用户,没有收藏的时候,出现的错误页面以及进不了首页的问题。
    出现的问题由于CollectorRepositoryImpl这个实现类,没有经过判断,直接就返回了list里面的对象,如果为空,那么还取里面的对象。举一个例子:
@Override
    public Long getMostCollectUser() {
        String querySql = "SELECT c.user_id ,COUNT(1) AS counts FROM collect c WHERE type='PUBLIC' AND is_delete='NO' GROUP BY c.user_id ORDER BY counts DESC LIMIT 1";
        List<Object[]> objecArraytList = sqlArrayList(querySql);
        Object[] obj =  objecArraytList.get(0);
        return Long.valueOf(obj[0].toString());
    }

其他的基本存在同样的问题。

2.解决方案:可以初始化一些数据,或是进行判断后再返回,那么需要默认一个用户或者收藏之类的。

@archerLj
Copy link

同问,一开始不可能有用户的吧,不知道是有初始化的数据还是本来就没人注意这个问题

@ityouknow
Copy link
Contributor

这是一个bug,已经修复了。请使用最新代码@archerLj

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

3 participants