|
|
本帖最后由 shary 于 2011-9-6 09:42 编辑
var opts = createOptions();
var rootid = getItemValueAsString("department1");
opts.add("--请选择--","");
try{
if(rootid!=null&&rootid!=""){
var process = createProcess("cn.myapps.core.dynaform.dts.datasource.ejb.DataSourceProcess");
var datas = process.queryDataSourceSQL("guarantee","select obpm.a.id,obpm.a.name from t_user a, t_user_department_set b,t_department c where obpm.a.domainid ='11e0-b734-3dfdcb2b-9e4d-bb8a4aef5fe7' and obpm.a.id = obpm.b.userid and obpm.c.id= obpm.b.departmentid and obpm.c.name='"+rootid+"'",getApplication());
if(datas==null){
var retvar = "null";
}
if(datas!=null){
for(var iterator = datas.iterator();iterator.hasNext();){
var map1 = iterator.next();
var name= map1.get("obpm.a.name");
var value = map1.get("obpm.a.id");
opts.add(name,value);
}
}
}
}catch(e){}
opts;
问题是这样的:
相当于是级联查询,根据前面一个框中选的部门,然后根据所选部门名称查询该部门下的人员。
整条sql语句在数据库中能查询出数据,但是用在上面这段代码中,则datas为null;
帮我分析一下。
非常感谢。 |
|