Task query method and device, equipment and storage medium
By generating signature and candidate task query clauses, combined with the UNION ALL operator and application-layer caching, the database resource consumption problem caused by nested loop joins in the workflow system is solved, improving the performance and stability of task queries.
Patent Information
- Application Number
- CN202511498748.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-20
- Publication Date
- 2026-01-23
AI Technical Summary
The existing workflow system uses nested loop joins when querying tasks, which results in high database resource consumption and affects system performance and stability.
By generating a signature task query clause and a candidate task query clause, the signature task query results and candidate task query results are obtained. Combined with the UNION ALL operation to merge the results, the overhead of multiplicative row scans is reduced, and the database load is reduced by utilizing the application layer caching mechanism.
It improved the performance and stability of task queries, reduced response time from milliseconds to sub-milliseconds, and alleviated database pressure.
Smart Images

Figure CN121387972A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and particularly relates to a task query method and device, equipment and a storage medium. BACKGROUND
[0002] In modern enterprise-level applications, a workflow system usually plays a crucial role, which can be used to manage and automate complex business processes, and an efficient workflow system can significantly improve the operation efficiency and response speed of an enterprise. However, with the expansion of business scale and the increase of data volume, the task query performance in the workflow system has become a problem to be solved.
[0003] At present, the existing workflow system usually queries the to-do tasks of a user by using a nested subquery, wherein a database query optimizer usually adopts a nested loop join when processing the nested subquery, however, this connection mode means that each row of the outer query needs to drive the execution of the inner query once, so that the number of row scans increases exponentially. Especially for a to-do task list request with extremely high query frequency, the database needs to process a large number of row scan operations when querying tasks, which not only increases the CPU computing burden, but also causes high IO overhead, thereby affecting the overall performance and stability of the system. SUMMARY
[0004] The main purpose of the present application is to provide a task query method, device, equipment and storage medium, which aims to solve the technical problem that the existing workflow system usually adopts nested loop connection for task query, resulting in large consumption of database resources.
[0005] To achieve the above purpose, the present application provides a task query method, which comprises: responding to a task query request, and determining task parameter configuration information of a to-be-queried task according to the task query request; generating a signed task query clause and a candidate task query clause based on the task parameter configuration information; obtaining a signed task query result and a candidate task query result based on the signed task query clause and the candidate task query clause; generating a task query result of the to-be-queried task according to the signed task query result and the candidate task query result.
[0006] In an embodiment, the step of generating a signed task query clause and a candidate task query clause based on the task parameter configuration information comprises: determining a target user identifier, a target task state and a target task classification of the to-be-queried task according to the task parameter configuration information; generating a signed task query clause based on the target user identifier, the target task state and the target task classification; constructing a task screening condition and an equivalent connection condition between the task table and the identity association table; generating a candidate task query clause based on the target task state, the target task classification, the task screening condition and the equivalent connection condition.
[0007] In an embodiment, the step of constructing the task screening condition and the equivalent connection condition between the task table and the identity association table comprises: obtaining a first task identifier field in the task table and a second task identifier field in the identity association table; constructing the equivalent connection condition between the task table and the identity association table based on the first task identifier field and the second task identifier field; determining an identity type field, a user identifier field and a role identifier field in the identity association table; constructing the task screening condition based on the identity type field, the user identifier field and the role identifier field.
[0008] In an embodiment, before the step of responding to the task query request, further comprising: constructing a joint index based on a task state field and a task allocation user field; The step of obtaining signed task query results and candidate task query results based on the signed task query clause and the candidate task query clause comprises: obtaining signed task query results based on the signed task query clause and the joint index; obtaining candidate task query results based on the candidate task query clause and the joint index.
[0009] In an embodiment, the step of obtaining signed task query results based on the signed task query clause and the joint index comprises: querying a first target task with a task state being the target task state in the signed task query clause from the task table through the joint index; determining an allocated task from the first target task based on the joint index and the target user identifier in the signed task query clause, to obtain signed task query results, the allocated task being a task in the first target task that has been allocated to a user to which the target user identifier belongs.
[0010] In an embodiment, the step of obtaining candidate task query results based on the candidate task query clause and the joint index comprises: determining unassigned tasks from the first target task through the task assignment user field in the joint index; associating the task table and the identity association table through the equality connection condition in the candidate task query clause; determining candidate tasks from the unassigned tasks through the task screening condition in the case of completed association; judging whether the user to which the target user identifier belongs is a candidate user of the candidate tasks, and obtaining candidate task query results according to the judgment result.
[0011] In an embodiment, after the step of generating the task query result of the task to be queried according to the signed task query result and the candidate task query result, the method further comprises: storing the task query result into a task cache; when a task state change event is listened to, determining a task to be updated according to the task state change event; deleting the target task query result corresponding to the task to be updated in the task cache.
[0012] In addition, to achieve the above-mentioned purpose, the present application further proposes a task query device, the device comprising: an information obtaining module, configured to respond to a task query request, and determine task parameter configuration information of a task to be queried according to the task query request; a query statement generating module, configured to generate a signed task query clause and a candidate task query clause based on the task parameter configuration information; a query result generating module, configured to obtain a signed task query result and a candidate task query result based on the signed task query clause and the candidate task query clause; the query result generating module is further configured to generate a task query result of the task to be queried according to the signed task query result and the candidate task query result.
[0013] In addition, to achieve the above-mentioned purpose, the present application further proposes a task query device, the device comprising: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the task query method as described above.
[0014] In addition, to achieve the above-mentioned purpose, the present application further proposes a storage medium, which is a computer readable storage medium, and the storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the task query method as described above.
[0015] The application provides a task query method, and discloses the following technical solutions: in response to a task query request, task parameter configuration information of a to-be-queried task is determined according to the task query request; a signed task query clause and a candidate task query clause are generated based on the task parameter configuration information; a signed task query result and a candidate task query result are obtained based on the signed task query clause and the candidate task query clause; and a task query result of the to-be-queried task is generated according to the signed task query result and the candidate task query result. Compared with the prior art, the workflow system in the prior art usually adopts a nested loop connection mode to query a user's to-be-done task, which causes the database to need to process a large amount of row scanning operations, thereby increasing resource consumption. According to the application, the signed task query result and the candidate task query result corresponding to the signed task query clause and the candidate task query clause of the to-be-queried task are obtained to obtain the final task query result, so that the row scanning overhead of the multiplication level can be eliminated, the technical problem that the workflow system in the prior art usually adopts the nested loop connection mode to query a task, thereby causing large database resource consumption, is solved, and the overall performance and stability of the system are improved. BRIEF DESCRIPTION OF DRAWINGS
[0016] The accompanying drawings, which are incorporated into and form a part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the application.
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained based on these drawings without creative labor.
[0018] Figure 1 A flowchart is provided for the task query method embodiment one of the present application. Figure 2 A flowchart is provided for the task query method embodiment two of the present application. Figure 3 A flowchart is provided for the task query method embodiment three of the present application. Figure 4 A module structure diagram of the task query device embodiment of the present application is provided. Figure 5 A device structure diagram of the hardware running environment involved in the task query method in the embodiment of the present application is provided.
[0019] The object implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0020] It should be understood that the specific embodiments described herein are merely intended to explain the technical solutions of the present application, and are not intended to limit the present application.
[0021] In order to better understand the technical solutions of the present application, the following will be described in detail in conjunction with the accompanying drawings and specific embodiments.
[0022] The main solution of the embodiment of the present application is: in response to a task query request, and according to the task query request, the task parameter configuration information of the task to be queried is determined; based on the task parameter configuration information, the signed task query clause and the candidate task query clause are generated; based on the signed task query clause and the candidate task query clause, the signed task query result and the candidate task query result are obtained; and according to the signed task query result and the candidate task query result, the task query result of the task to be queried is generated.
[0023] Since the workflow system in the prior art usually queries the user's to-do task by using nested subqueries, each row of the outer query needs to drive the execution of the inner query once, and the row scan number increases exponentially, resulting in large resource consumption.
[0024] The present application provides a solution, which can obtain the corresponding signed task query result and candidate task query result based on the signed task query clause and candidate task query clause of the task to be queried, to obtain the final task query result, so as to eliminate the row scan overhead of the multiplication level, solve the technical problem that the workflow system in the prior art usually uses nested loop connection for task query, resulting in large database resource consumption, and thus improve the overall performance and stability of the system.
[0025] It should be noted that the execution subject of the present embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a task query device, or a task query system containing a task query device, etc. The present embodiment and the following embodiments will be described below taking the task query system as an example (hereinafter referred to as the system).
[0026] Based on this, the present embodiment of the present application provides a task query method, which is described with reference to Figure 1 , Figure 1 The flowchart provided by the task query method embodiment one of the present application.
[0027] In the present embodiment, the task query method comprises steps S10-S40: Step S10: in response to a task query request, and according to the task query request, the task parameter configuration information of the task to be queried is determined.
[0028] It should be understood that the aforementioned task query request may be a request to instruct the system to retrieve the pending tasks of a specific user; correspondingly, the aforementioned task to be queried may be a task that needs to be retrieved from a database or task table, which may include signed-in tasks and candidate tasks, wherein signed-in tasks may be tasks that have been assigned to a specific user and the user has confirmed receipt; candidate tasks may be tasks that have not yet been assigned to a specific user, but the current user or their assigned role has the authority to handle them.
[0029] It is understood that the aforementioned task parameter configuration information can be parameters carried in the task query request, used to execute the task query conditions, such as user identifier, task status, task category, etc. The user identifier can be a unique identifier for the current user, which can be used to filter tasks assigned to the current user or their assigned role; the task status can be a parameter indicating whether the task is suspended, for example, 1 indicates not suspended; the task category is the category of the currently queried task, which can be used to filter tasks, for example, __HIDE indicates a hidden task. In this embodiment, the system can configure these parameters into the SQL query statement so that subsequent task queries are performed according to the configured information, ensuring that the task query results meet the user's needs.
[0030] Step S20: Generate a task acceptance query clause and a candidate task query clause based on the task parameter configuration information.
[0031] It should be noted that the above task acceptance query clause can be an SQL statement used to query tasks that have been assigned to a specific user and that the user has confirmed receipt of. In this case, the assignee_ field (used to identify the user to whom the task is currently assigned) in the task table directly points to the current user.
[0032] It should be noted that the above candidate task query clause can be an SQL statement used to query candidate tasks. Candidate tasks are tasks that have not yet been assigned to a specific user, but the current user or their assigned role has the right to handle them. These tasks have an empty assignee_ field in the task table, but there are records in the associated identity association table indicating that the current user or their assigned role is a candidate for the task.
[0033] In this embodiment, the system can parse the task query request, obtain the task parameter configuration information, and extract parameters such as user identifier (userId), task status (suspensionState), and task category (category) from the task parameter configuration information. For example, userId is the current user, suspensionState is 1, and category is __HIDE. Then, the system can construct the task acceptance query clause and candidate task query clause based on these parameters.
[0034] Step S30: obtaining a signed task query result and a candidate task query result based on the signed task query clause and the candidate task query clause.
[0035] It should be understood that the signed task query result is a set of tasks that are queried by the signed task query clause, have been assigned to a specific user, and have been confirmed to be received by the user; and the candidate task query result is a set of tasks that are queried by the candidate task query clause. In this embodiment, after the signed task query clause and the candidate task query clause are constructed, the system can execute the signed task query clause and the candidate task query clause to determine all signed tasks and candidate tasks, and finally obtain the signed task query result and the candidate task query result.
[0036] Step S40: generating a task query result of the to-be-queried tasks according to the signed task query result and the candidate task query result.
[0037] It should be understood that the task query result is a set of all to-be-done tasks of the current user, which includes signed tasks and candidate tasks that the current user has the right to process. In this embodiment, after the signed task query result and the candidate task query result are obtained, the system can use UNION ALL to merge the signed task query result and the candidate task query result, ensure that all tasks meeting the conditions are included in the result set, and avoid duplication, and finally obtain the task query result. UNION ALL can be a SQL operator used to merge the result sets of two or more SELECT statements, which is different from UNION. UNION ALL does not automatically remove duplicate rows, thereby significantly improving the task query performance.
[0038] Further, after the step S40, the method further includes: storing the task query result in a task cache; when a task state change event is listened to, determining a to-be-updated task according to the task state change event; and deleting a target task query result corresponding to the to-be-updated task in the task cache.
[0039] It should be noted that in the prior art, when a task query is performed, a database is usually directly accessed, which causes a large database pressure and a long query response time. Therefore, in this embodiment, an application layer cache mechanism can be introduced, and after each task query, a task query result can be stored in a task cache (such as Redis or Memcached), so that the response time of a regular query can be reduced from a millisecond level to a sub-millisecond level on the premise of not sacrificing data consistency, and the database pressure can be greatly reduced.
[0040] In the embodiment, the system can adopt a bypass cache mode for task query, that is, first, a query is initiated to the cache, if the cache is not hit, data is obtained from the main data source (such as a database), and the result is filled into the cache, and finally returned to the calling party. Specifically, when the system receives a to-do task query request, first, a predefined cache key (for example: todo_tasks:user_id) is used to query the cache, if the cache is hit, the result in the cache is directly returned, at this time, there is no need to access the database, thereby the load of the database can be greatly reduced, and the response time can be reduced to sub-millisecond level; if the cache is not hit, a multi-table join query can be performed, the latest data is obtained from the database, and after the query is completed, the result is returned to the user, and the data is stored in the cache for next time query.
[0041] It should be noted that the above task state change event can be an event that the state of the task changes, for example, task signing, task completion, task transfer, delegation or suspension, etc. These events are usually triggered by a workflow engine, indicating that the state of the task has changed. Correspondingly, the above to-be-updated task can be a task in the cache whose state has changed, and the above target task query result is the query result related to the to-be-updated task stored in the cache. In the embodiment, the query result of the to-be-updated task needs to be deleted from the task cache, so as to ensure that the data in the cache is consistent with the data in the database.
[0042] In actual application, when the user calls the claim() API to sign the task, or the user calls the complete() API to complete the task, or the assignee_ or candidate field of the task in the task table changes, etc., it indicates that the state of the current task has changed, at this time, the deletion operation of the cache needs to be triggered actively. Therefore, the embodiment can capture these task state change events by registering an event listener, and perform a cache deletion operation after listening to the task state change event, so as to ensure that when the source data changes, the corresponding cache data is immediately cleared, thereby forcing the next query to source to the database to obtain the latest data, so as to ensure data consistency.
[0043] The embodiment provides a task query method. The method discloses the following steps: in response to a task query request, determining task parameter configuration information of a to-be-queried task according to the task query request; generating a signed task query clause and a candidate task query clause based on the task parameter configuration information; obtaining a signed task query result and a candidate task query result based on the signed task query clause and the candidate task query clause; and generating a task query result of the to-be-queried task according to the signed task query result and the candidate task query result. Compared with the prior art, the workflow system usually adopts a nested loop connection mode to query a to-be-done task of a user, which causes a database to need to process a large amount of row scanning operations, and increases resource consumption. In the embodiment, the signed task query result and the candidate task query result corresponding to the signed task query clause and the candidate task query clause of the to-be-queried task are obtained to obtain the final task query result, so that the row scanning overhead of the multiplication level can be eliminated, the technical problem that the workflow system in the prior art usually adopts the nested loop connection mode to query a task, which causes large database resource consumption is solved, and the overall performance and stability of the system are improved.
[0044] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as the above-mentioned first embodiment can refer to the above introduction, and the following will not be repeated. On this basis, please refer to Figure 2 , Figure 2 The flowchart of the second embodiment of the task query method of the present application is provided.
[0045] In the embodiment, step S20 includes steps S201-S204: Step S201: determining a target user identifier, a target task state and a target task classification of the to-be-queried task according to the task parameter configuration information.
[0046] It can be understood that the above-mentioned target user identifier can be an identifier for uniquely identifying a current user, wherein the current user is a user who requests to query a to-be-done task, that is, a user who initiates a task query request, and the target user identifier corresponding to the user can be used to determine which tasks are assigned to the user. In the workflow system, each task can be assigned to a specific user, and the system can filter out these tasks through the target user identifier.
[0047] It should be understood that the target task state described above can be the state of the task queried by the current request, for example, whether to be suspended, whether to be completed, etc., which can be used to determine whether the task is in an active state or needs to be processed. The target task classification described above can be the classification or type of the task queried by the current request, for example, a hidden task (__HIDE), which can be used to distinguish different types of to-do tasks. In the embodiment, after receiving the task query request, the system can parse the task query to extract the target user identifier, the target task state, and the target task classification and the like.
[0048] Step S202: generating a signed task query clause based on the target user identifier, the target task state, and the target task classification.
[0049] In a specific implementation, the signed task query clause can include: t.suspension_state_ = 1; t.category_!= '__HIDE' and t.assignee_ = 'current user'. Wherein, t.suspension_state_ represents the task state of the task t, t.suspension_state_ = 1 indicates that the task t is in a non-suspended state; t.category_ represents the task classification of the task t, t.category_!= '__HIDE' indicates that the task t does not belong to a hidden task; t.assignee_ represents the processor of the task t, t.assignee_ = 'current user' indicates that the task t is assigned to the current user, and the parameters here can be the user identifier of the current user. After obtaining the user identifier, the task state corresponding to the task to be queried, the task classification and the like, the system can construct the signed task query clause based on these parameters, and in the embodiment, t.suspension_state_ = 1 set in the signed task query clause can ensure that only the tasks that are not suspended are counted; t.category_!= '__HIDE' can ensure that only the tasks belonging to the non-hidden classification are counted; t.assignee_ = 'current user' can ensure that the signed tasks of the current user are counted, which are the tasks assigned to the current user.
[0050] Step S203: constructing a task filtering condition and an equality join condition between the task table and the identity association table.
[0051] It should be noted that the above task filtering conditions can be used to filter tasks, such as task status, task category, task assigner, etc. Correspondingly, the above equi-join conditions can be used in SQL queries to join the task table and the identity association table. The task table can be a structure used to store basic task information (such as task ID, task status, task category, task assigner, etc.); the identity association table can be a structure used to store the association information between tasks and users or roles (such as task candidates, assigners, etc.).
[0052] Specifically, step S203 includes: obtaining a first task identifier field in the task table and a second task identifier field in the identity association table; constructing an equi-join condition between the task table and the identity association table based on the first task identifier field and the second task identifier field; determining the identity type field, user identifier field, and role identifier field in the identity association table; and constructing task filtering conditions based on the identity type field, the user identifier field, and the role identifier field.
[0053] It should be noted that the aforementioned first task identifier field can be the task ID field in the task table, which is used to uniquely identify each task in the task table, and is usually named id_; correspondingly, the aforementioned second task identifier field can be the task ID field in the identity association table, which is used to uniquely identify each task in the identity association table, and is usually named task_id_. In this embodiment, tasks in the task table can be associated through the task_id_ field.
[0054] It should be understood that the aforementioned "identity type" field can be a field in the identity association table used to identify the type of the associated task. It is typically named `type_`, and its value can be `assignee`, `candidate`, etc., where `assignee` represents the user to whom the task is assigned, and `candidate` represents a candidate for the task. The aforementioned "user identifier" field can be a field in the identity association table used to store the user ID associated with the task, identifying the specific user, and is typically named `user_id_`. The aforementioned "role identifier" field can be a field in the identity association table used to store the role ID associated with the task, identifying the specific user role, and is typically named `group_id_`.
[0055] In this embodiment, the system can perform an equi-join between the task table and the identity association table in the candidate task query clause by t.id_=link.task_id_. Unlike the inefficient exists subquery, this explicit table join can enable the database query optimizer to use a more efficient join algorithm (such as hash join or sort-merge join) for task query, so as to make full use of the indexes on the task table and the identity association table, and thus avoid the multiplication of row scan caused by nested loops, which is conducive to improving the efficiency of task query.
[0056] Step S204: generating a candidate task query clause based on the target task state, the target task classification, the task screening condition, and the equi-join condition.
[0057] In this embodiment, the system can construct an equi-join condition between the task table and the identity association table according to the first task identifier field in the task table and the second task identifier field in the identity association table, ensure that the task ID in the task table matches the task ID in the identity association table, and construct a task screening condition using the identity type field, the user identifier field, and the role identifier field in the identity association table, ensure that the current user is a candidate user of the task, or the role to which the current user belongs is a candidate user of the task. Finally, the system can combine these conditions to generate a candidate task query clause.
[0058] In a specific implementation, the candidate task query clause can include: t.suspension_state_ = 1; t.category_!= '__HIDE' and t.assignee_ is null; t.id_ = link.task_id_; link.type_ = 'candidate' and link.user_id_ = 'current user' or link.group_id_ in ('current user role'). Wherein, t.id_ represents the task ID field in the task table, link.task_id_ is the task ID field in the identity association table, which represents the task associated with the record, t.id_ = link.task_id_ means connecting the task t in the act_ru_task table (task table) and the identity association in the act_ru_identitylink table (identity association table), and the system can find all users or roles associated with a specific task in the identity association table through t.id_ = link.task_id_. link.type_ is the type field in the identity association table, which represents the type of record, for example, candidate represents a candidate, assignee represents an assignee, and link.type_ = 'candidate' can be used to filter records of the identity association table whose type is candidate, that is, only when the value of link.type_ is candidate, the record will be considered as the association of the candidate task. link.user_id_ is the user ID field in the identity association table, and link.user_id_ = 'current user' means that the current user is directly associated with the task; link.group_id_ is the role ID field in the identity association table, and link.group_id_ in ('current user role') means that the role to which the current user belongs is associated with the task; link.user_id_ = 'current user' or link.group_id_ in ('current user role') is used to determine whether the current user or the role to which the current user belongs is a candidate for the task, and here, through the OR operator, any one of the two conditions is satisfied, and the current user is considered as a candidate for the task. In this embodiment, t.assignee_ is NULL set in the candidate task query clause is used to ensure that only unassigned tasks are counted; link.type_ = 'candidate' is used to ensure that only candidate tasks are counted, that is, the task is associated with the current user or the role to which the current user belongs; link.user_id_ = 'current user' is used to ensure that the current user is a candidate for the task; and link.group_id_ in ('current user role') is used to ensure that the role to which the current user belongs is a candidate for the task.
[0059] In this embodiment, the target user identifier, the target task state and the target task classification are determined according to the task parameter configuration information, the task query clause is generated based on the target user identifier, the target task state and the target task classification, the task filtering condition and the equivalent connection condition between the task table and the identity association table are constructed, and the candidate task query clause is generated based on the target task state, the target task classification, the task filtering condition and the equivalent connection condition. Since the task query clause and the candidate task query clause can be accurately constructed based on the target user identifier, the target task state and the target task classification in this embodiment, the unnecessary data scanning in the task query can be reduced, the computing burden and the response time of the database can be reduced, and the efficiency of the task query can be improved.
[0060] Based on the first embodiment and / or the second embodiment of the present application, the same or similar contents as the above embodiments can be referred to the above description, and will not be described hereinafter. On this basis, please refer to Figure 3 , Figure 3 The flowchart provided for the third embodiment of the task query method of the present application is shown in the figure.
[0061] In this embodiment, before step S10, the method further includes step S01: Step S01: constructing a joint index based on the task state field and the task assignee field.
[0062] It should be noted that the task state field described above can be a field in the task table for identifying the state of the task, which is usually named as suspension_state_, and the corresponding values can be active, suspended, etc., wherein active indicates that the task is not suspended, and suspended indicates that the task is suspended. Correspondingly, the task assignee field described above can be a field in the task table for storing the user ID to which the task is assigned, which is usually named as assignee_, wherein if the task has not been assigned to any user, the field can be empty (NULL).
[0063] It should be noted that the above-mentioned joint index can be an index created on a database table, which can contain multiple fields. In actual application, the fields of the joint index of the existing task table are usually: SUSPENSION_STATE_+CATEGORY_+ASSIGNEE_. However, the selectivity of the SUSPENSION_STATE_ and CATEGORY_ fields in the field sequence is low, and almost all data satisfies these two conditions, which makes the effectiveness of the index interrupted and cannot fully utilize the index for efficient filtering. In addition, the query condition t.category_!='__HIDE' uses the "not equal to" judgment, which makes the database query optimizer unable to continue to use the subsequent field (i.e. ASSIGNEE_) for ordered search when processing the index, thereby causing the effectiveness of the index to be interrupted and further reducing the query efficiency. In the embodiment, by optimizing the field sequence of the joint index and removing the low-discriminative field, it can be ensured that the query condition can maximize the use of the index for efficient filtering. Specifically, the present application can reconstruct the existing index SUSPENSION_STATE_+CATEGORY_+ASSIGNEE_ to SUSPENSION_STATE_+ASSIGNEE_, thereby improving the selectivity and filtering efficiency of the index.
[0064] Correspondingly, the step S30 includes steps S301-S302: Step S301: obtaining a signed task query result based on the signed task query clause and the joint index.
[0065] Specifically, the step S301 includes: querying a first target task whose task state is the target task state in the signed task query clause from the task table through the joint index; and determining an assigned task from the first target task based on the joint index and the target user identifier in the signed task query clause, to obtain a signed task query result, the assigned task being a task in the first target task that has been assigned to a user to which the target user identifier belongs.
[0066] It should be understood that the above-mentioned first target task can be all tasks in the task table whose state is the target task state. Correspondingly, the above-mentioned assigned task can be a task in the first target task that has been signed by the current user, wherein the target user identifier assigned to the task by the task table is consistent with the current user identifier.
[0067] In this embodiment, the system can use the joint index to query the tasks that meet the specific conditions set in the signed task query clause from the task table. Specifically, the system can first use the task state field in the joint index to query all tasks with the target task state set in the signed task query clause from the task table, and determine these tasks as the first target tasks. For example, if the suspension_state_ = 1 in the signed task query clause, all tasks with the non-suspended state in the task table can be queried to obtain the first target tasks. Then, the system can further filter the tasks with the user identifier consistent with the target user identifier in the signed task query clause from the first target tasks through the task assignment user field in the joint index, and at the same time, the system can also obtain the tasks with the classification meeting the task classification set in the signed task query clause from these tasks, and finally obtain the assigned tasks.
[0068] Step S302: obtaining a candidate task query result based on the candidate task query clause and the joint index.
[0069] Specifically, the step S302 includes: determining unassigned tasks from the first target tasks through the task assignment user field in the joint index; associating the task table and the identity association table through the equality connection condition in the candidate task query clause; in the case of association completion, determining candidate tasks from the unassigned tasks through the task filtering condition; judging whether the user to which the target user identifier belongs is a candidate user of the candidate tasks, and obtaining a candidate task query result according to the judgment result.
[0070] It can be understood that the unassigned tasks mentioned above can be tasks in the first target tasks that are not assigned to specific users, and the assignee_ field of the task in the task table is empty.
[0071] In this embodiment, the system can query the tasks with the assignee_ field empty in the first target tasks through the task assignment user field in the joint index to determine all unassigned tasks in the first target tasks. At the same time, the system can associate the task table and the identity association table through the equality connection condition, so as to query whether there is a record of these unassigned tasks in the identity association table. If there is, the unassigned task is determined as a candidate task, and it is judged whether the user to which the target user identifier belongs is a candidate user of the candidate task, and finally the candidate task query result is obtained. If the current user is directly associated with the candidate task, or the role to which the current user belongs is associated with the candidate task, it means that the current user is a candidate user of the candidate task.
[0072] In this embodiment, a joint index is constructed based on the task status field and the task allocation user field; a signed task query result is obtained based on the signed task query clause and the joint index; a candidate task query result is obtained based on the candidate task query clause and the joint index; and the joint index is constructed based on the task status field and the task allocation user field to query the task, so that the number of scanned rows of the database during task query can be reduced, and the task query efficiency can be improved.
[0073] It should be noted that the above examples are only used for understanding the present application and do not constitute a limitation on the task query method of the present application. More forms of simple transformation based on this technical concept are within the protection scope of the present application.
[0074] The present application also provides a task query device, which refers to Figure 4 The task query device comprises: An information acquisition module 10 is configured to respond to a task query request and determine task parameter configuration information of a task to be queried according to the task query request; A query statement generation module 20 is configured to generate a signed task query clause and a candidate task query clause based on the task parameter configuration information; A query result generation module 30 is configured to obtain a signed task query result and a candidate task query result based on the signed task query clause and the candidate task query clause; The query result generation module 30 is further configured to generate a task query result of the task to be queried according to the signed task query result and the candidate task query result.
[0075] The task query device provided by the present application adopts the task query method in the above embodiment, and can solve the technical problem that the workflow system in the prior art usually adopts nested loop connection to query the task, resulting in large consumption of database resources. Compared with the prior art, the task query device provided by the present application has the same beneficial effects as the task query method provided by the above embodiment, and other technical features in the task query device are the same as the features disclosed in the above embodiment, which will not be repeated here.
[0076] The present application provides a task query device, which comprises at least one processor and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the task query method in the above embodiment one.
[0077] The following refers to Figure 5The diagram illustrates a structural schematic of a task query device suitable for implementing embodiments of this application. The task query device in this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The task query device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0078] like Figure 5 As shown, the task query device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in the read-only memory 1002 or a program loaded from the storage device 1003 into the random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the task query device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the task querying device to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows task querying devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0079] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the method shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network through a communication device, or installed from the storage device 1003, or installed from the read-only memory 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiments disclosed in the present application are executed.
[0080] The task query device provided by the present application adopts the task query method in the above-mentioned embodiments, and can solve the technical problem of task query. Compared with the prior art, the task query device provided by the present application has the same beneficial effects as the task query method provided by the above-mentioned embodiments, and other technical features in the task query device are the same as the features disclosed in the previous embodiment method, which will not be repeated here.
[0081] It should be understood that various parts of the present application can be realized by hardware, software, firmware or a combination thereof. In the description of the above-mentioned embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0082] The above is merely specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0083] The present application provides a computer readable storage medium having stored thereon computer readable program instructions (i.e. computer program) for executing the task query method in the above-mentioned embodiments.
[0084] The computer readable storage medium provided in the application may be, for example, a U disk, but is not limited to an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system or device, or any combination of the above. More specific examples of the computer readable storage medium may include, but are not limited to, an electric connection with one or more conductive lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiment, the computer readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer readable storage medium can be transmitted by any suitable medium, including but not limited to an electric wire, an optical cable, an RF (Radio Frequency), and the like, or any suitable combination of the above.
[0085] The computer readable storage medium described above may be contained in the task query device, or may exist separately without being assembled into the task query device.
[0086] The computer readable storage medium described above carries one or more programs, which, when executed by the task query device, cause the task query device to: in response to a task query request, determine task parameter configuration information of a task to be queried according to the task query request; generate a signed task query clause and a candidate task query clause based on the task parameter configuration information; obtain a signed task query result and a candidate task query result based on the signed task query clause and the candidate task query clause; and generate a task query result of the task to be queried according to the signed task query result and the candidate task query result.
[0087] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0088] The flow diagrams and the block diagrams in the drawings are illustrations of architectures, functionalities, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may
[0089] The modules involved in the embodiments of the present application can be implemented in the form of software or in the form of hardware. In some cases, the name of the module does not constitute a limitation on the module itself.
[0090] The readable storage medium provided by the present application is a computer readable storage medium, which stores computer readable program instructions (i.e., a computer program) for executing the above task query method, and can solve the technical problem that the workflow system in the prior art usually adopts nested loop connection for task query, resulting in large consumption of database resources. Compared with the prior art, the computer readable storage medium provided by the present application has the same beneficial effects as the task query method provided by the above embodiments, and will not be described here.
[0091] The above merely provides part of embodiments of the present application, and does not limit the patent scope of the present application. Any equivalent structure transformation, direct / indirect application in other related technical fields based on the technical concept of the present application, and contents of the present application specification and drawings are included in the patent protection scope of the present application.
Claims
1. A task query method characterized by, The method comprises: in response to a task query request, and according to the task query request, determining the task parameter configuration information of the task to be queried; generating a signed task query clause and a candidate task query clause based on the task parameter configuration information; obtaining a signed task query result and a candidate task query result based on the signed task query clause and the candidate task query clause; generating a task query result of the task to be queried according to the signed task query result and the candidate task query result.
2. The method of claim 1, wherein, The step of generating a signed task query clause and a candidate task query clause based on the task parameter configuration information comprises: determining a target user identifier, a target task state and a target task classification of the task to be queried according to the task parameter configuration information; generating a signed task query clause based on the target user identifier, the target task state and the target task classification; constructing a task filtering condition and an equivalent connection condition between a task table and an identity association table; generating a candidate task query clause based on the target task state, the target task classification, the task filtering condition and the equivalent connection condition.
3. The method of claim 2, wherein, The step of constructing a task filtering condition and an equivalent connection condition between a task table and an identity association table comprises: obtaining a first task identifier field in a task table and a second task identifier field in an identity association table; constructing an equivalent connection condition between the task table and the identity association table based on the first task identifier field and the second task identifier field; determining an identity type field, a user identifier field and a role identifier field in the identity association table; constructing a task filtering condition based on the identity type field, the user identifier field and the role identifier field.
4. The method of claim 2, wherein, Before the step of responding to a task query request, it further comprises: constructing a joint index based on a task state field and a task allocation user field; The step of obtaining a signed task query result and a candidate task query result based on the signed task query clause and the candidate task query clause comprises: obtaining a signed task query result based on the signed task query clause and the joint index; obtaining a candidate task query result based on the candidate task query clause and the joint index.
5. The method of claim 4, wherein, The step of obtaining a signed task query result based on the signed task query clause and the joint index comprises: querying a first target task with a task state being the target task state in the signed task query clause from the task table through the joint index; determining an allocated task from the first target task based on the joint index and the target user identifier in the signed task query clause, obtaining a signed task query result, the allocated task being a task in the first target task that has been allocated to a user to which the target user identifier belongs.
6. The method of claim 5, wherein, The step of obtaining a candidate task query result based on the candidate task query clause and the joint index comprises: determining an unallocated task from the first target task through the task allocation user field in the joint index; correlate the task table and the identity association table through the equality connection condition in the candidate task query clause; in the case of association, determine a candidate task from the unassigned tasks through the task screening condition; determine whether the user to which the target user identifier belongs is a candidate user of the candidate task, and obtain a candidate task query result according to the determination result.
7. The method of any one of claims 1 to 6, wherein, The step of generating the task query result of the to-be-queried task according to the signed task query result and the candidate task query result further includes: store the task query result into a task cache; when a task state change event is listened to, determine a to-be-updated task according to the task state change event; delete the target task query result corresponding to the to-be-updated task in the task cache.
8. A task query apparatus characterized by comprising: The device includes: an information obtaining module configured to determine task parameter configuration information of a to-be-queried task according to a task query request in response to the task query request; a query statement generating module configured to generate a signed task query clause and a candidate task query clause based on the task parameter configuration information; a query result generating module configured to obtain a signed task query result and a candidate task query result based on the signed task query clause and the candidate task query clause; The query result generating module is further configured to generate a task query result of the to-be-queried task according to the signed task query result and the candidate task query result.
9. A task inquiry device characterized by comprising: The device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the task query method according to any one of claims 1 to 7.
10. A storage medium, characterized by The storage medium is a computer readable storage medium, and the storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the task query method according to any one of claims 1 to 7.