java中table接收数据,bootStrap-table前端表格接收数据格式后台实现

(1)controller

@RequestMapping("/findData")

@ResponseBody

public Object findPhoneList(String startDate,String endDate,String phone,Integer pageIndex,Integer rows){

System.out.println(startDate+"||"+endDate+"||"+phone+"||"+pageIndex+"||"+rows);

PageInfo phoneList = cdrVoiceService.findPhoneListService(startDate, endDate, phone, pageIndex, rows);

return phoneList;

}

(2)service

public PageInfo findPhoneListService(String startDate,String endDate,String phone,Integer pageIndex,Integer rows){

Integer min = (pageIndex - 1) * rows;

Integer max = pageIndex * rows;

startDate=startDate!=""&&startDate!=null ?startDate+" 00:00:00":startDate;

endDate=endDate!=""&&endDate!=null?endDate+" 23:59:59":endDate;

int count = fraudCdrDao.countData(startDate, endDate, phone);

List phoneInfos=new ArrayList<>();

if(count>0){

phoneInfos = fraudCdrDao.listData(startDate, endDate, phone, max, min);

}

PageInfo pageInfo = new PageInfo();

pageInfo.setRows(phoneInfos);

pageInfo.setTotal(count);

return pageInfo;

}

(3)dao

@Select("

" select count(*) from phoneTable t " +

" "+

" " +

" and t.phone like '%${phone}%'" +

" " +

" " +

" and t.insert_time >= to_date('${startDate}','yyyy-mm-dd hh24:mi:ss') " +

" " +

" " +

" and t.insert_time <= to_date('${endDate}','yyyy-mm-dd hh24:mi:ss') " +

" " +

" " +

" ")

int countData(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("phone") String phone);

@Select("

" select t2.id,t2.phone,trim(t2.phone_type) phone_type,to_char(t2.insert_time,'yyyy-mm-dd hh24:mi:ss') insert_time,t2.insert_user from (" +

" select t.*,ROWNUM rn from phoneTable t " +

" " +

" " +

" and ROWNUM <= ${max}" +

" "+

" " +

" and t.phone like '%${phone}%'" +

" " +

" " +

" and t.insert_time >= to_date('${startDate}','yyyy-mm-dd hh24:mi:ss') " +

" " +

" " +

" and t.insert_time <= to_date('${endDate}','yyyy-mm-dd hh24:mi:ss') " +

" " +

" )t2 " +

" " +

" " +

" t2.rn > ${min}" +

" " +

" " +

" order by t2.insert_time desc" +

" ")

List listData(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("phone") String phone,@Param("max") Integer max,@Param("min") Integer min);

(4)PageInfo类:

语言

主方法

5OaMc

54qjAzX8sX

5wd9S

r9t2PGv2V1

import java.io.Serializable;

import java.util.List;

public class PageInfo implements Serializable {

private Integer total;

private List rows;

public Integer getTotal() {

return total;

}

public void setTotal(Integer total) {

this.total = total;

}

public List getRows() {

return rows;

}

public void setRows(List rows) {

this.rows = rows;

}

}

(5)分页sql理论依据:

befc50b0488ecec324ea9f94a16443da.png

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值