直接上代码 :
double zonge = 0.00;
double weishuijia = 0.0;
Subject sub = SecurityUtils.getSubject();
User user = userService.dao().fetchLinks(userService.dao().fetch(User.class, Long.valueOf(sub.getPrincipal().toString())),null);
userService.dao().fetchLinks(user.getProfile(),null);
Sql sql2 = Sqls.create("select SUM(JIESUANJINE) ,SUM(WEISHUIJIA)FROM WINE_QCYS_GZLYF where DANWEICODE=@DANWEICODE and BAOSHENXUHAO=@BAOSHENXUHAO and MONTHSTR=@MONTHSTR and CHELIANGLEIXING=@CHELIANGLEIXING"); //计算这一批数据的总金额
sql2.setCallback(Sqls.callback.doubleValue());
sql2.params().set("DANWEICODE", user.getProfile().getDept()).set("BAOSHENXUHAO",baoshenxuhao).set("MONTHSTR", monthstr).set("CHELIANGLEIXING", cheliangleixing);
dao.execute(sql2);
zonge = sql2.getDouble();