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

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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;
}
}