public static Table reportAction2(String ZZJG,String YGNUMBER,String YGXM,String LEVER,String WGRQ,String ENDWGRQ) throws Exception {
String sql = " select a.fCJMIAOSHU as FCJMIAOSHU,a.fDYMS as FDYMS,a.fGDMS as FGDMS,a.fZYZMS as FZYZMS,a.fGWMS as FGWMS,b.fBBYGH as FYGNUMBER,b.fBBYGXM as FYGXM,a.fHJGS as FHJGS, b.fBBDRGS as FBBDRGS from YT_LHGS_LR a,YT_LHGS_BBTJ b where a.fID=b.fBBID ";
if (Utils.isNotEmptyString(YGNUMBER)) {
sql += " and b.fBBYGH like '%"+YGNUMBER+"%' ";
}
if (Utils.isNotEmptyString(YGXM)) {
sql += " and b.fBBYGXM like '%"+YGXM+"%' ";
}
if (Utils.isNotEmptyString(ZZJG)) {
sql += " and ((a.fCJ = '"+ZZJG+"') or (a.fCJMIAOSHU = '"+ZZJG+"') or (a.fDY = '"+ZZJG+"' ) or (a.fDYMS = '"+ZZJG+"') or (a.fZBZYZ = '"+ZZJG+"') or (a.fZYZMS = '"+ZZJG+"') or (a.fXFGW = '"+ZZJG+"') or (a.fGD = '"+ZZJG+"') or (a.fGDMS = '"+ZZJG+"') or (a.fGWMS = '"+ZZJG+"'))";
}
if (Utils.isNotEmptyString(WGRQ)){
//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//String wqdata = sdf.format(WGRQ);
// sql += " and a.fQRRQ = to_date('"+WGRQ+"','yyyy-mm-dd')";
sql += " and a.fQRRQ between to_date('"+WGRQ+"','yyyy-mm-dd') and to_date('"+ENDWGRQ+"','yyyy-mm-dd')";
}
/级别
// if (Utils.isNotEmptyString(LEVER)) {
// String lever = "";
// String ksql = "select a.fZZJGDM from YT_ZZJG_WH a where a.flever = '"+LEVER+"' ";
// Table table2 = KSQL.select(ksql, null, "/YT_LHGS/YT_ZZJG/data", null);
// Iterator<Row> rows2 = table2.iterator();
// Row rs2 = null;
// if (rows2.hasNext()) {
// rs2 = rows2.next();
// lever = rs2.getString("fZZJGDM");
// }else{
// lever = "";
// }
// if(!"".equals(lever)){
// sql += " and ((a.fCJ = '"+lever+"') or (a.fCJMIAOSHU = '"+lever+"') or (a.fDY = '"+lever+"' ) or (a.fDYMS = '"+lever+"') or (a.fZBZYZ = '"+lever+"') or (a.fZYZMS = '"+lever+"') or (a.fXFGW = '"+lever+"') or (a.fGD = '"+lever+"') or (a.fGDMS = '"+lever+"') or (a.fGWMS = '"+lever+"')) ";
// }
// }
sql += " and a.fWGZT ='已完工'";
System.out.println(sql+"报表查询语句");
//String biaotiTitle = "灵活工时统计报表";
//if(null!=WGRQ&&!"".equals(WGRQ)){
// biaotiTitle = "灵活工时统计报表("+WGRQ+"-"+ENDWGRQ+")";
//}
Connection connection = ModelUtils.getConnection("/YT_LHGS/YT_ZZJG/data");
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(sql);
Table table = BizUtils.resultSet2Table(rs, (Model) null);
//在table返回数据对象中加入了一个字段
//table.addColumn("biaotiTitle", "String");
Iterator<Row> iterator = table.iterator();
Row row= null;
while (iterator.hasNext()) {
row = (Row) iterator.next();
}
//把变量付给table对象中加入的那个值
// row.setString("biaotiTitle", biaotiTitle);
return table;
String sql = " select a.fCJMIAOSHU as FCJMIAOSHU,a.fDYMS as FDYMS,a.fGDMS as FGDMS,a.fZYZMS as FZYZMS,a.fGWMS as FGWMS,b.fBBYGH as FYGNUMBER,b.fBBYGXM as FYGXM,a.fHJGS as FHJGS, b.fBBDRGS as FBBDRGS from YT_LHGS_LR a,YT_LHGS_BBTJ b where a.fID=b.fBBID ";
if (Utils.isNotEmptyString(YGNUMBER)) {
sql += " and b.fBBYGH like '%"+YGNUMBER+"%' ";
}
if (Utils.isNotEmptyString(YGXM)) {
sql += " and b.fBBYGXM like '%"+YGXM+"%' ";
}
if (Utils.isNotEmptyString(ZZJG)) {
sql += " and ((a.fCJ = '"+ZZJG+"') or (a.fCJMIAOSHU = '"+ZZJG+"') or (a.fDY = '"+ZZJG+"' ) or (a.fDYMS = '"+ZZJG+"') or (a.fZBZYZ = '"+ZZJG+"') or (a.fZYZMS = '"+ZZJG+"') or (a.fXFGW = '"+ZZJG+"') or (a.fGD = '"+ZZJG+"') or (a.fGDMS = '"+ZZJG+"') or (a.fGWMS = '"+ZZJG+"'))";
}
if (Utils.isNotEmptyString(WGRQ)){
//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//String wqdata = sdf.format(WGRQ);
// sql += " and a.fQRRQ = to_date('"+WGRQ+"','yyyy-mm-dd')";
sql += " and a.fQRRQ between to_date('"+WGRQ+"','yyyy-mm-dd') and to_date('"+ENDWGRQ+"','yyyy-mm-dd')";
}
/级别
// if (Utils.isNotEmptyString(LEVER)) {
// String lever = "";
// String ksql = "select a.fZZJGDM from YT_ZZJG_WH a where a.flever = '"+LEVER+"' ";
// Table table2 = KSQL.select(ksql, null, "/YT_LHGS/YT_ZZJG/data", null);
// Iterator<Row> rows2 = table2.iterator();
// Row rs2 = null;
// if (rows2.hasNext()) {
// rs2 = rows2.next();
// lever = rs2.getString("fZZJGDM");
// }else{
// lever = "";
// }
// if(!"".equals(lever)){
// sql += " and ((a.fCJ = '"+lever+"') or (a.fCJMIAOSHU = '"+lever+"') or (a.fDY = '"+lever+"' ) or (a.fDYMS = '"+lever+"') or (a.fZBZYZ = '"+lever+"') or (a.fZYZMS = '"+lever+"') or (a.fXFGW = '"+lever+"') or (a.fGD = '"+lever+"') or (a.fGDMS = '"+lever+"') or (a.fGWMS = '"+lever+"')) ";
// }
// }
sql += " and a.fWGZT ='已完工'";
System.out.println(sql+"报表查询语句");
//String biaotiTitle = "灵活工时统计报表";
//if(null!=WGRQ&&!"".equals(WGRQ)){
// biaotiTitle = "灵活工时统计报表("+WGRQ+"-"+ENDWGRQ+")";
//}
Connection connection = ModelUtils.getConnection("/YT_LHGS/YT_ZZJG/data");
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(sql);
Table table = BizUtils.resultSet2Table(rs, (Model) null);
//在table返回数据对象中加入了一个字段
//table.addColumn("biaotiTitle", "String");
Iterator<Row> iterator = table.iterator();
Row row= null;
while (iterator.hasNext()) {
row = (Row) iterator.next();
}
//把变量付给table对象中加入的那个值
// row.setString("biaotiTitle", biaotiTitle);
return table;
}
报表绑定的 report数据上 mappin 里面返回得到的数据写 as后面的 如:FCJMIAOSHU