起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1873|回复: 3

[结贴] action 报表获取数据失败

[复制链接]

188

主题

598

帖子

1210

积分

金牌会员

Rank: 6Rank: 6

积分
1210
QQ
发表于 2013-11-23 08:38:09 | 显示全部楼层 |阅读模式
版本: X5.2.6 小版本号:
数据库: MySQL 服务器操作系统: 应用服务器:
客户端操作系统: 浏览器:
public static Table LZBHZ(){
  String mssql= "select * from (select count(t36.fZLLX)as p1 from KJ_SQZL t36 where t36.fZLLX like '%发明专利%'and t36.fDW = '冷轧部')a," +
"(select count(t37.fLWTM)as p2 from KJ_LWXX t37 where t37.fDW = '冷轧部')b," +
"(select count(t38.fSBMC)as p3 from KJ_SB t38 where t38.fDW = '冷轧部')c," +
"(select count(t39.fBZMC)as p4 from KJ_BZXX t39 where t39.fDW = '冷轧部')d," +
"(select count(t40.fHJMC)as p4 from KJ_HJXX t40 where t40.fDW = '冷轧部')e," +
"(select sum(t19.fZFZJZED)as p5 from KJ_ZFZJ t19 where t19.fDW = '冷轧部')f," +
"(select sum(t10.fGZSJRYS)as p6 from KJ_WBZJ t10 where t10.fDW = '冷轧部')g," +
"(select count(t34.fSQZLMC)as p7,count(case when fZLLX like '%发明专利%' then fZLLX else null end)as p8 from KJ_SLZL t34 where t34.fDW = '冷轧部')h," +
"(select count(fXMMC)as p9," +
"count(case when fXMLY like '%省级项目%' then fXMLY else null end)as p10," +
"count(case when fXMLY like '%对外合作%' then fXMLY else null end)as p11," +
"count(case when fXMLY like '%三年以上%' then fXMJZ else null end)as p12," +
"count(case when fXMLY like '%完成%' then fXMJZ else null end)as p13" +
"from KJ_QBXM  where fDW = '冷轧部')i," +
"(select sum(t20.fYQSBYJ)p14," +
"sum(case when t20.fJKGC = '进口' then t20.fYQSBYJ else 0 end)p15 from KJ_YQSB t20  where t20.fDW = '冷轧部')j," +
"(select sum(CASE WHEN t12. fXMCGXS<5 or t12.fXMCGXS=8 or t12.fXMJSJJMB<3 THEN t12.fxmry ELSE 0 END)as p16," +
"sum(t12.fLWF+t12.fYCLXHF+t12.fQQLZF+t12.fDYCLF+t12.fBGF+t12.fZLTSF+t12.fKYSBWXF+t12.fYSF+t12.fZTHYF+t12.fCGJDF+t12.fKYFZF+t12.fJJLWF+t12.fPXF+t12.fQTNBZC+t12.fSDF+t12.fSBZJYCQFYTX+t12.fYYKYZYJZWDZJFY+t12.fWXZCTX)as p17," +
"sum(t12.fLWF)as p18," +
"sum(t12.fYCLXHF)as p19,"+
"sum(t12.fSBZJYCQFYTX+t12.fYYKYZYJZWDZJFY)as p20,"+
"sum(t12.fWXZCTX)as p21,"+
"sum(t12.fDNZC)as p22,"+
"sum(t12.fGMYZZSBF)as p23,"+
"count(case when (fXMCGXS>0 and fXMCGXS<5) or fXMCGXS=8 then 1 else null end)+count(case when fXMJSJJMB>0 AND fXMJSJJMB<3 then 1 else null end)as p24," +
"count(case when t12.fXMJSJJMB = '3' or t12.fXMJSJJMB = '4' then t12.fXMJSJJMB else null end)as p25," +
"sum(case when t12.fXMJSJJMB = '3' or t12.fXMJSJJMB = '4' then t12.fLWF+t12.fYCLXHF+t12.fQQLZF+t12.fDYCLF+t12.fBGF+t12.fZLTSF+t12.fKYSBWXF+t12.fYSF+t12.fZTHYF+t12.fCGJDF+t12.fKYFZF+t12.fJJLWF+t12.fPXF+t12.fQTNBZC+t12.fSDF+t12.fGMYZZSBF else 0 end)as p26," +
"sum(t12.fLWF+t12.fYCLXHF+t12.fQQLZF+t12.fDYCLF+t12.fBGF+t12.fZLTSF+t12.fKYSBWXF+t12.fYSF+t12.fZTHYF+t12.fCGJDF+t12.fKYFZF+t12.fJJLWF+t12.fPXF+t12.fQTNBZC+t12.fSDF+t12.fGMYZZSBF)as p27," +
"sum(t12.fPXF)as p28," +
"sum(t12.fYJJSXSJFZC)as p29," +
"sum(t12.fGMGNJFZC)as p30 from KJ_XMJB t12 where t12.fDW = '冷轧部')k," +
"(select count(t1.fXM)as p31," +
"count(case when t1.fJSZW = '项目人员' and t1.fDW = '冷轧部' then t1.fJSZW else null end)as p32," +
"count(case when (t1.fJSZW = '服务人员'or t1.fJSZW = '管理人员') then t1.fJSZW else null end)as p33," +
"count(case when t1.fXB = '女' then t1.fXB else null end)as p34," +
"count(case when (t1.fZC = '高级职称'or t1.fZC = '中级职称') then t1.fZC else null end)as p35," +
"count(t1.fXM)as p36," +
"count(case when t1.fXL = '博士' then t1.fXL else null end)as p37," +
"count(case when t1.fXL = '硕士' then t1.fXL else null end)as p38," +
"count(case when t1.fXL = '本科' then t1.fXL else null end)as p39 from KJ_KJHDRYMXB t1 where t1.fDW = '冷轧部')l";

  HashMap<String,String> sqlMap=new HashMap<String,String>();
  System.out.println(mssql);
  sqlMap.put(DatabaseProduct.MYSQL.name(), mssql);
  return SQL.select(sqlMap, null, "/KJXM/kjxm/data");
}
}
红色的这段是可以查询的,写到action上怎么就获取失败呢,求大神看一下。谢谢
  1. 执行sqlQueryAction时报错!select * from (select count(t36.fZLLX)as p1 from KJ_SQZL t36 where t36.fZLLX like '%发明专利%'and t36.fDW = '冷轧部')a,(select count(t37.fLWTM)as p2 from KJ_LWXX t37 where t37.fDW = '冷轧部')b,(select count(t38.fSBMC)as p3 from KJ_SB t38 where t38.fDW = '冷轧部')c,(select count(t39.fBZMC)as p4 from KJ_BZXX t39 where t39.fDW = '冷轧部')d,(select count(t40.fHJMC)as p4 from KJ_HJXX t40 where t40.fDW = '冷轧部')e,(select sum(t19.fZFZJZED)as p5 from KJ_ZFZJ t19 where t19.fDW = '冷轧部')f,(select sum(t10.fGZSJRYS)as p6 from KJ_WBZJ t10 where t10.fDW = '冷轧部')g,(select count(t34.fSQZLMC)as p7,count(case when fZLLX like '%发明专利%' then fZLLX else null end)as p8 from KJ_SLZL t34 where t34.fDW = '冷轧部')h,(select count(fXMMC)as p9,count(case when fXMLY like '%省级项目%' then fXMLY else null end)as p10,count(case when fXMLY like '%对外合作%' then fXMLY else null end)as p11,count(case when fXMLY like '%三年以上%' then fXMJZ else null end)as p12,count(case when fXMLY like '%完成%' then fXMJZ else null end)as p13from KJ_QBXM where fDW = '冷轧部')i,(select sum(t20.fYQSBYJ)p14,sum(case when t20.fJKGC = '进口' then t20.fYQSBYJ else 0 end)p15 from KJ_YQSB t20 where t20.fDW = '冷轧部')j,(select sum(CASE WHEN t12. fXMCGXS<5 or t12.fXMCGXS=8 or t12.fXMJSJJMB<3 THEN t12.fxmry ELSE 0 END)as p16,sum(t12.fLWF+t12.fYCLXHF+t12.fQQLZF+t12.fDYCLF+t12.fBGF+t12.fZLTSF+t12.fKYSBWXF+t12.fYSF+t12.fZTHYF+t12.fCGJDF+t12.fKYFZF+t12.fJJLWF+t12.fPXF+t12.fQTNBZC+t12.fSDF+t12.fSBZJYCQFYTX+t12.fYYKYZYJZWDZJFY+t12.fWXZCTX)as p17,sum(t12.fLWF)as p18,sum(t12.fYCLXHF)as p19,sum(t12.fSBZJYCQFYTX+t12.fYYKYZYJZWDZJFY)as p20,sum(t12.fWXZCTX)as p21,sum(t12.fDNZC)as p22,sum(t12.fGMYZZSBF)as p23,count(case when (fXMCGXS>0 and fXMCGXS<5) or fXMCGXS=8 then 1 else null end)+count(case when fXMJSJJMB>0 AND fXMJSJJMB<3 then 1 else null end)as p24,count(case when t12.fXMJSJJMB = '3' or t12.fXMJSJJMB = '4' then t12.fXMJSJJMB else null end)as p25,sum(case when t12.fXMJSJJMB = '3' or t12.fXMJSJJMB = '4' then t12.fLWF+t12.fYCLXHF+t12.fQQLZF+t12.fDYCLF+t12.fBGF+t12.fZLTSF+t12.fKYSBWXF+t12.fYSF+t12.fZTHYF+t12.fCGJDF+t12.fKYFZF+t12.fJJLWF+t12.fPXF+t12.fQTNBZC+t12.fSDF+t12.fGMYZZSBF else 0 end)as p26,sum(t12.fLWF+t12.fYCLXHF+t12.fQQLZF+t12.fDYCLF+t12.fBGF+t12.fZLTSF+t12.fKYSBWXF+t12.fYSF+t12.fZTHYF+t12.fCGJDF+t12.fKYFZF+t12.fJJLWF+t12.fPXF+t12.fQTNBZC+t12.fSDF+t12.fGMYZZSBF)as p27,sum(t12.fPXF)as p28,sum(t12.fYJJSXSJFZC)as p29,sum(t12.fGMGNJFZC)as p30 from KJ_XMJB t12 where t12.fDW = '冷轧部')k,(select count(t1.fXM)as p31,count(case when t1.fJSZW = '项目人员' and t1.fDW = '冷轧部' then t1.fJSZW else null end)as p32,count(case when (t1.fJSZW = '服务人员'or t1.fJSZW = '管理人员') then t1.fJSZW else null end)as p33,count(case when t1.fXB = '女' then t1.fXB else null end)as p34,count(case when (t1.fZC = '高级职称'or t1.fZC = '中级职称') then t1.fZC else null end)as p35,count(t1.fXM)as p36,count(case when t1.fXL = '博士' then t1.fXL else null end)as p37,count(case when t1.fXL = '硕士' then t1.fXL else null end)as p38,count(case when t1.fXL = '本科' then t1.fXL else null end)as p39 from KJ_KJHDRYMXB t1 where t1.fDW = '冷轧部')l
  2. at com.justep.report.controller.DataController.a(Unknown Source)
  3. at com.justep.report.controller.DataController.a(Unknown Source)
复制代码

188

主题

598

帖子

1210

积分

金牌会员

Rank: 6Rank: 6

积分
1210
QQ
 楼主| 发表于 2013-11-23 09:05:58 | 显示全部楼层
我把代码上的sql复制下来,查询正常、
回复 支持 反对

使用道具 举报

109

主题

1191

帖子

3851

积分

论坛元老

Rank: 8Rank: 8

积分
3851
QQ
发表于 2013-11-23 09:13:01 | 显示全部楼层
谁用谁知道 发表于 2013-11-23 09:05
我把代码上的sql复制下来,查询正常、

后台错误信息,不详细
回复 支持 反对

使用道具 举报

188

主题

598

帖子

1210

积分

金牌会员

Rank: 6Rank: 6

积分
1210
QQ
 楼主| 发表于 2013-11-23 09:39:01 | 显示全部楼层
代码太多,有的重复定义,谢谢。可以结贴了。。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-5-18 23:40 , Processed in 0.071066 second(s), 25 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表