public abstract class BaseController中添加以下方法
/**
* 获取请求属性封装为Map类型
* @param request
* @return
*/
protected HashMap<String, Object> getRequestMapSingle(HttpServletRequest request) {
HashMap<String, Object> conditions = new HashMap<String, Object>();
Map map = request.getParameterMap();
for (Object o : map.keySet()) {
String key = (String) o;
conditions.put(key, ((String[]) map.get(key))[0]);
}
return conditions;
}
在普通Controller中public class XXController extends BaseController {
在方法中调用即可:HashMap<String, Object> parameters = getRequestMapSingle(request);
}
还请各位大神多多指导!不喜勿喷!!!