update 空指针异常

1 个父辈 1af58920
......@@ -15,7 +15,7 @@ public class Prize implements Serializable {
private Integer id;
private String name;
private Integer num;
private Integer num = 0;
private Boolean isMoney;
private Integer probability;
private Integer mixMoney;
......@@ -72,16 +72,16 @@ public class Prize implements Serializable {
}
public Integer getNum() {
if(num==0||num==null) {
return 0;
}
if (null != num)
return num;
else
return 0;
}
public void setNum(Integer num) {
if(num < 0) {
if (num < 0) {
this.num = 0;
}else {
} else {
this.num = num;
}
......@@ -103,5 +103,4 @@ public class Prize implements Serializable {
this.deleted = deleted;
}
}
\ No newline at end of file
......@@ -29,8 +29,9 @@ public class GoodsService {
public List<Goods> getHomeData() {
Example ex = new Example(Goods.class);
ex.createCriteria().andEqualTo("deleted", false).andEqualTo("isHome", true);
RowBounds r = new RowBounds(0, 5);
return goodsDao.selectByExampleAndRowBounds(ex, r);
ex.setOrderByClause("pageViews desc");
RowBounds r = new RowBounds(0, 10);
return goodsDao.selectByExample(ex);
}
@SuppressWarnings("unchecked")
......
Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
请先完成此消息的编辑!