easyui一行显示多行_easyui datagrid以及oracle中的多行合并一行

页面显示:

前端代码:

toolbar="#toolbar" rownumbers="true" singleSelect="true" fitColumns="true">

大箱码关联的箱码(不同箱码用分号分开,相同箱码用逗号分开)关联数量

data-options="

total: 0,

pageSize:15,

pageList: [15,30,50,100],

onSelectPage: function(pageNumber, pageSize){ // 页面切换动作

getDataByPageRows(pageNumber,pageSize);

}">

js:

function getDataByPageRows(pageNum, rowsLimit){

$("#pp").show();

pageNum = pageNum || 1; // 设置默认的页号

rowsLimit = rowsLimit || 2;// 设置默认的每页记录数

$.ajax({

type: "POST",

dataType: 'json', // 注意格式是html,不是json

url:"outdata/querydetaillist",

data: {

startdate: $("#startdate").datetimebox('getValue'),

enddate: $("#enddate").datetimebox('getValue'),

storecode: $("#storecode").val(),

page: pageNum,

rows: rowsLimit

},

success: function(data){ // 请求成功,将返回的数据(一页的记录数)绑定到 datagrid控件

var count = data.total; // 总记录个数

var datarow = data.rows; //获取条数;

$('#dgs').datagrid('loadData',datarow);

$('#pp').pagination({

total: count, // 由于显示 ”共XXX条记录” 等信息用

pageNumber: pageNum //

});

}

});//ajax

}

controller:

@RequestMapping(value="/querydetaillist")

@ResponseBody

public String querydetaillist(Model model,HttpServletResponse response,HttpServletRequest request,

@RequestParam(value = "page", required = false, defaultValue = "") String page,

@RequestParam(value = "storecode", required = false, defaultValue = "") String storecode,

@RequestParam(value = "startdate", required = false, defaultValue = "") String startdate,

@RequestParam(value = "enddate", required = false, defaultValue = "") String enddate,

@RequestParam(value = "rows", required = false, defaultValue = "") String rows){

int endindex=Integer.valueOf(page)*Integer.valueOf(rows);

int startindex=(Integer.valueOf(page)-1)*Integer.valueOf(rows);

Map params = new HashMap();

if(!storecode.equals("")){

storecode = storecode.replaceFirst("^0*", "");

}

if(!startdate.equals("")){

startdate = startdate.replaceAll(" ", "");

}

if(!enddate.equals("")){

enddate = enddate.replaceAll(" ", "");

}

params.put("endIndex", endindex);

params.put("storecode", storecode);

params.put("startIndex", startindex);

params.put("startdate", startdate);

params.put("enddate", enddate);

List datalist=outdataDao.querydetaillist(params);

String total=outdataDao.querydetaillistcount(params);

JSONObject obj=new JSONObject();

obj.put("total", total);

obj.put("rows", datalist);

return obj.toJSONString();

}

xml:

select * from (

select tt1.*, ROWNUM as rowno

from (

select storecode,listagg(casecode,';') within group (order by casecode) as casecode,count(casecode) as "count" from

(

select s.storecode,c.caseid,listagg(c.casecode,',') within group (order by c.casecode,c.caseid) as casecode,

count(distinct caseid)

from ys_store s

left join ys_case c on s.id=c.storeid

where 1=1 and casecode is not null

and to_char(s.gldate,'yyyy-MM-dd')>='${startdate}'

and to_char(s.gldate,'yyyy-MM-dd')<='${enddate}'

and s.storecode=${storecode}

group by s.storecode,c.caseid

)

group by storecode

) tt1

where ROWNUM <= '${endIndex}') tt2

where tt2.rowno > '${startIndex}'

select count(*) from(

select storecode,listagg(casecode,';') within group (order by casecode) as casecode,count(casecode) as "count" from

(

select s.storecode,c.caseid,listagg(c.casecode,',') within group (order by c.casecode,c.caseid) as casecode,

count(distinct caseid)

from ys_store s

left join ys_case c on s.id=c.storeid

where 1=1 and casecode is not null

and to_char(s.gldate,'yyyy-MM-dd')>='${startdate}'

and to_char(s.gldate,'yyyy-MM-dd')<='${enddate}'

and s.storecode=${storecode}

group by s.storecode,c.caseid

)

group by storecode

)

参考文档:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值