CN115033575A - A data query method, device, equipment and storage medium - Google Patents

A data query method, device, equipment and storage medium Download PDF

Info

Publication number
CN115033575A
CN115033575A CN202210778189.1A CN202210778189A CN115033575A CN 115033575 A CN115033575 A CN 115033575A CN 202210778189 A CN202210778189 A CN 202210778189A CN 115033575 A CN115033575 A CN 115033575A
Authority
CN
China
Prior art keywords
data
query
business
target
field
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210778189.1A
Other languages
Chinese (zh)
Other versions
CN115033575B (en
Inventor
侯丽杰
潘建
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengcaiyun Co ltd
Original Assignee
Zhengcaiyun Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengcaiyun Co ltd filed Critical Zhengcaiyun Co ltd
Priority to CN202210778189.1A priority Critical patent/CN115033575B/en
Publication of CN115033575A publication Critical patent/CN115033575A/en
Application granted granted Critical
Publication of CN115033575B publication Critical patent/CN115033575B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/283Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请涉及计算机技术领域,公开了一种数据查询方法、装置、设备及存储介质,包括:从业务系统的数据库中获取多个具有关联关系的业务数据表,并将多个所述业务数据表存储至数据仓库中;根据查询需求从所述数据仓库中存储的多个所述业务数据表对应的字段中确定出目标字段,并在统计系统的数据库中构建包含所述目标字段及对应字段数据的目标宽表;其中,所述目标字段至少包含查询数据对应的字段;获取查询指令并根据所述查询指令对所述目标宽表进行查询,得到与所述查询指令对应的所述查询数据。本申请能够避免查询逻辑同时涉及多个数据表使得查询复杂度较高以产生查询超时的问题,简化查询逻辑进而提高数据查询效率。

Figure 202210778189

The present application relates to the field of computer technology, and discloses a data query method, device, device and storage medium, including: acquiring a plurality of business data tables with associated relationships from a database of a business system, and storing a plurality of the business data tables Store in the data warehouse; determine the target field from the fields corresponding to a plurality of the business data tables stored in the data warehouse according to the query requirements, and construct the target field and corresponding field data in the database of the statistical system The target width table; wherein, the target field contains at least a field corresponding to the query data; a query instruction is obtained and the target width table is queried according to the query instruction to obtain the query data corresponding to the query instruction. The present application can avoid the problem of query logic involving multiple data tables at the same time, resulting in high query complexity and query timeout, simplifying query logic and improving data query efficiency.

Figure 202210778189

Description

一种数据查询方法、装置、设备及存储介质A data query method, device, equipment and storage medium

技术领域technical field

本发明涉及计算机技术领域,特别涉及一种数据查询方法、装置、设备及存储介质。The present invention relates to the field of computer technology, and in particular, to a data query method, apparatus, device and storage medium.

背景技术Background technique

目前,营收看板的数据查询是直接基于数据仓库,通过Data API来连接前台与后台,利用API的方式提供数据服务,其具体流程如图1,在Data API写好查询项对应的查询语句,然后利用接口调用的形式从数据仓库获取想要的数据,从而提供给前台。用户在页面进行搜索时,前端调用API时把查询参数提供出来,然后经过后端的处理,将查询参数补充到Data API查询语句中,从而获得想要的查询结果。At present, the data query of the revenue kanban is directly based on the data warehouse. The front-end and the back-end are connected through the Data API, and the API is used to provide data services. The specific process is shown in Figure 1. Write the query statement corresponding to the query item in the Data API. Then use the form of interface calls to obtain the desired data from the data warehouse and provide it to the foreground. When a user searches on a page, the front-end provides the query parameters when calling the API, and then through the back-end processing, the query parameters are added to the Data API query statement to obtain the desired query results.

上述流程存在如下问题:1)查询逻辑复杂,出现接口响应超时问题。往往营收看板中的一项数据的查询要多张表进行关联且查询条件过多,查询速度会大大降低,接口响应时间经常出现超出10秒的情况,导致用户体验感极差;The above process has the following problems: 1) The query logic is complex, and the interface response timeout problem occurs. Often, a data query in the revenue kanban requires multiple tables to be associated with too many query conditions, and the query speed will be greatly reduced. The response time of the interface often exceeds 10 seconds, resulting in an extremely poor user experience;

2)对接及维护成本高。由于查询逻辑复杂,Data API中的查询语句一般都比较长,动则就是数十行的查询语句,代码也写得相对复杂些。营收看板需求每次的迭代优化都需要接手该项目的开发耗费不少时间去熟悉如何运用。作为公司内部运营,当他们发现营收看板上统计的营收与自己估算的累计营收不一致时,他们期望能查询下具体是哪一笔对不上。运营一般对Data API工具了解不多,查询语句过于复杂的话,也需要耗费运营一定的学习成本以及与测试、开发们的沟通成本,费时费力。另外查询的语句存放于Data API开发工具中,需要人工定期维护,一旦有他人动用,查询结果就会受到影响;3)系统稳定性不足,出现问题不易排查。基于各事业部业务推进现状,各业务的营收额,交易高峰期系统稳定性不足,会出现营收看板数据异常的情况。出现问题不易排查,需耗费大量时间去核对数据。2) The docking and maintenance costs are high. Due to the complex query logic, the query statements in the Data API are generally long, and the action is dozens of lines of query statements, and the code is relatively complex. Each iteration and optimization of revenue kanban needs to take over the development of the project and spend a lot of time to get familiar with how to use it. As an internal operation of the company, when they find that the revenue counted on the revenue board is inconsistent with their estimated cumulative revenue, they expect to check which one is not correct. Operations generally do not know much about Data API tools. If the query statement is too complex, it will also cost the operation a certain learning cost and the cost of communication with the testers and developers, which is time-consuming and labor-intensive. In addition, the query statement is stored in the Data API development tool, which requires manual maintenance on a regular basis. Once someone uses it, the query result will be affected; 3) The system stability is insufficient, and it is difficult to troubleshoot problems. Based on the current status of the business promotion of each business division, the revenue of each business, and the lack of system stability during peak trading periods, abnormal revenue kanban data may occur. Problems are not easy to troubleshoot, and it takes a lot of time to check the data.

因此,上述技术问题是亟待本领域技术人员进行解决的。Therefore, the above technical problems are urgently to be solved by those skilled in the art.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明的目的在于提供一种数据查询方法、装置、设备及存储介质,能够避免查询逻辑同时涉及多个数据表使得查询复杂度较高以产生查询超时的问题,简化查询逻辑进而提高数据查询效率。其具体方案如下:In view of this, the purpose of the present invention is to provide a data query method, device, device and storage medium, which can avoid the problem that query logic involves multiple data tables at the same time, which makes the query complex to generate query timeout, and simplifies the query logic and further Improve data query efficiency. Its specific plan is as follows:

本申请的第一方面提供了一种数据查询方法,包括:A first aspect of the present application provides a data query method, including:

从业务系统的数据库中获取多个具有关联关系的业务数据表,并将多个所述业务数据表存储至数据仓库中;Obtain a plurality of business data tables with associated relationships from the database of the business system, and store the plurality of business data tables in a data warehouse;

根据查询需求从所述数据仓库中存储的多个所述业务数据表对应的字段中确定出目标字段,并在统计系统的数据库中构建包含所述目标字段及对应字段数据的目标宽表;其中,所述目标字段至少包含查询数据对应的字段;According to the query requirement, the target field is determined from the fields corresponding to the plurality of the business data tables stored in the data warehouse, and a target wide table containing the target field and the corresponding field data is constructed in the database of the statistical system; wherein , the target field contains at least the field corresponding to the query data;

获取查询指令并根据所述查询指令对所述目标宽表进行查询,得到与所述查询指令对应的所述查询数据。Obtain a query instruction and query the target wide table according to the query instruction to obtain the query data corresponding to the query instruction.

可选的,所述从业务系统的数据库中获取多个具有关联关系的业务数据表之后,还包括:Optionally, after obtaining a plurality of business data tables with associated relationships from the database of the business system, the method further includes:

对多个所述业务数据表中的数据依次进行抽取处理、清洗处理及转换处理,以将最终处理后的多个所述业务数据表存储至所述数据仓库中。The data in the plurality of business data tables are sequentially extracted, cleaned, and converted, so as to store the finally processed plurality of the business data tables in the data warehouse.

可选的,所述从业务系统的数据库中获取多个具有关联关系的业务数据表,并将多个所述业务数据表存储至数据仓库中,包括:Optionally, obtaining a plurality of business data tables with associated relationships from the database of the business system, and storing the plurality of business data tables in a data warehouse, including:

利用数据同步工具按照第一预设同步周期将所述业务系统的数据库中的多个具有关联关系的所述业务数据表同步至所述数据仓库中。A data synchronization tool is used to synchronize a plurality of the business data tables with associated relationships in the database of the business system to the data warehouse according to a first preset synchronization period.

可选的,所述将多个所述业务数据表存储至数据仓库中之后,还包括:Optionally, after the plurality of business data tables are stored in the data warehouse, the method further includes:

根据以数据表格式存储的配置逻辑对多个所述数据表中的数据进行整合计算,得到整合后的字段数据;According to the configuration logic stored in the data table format, the data in the plurality of data tables is integrated and calculated to obtain the integrated field data;

相应的,所述在统计系统的数据库中构建包含所述目标字段及对应字段数据的目标宽表,包括:Correspondingly, constructing a target wide table including the target field and corresponding field data in the database of the statistical system includes:

在所述统计系统的数据库中构建包含所述目标字段及对应的整合后的所述字段数据的所述目标宽表。The target wide table containing the target field and the corresponding integrated field data is constructed in the database of the statistical system.

可选的,所述在所述统计系统的数据库中构建包含所述目标字段及对应的整合后的所述字段数据的所述目标宽表,包括:Optionally, constructing the target wide table including the target field and the corresponding integrated field data in the database of the statistical system includes:

在所述统计系统的数据库中构建包含所述目标字段的所述目标宽表;constructing the target wide table containing the target field in a database of the statistical system;

通过设置并运行定时任务的方式将所述数据仓库中所述目标字段对应的整合后的所述字段数据在所述目标宽表中进行更新。The integrated field data corresponding to the target field in the data warehouse is updated in the target wide table by setting and running a timed task.

可选的,所述获取查询指令之后,还包括:Optionally, after obtaining the query instruction, the method further includes:

获取所述查询指令的触发账号;其中,所述触发账号为当前在所述统计系统中登录的第一部门账号;Obtain the trigger account of the query instruction; wherein, the trigger account is the first department account currently logged in in the statistics system;

确定出所述触发账号在所述业务系统中对应的第二部门账号,并根据所述查询指令对所述目标宽表中与所述第二部门账号相关的所述字段数据进行查询,得到与所述查询指令对应的所述查询数据;Determine the second department account corresponding to the trigger account in the business system, and query the field data related to the second department account in the target width table according to the query instruction, and obtain a the query data corresponding to the query instruction;

将与所述查询指令对应的所述查询数据输出至营收看板的人工交互界面上进行显示。The query data corresponding to the query instruction is output to the manual interactive interface of the revenue kanban for display.

可选的,所述数据查询方法,还包括:Optionally, the data query method further includes:

构建所述统计系统中的所述第一部门账号与所述业务系统中的所述第二部门账号之间的映射关系,以便根据所述映射关系确定出所述触发账号在所述业务系统中对应的所述第二部门账号。Build a mapping relationship between the first department account in the statistics system and the second department account in the business system, so as to determine that the trigger account is in the business system according to the mapping relationship The corresponding account of the second department.

本申请的第二方面提供了一种数据查询装置,包括:A second aspect of the present application provides a data query device, comprising:

获取存储模块,用于从业务系统的数据库中获取多个具有关联关系的业务数据表,并将多个所述业务数据表存储至数据仓库中;an acquisition storage module for acquiring a plurality of business data tables with associated relationships from the database of the business system, and storing a plurality of the business data tables in a data warehouse;

确定构建模块,用于根据查询需求从所述数据仓库中存储的多个所述业务数据表对应的字段中确定出目标字段,并在统计系统的数据库中构建包含所述目标字段及对应字段数据的目标宽表;其中,所述目标字段至少包含查询数据对应的字段;A determination building module is used to determine a target field from the fields corresponding to a plurality of the business data tables stored in the data warehouse according to query requirements, and construct a database containing the target field and corresponding field data in the statistical system The target wide table; wherein, the target field contains at least the field corresponding to the query data;

获取查询模块,用于获取查询指令并根据所述查询指令对所述目标宽表进行查询,得到与所述查询指令对应的所述查询数据。An acquisition query module is configured to acquire a query instruction and query the target wide table according to the query instruction to obtain the query data corresponding to the query instruction.

本申请的第三方面提供了一种电子设备,所述电子设备包括处理器和存储器;其中所述存储器用于存储计算机程序,所述计算机程序由所述处理器加载并执行以实现前述数据查询方法。A third aspect of the present application provides an electronic device, which includes a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the aforementioned data query method.

本申请的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机可执行指令,所述计算机可执行指令被处理器加载并执行时,实现前述数据查询方法。A fourth aspect of the present application provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are loaded and executed by a processor, the aforementioned data query method is implemented .

本申请中,先从业务系统的数据库中获取多个具有关联关系的业务数据表,并将多个所述业务数据表存储至数据仓库中;然后根据查询需求从所述数据仓库中存储的多个所述业务数据表对应的字段中确定出目标字段,并在统计系统的数据库中构建包含所述目标字段及对应字段数据的目标宽表;其中,所述目标字段至少包含查询数据对应的字段;最后获取查询指令并根据所述查询指令对所述目标宽表进行查询,得到与所述查询指令对应的所述查询数据。可见,本申请将业务系统数据库中多个业务数据表统一存储在数据仓库中,由于多个业务数据表之间具有关联关系,在进行查询时,查询逻辑可能同时涉及多个数据表,查询逻辑较为复杂。为此,以数据仓库中的多个业务数据表的字段为提取基础,按需提取字段,并利用提取的字段及字段数据在统计系统中构建新的宽表,在进行查询时,大部分查询逻辑仅涉及新构建的宽表,能够避免查询逻辑同时涉及多个数据表使得查询复杂度较高以产生查询超时的问题,简化查询逻辑进而提高数据查询效率。In this application, a plurality of business data tables with associated relationships are first obtained from the database of the business system, and a plurality of the business data tables are stored in a data warehouse; A target field is determined from the fields corresponding to the business data table, and a target wide table containing the target field and corresponding field data is constructed in the database of the statistical system; wherein, the target field at least contains the field corresponding to the query data and finally obtain a query instruction and query the target wide table according to the query instruction to obtain the query data corresponding to the query instruction. It can be seen that in this application, multiple business data tables in the business system database are uniformly stored in the data warehouse. Due to the association between multiple business data tables, when querying, the query logic may involve multiple data tables at the same time, and the query logic more complicated. To this end, based on the fields of multiple business data tables in the data warehouse, extract fields as needed, and use the extracted fields and field data to build a new wide table in the statistical system. The logic only involves the newly constructed wide table, which can avoid the problem that the query logic involves multiple data tables at the same time, which makes the query complex and causes query timeout, and simplifies the query logic and improves the data query efficiency.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention. For those of ordinary skill in the art, other drawings can also be obtained according to the provided drawings without creative work.

图1为本申请提供的一种通过API进行数据查询的方法示意图;1 is a schematic diagram of a method for performing data query through API provided by the present application;

图2为本申请提供的一种数据查询方法流程图;2 is a flowchart of a data query method provided by the application;

图3为本申请提供的一种具体的数据查询方法示意图;3 is a schematic diagram of a specific data query method provided by the application;

图4为本申请提供的一种统计抽佣订单已支付金额查询方法示意图;4 is a schematic diagram of a method for querying the paid amount of a statistical commission order provided by the present application;

图5为本申请提供的一种数据查询装置结构示意图;5 is a schematic structural diagram of a data query device provided by the present application;

图6为本申请提供的一种数据查询电子设备结构图。FIG. 6 is a structural diagram of a data query electronic device provided by the present application.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

现有技术中,通过Data API来连接前台与后台,利用API的方式提供数据服务的方案存在查询逻辑复杂,出现接口响应超时问题;对接及维护成本高;系统稳定性不足,出现问题不易排查等技术问题。针对上述技术缺陷,本申请提供一种数据查询方案,能够避免查询逻辑同时涉及多个数据表使得查询复杂度较高以产生查询超时的问题,简化查询逻辑进而提高数据查询效率。In the prior art, the data API is used to connect the front-end and the back-end, and the solution of using the API to provide data services has complex query logic, interface response timeout problems, high connection and maintenance costs, insufficient system stability, and difficulty in troubleshooting. technical problem. In view of the above technical defects, the present application provides a data query solution, which can avoid the problem of query logic involving multiple data tables at the same time, resulting in high query complexity and query timeout, simplifying query logic and improving data query efficiency.

图2为本申请实施例提供的一种数据查询方法流程图。参见图2所示,该数据查询方法包括:FIG. 2 is a flowchart of a data query method provided by an embodiment of the present application. Referring to Figure 2, the data query method includes:

S11:从业务系统的数据库中获取多个具有关联关系的业务数据表,并将多个所述业务数据表存储至数据仓库中。S11: Acquire a plurality of business data tables with associated relationships from the database of the business system, and store the plurality of business data tables in a data warehouse.

本实施例中,各个业务的数据组成了业务系统数据源,也即业务系统的数据库,用户交易是在各个业务系统中,交易过程中产生的交易数据存储在各自业务系统的数据库中,这就构成了业务系统的数据源。首先从业务系统的数据库中获取多个具有关联关系的业务数据表,并将多个所述业务数据表存储至数据仓库中。可以理解,数据仓库(DataWarehouse,DW或DWH)可简写为是为企业所有级别的决策制定过程,提供所有类型数据支持的战略集合。它是单个数据存储,出于分析性报告和决策支持目的而创建。为需要业务智能的企业,提供指导业务流程改进、监视时间、成本、质量以及控制。In this embodiment, the data of each business constitutes the data source of the business system, that is, the database of the business system. The user transaction is in each business system, and the transaction data generated during the transaction is stored in the database of the respective business system. It constitutes the data source of the business system. First, a plurality of business data tables with associated relationships are obtained from the database of the business system, and the plurality of business data tables are stored in a data warehouse. Understandably, a Data Warehouse (DW or DWH) can be abbreviated as a strategic collection that provides all types of data support for decision-making processes at all levels of an enterprise. It is a single data store created for analytical reporting and decision support purposes. Provides guidance on business process improvement, monitoring time, cost, quality and control for businesses that require business intelligence.

进一步的,可以利用数据同步工具按照第一预设同步周期将所述业务系统的数据库中的多个具有关联关系的所述业务数据表同步至所述数据仓库中。所述数据同步工具可通过定时任务来触发将数据同步到数据仓库,查询采用“T+1”天的形式,也就是今天只能查到截止到昨天的数据。在同步之前,也即从业务系统的数据库中获取多个具有关联关系的业务数据表之后,需要对多个所述业务数据表中的数据依次进行抽取处理、清洗处理及转换处理,以将最终处理后的多个所述业务数据表存储至所述数据仓库中。例如,多个业务数据表(业务订单数据、收费系统的配置数据等)为:table1、table2、table3、table4,通过数据同步工具将上述各表经过抽取、清洗转换之后加载到数据仓库并存储。具体如图3所示。Further, a data synchronization tool may be used to synchronize a plurality of the business data tables with associated relationships in the database of the business system to the data warehouse according to a first preset synchronization period. The data synchronization tool can trigger the synchronization of data to the data warehouse through timed tasks, and the query is in the form of "T+1" days, that is, only data up to yesterday can be found today. Before synchronization, that is, after obtaining a plurality of business data tables with associated relationships from the database of the business system, it is necessary to sequentially extract, clean and transform the data in the plurality of business data tables, so that the final The processed multiple business data tables are stored in the data warehouse. For example, multiple business data tables (business order data, configuration data of the charging system, etc.) are: table1, table2, table3, table4. The above tables are extracted, cleaned and transformed by the data synchronization tool and loaded into the data warehouse and stored. Specifically as shown in Figure 3.

S12:根据查询需求从所述数据仓库中存储的多个所述业务数据表对应的字段中确定出目标字段,并在统计系统的数据库中构建包含所述目标字段及对应字段数据的目标宽表;其中,所述目标字段至少包含查询数据对应的字段。S12: Determine a target field from the fields corresponding to a plurality of the business data tables stored in the data warehouse according to the query requirement, and construct a target wide table including the target field and corresponding field data in the database of the statistical system ; wherein, the target field at least includes a field corresponding to the query data.

本实施例中,在将多个业务数据表存储至数据仓库中之后,根据查询需求从所述数据仓库中存储的多个所述业务数据表对应的字段中确定出目标字段。所述目标字段至少包含查询数据对应的字段。然后在统计系统的数据库中构建包含所述目标字段及对应字段数据的目标宽表。宽表从字面意义上来说就是字段比较多的数据库表。通常是指业务主题相关的指标、属性、维护关联在一起的一张数据表。它通过把多张表中的相关字段放在同一张表中,减少表关联,可提高数据计算的效率。简而言之,就是空间换时间,便于迭代、减少表关联数量,修改少量数据时不需要改多张表。In this embodiment, after a plurality of business data tables are stored in the data warehouse, a target field is determined from the fields corresponding to the plurality of business data tables stored in the data warehouse according to query requirements. The target field at least includes a field corresponding to the query data. Then, a target wide table containing the target field and corresponding field data is constructed in the database of the statistical system. A wide table is literally a database table with many fields. It usually refers to a data table that is related to indicators, attributes, and maintenance related to business topics. It reduces table association by placing related fields in multiple tables in the same table, which can improve the efficiency of data calculation. In short, it is the exchange of space for time, which is easy to iterate and reduce the number of table associations. When modifying a small amount of data, you do not need to change multiple tables.

本实施例中,数据仓库中存储有配置逻辑,进一步根据以数据表格式存储的配置逻辑对多个所述数据表中的数据进行整合计算,得到整合后的字段数据。新建的所述目标宽表主要是用来存放整合后的统计字段,把统计所要用到的字段都放在同一张表中,最后直接通过宽表来进行数据统计查询,减少了表关联数量,提高了数据查询统计效率。在所述统计系统的数据库中构建包含所述目标字段及对应的整合后的所述字段数据的所述目标宽表。具体的,先在所述统计系统的数据库中构建包含所述目标字段的所述目标宽表,然后通过设置并运行定时任务的方式将所述数据仓库中所述目标字段对应的整合后的所述字段数据在所述目标宽表中进行更新。In this embodiment, the configuration logic is stored in the data warehouse, and the data in the plurality of data tables is further integrated and calculated according to the configuration logic stored in the data table format to obtain the integrated field data. The newly created target wide table is mainly used to store the integrated statistical fields, put all the fields used for statistics in the same table, and finally conduct data statistical query directly through the wide table, which reduces the number of table associations and improves the performance. Data query statistical efficiency. The target wide table containing the target field and the corresponding integrated field data is constructed in the database of the statistical system. Specifically, the target wide table containing the target field is first constructed in the database of the statistical system, and then the integrated data corresponding to the target field in the data warehouse is set and run by setting and running a scheduled task. The field data is updated in the target wide table.

例如,每天等数据仓库任务同步完后,再通过定时任务的形式从table1、table2、table3、table4等多张业务表及权限表中取出统计所需要的字段1、字段2、字段3,字段4、字段5等查询所需要用到的一些字段组成一张临时宽表table5。数据统计需要用到哪些字段,就把哪些字段从各个表中以定时任务的形式每天00:00点同步到临时宽表table5中,这样宽表中就已经具备了我们数据查询要用到的所有字段。至于宽表的索引,根据实际业务需要来创建即可。另外,每天的数据可能有所更新,通过定时任务每天凌晨2:00将数据仓库中变动的数据更新同步到宽表table5中。因为table5已经包含了统计数据所需要的所有字段,所以之后数据系统查询就可以直接通过临时宽表便可过滤所有条件,并查询出所有所需的字段,这样大大减少了表关联数量,很大程度上降低了数据库压力,加快了查询速度,提高了查询性能。For example, after the data warehouse tasks are synchronized every day, the field 1, field 2, field 3, and field 4 required for statistics are extracted from multiple business tables and permission tables such as table1, table2, table3, table4, etc., in the form of timed tasks. , Field 5 and other fields required for query form a temporary wide table table5. Which fields need to be used for data statistics, which fields are synchronized from each table to the temporary wide table table5 at 00:00 every day in the form of timed tasks, so that the wide table already has all the data we need to query. field. As for the index of the wide table, it can be created according to the actual business needs. In addition, the data may be updated every day, and the changed data update in the data warehouse is synchronized to the wide table table5 at 2:00 am every day through a scheduled task. Because table5 already contains all the fields required for statistical data, the data system query can directly filter all the conditions through the temporary wide table, and query all the required fields, which greatly reduces the number of table associations, greatly reducing the number of table associations. To a certain extent, the pressure on the database is reduced, the query speed is accelerated, and the query performance is improved.

S13:获取查询指令并根据所述查询指令对所述目标宽表进行查询,得到与所述查询指令对应的所述查询数据。S13: Acquire a query instruction and query the target width table according to the query instruction to obtain the query data corresponding to the query instruction.

本实施例中,当在页面上进行筛选查询时,获取查询指令并根据所述查询指令对所述目标宽表进行查询,得到与所述查询指令对应的所述查询数据。这种数据查询的流程可共用于所有的统计方案,可提高数据查询效率,具有通用性且有利于二次开发。在大多数情况下,统计的数据不会只在一张表中就能得出,针对逻辑复杂的查询,就可以通过这种方式将多张表中的字段按需提取整合到一张新的宽表中查询,减少数据关联查询,简化SQL查询语句,从而提高查询效率。一般来说,数据统计都会有一些通性,例如按时间统计,按地区、部门统计等,也可以以本套流程所抽取出来的统计宽表为基础,进行二次开发统计。通过修改宽表中的少量数据即可,不需要再改动多张表,开发时可省时省力。In this embodiment, when a screening query is performed on a page, a query instruction is obtained, and the target wide table is queried according to the query instruction to obtain the query data corresponding to the query instruction. This data query process can be used in all statistical schemes, which can improve the efficiency of data query, is universal, and is conducive to secondary development. In most cases, statistical data will not be obtained from only one table. For complex logical queries, fields in multiple tables can be extracted and integrated into a new wide table in this way as needed. , reduce data association queries, simplify SQL query statements, and improve query efficiency. Generally speaking, data statistics will have some commonalities, such as statistics by time, statistics by region, department, etc., and secondary development statistics can also be carried out based on the statistical wide table extracted from this set of processes. By modifying a small amount of data in the wide table, there is no need to modify multiple tables, which can save time and effort during development.

本实施例中,在得到查询结果之后将查询结果在营收看板上进行展示,营收看板通过数据可视化工具以更直观、形象的方式,来统计公司各项营收数据的看板,也是一种可以提高效率的管理手段。出于数据安全的考虑,营收看板的数据并不是针对所有人公开的,而是权限不同,可看到的数据范围不同。基于此,本实施例在页面上进行筛选查询时,需要经过账号权限以及其他筛选条件的过滤得出最终想要的统计结果。具体的,先获取所述查询指令的触发账号;其中,所述触发账号为当前在所述统计系统中登录的第一部门账号。然后确定出所述触发账号在所述业务系统中对应的第二部门账号,并根据所述查询指令对所述目标宽表中与所述第二部门账号相关的所述字段数据进行查询,得到与所述查询指令对应的所述查询数据。因此需要构建所述统计系统中的所述第一部门账号与所述业务系统中的所述第二部门账号之间的映射关系,以便根据所述映射关系确定出所述触发账号在所述业务系统中对应的所述第二部门账号。最后将与所述查询指令对应的所述查询数据输出至营收看板的人工交互界面上进行显示。In this embodiment, after the query results are obtained, the query results are displayed on the revenue kanban, and the revenue kanban uses the data visualization tool to collect various revenue data of the company in a more intuitive and visual way, which is also a kind of kanban. Management tools that can improve efficiency. For the sake of data security, the data of the revenue kanban is not disclosed to everyone, but with different permissions, the range of data that can be seen is different. Based on this, when performing a screening query on a page in this embodiment, the final desired statistical result needs to be filtered by account authority and other screening conditions. Specifically, the triggering account of the query instruction is obtained first; wherein, the triggering account is the first department account currently logged in in the statistics system. Then, determine the second department account corresponding to the trigger account in the business system, and query the field data related to the second department account in the target width table according to the query instruction, and obtain the query data corresponding to the query instruction. Therefore, it is necessary to construct a mapping relationship between the first department account in the statistics system and the second department account in the business system, so as to determine the trigger account in the business according to the mapping relationship The corresponding second department account in the system. Finally, the query data corresponding to the query instruction is output to the manual interactive interface of the revenue kanban for display.

其中,第一部门账号可以为钉钉部门账号(id),第二部门账号可以为业务部门账号(id),每个员工账号都有归属的部门,通过钉钉部门id与账单中的营收部门id打通作映射过滤权限。例如,订单有对应的账单,而账单中都有营收部门,通过登录账号的钉钉部门id映射账单中的营收部门id,再通过营收部门下的账单过滤出对应的订单,从而实现了通过账号的部门权限过滤得出想要的订单统计数据。这样便于统计各个员工的营收数据、各个部门的营收数据。以现有技术中的统计抽佣订单已支付金额的接口为例,优化前接口经常性出现响应时长超出10秒的情况,页面统计数据迟迟出不来,常常听到用户吐槽。当并发为5时,数据库CPU利用率就达到了90%以上。这样稍微施加点压力,系统就崩了。而优化后,再对此接口进行压力测试,该接口的平均响应时长一般都能控制在1秒左右,数据库压力也减少了不少,数据库CPU利用率可控制在60%以下,该接口的最佳并发数提高到了30,可谓是接口性能提升显著。Among them, the first department account can be the DingTalk department account (id), the second department account can be the business department account (id), each employee account has a department to which it belongs, and the DingTalk department id and the revenue in the bill The department id is used for mapping and filtering permissions. For example, an order has a corresponding bill, and there is a revenue department in the bill. Map the revenue department id in the bill through the DingTalk department id of the login account, and then filter the corresponding order through the bill under the revenue department, so as to achieve In order to obtain the desired order statistics by filtering the department permissions of the account. In this way, it is convenient to count the revenue data of each employee and the revenue data of each department. Taking the interface of the prior art for counting the amount paid for commission orders as an example, the response time of the interface before optimization often exceeds 10 seconds, the statistical data of the page is delayed, and users are often complained. When the concurrency is 5, the database CPU utilization reaches more than 90%. Apply a little pressure and the system collapses. After optimization, perform stress testing on this interface. The average response time of this interface can generally be controlled at about 1 second, the database pressure is also reduced a lot, and the database CPU utilization can be controlled below 60%. The optimal number of concurrency has been increased to 30, which can be said to be a significant improvement in interface performance.

可见,本申请实施例先从业务系统的数据库中获取多个具有关联关系的业务数据表,并将多个所述业务数据表存储至数据仓库中;然后根据查询需求从所述数据仓库中存储的多个所述业务数据表对应的字段中确定出目标字段,并在统计系统的数据库中构建包含所述目标字段及对应字段数据的目标宽表;其中,所述目标字段至少包含查询数据对应的字段;最后获取查询指令并根据所述查询指令对所述目标宽表进行查询,得到与所述查询指令对应的所述查询数据。本申请实施例将业务系统数据库中多个业务数据表统一存储在数据仓库中,由于多个业务数据表之间具有关联关系,在进行查询时,查询逻辑可能同时涉及多个数据表,查询逻辑较为复杂。为此,以数据仓库中的多个业务数据表的字段为提取基础,按需提取字段,并利用提取的字段及字段数据在统计系统中构建新的宽表,在进行查询时,大部分查询逻辑仅涉及新构建的宽表,能够避免查询逻辑同时涉及多个数据表使得查询复杂度较高以产生查询超时的问题,简化查询逻辑进而提高数据查询效率。It can be seen that the embodiment of the present application first obtains multiple business data tables with associated relationships from the database of the business system, and stores the multiple business data tables in the data warehouse; and then stores the multiple business data tables from the data warehouse according to query requirements. The target field is determined in the corresponding fields of a plurality of the business data tables, and a target wide table containing the target field and corresponding field data is constructed in the database of the statistical system; wherein, the target field at least contains the corresponding query data. Finally, a query instruction is obtained and the target wide table is queried according to the query instruction to obtain the query data corresponding to the query instruction. In this embodiment of the present application, multiple business data tables in the business system database are uniformly stored in the data warehouse. more complicated. To this end, based on the fields of multiple business data tables in the data warehouse, extract fields as needed, and use the extracted fields and field data to build a new wide table in the statistical system. The logic only involves the newly constructed wide table, which can avoid the problem that the query logic involves multiple data tables at the same time, which makes the query complex and causes query timeout, and simplifies the query logic and improves the data query efficiency.

下面以统计抽佣订单已支付金额查询为例,对上述过程进行具体说明,如图4所示。The above process is described in detail by taking the query of the paid amount of the commission order as an example, as shown in Figure 4.

首先,业务系统基于交易产生了交易数据,这些与交易有关的数据存储于不同的数据库中,构成了业务系统数据源,并且这些原始存在库中的数据是未经过逻辑运算处理的。由于考虑到业务场景的特殊及系统性能因素,将抽佣计算的逻辑放至大数据平台进行处理。这就需要事先将表数据通过定时任务同步到数据仓库中再运算。接着将原本数据库中的table1、table2、table3、table4、table5等多个表都同步到数据仓库的库中一份。然后从这些表中提取出用于统计所需要的一些字段,如账单类型、账单状态、收费金额、总金额、收费策略、收付款人(公司)、营收部门、账单所属区划等。利用提取出来的字段建立新的临时宽表数据new table并通过定时任务每天将数据仓库中变动的数据更新同步到newtable表中。从而实现将原本需要关联多表查询的数据,仅仅通过一张单表即可查询,大大降低了数据库压力且加快了数据查询速度。First, the business system generates transaction data based on transactions. These transaction-related data are stored in different databases, constituting the data source of the business system, and these data originally stored in the database are not processed by logical operations. Due to the special business scenarios and system performance factors, the logic of commission calculation is put into the big data platform for processing. This requires the table data to be synchronized to the data warehouse through timed tasks before operation. Then, synchronize multiple tables such as table1, table2, table3, table4, and table5 in the original database to the database of the data warehouse. Then some fields required for statistics are extracted from these tables, such as bill type, bill status, billing amount, total amount, billing strategy, payee (company), revenue department, and the division to which the bill belongs. Use the extracted fields to create a new temporary wide table data new table and synchronize the data updates in the data warehouse to the new table table through scheduled tasks every day. In this way, the data that originally needs to be related to multi-table query can be queried only through a single table, which greatly reduces the pressure on the database and speeds up the data query speed.

往往出于公司数据安全的考虑,营收看板的数据并不是针对所有人公开的,而是权限不同,可看到的数据范围不同。营收看板的数据除了有账号权限的过滤以外,还有业务数据权限的过滤。账号权限的过滤是通过钉钉部门与账单的营收部门打通做映射实现的。可通过每一个钉钉部门id能找到对应的营收部门id。订单存在于账单中,而账单中都有营收部门,从而实现了通过账号的部门权限过滤得出可查看的订单数据。页面在筛选条件查询,后端经过逻辑运算和处理,在接口中返回最终得出订单已支付金额,并通过前端展示出来。Often due to the company's data security considerations, the data on the revenue dashboard is not disclosed to everyone, but with different permissions and different scopes of data that can be seen. In addition to the filtering of account permissions, the data of the revenue kanban also has the filtering of business data permissions. The filtering of account permissions is realized by mapping between the DingTalk department and the revenue department of the bill. You can find the corresponding revenue department id through each DingTalk department id. The order exists in the bill, and there is a revenue department in the bill, so that the viewable order data can be filtered by the department permissions of the account. The page is queried by the filter conditions, the back-end undergoes logical operations and processing, and is returned in the interface to finally obtain the paid amount of the order, which is displayed on the front-end.

上述过程,第一方面简化了查询并降低对接学习成本。原方案中查询语句存放于DATA API开发工具上,DATA API开发工具上的查询语句与直接从数据库中查询的语句有所区别,且查询SQL关联数据库表过多,语句过于复杂,新接手的测试、开发都需要耗费一定的学习成本。新方案实现了由多表关联查询到单表查询的转换,SQL语句更加简洁,提升了查询效率,新手接手业务更容易上手,降低了学习时间成本。经实践证明,以前采用原方案,开发、测试至少需要0.5天时间去熟悉原有的设计,而采用新方案后,开发和测试加起来也才用了不到0.5天时间就可上手,节省了时间成本。In the above process, the first aspect simplifies the query and reduces the cost of docking learning. The query statement in the original solution is stored on the DATA API development tool. The query statement on the DATA API development tool is different from the statement queried directly from the database, and the query SQL is associated with too many database tables, and the statement is too complicated. , development requires a certain learning cost. The new solution realizes the conversion from multi-table association query to single-table query, the SQL statement is more concise, the query efficiency is improved, it is easier for newbies to take over the business, and the cost of learning time is reduced. It has been proved by practice that it took at least 0.5 days for development and testing to be familiar with the original design before using the original solution, but after adopting the new solution, it took less than 0.5 days for development and testing to get started, saving money. Time costs.

第二方面提升查询效率,提高用户体验和系统性能。原方案直接通过调用DATAAPI从数据仓库查询,受制于数据仓库,经常出现接口超时、慢SQL等问题。新方案结合数据仓库做了优化处理,通过对数据预先处理,将原本数十张表的数据,统一整合在一张临时宽表中,实现了多表关联查询到单表查询的转换,简化了查询SQL语句,提升了查询效率。慢SQL、接口超时现象得到解决,提升了用户体验,系统性能提升效果显著。The second aspect improves query efficiency, user experience and system performance. The original solution directly calls the DATAAPI to query from the data warehouse, which is subject to the data warehouse, and problems such as interface timeout and slow SQL often occur. The new solution is optimized in combination with the data warehouse. By preprocessing the data, the data of dozens of tables is unified and integrated into a temporary wide table, which realizes the conversion of multi-table association query to single-table query, which simplifies the Query SQL statements to improve query efficiency. Slow SQL and interface timeouts have been resolved, improving user experience and significantly improving system performance.

第三方面也提升了系统容错率,对业务扩展支持更加平滑。由于业务的不断扩展,后续若要针对营收看板增删改一些内容,只需根据统计的字段判断是否需要在临时宽表中新增字段,然后更新查询的SQL即可。新方案的SQL更简约,更易于修改。且若数据仓库中的数据因为某些原因丢失,临时宽表中也会因为数据丢失之前,已通过定时任务把统计要用的数据已同步到了宽表中,所以不会导致整个看板都无法使用。同时也可以增加系统监控告警,针对丢失未同步的数据重新拉取计算。In the third aspect, the fault tolerance rate of the system is also improved, and the support for business expansion is smoother. Due to the continuous expansion of the business, if you want to add, delete or modify some content for the revenue kanban in the future, you only need to judge whether you need to add new fields in the temporary wide table according to the statistical fields, and then update the query SQL. The SQL for the new scheme is more minimalistic and easier to modify. And if the data in the data warehouse is lost for some reason, the temporary wide table will also be synchronized to the wide table through a scheduled task before the data is lost, so the entire Kanban board will not be unavailable. . At the same time, you can also add system monitoring alarms, and re-pull and calculate for lost and unsynchronized data.

第四方面提高通用性,降低二次开发成本,缩短项目交付周期。在大多数情况下,统计数据不会只在一张表中就能得出。针对类似逻辑复杂的查询,就可以通过这种方式将多张表中的字段按需提取整合到一张新的宽表中查询,从而提升查询效率,这种方法适用于各个业务的数据统计查询中。另外还可以以本套流程所抽取出来的统计宽表为基础,进行二次统计,比如按时间统计,按地区、部门统计等,便于向上兼容不同类型的统计。原方案每次数据统计看板的开发设计需要1天,进行开发5天,然后数据测试又至少需要3天;新方案可在原来的宽表基础上改动,根据迭代需要,只需修改少量数据字段而不需要改多张表。开发设计几乎不用怎么改动,开发只需要1天时间,测试也只需要2天时间即可完成。原先交付需要9天,优化后只需要3天,大大降低了二次开发的时间成本,缩短了交付周期。The fourth aspect is to improve the versatility, reduce the cost of secondary development, and shorten the project delivery cycle. In most cases, statistics will not be available in just one table. For similar logically complex queries, fields in multiple tables can be extracted and integrated on demand into a new wide table in this way, thereby improving query efficiency. This method is suitable for data statistics queries of various businesses. In addition, based on the statistical wide table extracted by this set of processes, secondary statistics can be performed, such as statistics by time, statistics by region, department, etc., which is convenient for upward compatibility with different types of statistics. The original plan takes 1 day to develop and design the data statistics kanban, 5 days for development, and at least 3 days for data testing; the new plan can be modified on the basis of the original wide table, and only a small number of data fields need to be modified according to the needs of iteration No need to change multiple tables. The development design hardly needs to be changed, the development only takes 1 day, and the test only takes 2 days to complete. The original delivery took 9 days, but it only takes 3 days after optimization, which greatly reduces the time cost of secondary development and shortens the delivery cycle.

参见图5所示,本申请实施例还相应公开了一种数据查询装置,包括:Referring to FIG. 5 , an embodiment of the present application also discloses a data query device, including:

获取存储模块11,用于从业务系统的数据库中获取多个具有关联关系的业务数据表,并将多个所述业务数据表存储至数据仓库中;an acquisition storage module 11, configured to acquire a plurality of business data tables with associated relationships from the database of the business system, and store the plurality of business data tables in a data warehouse;

确定构建模块12,用于根据查询需求从所述数据仓库中存储的多个所述业务数据表对应的字段中确定出目标字段,并在统计系统的数据库中构建包含所述目标字段及对应字段数据的目标宽表;其中,所述目标字段至少包含查询数据对应的字段;Determine the construction module 12, which is used to determine the target field from the fields corresponding to the plurality of the business data tables stored in the data warehouse according to the query requirements, and construct the database containing the target field and the corresponding field in the statistical system A target wide table of data; wherein, the target field at least includes a field corresponding to the query data;

获取查询模块13,用于获取查询指令并根据所述查询指令对所述目标宽表进行查询,得到与所述查询指令对应的所述查询数据。The acquiring query module 13 is configured to acquire a query instruction and query the target width table according to the query instruction to obtain the query data corresponding to the query instruction.

可见,本申请实施例先从业务系统的数据库中获取多个具有关联关系的业务数据表,并将多个所述业务数据表存储至数据仓库中;然后根据查询需求从所述数据仓库中存储的多个所述业务数据表对应的字段中确定出目标字段,并在统计系统的数据库中构建包含所述目标字段及对应字段数据的目标宽表;其中,所述目标字段至少包含查询数据对应的字段;最后获取查询指令并根据所述查询指令对所述目标宽表进行查询,得到与所述查询指令对应的所述查询数据。本申请实施例将业务系统数据库中多个业务数据表统一存储在数据仓库中,由于多个业务数据表之间具有关联关系,在进行查询时,查询逻辑可能同时涉及多个数据表,查询逻辑较为复杂。为此,以数据仓库中的多个业务数据表的字段为提取基础,按需提取字段,并利用提取的字段及字段数据在统计系统中构建新的宽表,在进行查询时,大部分查询逻辑仅涉及新构建的宽表,能够避免查询逻辑同时涉及多个数据表使得查询复杂度较高以产生查询超时的问题,简化查询逻辑进而提高数据查询效率。It can be seen that the embodiment of the present application first obtains multiple business data tables with associated relationships from the database of the business system, and stores the multiple business data tables in the data warehouse; and then stores the multiple business data tables from the data warehouse according to query requirements. The target field is determined in the corresponding fields of a plurality of the business data tables, and a target wide table containing the target field and corresponding field data is constructed in the database of the statistical system; wherein, the target field at least contains the corresponding query data. Finally, a query instruction is obtained and the target wide table is queried according to the query instruction to obtain the query data corresponding to the query instruction. In this embodiment of the present application, multiple business data tables in the business system database are uniformly stored in the data warehouse. more complicated. To this end, based on the fields of multiple business data tables in the data warehouse, extract fields as needed, and use the extracted fields and field data to build a new wide table in the statistical system. The logic only involves the newly constructed wide table, which can avoid the problem that the query logic involves multiple data tables at the same time, which makes the query complex and causes query timeout, and simplifies the query logic and improves the data query efficiency.

在一些具体实施例中,所述获取存储模块11,具体用于利用数据同步工具按照第一预设同步周期将所述业务系统的数据库中的多个具有关联关系的所述业务数据表同步至所述数据仓库中。In some specific embodiments, the acquisition and storage module 11 is specifically configured to use a data synchronization tool to synchronize a plurality of the business data tables with associated relationships in the database of the business system to a first preset synchronization period. in the data warehouse.

在一些具体实施例中,所述数据查询装置还包括:In some specific embodiments, the data query apparatus further includes:

处理模块,用于对多个所述业务数据表中的数据依次进行抽取处理、清洗处理及转换处理,以将最终处理后的多个所述业务数据表存储至所述数据仓库中;a processing module, configured to sequentially perform extraction processing, cleaning processing and conversion processing on the data in a plurality of the business data tables, so as to store the final processed plurality of the business data tables in the data warehouse;

整合模块,用于根据以数据表格式存储的配置逻辑对多个所述数据表中的数据进行整合计算,得到整合后的字段数据;an integration module, configured to perform integrated calculation on the data in a plurality of the data tables according to the configuration logic stored in the data table format, to obtain the field data after integration;

在一些具体实施例中,所述确定构建模块12,具体包括:In some specific embodiments, the determining the building module 12 specifically includes:

确定单元,用于根据查询需求从所述数据仓库中存储的多个所述业务数据表对应的字段中确定出目标字段;a determining unit, configured to determine a target field from fields corresponding to a plurality of the business data tables stored in the data warehouse according to query requirements;

构建单元,用于在所述统计系统的数据库中构建包含所述目标字段及对应的整合后的所述字段数据的所述目标宽表。A construction unit, configured to construct the target wide table including the target field and the corresponding integrated field data in the database of the statistical system.

在一些具体实施例中,所述构建单元,具体用于在所述统计系统的数据库中构建包含所述目标字段的所述目标宽表,并通过设置并运行定时任务的方式将所述数据仓库中所述目标字段对应的整合后的所述字段数据在所述目标宽表中进行更新。In some specific embodiments, the constructing unit is specifically configured to construct the target wide table including the target field in the database of the statistical system, and configure the data warehouse by setting and running a scheduled task. The integrated field data corresponding to the target field is updated in the target wide table.

在一些具体实施例中,所述数据查询装置还包括:In some specific embodiments, the data query apparatus further includes:

账号获取模块,用于获取所述查询指令的触发账号;其中,所述触发账号为当前在所述统计系统中登录的第一部门账号;an account acquisition module, configured to acquire a trigger account of the query instruction; wherein, the trigger account is the first department account currently logged in in the statistics system;

账号确定模块,用于确定出所述触发账号在所述业务系统中对应的第二部门账号,并根据所述查询指令对所述目标宽表中与所述第二部门账号相关的所述字段数据进行查询,得到与所述查询指令对应的所述查询数据;an account number determination module, configured to determine the second department account corresponding to the trigger account in the business system, and perform the search for the field related to the second department account in the target width table according to the query instruction querying the data to obtain the query data corresponding to the query instruction;

输出模块,用于将与所述查询指令对应的所述查询数据输出至营收看板的人工交互界面上进行显示;an output module, configured to output the query data corresponding to the query instruction to the manual interactive interface of the revenue kanban for display;

关系构建模块,用于构建所述统计系统中的所述第一部门账号与所述业务系统中的所述第二部门账号之间的映射关系,以便根据所述映射关系确定出所述触发账号在所述业务系统中对应的所述第二部门账号。A relationship building module for constructing a mapping relationship between the first department account in the statistical system and the second department account in the business system, so as to determine the trigger account according to the mapping relationship the corresponding second department account in the business system.

进一步的,本申请实施例还提供了一种电子设备。图6是根据一示例性实施例示出的电子设备20结构图,图中的内容不能认为是对本申请的使用范围的任何限制。Further, the embodiments of the present application also provide an electronic device. FIG. 6 is a structural diagram of an electronic device 20 according to an exemplary embodiment, and the contents in the diagram should not be considered as any limitation on the scope of use of the present application.

图6为本申请实施例提供的一种电子设备20的结构示意图。该电子设备20,具体可以包括:至少一个处理器21、至少一个存储器22、电源23、通信接口24、输入输出接口25和通信总线26。其中,所述存储器22用于存储计算机程序,所述计算机程序由所述处理器21加载并执行,以实现前述任一实施例公开的数据查询方法中的相关步骤。FIG. 6 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21 , at least one memory 22 , a power supply 23 , a communication interface 24 , an input and output interface 25 and a communication bus 26 . Wherein, the memory 22 is used for storing a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the data query method disclosed in any of the foregoing embodiments.

本实施例中,电源23用于为电子设备20上的各硬件设备提供工作电压;通信接口24能够为电子设备20创建与外界设备之间的数据传输通道,其所遵循的通信协议是能够适用于本申请技术方案的任意通信协议,在此不对其进行具体限定;输入输出接口25,用于获取外界输入数据或向外界输出数据,其具体的接口类型可以根据具体应用需要进行选取,在此不进行具体限定。In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows is applicable Any communication protocol in the technical solution of the present application is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, here No specific limitation is made.

另外,存储器22作为资源存储的载体,可以是只读存储器、随机存储器、磁盘或者光盘等,其上所存储的资源可以包括操作系统221、计算机程序222及数据223等,存储方式可以是短暂存储或者永久存储。In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc. The resources stored on it can include an operating system 221, a computer program 222, and data 223, etc., and the storage method can be short-term storage. or permanent storage.

其中,操作系统221用于管理与控制电子设备20上的各硬件设备以及计算机程序222,以实现处理器21对存储器22中海量数据223的运算与处理,其可以是Windows Server、Netware、Unix、Linux等。计算机程序222除了包括能够用于完成前述任一实施例公开的由电子设备20执行的数据查询方法的计算机程序之外,还可以进一步包括能够用于完成其他特定工作的计算机程序。数据223可以包括电子设备20收集到的数据表数据。The operating system 221 is used to manage and control each hardware device and computer program 222 on the electronic device 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows Server, Netware, Unix, Linux etc. The computer program 222 may further include a computer program that can be used to complete other specific tasks in addition to the computer program that can be used to complete the data query method executed by the electronic device 20 disclosed in any of the foregoing embodiments. Data 223 may include data sheet data collected by electronic device 20 .

进一步的,本申请实施例还公开了一种存储介质,所述存储介质中存储有计算机程序,所述计算机程序被处理器加载并执行时,实现前述任一实施例公开的数据查询方法步骤。Further, an embodiment of the present application also discloses a storage medium, where a computer program is stored in the storage medium, and when the computer program is loaded and executed by a processor, the steps of the data query method disclosed in any of the foregoing embodiments are implemented.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments may be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant part can be referred to the description of the method.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个…”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should also be noted that in this document, relational terms such as first and second are used only to distinguish one entity or operation from another, and do not necessarily require or imply these entities or that there is any such actual relationship or sequence between operations. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

以上对本发明所提供的数据查询方法、装置、设备及存储介质进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The data query method, device, device and storage medium provided by the present invention have been introduced in detail above. Specific examples are used in this paper to illustrate the principles and implementations of the present invention. The method of the invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation and application scope. In summary, the content of this description should not be understood to limit the present invention.

Claims (10)

1. A method for querying data, comprising:
acquiring a plurality of service data tables with incidence relations from a database of a service system, and storing the plurality of service data tables into a data warehouse;
determining target fields from fields corresponding to a plurality of business data tables stored in the data warehouse according to query requirements, and constructing a target width table containing the target fields and corresponding field data in a database of a statistical system; wherein, the target field at least comprises a field corresponding to the query data;
and acquiring a query instruction and querying the target wide table according to the query instruction to obtain the query data corresponding to the query instruction.
2. The data query method of claim 1, after obtaining a plurality of business data tables with association relationships from a database of a business system, further comprising:
and sequentially carrying out extraction processing, cleaning processing and conversion processing on the data in the plurality of business data tables so as to store the finally processed plurality of business data tables into the data warehouse.
3. The data query method of claim 1, wherein the obtaining a plurality of business data tables with association relationships from a database of a business system and storing the plurality of business data tables in a data warehouse comprises:
and synchronizing a plurality of business data tables with incidence relations in a database of the business system to the data warehouse according to a first preset synchronization period by using a data synchronization tool.
4. The data query method of claim 3, after storing the plurality of business data tables in a data warehouse, further comprising:
integrating and calculating data in the data tables according to configuration logic stored in a data table format to obtain integrated field data;
correspondingly, the constructing a target width table containing the target fields and the corresponding field data in the database of the statistical system includes:
and constructing the target wide table containing the target fields and the corresponding integrated field data in a database of the statistical system.
5. The method according to claim 4, wherein said constructing the target broad table containing the target fields and the corresponding integrated field data in the database of the statistical system comprises:
constructing the target width table containing the target field in a database of the statistical system;
and updating the integrated field data corresponding to the target field in the data warehouse in the target wide table in a mode of setting and running a timing task.
6. The data query method according to any one of claims 1 to 5, wherein after the obtaining the query instruction, the method further comprises:
acquiring a trigger account of the query instruction; the triggering account is a first department account which is logged in the statistical system at present;
determining a second department account corresponding to the trigger account in the service system, and inquiring the field data related to the second department account in the target broad list according to the inquiry instruction to obtain the inquiry data corresponding to the inquiry instruction;
and outputting the query data corresponding to the query instruction to a manual interaction interface of a revenue billboard for display.
7. The data query method of claim 6, further comprising:
and constructing a mapping relation between the first department account number in the statistical system and the second department account number in the business system so as to determine the second department account number corresponding to the trigger account number in the business system according to the mapping relation.
8. A data query apparatus, comprising:
the acquisition and storage module is used for acquiring a plurality of business data tables with incidence relations from a database of a business system and storing the business data tables into a data warehouse;
the determining and constructing module is used for determining a target field from fields corresponding to a plurality of business data tables stored in the data warehouse according to query requirements, and constructing a target width table containing the target field and corresponding field data in a database of a statistical system; wherein, the target field at least comprises a field corresponding to the query data;
and the acquisition query module is used for acquiring a query instruction and querying the target wide table according to the query instruction to obtain the query data corresponding to the query instruction.
9. An electronic device, comprising a processor and a memory; wherein the memory is for storing a computer program that is loaded and executed by the processor to implement the data query method of any one of claims 1 to 7.
10. A computer-readable storage medium storing computer-executable instructions which, when loaded and executed by a processor, implement the data query method of any one of claims 1 to 7.
CN202210778189.1A 2022-06-29 2022-06-29 Data query method, device, equipment and storage medium Active CN115033575B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210778189.1A CN115033575B (en) 2022-06-29 2022-06-29 Data query method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210778189.1A CN115033575B (en) 2022-06-29 2022-06-29 Data query method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115033575A true CN115033575A (en) 2022-09-09
CN115033575B CN115033575B (en) 2025-01-10

Family

ID=83129865

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210778189.1A Active CN115033575B (en) 2022-06-29 2022-06-29 Data query method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115033575B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115407992A (en) * 2022-10-31 2022-11-29 平安银行股份有限公司 Configuration method and device of data query menu, electronic equipment and storage medium
CN115525722A (en) * 2022-11-04 2022-12-27 杭州小电科技股份有限公司 Wide table data synchronization method and device, electronic device and storage medium
CN115544096A (en) * 2022-11-22 2022-12-30 深圳市东信时代信息技术有限公司 Data query method and device, computer equipment and storage medium
CN116578754A (en) * 2023-07-13 2023-08-11 杭州之数科技有限公司 Enterprise data accurate query method and system
CN116610714A (en) * 2023-07-14 2023-08-18 北京数巅科技有限公司 Data query method, device, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110597851A (en) * 2019-09-20 2019-12-20 四川长虹电器股份有限公司 Big data based data processing and report display method
CN111241185A (en) * 2020-04-26 2020-06-05 浙江网商银行股份有限公司 Data processing method and device
CN112989171A (en) * 2021-03-26 2021-06-18 广东电网有限责任公司 Data query method, device, equipment and medium
WO2021139426A1 (en) * 2020-01-06 2021-07-15 平安科技(深圳)有限公司 Method, device and apparatus for querying data in database, and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110597851A (en) * 2019-09-20 2019-12-20 四川长虹电器股份有限公司 Big data based data processing and report display method
WO2021139426A1 (en) * 2020-01-06 2021-07-15 平安科技(深圳)有限公司 Method, device and apparatus for querying data in database, and storage medium
CN111241185A (en) * 2020-04-26 2020-06-05 浙江网商银行股份有限公司 Data processing method and device
CN112989171A (en) * 2021-03-26 2021-06-18 广东电网有限责任公司 Data query method, device, equipment and medium

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115407992A (en) * 2022-10-31 2022-11-29 平安银行股份有限公司 Configuration method and device of data query menu, electronic equipment and storage medium
CN115407992B (en) * 2022-10-31 2023-04-28 平安银行股份有限公司 Configuration method and device of data query menu, electronic equipment and storage medium
CN115525722A (en) * 2022-11-04 2022-12-27 杭州小电科技股份有限公司 Wide table data synchronization method and device, electronic device and storage medium
CN115544096A (en) * 2022-11-22 2022-12-30 深圳市东信时代信息技术有限公司 Data query method and device, computer equipment and storage medium
CN115544096B (en) * 2022-11-22 2023-03-28 深圳市东信时代信息技术有限公司 Data query method and device, computer equipment and storage medium
CN116578754A (en) * 2023-07-13 2023-08-11 杭州之数科技有限公司 Enterprise data accurate query method and system
CN116578754B (en) * 2023-07-13 2023-11-03 杭州之数科技有限公司 Enterprise data accurate query method and system
CN116610714A (en) * 2023-07-14 2023-08-18 北京数巅科技有限公司 Data query method, device, computer equipment and storage medium
CN116610714B (en) * 2023-07-14 2023-10-31 北京数巅科技有限公司 Data query method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN115033575B (en) 2025-01-10

Similar Documents

Publication Publication Date Title
CN115033575A (en) A data query method, device, equipment and storage medium
EP2702510B1 (en) Joining tables in a mapreduce procedure
US20080250057A1 (en) Data Table Management System and Methods Useful Therefor
WO2019157776A1 (en) Processing method and system for reconciling discrepancies
WO2011140759A1 (en) Report form querying system and method and device for collecting data thereof
CN115794929B (en) Data management system and data management method for data marts
US11913811B2 (en) Enhanced meter management solution
CN111400356A (en) Data query method, device and equipment
CN109299089A (en) The calculating and storage method and calculating of a kind of label data of drawing a portrait and storage system
CN118210772A (en) Log management method and device, electronic equipment and storage medium
CN115034512A (en) A process optimization method, system, device and computer-readable storage medium
CN114996104A (en) Data processing method and device
CN116450753A (en) Method, device, computer equipment group and storage medium for structured management of customs business data
US11567961B2 (en) Using flat data input for simultaneous application of multiple separate calculations rule sets to obtain multiple output results
CN116049194A (en) Database index optimization method, storage medium and device
CN115510072A (en) Main data engine based on multi-tenant SaaS application platform
CN114443427A (en) Cloud resource efficiency evaluation method based on big data analysis
US10810640B1 (en) Automated time tracking of events in a calendar and use of the same to generate invoices
CN110910079A (en) Payroll management system and working method thereof
CN116346514B (en) Metering and charging method for cloud service products
CN112561368B (en) Visual performance calculation method and device for OA approval system
CN112559494A (en) Visual warehouse modeling method and system
CN117891813A (en) Method and device for realizing data sharing based on data catalogue
CN114398244A (en) Communication system stability evaluation method and device
US20120253864A1 (en) Methods for recording and tracking projects and devices thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: 5th Floor, Zone 2, Building 1, Science and Technology Economic Block 9, Zhuantang Street, Xihu District, Hangzhou City, Zhejiang Province 310024

Applicant after: Zhengcai Cloud Co.,Ltd.

Address before: 5 / F, area 2, building 1, No.9, Zhuantang science and technology economic block, Xihu District, Hangzhou City, Zhejiang Province, 310000

Applicant before: ZHENGCAIYUN Co.,Ltd.

Country or region before: China