标签:
关于Service中的赋值计算,利用三目运算符
注意:判断是"==",赋值是"="
private Stipend getCountTotalize(Stipend e) { float count=0; count=count+(e.getBasic()==null?0:e.getBasic().longValue()); // count=count+e.getBasic().longValue(); count=count+(e.getDuty()==null?0:e.getDuty().longValue()); // count=count+e.getDuty().longValue(); count=count+(e.getEat()==null?0:e.getEat().longValue()); // count=count+e.getEat().longValue(); count=count+(e.getHouse()==null?0:e.getHouse().longValue()); // count=count+e.getHouse().longValue(); count=count+(e.getOther()==null?0:e.getOther().longValue()); count=count-(e.getPunishment()==null?0:e.getPunishment().longValue()); count=count-(e.getScot()==null?0:e.getScot().longValue()); System.out.println("============================"); System.out.println(count); e.setTotalize(new Float(count)); return e; }
标签:
原文地址:http://www.cnblogs.com/otio/p/4178975.html