X5 报表的ACTION 数据返回TABLE 代码

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;

    }

报表绑定的  report数据上  mappin  里面返回得到的数据写   as后面的  如:FCJMIAOSHU

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值