`
打了个D
  • 浏览: 74305 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

报表求大虾优化或解决方案

阅读更多

 

private String getSQL(String strDate,String endDate){
		String sql = "select t.arlncd,t.fleetcd,sum(t.flightnum) flightnum,sum(t.incountry) incountry,sum(t.international) international,"
		             +" sum(t.transport) transport,sum(t.freight) freight,sum(t.pilotnum) pilotnum,sum(t.capnum) capnum,sum(t.capflytime) capflytime,"
		             +" sum(t.fonum) fonum,sum(t.foflytime) foflytime,sum(t.groupnum) groupnum,sum(t.mttime) mttime,sum(t.motime) motime,"
		             +" sum(t.segtime) segtime,sum(t.bttime) bttime,sum(t.botime) botime"
        +" from (select substr(fd.arlncd, 1, 3) arlncd,fd.fleetcd fleetcd,0 flightNum,0 incountry,0 international,case when fd.flighttype = 'B/W' or fd.flighttype = 'C/B' or"
	  			+" fd.flighttype = 'F/H' or fd.flighttype = 'W/Z' or fd.flighttype = 'Z/P' or fd.flighttype = 'Z/X' then fd.flytime else 0 end transport,"
	  			+" case when fd.flighttype = 'H/G' or fd.flighttype = 'H/Y' then fd.flytime else 0 end freight,0 pilotNum,0 capNum,0 capFlyTime,"
	  			+" 0 foNum,0 foFlyTime,0 groupnum,0 mtTime,0 moTime,0 segTime,0 btTime,0 boTime from pilotduty pd left join flyduty fd on pd.flyduty_id = fd.id"
	  			+" where fd.flighttype in ('H/G', 'H/Y', 'B/W', 'C/B', 'F/H', 'W/Z', 'Z/P', 'Z/X') and fd.strdt between to_date('"+strDate+"','YYYY-MM-DD') and to_date('"+endDate+"','YYYY-MM-DD')" 
	  			+" union all select substr(fd.arlncd, 1, 3) arlncd, fd.fleetcd fleetcd,0 flightNum,0 incountry,0 international,"
	  			+" 0 transport,0 freight,0 pilotNum,0 capNum,sum(decode(pd.identify, 'CAP', pd.flytime, 0)) capFlyTime,0 foNum,"
	  			+" sum(decode(pd.identify, 'F/O', pd.flytime, 'S/O', pd.flytime, 0)) foFlyTime,0 groupnum,0 mtTime,0 moTime,0 segTime,0 btTime,0 boTime"
  			+" from flyduty fd left join pilotduty pd on pd.flyduty_id = fd.id where (pd.identify = 'CAP' or pd.identify = 'F/O' or pd.identify = 'S/O')"
  			+" and fd.arlncd is not null and fd.fleetcd is not null and fd.strdt between to_date('"+strDate+"','YYYY-MM-DD') and to_date('"+endDate+"','YYYY-MM-DD')" 
  			+"  group by fd.arlncd, fd.fleetcd having fd.arlncd is not null"
  			+" union all"
  			+" select p.arlcd,p.fleetcd,0 flightNum,0 incountry,0 international,0 transport,0 freight,count(*) pilotNum,0 capNum,0 capFlyTime,0 foNum,"
  			+" 0 foFlyTime,0 groupnum,0 mtTime,0 moTime,0 segTime,0 btTime,0 boTime from (select substr(f.arlncd, 1, 3) arlcd, f.fleetcd"
  			+" from flyduty f where f.arlncd is not null and f.fleetcd is not null group by f.arlncd, f.fleetcd) p left join (select"
  			+" substr(registration_base_code,-4,3) arlcd,pt.fleet from post pt"
  			+" left join subranktype s on pt.subranktype_id = s.id left join person pn on pt.person_id = pn.id where type = '注册岗位'"
  			+" and s.fd_ind = '飞行员' and pn.deleted = 0 and pt.effdt <= to_date('"+endDate+"', 'YYYY-MM-DD') and (pt.expdt is null or pt.expdt>to_date('"+strDate+"', 'YYYY-MM-DD'))"
  			+" and pt.fleet is not null and pn.registration_base_code is not null) t on t.arlcd = p.arlcd"
  			+" where t.fleet like '%' || p.fleetcd || '%' group by p.arlcd, p.fleetcd"
  			+" union all"    
  			+" select p.arlcd, p.fleetcd,0 flightNum,0 incountry,0 international,0 transport,0 freight,0 pilotNum,count(*) capNum,0 capFlyTime,"
  			+" 0 foNum,0 foFlyTime,0 groupnum,0 mtTime,0 moTime,0 segTime,0 btTime,0 boTime from (select substr(f.arlncd, 1, 3) arlcd, f.fleetcd"
  			+" from flyduty f where f.arlncd is not null and f.fleetcd is not null group by f.arlncd, f.fleetcd) p left join (select"
  			+" substr(registration_base_code,-4,3) arlcd,pt.fleet from post pt left join subranktype s on pt.subranktype_id = s.id"
  			+" left join person pn on pt.person_id = pn.id where pt.type = '注册岗位' and s.rank_cd = 'CAP' or s.rank_cd = 'CAPT' and pn.deleted = 0"
  			+" and pt.effdt <= to_date('"+endDate+"', 'YYYY-MM-DD') and (pt.expdt is null or pt.expdt > to_date('"+strDate+"', 'YYYY-MM-DD'))"
  			+" and pt.fleet is not null) t on t.arlcd = p.arlcd where t.fleet like '%' || p.fleetcd || '%' group by p.arlcd, p.fleetcd"
  			+" union all"  
  			+" select p.arlcd,p.fleetcd,0 flightNum,0 incountry,0 international,0 transport,0 freight,0 pilotNum,0 capNum,0 capFlyTime,"
  			+" count(*) foNum,0 foFlyTime,0 groupnum,0 mtTime,0 moTime,0 segTime,0 btTime,0 boTime from (select substr(f.arlncd, 1, 3) arlcd, f.fleetcd fleetcd"
  			+" from flyduty f where f.arlncd is not null and f.fleetcd is not null group by f.arlncd, f.fleetcd) p left join (select"
  			+" substr(registration_base_code,-4,3) arlcd,pt.fleet from post pt left join subranktype s on pt.subranktype_id = s.id"
  			+" left join person pn on pt.person_id = pn.id where pt.type = '注册岗位' and s.rank_cd = 'FO' and pn.deleted = 0"
  			+" and pt.effdt <= to_date('"+endDate+"', 'YYYY-MM-DD') and (pt.expdt is null or pt.expdt > to_date('"+strDate+"', 'YYYY-MM-DD')) and pt.fleet is not null) t on t.arlcd = p.arlcd"
  			+" where t.fleet like '%' || p.fleetcd || '%' group by p.arlcd, p.fleetcd"
  			+" union all"
  			+" select tp.orgunitcoding arlncd,tp.fleetcd fleetcd,0 flightNum,0 incountry,0 international,0 transport,0 freight,0 pilotNum,0 capNum,0 capFlyTime,"
  			+" 0 foNum,0 foFlyTime,count(*) groupnum,sum(tf.teachertime) mtTime,sum(tf.observerstime) moTime,0 segTime,0 btTime,0 boTime"
  			+" from trainingplan tp left join trainingproject tg on tg.id = tp.trainingproject_id left join trainingsubject ts on ts.id = tg.trainingsubject_id"
  			+" left join trainingpersoninfo tf on tf.trainingplan_id = tp.id where ts.subjecttype = '模拟机训练'"
  			+" and tf.startdate_str between '"+strDate+"' and '"+endDate+"' group by tp.orgunitcoding, tp.fleetcd"
  			+" union all"
  			+" select tp.orgunitcoding arlncd,tp.fleetcd fleetcd,0 flightNum,0 incountry,0 international,0 transport,0 freight,0 pilotNum,0 capNum,0 capFlyTime,"
  			+" 0 foNum,0 foFlyTime,0 groupnum,0 mtTime,0 moTime,0 segTime,sum(tf.teachertime) btTime,sum(tf.observerstime) boTime from trainingplan tp"
  			+" left join trainingproject tg on tg.id = tp.trainingproject_id left join trainingpersoninfo tf on tf.trainingplan_id = tp.id"
  			+" where tg.isplacetraining = '是' and tf.startdate_str between '"+strDate+"' and '"+endDate+"' group by tp.orgunitcoding, tp.fleetcd"
  			+" union all"
  			+" select fd.fleetcd fleetcd,fd.arlncd arlncd,0 flightNum,0 incountry,0 international,0 transport,0 freight,0 pilotNum,0 capNum,"
  			+" 0 capFlyTime,0 foNum,0 foFlyTime,0 groupnum,0 mtTime,0 moTime,pd.segtimes segTime,0 btTime,0 boTime from pilotduty pd"
  			+" left join flyduty fd on pd.flyduty_id = fd.id where fd.flighttype = 'K/L' and fd.strdt between to_date('"+strDate+"', 'YYYY-MM-DD') and to_date('"+endDate+"', 'YYYY-MM-DD')"
  		    +" ) t group by t.arlncd,fleetcd";
		return sql.toUpperCase();
	}
分享到:
评论

相关推荐

    大虾串口助手sscom5.13.1

    一款非常好用的串口调试工具

    大虾电子网30章C51入门教程

    这份《大虾电子网30章C51入门教程》涵盖了以上各个关键知识点,并且提供了丰富的实例和练习,适合自学或课堂教学。通过系统学习,读者不仅可以掌握C51编程,还能建立起单片机硬件与软件之间的桥梁,为进一步的嵌入式...

    水晶报表中文帮助手册

    8. 故障排查和优化:手册通常会包含一些常见问题的解决方案和性能优化建议,帮助用户解决在使用过程中遇到的问题。 通过阅读这个中文帮助手册,无论是初学者还是有经验的报表设计者,都能获得对水晶报表全面深入的...

    C# 打印与报表技术 源码

    如何快速创建水晶报表  如何编写带图片的报表  如何使图片成为整个报表的背景  如何设置水晶报表中节的背景图片 如何设置水晶报表中节的背景色  如何设置水晶报表的页面  如何在报表中添加节...

    大虾网超好的串口调试工具-sscom5.04a.rar-大虾网超好的串口工具-sscom5.04a.rar

    同时,软件还提供了波特率自动测量功能,可以帮助用户准确地确定设备的实际波特率,解决通信问题。 在电子设计领域,SSCOM5.04a常用于开发、测试和维护嵌入式系统、单片机项目以及各种串口设备。例如,在调试嵌入式...

    大虾电子网30章C51入门教程.zip

    《大虾电子网30章C51入门教程》是一份专为初学者设计的教程,旨在帮助读者快速掌握C51编程语言的基础知识和应用技巧。C51是为8051微控制器系列设计的一种高级编程语言,广泛应用于嵌入式系统开发。这份教程共分为30...

    跟我一起写大虾网(第2天)

    【标题】"跟我一起写大虾网(第2天)"是一个关于编程学习的教程,可能是系列教程的一部分,主要聚焦在代码编写和开发工具的使用上。这个标题暗示了作者将带领读者逐步了解如何构建一个名为“大虾网”的项目,可能是...

    大虾电子网30章C51入门教程--奉献了

    大虾电子网30章C51入门教程--奉献了,需要下载的学习吧

    与大虾对话 领悟设计模式

    在编程领域,设计模式是软件开发中的重要概念,它代表了在特定上下文中解决常见问题的最佳实践。"与大虾对话 领悟设计模式"这个主题,暗示我们将通过一个交流或者讨论的形式来深入理解设计模式的核心思想和应用场景...

    C程序优化方案.pdf

    C程序优化方案 本文主要讨论C程序优化方案,包括选择合适的算法和数据结构、使用尽量小的数据类型、减少运算的强度等几个方面。 一、选择合适的算法和数据结构 在编写C程序时,选择合适的算法和数据结构非常重要...

    sscom大虾串口调试助手

    《sscom大虾串口调试助手详解》 在IT领域,串口通信是设备间进行数据传输的一种常见方式,尤其在嵌入式系统、单片机编程以及物联网应用中尤为重要。"sscom大虾串口调试助手"是一款专门用于串口调试的软件工具,它以...

    大虾的不同做法.docx

    虽然文档未提及,但在实际操作中,这些设备可能被用来提高红烧大虾或干烧大虾的烹饪效果。 4. 食谱推荐算法:在线烹饪平台常常使用算法分析用户的偏好,推荐相应的食谱。用户对大虾的兴趣可能会触发类似的推荐,...

    9天鹅、大虾和梭鱼.ppt

    在本例中,可能的解决方案是让天鹅负责拉起车头,大虾向前推动,梭鱼在水中提供浮力,这样三者的力量才能有效地结合在一起,推动大车前进。 学了这个故事,我们可以领悟到,无论是学习、工作还是生活中,与人合作时...

    PHP优化,代码优化

    优化不仅能够提升应用的响应速度,还能提高资源利用效率,为用户提供更好的体验。以下是从给定文件中提炼出的关于PHP优化的重要知识点,这些方法覆盖了代码层面、数据库交互、以及服务器配置等多个方面。 #### 代码...

    大虾的拼音怎么写.docx

    总的来说,大虾不仅是生物分类学中的一个物种,也是人类饮食文化中不可或缺的食材。了解其拼音、生物学特性和在日常生活中的应用,有助于我们更好地欣赏和利用这一自然资源。在享受美食的同时,我们也应关注海洋生态...

    大数据下的青岛大虾事件实用.pdf

    在危机公关策略上,大数据提供了有针对性的解决方案。借鉴淘宝的评价系统,青岛市政府可以建立类似机制,通过监控社交媒体和在线评价平台(如大众点评)上的消费者反馈,来识别有问题的餐饮企业。大数据的关键词分析...

    求助各位大虾关于itae积分指标实现的问题-heatexdemo.m

    求助各位大虾关于itae积分指标实现的问题-heatexdemo.m 这个在matlab里面怎么实现阿 ! 比如用pid去控制一个最简单的一阶惯性环节! 用这个itae指标去优化pid的参数 这个怎么弄 具体步骤 向各位大虾求助...

Global site tag (gtag.js) - Google Analytics