grid添加合计功能

2019-07-24  本文已影响0人  LCF_全博

效果图

dataSource.png

前段代码

grid.png

注意点:

后段代码

controller类

public AggregatesResponseData queryTotal(FsUseFund dto, @RequestParam(defaultValue = DEFAULT_PAGE) int page,
                                             @RequestParam(defaultValue = DEFAULT_PAGE_SIZE) int pageSize, HttpServletRequest request) {
        IRequest requestContext = createRequestContext(request);
        AggregatesResponseData aggregatesResponseData = service.selectSumUseFundNew(requestContext, dto, page, pageSize);
        return aggregatesResponseData;
    }

controller返回的是AggregatesResponseData数据

service类

Map<String,Map<String,Object>> aggregates=new HashMap<>();
Map<String,Object> wareAmtSumA=new HashMap<>(); 
wareAmtSumA.put(FsUseFund.AGGREGATE_SUM,wareAmtSum);
aggregates.put(FsUseFund.FIELD_WARE_AMT,wareAmtSumA);


AggregatesResponseData aggregatesResponseData = new AggregatesResponseData(fsUseFunds);
aggregatesResponseData.setAggregates(aggregates);
return aggregatesResponseData;

fsUseFunds存的是需要返回前台的List数据
aggregates存的是map函数,里面包含各列的数据。各列的数据是以map的形式存储。
FsUseFund.FIELD_WARE_AMT是前台的列名字段,
FsUseFund.AGGREGATE_SUM是sum

上一篇下一篇

猜你喜欢

热点阅读