SSM实现多条件查询

jsp:select月份时本该做成一个日历格式的,但是能力有限,暂时只能做成现在的这个样子,基本功能算是实现了。

月份:     姓名:     手机号:     部门:    查询 重置条件

js:
 function doSearch(){
		$('#dg').datagrid('reload',{
			test:$('#monthSearch').combobox('getValue'),
			username:$('#usernameSearch').textbox('getValue'),
			phone:$('#phoneSearch').textbox('getValue'),
			dName:$('#departmentSearch').combobox('getText')
		})
	
dao:

	
	

mapper.xml  查询语句多看多练
		

service:

	/**
	 * 传入所有要查询的条件作为参数
	 * @param phone
	 * @param test
	 * @return
	 */
	
	public List selectSwipeRecordByPage(PageBean pageBean, String dName, String username, String test, String phone) ;
 
  
serviceImpl:
	@Override
	public List selectSwipeRecordByPage(PageBean pageBean,
			String dName, String username, String test, String phone) {
		
		return swipeRecordDao.selectSwipeRecordByPage(pageBean, dName, username, test, phone);
	}
controller:

在查询所有的考勤记录时已经将查询条件传进去了。

	/**
	 * 分页
	 * @param pageNow
	 * @return
	 */
	@RequestMapping(value = "/swipeRecordByPage" , method = RequestMethod.POST)
	@ResponseBody
	public JSONObject swipeRecordByPage(@RequestParam(value="page",required=false)String page,@RequestParam(value="rows",required=false)String rows,String dName, String username, String test, String phone,HttpServletResponse response){
		JSONObject result = new JSONObject();
		try {
			
			PageBean pageBean=new PageBean(Integer.parseInt(page),Integer.parseInt(rows));
			List swipeRecordList = swipeRecordService.selectSwipeRecordByPage(pageBean, dName, username, test, phone);
			Long total = swipeRecordService.selectSwipeRecordCount();
			
			result.put("rows", swipeRecordList);
			result.put("total", total);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return  result;
	}



你可能感兴趣的:(SSM)