项目地址:http://git.oschina.net/kaierge/SpringMVC_Hibernate_EesyUI/tree/master
贴出一段action层的代码:
@Controller
@SuppressWarnings({"rawtypes","unchecked"})
@RequestMapping("/dept")
public class DeptAction {
@Autowired
@Qualifier(value="deptDao")
private DeptDao deptDao;
// 根据各种条件获取
@RequestMapping(value="/getDeptListByPId.xhtml")
@ResponseBody
public JsonResult getDeptListByPId(PageBean pageBean,Integer pid,String name,
HttpServletRequest request,HttpServletResponse response){
JsonResult jsonResult = new JsonResult();
StringBuilder queryFromSb = new StringBuilder();
queryFromSb.append("o.pid=?");
List
params.add(pid);//选择条件
//前台查找条件
if(name!=null){
queryFromSb.append(" and o.name like ? ");
params.add("%"+name+"%");
}
List
Object rows = deptDao.getScrollDataCount(queryFromSb.toString(), params.toArray());
jsonResult.setTotal(rows);
jsonResult.setRows(deList);
return jsonResult;
}
}