bootstrap点击表头实现排序功能


JSP页面:关键地方已经用绿色标识

<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/admin/includes/header.jsp"%>










<%--jqgrid数据表格 --%>
<%--jqgrid表格 页脚 --%>





后台展示数据方法:

controller:

@RequestMapping(value = "/getList", method = RequestMethod.POST)
	public @ResponseBody String getList(Page page,DbcOilBill dbcOilBill,
			   @RequestParam(value = "shipperName",required = false)String shipperName,
			   @RequestParam(value = "phzName",required = false)String phzName,
			   @RequestParam(value = "dispatchAudit",required = false)String dispatchAudit,
			   @RequestParam(value = "depotId",required = false)String depotId,
			   @RequestParam(value = "carNo",required = false)String carNo,
			   @RequestParam(value = "getowner",required = false)String getowner,
			   @RequestParam(value = "carReceive",required = false)String carReceive,
			   @RequestParam(value = "park",required = false)String park,
			   @RequestParam(value = "depot",required = false)String depot,
			   @RequestParam(value = "indexs",required = false)String indexs,
			   @RequestParam(value = "sortorders",required = false)String sortorders){
	    
	    List depotList = new ArrayList();
        //如果库区为空,则选择为全部,取该用户所属部门下拥有的库区权限
        if(StringUtils.isEmpty(depotId)){
            Map map = getBackUserDepot();
            depotList = (List) map.get("idList");
        }else{
            depotList.add(Integer.valueOf(depotId));
        }
        
		return JSON.toJSONString(backBillPcService.findall(page,dbcOilBill,shipperName,phzName,dispatchAudit,
		        depotList,carNo,getowner,carReceive,park,depot,indexs,sortorders));
	}

service:

@Override
	public Map findall(Page page, DbcOilBill dbcOilBill,String shipperName, String phzName, 
		String dispatchAudit, List depotList, String carNo, String getowner, 
		String carReceive, String park, String depot,String indexs,String sortorders) {
		 Map map = new HashMap();
	        PageHelper.startPage(page.getPage(), page.getRows());
	        List> list = dbcOilBillMapper.findAll(dbcOilBill,shipperName,phzName,dispatchAudit,
	                depotList,carNo,getowner,carReceive,park,depot,indexs,sortorders);
	        PageInfo pageInfo = new PageInfo(list);
	        map.put("total", pageInfo.getPages());
	        map.put("records", pageInfo.getSize());
	        map.put("rows", list);
			return map;
	}

mapper:

List> findAll(@Param("dbcOilBill")DbcOilBill dbcOilBill,
			@Param("shipperName")String shipperName, 
			@Param("phzName")String phzName, 
			@Param("dispatchAudit")String dispatchAudit, 
			@Param("depotList")List depotList, 
			@Param("carNo")String carNo, 
			@Param("getowner")String getowner, 
			@Param("carReceive")String carReceive, 
			@Param("park")String park, 
			@Param("depot")String depot, 
			@Param("indexs")String indexs, 
			@Param("sortorders")String sortorders);


mapper.xml:




你可能感兴趣的:(bootstrap,ssm)