- 注册时间
- 2013-5-1
- 最后登录
- 2014-9-24
- 阅读权限
- 10
- 积分
- 83
- 精华
- 0
- 帖子
- 17
|
factory 发表于 2013-5-9 17:09
1.。。。这跟是不是一张表没关系啊,你后台都拿到查询条件了,该怎么查就怎么查啊,该关联查就关联查,这 ...
查询结果返回null,我改变后的代码如下:
(1)获取值下拉列表值:
function greatSearch(){
var school = mini.get("school").getValue();
var major = mini.get("major").getValue();
var grade = mini.get("grade").getValue();
var obj = {
a:school,
b:major,
c:grade,
}
grid.load(obj);
}
(2)将获取的值传到后台:
//查询条件
String key = request.getParameter("key");
String school = request.getParameter("school");
String major = request.getParameter("major");
String grade = request.getParameter("grade");
HashMap result = new Test.TestDB().SearchEmployees(key, pageIndex, pageSize, sortField, sortOrder,school, major, grade);
(3)修改SQL查询语句:
String sql =
"select a.*, b.name dept_name, c.name position_name, d.name educational_name \n"
+"from t_employee a \n"
+"left join t_department b \n"
+"on a.dept_id = b.id \n"
+"left join t_position c \n"
+"on a.position = c.id \n"
+"left join t_educational d \n"
+"on a.educational = d.id \n"
+"where a.name like '%" + key + "%' \n"
+"b.name like '%" + school + "%' \n"
+"c.name like '%" + major + "%' \n"
+"d.name like '%" + grade + "%' \n";
查询结果:
请问错在哪里呢?
|
|