首页>代码>spring boot+Bootstrap-table的使用,列权限控制,表头居中项目实例>/bootstrap-demo/src/main/java/com/example/demo/controller/IndexController.java
package com.example.demo.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.example.demo.entity.Pager;

/**
 * bootstrap-table练习demo
 * @author 程就人生
 * @date 2019年9月6日
 */
@RestController
public class IndexController {

	/**
	 * 列表页初始化
	 * @return
	 *
	 */
	@GetMapping("/index")
	public ModelAndView index(){
		return new ModelAndView("/index");
	}
	
	/**
	 * 列表页查询结果模拟
	 * @return
	 *
	 */
	@GetMapping("/searchByCriteria")
	public Object searchByCriteria(Pager pager){
		List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
		Map<String,Object> dataMap = null;
		//模拟分页查询的结果
		for(int i=((pager.getCurrentPage()-1) * pager.getPageSize()); i<pager.getCurrentPage() * pager.getPageSize();i++){
			dataMap = new HashMap<String,Object>();
			dataMap.put("userName", "程就人生" + i);
			dataMap.put("sex", i%2==0?"1":"0");
			dataMap.put("desc", "描述描述描述" + i);
			dataMap.put("money", "100.00");
			dataMap.put("userUid", "N"+i);
			list.add(dataMap);
		}
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("total", 100);
		map.put("code", 200);
		map.put("rows", list);
		return map;
	}
}
最近下载更多
qhdjod  LV7 2023年4月11日
想个名熬一宿  LV2 2022年4月26日
tj8888  LV5 2022年4月9日
PJ辰天  LV1 2021年12月20日
LHQYYQX  LV1 2021年12月8日
lianghui  LV13 2021年7月7日
a244806065  LV1 2021年5月18日
adminfht  LV1 2021年3月27日
caozongan  LV19 2021年3月24日
archerliangce  LV2 2021年1月24日
最近浏览更多
zhujunnan  LV12 3月5日
漫步的海星  LV4 2023年9月26日
neuwxr2015  LV8 2023年8月11日
qhdjod  LV7 2023年4月11日
hesu2020  LV1 2023年3月20日
hellof 2022年10月23日
暂无贡献等级
北斗闪耀星空 2022年5月9日
暂无贡献等级
想个名熬一宿  LV2 2022年4月26日
tj8888  LV5 2022年4月9日
snowbread86 2022年3月23日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友