You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
2.0 KiB
Java

package weaver.formmode.customjavacode.customsearch.rules;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
import java.util.Map;
public class FindDw extends AbstractCustomSqlConditionJavaCode {
/**
* SQL
*
* @param param param()
* user
* @return : t1.a = '1' and t1.b = '3' and t1.c like '%22%'
* t1
*/
public String generateSqlCondition(Map<String, Object> param) {
//获取管理职能
String glzn = (String) param.get("glzn");
System.out.println("glan===========" + glzn);
//通过管理职能查询有哪些单位
String sqlCondition = "";
if (glzn != null && !"".equals(glzn)) {
if ("1".equals(glzn) || "6".equals(glzn) || "7".equals(glzn)) {//167为公司级其余根据部门查询
if ("1".equals(glzn)) {//如果是1则查找公司级所有
sqlCondition = "t1.jb ='0'";
} else if ("6".equals(glzn)) {//如果是6则查找集团
sqlCondition = "t1.jb ='0' and t1.wdml in ('501_1','501_2')";
} else {//其余是股份
sqlCondition = "t1.jb ='0' and t1.wdml not in ('501_1','501_2')";
}
} else {
String sql = "select * from uf_dwpp where glzn = '2502_" + glzn + "'";
RecordSet rs = new RecordSet();
rs.execute(sql);
String dws = "";
while (rs.next()) {
dws += "'" + rs.getInt("dw") + "',";
}
sqlCondition = "t1.fb in (" + dws.substring(0, dws.length() - 1) + ")";
}
}
System.out.println("sqlCondition===============" + sqlCondition);
return sqlCondition;
}
}