zoukankan      html  css  js  c++  java
  • 设计与实现模块管理系统的基本功能定义自己的(38--终极阶段 综合查询[5])

    综合查询(5)--选择参考模块


           什么是基准模块。就是你的综合查询要以哪个模块作为查询的主模块,我没想到其它的词,就用这个来表示一下。详细的来说。就是你选择了若干个模块的字段组成了一个查询,你究竞是想展示哪个模块的内容。

    比方我们前几节的样例中,选择的模块有“订单”和“订单明细”,里面有分别以“订单”和“订单明细”作为基准模块的截图。如今来详细讲讲二个父子模块作为基准模块时的不同之处。


            1、子模块作为基准模块:这时全部的父模块的字段都会增加。



    查询的sql 语句为:
        select
        		// 订单明细的字段
            _t6050.tf_ordersDetailId as tf_ordersDetailId ,
            _t6050.tf_name as tf_name ,
            _t6050.tf_number as tf_number ,
            _t6050.tf_unitPrice as tf_unitPrice ,
            _t6050.tf_subtotalPrice as tf_subtotalPrice ,
            _t6050.tf_remark as tf_remark ,
            
            //订单的字段
            _t6040.tf_date as _t6040___tf_date ,
            _t6040.tf_finished as _t6040___tf_finished ,
            _t6040.tf_ordersId as _t6040___tf_ordersId ,
            _t6040.tf_ordersNumber as _t6040___tf_ordersNumber ,
        from
            OrdersDetail _t6050 //订单明细
        left outer join
            Orders _t6040 //订单
                on _t6040.tf_ordersId = _t6050.tf_ordersId  

            2、当以父模块作为基准模块时。子模块的记录就仅仅能以聚合字段的形式出现了。没有聚合操作的字段将会被舍去。



    生成的sql 语句为:

        select
        		//订单信息
            _t6040.tf_ordersId as tf_ordersId ,
            _t6040.tf_ordersNumber as tf_ordersNumber ,
            _t6040.tf_date as tf_date ,
            _t6040.tf_finished as tf_finished ,
            _t6040.tf_remark as tf_remark ,
            
            //订单明细的数量汇总
            ( select
                sum(_t6050.tf_number)  
            from
                OrdersDetail _t6050 
            left outer join
                Orders _child_t6040 
                    on _child_t6040.tf_ordersId = _t6050.tf_ordersId  
            where
                _child_t6040.tf_ordersId = _t6040.tf_ordersId ) as S__t6050___tf_number ,
                
            //订单明细的金额汇总
            ( select
                sum(_t6050.tf_subtotalPrice)  
            from
                OrdersDetail _t6050 
            left outer join
                Orders _child_t6040 
                    on _child_t6040.tf_ordersId = _t6050.tf_ordersId  
            where
                _child_t6040.tf_ordersId = _t6040.tf_ordersId ) as S__t6050___tf_subtotalPrice 
    
        from
            Orders _t6040 

            上面的样例里仅仅出现了求和的聚合操作。那么假设要增加计数,最大值,最小值,平均值要怎样操作呢。

    前面几节在介绍选择字段。输入字段的条件时,在条件值的以下有5个checkbox ,用来设置该字段。能够生成哪些个聚合的字段。




    确定后运行后。我们来看看查询结果:



            sql语句和上面的类似就是增加了count ,max ,min,avg 等。这个界面上以后还能增加扩展功能。比方说在“数量个数”的值上加个链接,一点就能看到明细;在“数量最大值”的值上加个链接,一点就能查看最大值的那个“订单明细”等等。





    版权声明:本文博主原创文章,博客,未经同意不得转载。

  • 相关阅读:
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    《EffectiveJava中文第二版》 高清PDF下载
    《MoreEffectiveC++中文版》 pdf 下载
    《啊哈c语言》 高清 PDF 下载
  • 原文地址:https://www.cnblogs.com/gcczhongduan/p/4840768.html
Copyright © 2011-2022 走看看