mybatis多条件查询

忽略时分秒的条件查询:

 

 

 

controller:

	@RequestMapping(value="/application/queryUserapplication",method=RequestMethod.POST,produces = "application/json;charset=UTF-8")
	@ResponseBody
	public String queryUserapplication(@RequestBody Userapplicationform user) {
		Result result=null;
		List users=applicationService.queryUserapplication(user);
		if(users.size()>0) {
			 result = Result.build(200, "数据查询成功", users);
				return new Gson().toJson(result);
		}else {
			 result = Result.build(400, "查询没有结果", users);
				return new Gson().toJson(result);
		}
		
		
		
	}

mapper:

 

   List queryUserapplication(Userapplicationform user);

mapper.xml:

 


  

对象查询

排序

example.setOrderByClause("time desc");

 

模糊查询

dao:

	Map data = new HashedMap();
        data.put("phone", phone);
       List list=h5codeMapper.queryh5codeophone(data);
       if (list.size()>0) {
		return Result.build(200, "数据查询成功", list);
	}
		return Result.build(400, "数据查询失败", list);

	}

xml:
 

string类型的数字排序在xml中加:up+0

 

你可能感兴趣的:(mybatis)