update 空指针异常

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