cuxOptionVO.setFullSqlMode(cuxOptionVO.FULLSQL_MODE_AUGMENTATION); cuxOptionVO.setQuery(null); cuxOptionVO.setWhereClause(null); if (!flag) { cuxOptionVO.setQuery(" select lookup_code FLEX_VALUE, meaning description " + " from fnd_lookup_values_vl " + " where lookup_type='CUX_PON_AUTO_EVALUATION' and lookup_code in (select target_name " + " from CUX_POS_BASIC_INFO " + " where org_id = :1)"); cuxOptionVO.setWhereClauseParam(0, pageContext.getOrgId()); } else { cuxOptionVO.setQuery("select ffv.FLEX_VALUE, ffv.DESCRIPTION " + " from FND_FLEX_VALUE_SETS ffs, FND_FLEX_VALUES_VL ffv " + " WHERE ffs.flex_value_set_id = ffv.FLEX_VALUE_SET_ID " + " AND ffs.flex_value_set_name = 'CUX_AUTO_EVALUATION_PARA' " + " and ffv.PARENT_FLEX_VALUE_low = :1 " + " order by flex_value"); cuxOptionVO.setWhereClauseParam(0, autoAttr); }
注:如果是更改页面poplist的查询结果,不设置FULLSqlMode也没太大关系。
注意:cuxOptionVO.setFullSqlMode(cuxOptionVO.FULLSQL_MODE_AUGMENTATION);
这个方法厉害的,他会把VO里面的SQL默认设置为最近的setQury的值,所以if else应当结对出现,否则走过!flag之后,即使再走flag,VO的QUERY依然是!flag的SQL.
打个比方,有两条路径, A B,分别对应的SQL 应该是SQLA,SQLB,A条件是默认路径,SQLA是VO里面的原始SQL,如果一旦走过B,设置了SQLB,在走A,如果不重新setQuery,A路径下的SQL也变成了SQLB