WO2023226255A1 - 基于策略模式的物品查询方法、装置、设备及存储介质 - Google Patents

基于策略模式的物品查询方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2023226255A1
WO2023226255A1 PCT/CN2022/119705 CN2022119705W WO2023226255A1 WO 2023226255 A1 WO2023226255 A1 WO 2023226255A1 CN 2022119705 W CN2022119705 W CN 2022119705W WO 2023226255 A1 WO2023226255 A1 WO 2023226255A1
Authority
WO
WIPO (PCT)
Prior art keywords
policy
item
query
user information
target
Prior art date
Application number
PCT/CN2022/119705
Other languages
English (en)
French (fr)
Inventor
孙飞
Original Assignee
青岛海尔科技有限公司
海尔智家股份有限公司
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 青岛海尔科技有限公司, 海尔智家股份有限公司 filed Critical 青岛海尔科技有限公司
Publication of WO2023226255A1 publication Critical patent/WO2023226255A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying

Definitions

  • the present application relates to computer technology, and more specifically, to an item query method, device, equipment and storage medium based on a policy pattern.
  • the logic type for consumers to query items is different from the logic type for store owners to query items. Consumers can query all items displayed in the store, and store owners can query store inventory. items in.
  • the current item query method requires the overall arrangement and testing of the item query code, which wastes manpower and time in development and testing, has a high probability of errors, and affects the efficiency and accuracy of item query.
  • the purpose of this application is to provide an item query method, device, equipment and storage medium based on a policy pattern to improve the accuracy of item query.
  • this application discloses an item query method based on a strategy pattern, including:
  • the policy object determines the policy object associated with the user information from the preset policy objects; wherein the policy object is used to characterize the logic code that needs to be executed to query the item;
  • the logic code in the policy object associated with the user information is executed to query the item to be queried.
  • this application discloses an item query device based on a policy pattern, including:
  • the item query instruction response module is configured to respond to the user's item query instruction and determine the user information and the item information of the item to be queried; wherein the item query instruction is used to represent the item to be queried for query;
  • a policy object determination module configured to determine a policy object associated with the user information from preset policy objects according to the user information; wherein the policy object is used to represent the logic code that needs to be executed to query the item;
  • the item query module is configured to execute the logic code in the policy object associated with the user information according to the item information of the item to be queried, and to query the item to be queried.
  • this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
  • the memory stores computer execution instructions
  • the processor executes the computer execution instructions stored in the memory to implement the item query method based on the policy pattern as described in any embodiment of the present application.
  • the present application provides a computer-readable storage medium.
  • the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are executed by a processor, they are used to implement any of the embodiments of the present application.
  • the present application provides a computer program product, including a computer program that, when executed by a processor, implements the policy pattern-based item query method as described in any embodiment of the present application.
  • Figure 1 is a schematic flow chart of an item query method based on a policy pattern provided by an embodiment of the present application
  • Figure 2 is a schematic flow chart of an item query method based on a policy pattern provided by an embodiment of the present application
  • Figure 3 is a schematic flow chart of an item query method based on a policy pattern provided by an embodiment of the present application
  • Figure 4 is a schematic structural diagram of an item query device based on a policy mode provided by an embodiment of the present application
  • FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • Figure 1 is a schematic flowchart of an item query method based on a policy pattern provided according to an embodiment of the present application.
  • the method provided in this embodiment is executed by an item query device based on a policy pattern.
  • the method includes the following steps:
  • the items can be products in the store, and the users can be consumers, store owners, or partners.
  • the same items can exist in different stores, that is, the items in each store can be the same or different.
  • the store in the embodiment of this application is an online store, and the store may include a subsidiary store, an ecological store, a brand store, etc.
  • Users can query or purchase items in the online store system. For example, if the user issues an item query command, they can query the items in a certain store, or they can query the items in each store without targeting a certain store. .
  • the user issues an item query instruction, which may include user information and item information of the item to be queried.
  • the user information may include the user's account name and password, etc.
  • the item information of the item to be queried may include the name and model of the item to be queried, etc.
  • it is determined that the item to be queried needs to be queried For example, if the user initiates an item query request for refrigerators, it can be determined that refrigerators in all online stores need to be queried.
  • User information can also include user identity.
  • users When users register an account on the online store system, they can select the user identity. That is, the user identity can be associated with user account and other information. After receiving the item query instruction, the user's identity can be obtained directly, or the user's identity can be determined based on the user account and other information. For example, users can, as consumers, inquire about items.
  • Users can issue item query instructions for a certain store. For example, if the online store system has No. 1 store and No. 2 store, the user can query the items in No. 2 store. Users can also query items in all stores. For example, if the user wants to query refrigerators, they can query refrigerators in all stores. If the user performs an item query for a certain store, the query results can be the items to be queried in the store; if the user does not query for a certain store, the query results can be the items to be queried in all stores, or for the user Select a store to display only the items to be queried in that store. For example, you can select a store with a closer delivery distance for the user based on the user's IP address in the user information.
  • S102 According to the user information, determine the policy object associated with the user information from the preset policy objects; wherein the policy object is used to represent the logic code that needs to be executed to query the item.
  • policy objects can be preset, and the policy object can be an encapsulated algorithm code used to represent the logic code that needs to be executed when querying items.
  • the policy object may include the database required to query items, etc.
  • the association between user information and policy objects can be set in advance. For example, the association between different user identities and policy objects can be set. If the user identity is a store owner, policy object one can be used; if the user identity is a consumer, policy object two can be used.
  • the policy object associated with the user information can be determined based on the preset association relationship between the user information and the policy object.
  • the strategy pattern (Strategy Pattern) can be an algorithm that defines a series of item query logic, encapsulates the algorithm of each query logic, and makes them interchangeable.
  • the strategy pattern usually encapsulates a series of algorithms into a series of classes to obtain the strategy implementation class.
  • the strategy object can be obtained by calling the strategy implementation class.
  • the strategy implementation class includes the logic code for item query, and the strategy object can execute the code.
  • Policy implementation classes can also be stored in association with user information.
  • each policy implementation class can be called in advance to obtain the policy object corresponding to each policy implementation class, and the association between the user information and the policy object can be obtained, so as to obtain the corresponding policy object based on the user information. It is also possible to first determine the policy implementation class corresponding to the user information based on the association between the user information and the policy implementation class during item query, and then obtain the policy object based on the policy implementation class.
  • the strategy pattern to encapsulate the strategy implementation classes of different query logic types to obtain the strategy object.
  • the logic of the main program is fixed.
  • the main program can be used to respond to the user's item query instructions, determine user information and item information of the item to be queried, etc.
  • the public main program has been defined in the preset template, and the entire program does not need to be reorganized. Testing only needs to test the newly added logic code, which greatly reduces the probability of problems and reduces the time and cost of development and testing.
  • the logic code in the policy object can represent how to perform item query, that is, the logic of item query, and the item information of the item to be queried represents the item to be queried.
  • how to query the item to be queried can be determined based on the item information of the item to be queried and the logic code of the policy object.
  • the strategy object can be used to query items from database 1 based on the logic code.
  • the item information is the name of the item to be queried, "refrigerator”.
  • the logic code of the strategy object can be executed to query the item "refrigerator” from database 1.
  • the query results can be information such as the store where the item to be queried is located or the inventory of the item, and the query results can be displayed for user reference.
  • the embodiment of this application provides an item query method based on a strategy pattern.
  • the strategy pattern in this method is an encapsulation of an algorithm.
  • the strategy pattern can encapsulate the algorithm into a strategy implementation class.
  • the strategy implementation class can generate a strategy object and perform item query. Execution of the query's logic code.
  • This application determines the user information and the item information of the item to be queried by responding to the item query instruction issued by the user. According to the user information, a strategy object is determined from a variety of preset strategy objects, and the logic code in the strategy object is executed based on the item information of the item to be queried.
  • This method avoids the process of determining the logical code corresponding to the user information based on the statement of the selected branch in the main program in the prior art, so that the code of the main program and the logical code of the item query are separated from each other.
  • there are new logic types there is no need to change the main program, saving manpower and time in development and testing, reducing the probability of errors, and improving the efficiency and accuracy of item query.
  • Figure 2 is a schematic flowchart of an item query method based on a policy pattern provided by an embodiment of the present application. This embodiment is an optional embodiment based on the above embodiment.
  • the policy object associated with the user information is determined from the preset policy objects, which can be refined into: according to the user information, the query logic associated with the user information is determined from the preset query logic type. Type; where the query logic type represents the type of logic that needs to be executed to query the item; according to the query logic type associated with the user information, the policy object corresponding to the query logic type associated with the user information is determined from the preset policy objects.
  • the method includes the following steps:
  • the query logic type may refer to the type of logic that needs to be executed when querying items. For example, multiple types are preset as query logic types. Each type corresponds to a query logic. The query logic of each type can be set according to actual needs. For example, set up two query logic types. The first query logic type is to query items from database one, and the second query logic type is to query items from data table three.
  • the query logic types applied by different users when querying items can be different.
  • corresponding query logic types can be configured for different user identities. If new user information such as user identity is added, a new query logic type can be configured.
  • the query logic types of the items can be different; when users with the same user identity query items in different stores, the query logic types of the items can also be different.
  • the query logic type associated with the user information can be queried from a variety of preset query logic types as the target query logic type.
  • the staff prepares corresponding policy implementation classes for different query logic types in advance, that is, sets the association between the query logic type and the strategy implementation class in advance.
  • Each strategy implementation class can generate a strategy object, so the association between the query logic type and the strategy object can be obtained.
  • the default strategy object is the strategy object generated by calling the strategy implementation class.
  • Each strategy implementation class can generate a strategy object.
  • the strategy implementation class is called for the first time, the corresponding strategy object will be generated. If the same strategy implementation class needs to be called later, the corresponding strategy object can be used directly.
  • the policy object associated with the target query logical type is determined as the target policy object based on the association between the query logical type and the policy object.
  • the target policy object is the policy object associated with the user information.
  • determining the policy object corresponding to the query logic type associated with the user information from the preset policy objects according to the query logic type associated with the user information includes: based on the query logic type associated with the user information, and The association between the preset query logic type and the policy identifier determines the target policy identifier corresponding to the query logic type associated with the user information; based on the target policy identifier and the association between the preset policy identifier and the policy object, Determine the policy object corresponding to the target policy ID.
  • a strategy identification is configured for each strategy implementation class. For example, a strategy identification is assigned every time a strategy implementation class is written. That is, each policy object can correspond to a policy identifier.
  • the query logic type and the policy implementation class are related to each other. Therefore, each query logic type can correspond to a policy identifier.
  • the KV (key-value) format can be used to store the association between the query logical type and the policy identifier.
  • the policy identifier associated with the target query logical type is determined based on the association between the query logical type and the policy identifier, and is used as the target policy identifier. Then, according to the association between the policy identifier and the policy object, the policy object corresponding to the target policy identifier is determined as the target policy object.
  • the target policy object can be quickly determined, avoiding policy object determination errors, improving the accuracy and efficiency of determining the policy object, thereby improving the efficiency and accuracy of item query, and also avoiding the writing of statements for selecting branches in the program, reducing the Development test burden on staff.
  • the policy object corresponding to the target policy identifier is determined based on the target policy identifier and the association between the preset policy identifier and the policy object, including: if based on the target policy identifier, and the preset policy identifier and the policy object, the policy object corresponding to the target policy identifier is determined. If the association between policy objects determines that there is no policy object corresponding to the target policy identifier, then the target policy implementation class is determined from the pre-written policy implementation class based on the query logic type associated with the user information; the target policy implementation class is called , generate a policy object corresponding to the target policy identifier.
  • the strategy object will be generated after the corresponding strategy implementation class is called for the first time. If the strategy implementation class has not been called, the corresponding strategy object does not exist.
  • the target policy identifier After determining the target policy identifier, first determine whether there is a policy object associated with the target policy identifier. If it exists, directly obtain the target policy object associated with the target policy identifier; if it does not exist, indicate the policy implementation class corresponding to the target policy identifier. It has not been called yet.
  • the policy implementation class corresponding to the target policy identification is determined from a plurality of pre-written policy implementation classes. As the target policy implementation class, the target policy implementation class is also associated with the target query logical type. Call the target policy implementation class to get the policy object corresponding to the target policy implementation class, which is the target policy object. In subsequent item queries of the target query logic type, the target policy object can be used directly.
  • the strategy object only needs to be generated when the corresponding strategy implementation class is called for the first time.
  • the corresponding strategy implementation class can be called for the first time to facilitate subsequent use of the target strategy object and improve The efficiency of item query.
  • the target policy implementation class after calling the target policy implementation class and generating the policy object corresponding to the target policy identifier, it also includes: using a hash map to associate and store the policy object corresponding to the target policy implementation class and the target policy identifier.
  • the policy identifier corresponds to the policy implementation class one-to-one.
  • the policy identifier can correspond to the policy object one-to-one.
  • the target policy object is generated, the policy identifier of the target policy implementation class is associated and stored with the target policy object.
  • a HashMap (hash map) may be used to store unique policy identifiers and policy objects.
  • a HashMap can also be used to store the association between the query logical type and the unique policy identifier.
  • the target strategy identifier is obtained from the HashMap according to the target query logic type, and then the corresponding target strategy object is determined based on the target strategy identifier, and the logic of querying the product is executed.
  • the KV method can be used to store the association relationship, which facilitates finding the target policy object and improves the accuracy and efficiency of determining the target policy object.
  • the target strategy implementation class before calling the target strategy implementation class from the preset factory class according to Spring control inversion to obtain the strategy object corresponding to the target strategy identifier, it also includes: obtaining the pre-written strategy implementation class and implementing the strategy. Classes are aggregated into default factory classes.
  • write strategy implementation classes for different query logic types obtain each pre-written strategy implementation class, and aggregate all strategy implementation classes into factory classes through Spring IOC (Spring Inversion of Control, Spring Inversion of Control).
  • the strategy implementation class can be implemented based on the preset interface.
  • the strategy implementation class is a basic template and can define general methods of querying products and filling stores, etc.
  • the policy implementation class can be continuously expanded, which can improve the business expansion capabilities of product query without modifying the original main program. It also simplifies the cost of business expansion.
  • the main program is isolated from the logical branches, making the main program more concise and reducing the later operation and maintenance costs of the code.
  • calling the target strategy implementation class to generate a strategy object corresponding to the target strategy identification includes: calling the target strategy implementation class from the preset factory class according to Spring control inversion to obtain the strategy corresponding to the target strategy identification. object.
  • the target strategy implementation class is called from the preset factory class to generate the target strategy object.
  • Arrange the target policy object into the policy factory obtain the corresponding policy object through the relationship between the configured query logic type and the policy identifier, and execute specific logic.
  • the strategy pattern in the embodiment of this application is an encapsulation of the algorithm.
  • the strategy pattern can encapsulate the algorithm into a strategy implementation class.
  • the strategy implementation class can generate a strategy object and execute the logic code of item query.
  • This application determines the user information and the item information of the item to be queried by responding to the item query instruction issued by the user. According to the user information, a strategy object is determined from a variety of preset strategy objects, and the logic code in the strategy object is executed based on the item information of the item to be queried.
  • This method avoids the process of determining the logical code corresponding to the user information based on the statement of the selected branch in the main program in the prior art, so that the code of the main program and the logical code of the item query are separated from each other.
  • Figure 3 is a schematic flowchart of an item query method based on a policy pattern provided by an embodiment of the present application. This embodiment is an optional embodiment based on the above embodiment.
  • the logic code in the policy object associated with the user information is executed, which can be refined into: using the name of the item to be queried as an input parameter of the policy object associated with the user information, and Execute the logic code in the policy object associated with the user information based on the input parameters.
  • the method includes the following steps:
  • the logic code in the policy object can indicate how to query the items to be queried, but it cannot determine what items to be queried are specifically queried.
  • the item information of the item to be queried can be used as an input parameter of the target policy object, that is, the items to be queried through the target policy object are determined.
  • the item information of the item to be queried may include the name of the item to be queried, and the name of the item to be queried is used as an input parameter of the policy object associated with the user information, and the logic code in the policy object associated with the user information is executed based on the input parameters to implement the treatment Query items to query.
  • the target strategy object can determine to query items from database 1, but there are multiple items in database 1, and the target strategy object cannot directly query the items in database 1 through logic code.
  • the name of the item to be queried can be "air conditioner”, then "air conditioner” can be found from database one according to the target policy object. It realizes accurate query for the items to be queried through the same policy object.
  • the strategy pattern in the embodiment of this application is an encapsulation of the algorithm.
  • the strategy pattern can encapsulate the algorithm into a strategy implementation class.
  • the strategy implementation class can generate a strategy object and execute the logic code of item query.
  • This application determines the user information and the item information of the item to be queried by responding to the item query instruction issued by the user. According to the user information, a strategy object is determined from a variety of preset strategy objects, and the logic code in the strategy object is executed based on the item information of the item to be queried.
  • This method avoids the process of determining the logical code corresponding to the user information based on the statement of the selected branch in the main program in the prior art, so that the code of the main program and the logical code of the item query are separated from each other.
  • Figure 4 is a schematic structural diagram of an item query device based on a policy mode provided by an embodiment of the present application.
  • the device can be implemented through software, hardware, or a combination of both.
  • the device includes: an item query instruction response module 401, a policy object determination module 402, and an item query module 403.
  • the item query instruction response module 401 is configured to respond to the user's item query instruction and determine the user information and the item information of the item to be queried; wherein the item query instruction is used to represent the query for the item to be queried;
  • the policy object determination module 402 is configured to determine the policy object associated with the user information from the preset policy objects according to the user information; wherein the policy object is used to represent the logic code that needs to be executed to query the item;
  • the item query module 403 is configured to execute the logic code in the policy object associated with the user information according to the item information of the item to be queried, and to query the item to be queried.
  • policy object determination module 402 includes:
  • a query logic type determination unit configured to determine a query logic type associated with the user information from preset query logic types according to the user information; wherein the query logic type represents the logic required to be executed for querying items. type;
  • the policy object search unit is configured to determine the policy object corresponding to the query logic type associated with the user information from the preset policy objects according to the query logic type associated with the user information.
  • policy object search unit including:
  • the target policy identification determination subunit is configured to determine the query logic type associated with the user information based on the query logic type associated with the user information and the preset association relationship between the query logic type and the policy identification.
  • Target policy identifier
  • the policy object confirmation subunit is configured to determine the policy object corresponding to the target policy identity according to the target policy identity and the preset association relationship between the policy identity and the policy object.
  • policy object confirmation subunits include:
  • the target policy implementation class determination slave unit is configured to determine that there is no policy object corresponding to the target policy identifier based on the target policy identifier and the preset association relationship between the policy identifier and the policy object.
  • the query logic type associated with the user information determines the target policy implementation class from the pre-written policy implementation classes;
  • the policy object generation slave unit is configured to call the target policy implementation class and generate a policy object corresponding to the target policy identifier.
  • the device also includes:
  • the policy object storage module is configured to use a hash map to store the policy object corresponding to the target policy implementation class and the target after calling the target policy implementation class and generating a policy object corresponding to the target policy identifier. Policy identification is stored in association.
  • policy object generation slave unit specific settings are:
  • the target policy implementation class is called from the preset factory class to obtain the policy object corresponding to the target policy identifier.
  • the device also includes:
  • the strategy implementation class aggregation module is configured to obtain the pre-written strategy implementation class before calling the target strategy implementation class from the preset factory class according to Spring control inversion to obtain the strategy object corresponding to the target strategy identifier. , aggregating the policy implementation classes into the default factory class.
  • the user information includes the user's identity
  • the item information of the item to be queried includes the name of the item to be queried.
  • the name of the item to be queried is used as an input parameter of the policy object associated with the user information, and the logic code in the policy object associated with the user information is executed according to the input parameter.
  • the strategy pattern in the embodiment of this application is an encapsulation of the algorithm.
  • the strategy pattern can encapsulate the algorithm into a strategy implementation class.
  • the strategy implementation class can generate a strategy object and execute the logic code of item query.
  • This application determines the user information and the item information of the item to be queried by responding to the item query instruction issued by the user. According to the user information, a strategy object is determined from a variety of preset strategy objects, and the logic code in the strategy object is executed based on the item information of the item to be queried.
  • This method avoids the process of determining the logical code corresponding to the user information based on the statement of the selected branch in the main program in the prior art, so that the code of the main program and the logical code of the item query are separated from each other.
  • Figure 5 is a schematic structural diagram of an electronic device according to an exemplary embodiment.
  • the device may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal device Digital assistants and more.
  • Device 500 may include one or more of the following components: processing component 502 , memory 504 , power component 506 , multimedia component 508 , audio component 510 , input/output (I/O) interface 512 , sensor component 514 , and communications component 516 .
  • Processing component 502 generally controls the overall operations of device 500, such as operations associated with display, phone calls, data communications, camera operations, and recording operations.
  • the processing component 502 may include one or more processors 520 to execute instructions to complete all or part of the steps of the above method.
  • processing component 502 may include one or more modules that facilitate interaction between processing component 502 and other components.
  • processing component 502 may include a multimedia module to facilitate interaction between multimedia component 508 and processing component 502.
  • Memory 504 is configured to store various types of data to support operations at device 500 . Examples of such data include instructions for any application or method operating on device 500, contact data, phonebook data, messages, pictures, videos, etc.
  • Memory 504 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EEPROM erasable programmable read-only memory
  • EPROM Programmable read-only memory
  • PROM programmable read-only memory
  • ROM read-only memory
  • magnetic memory flash memory, magnetic or optical disk.
  • Power supply component 506 provides power to the various components of device 500 .
  • Power supply components 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 500 .
  • Multimedia component 508 includes a screen that provides an output interface between the device 500 and the user.
  • the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user.
  • the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide action.
  • multimedia component 508 includes a front-facing camera and/or a rear-facing camera.
  • the front camera and/or the rear camera may receive external multimedia data.
  • Each front-facing camera and rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
  • Audio component 510 is configured to output and/or input audio signals.
  • audio component 510 includes a microphone (MIC) configured to receive external audio signals when device 500 is in operating modes, such as call mode, recording mode, and speech recognition mode. The received audio signals may be further stored in memory 504 or sent via communication component 516 .
  • audio component 510 also includes a speaker for outputting audio signals.
  • the I/O interface 512 provides an interface between the processing component 502 and a peripheral interface module, which may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
  • Sensor component 514 includes one or more sensors that provide various aspects of status assessment for device 500 .
  • the sensor component 514 can detect the open/closed state of the device 500, the relative positioning of components, such as the display and keypad of the device 500, and the sensor component 514 can also detect a change in position of the device 500 or a component of the device 500. , the presence or absence of user contact with device 500 , device 500 orientation or acceleration/deceleration and temperature changes of device 500 .
  • Sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact.
  • Sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 516 is configured to facilitate wired or wireless communications between device 500 and other devices.
  • Device 500 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof.
  • the communication component 516 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communications component 516 also includes a near field communications (NFC) module to facilitate short-range communications.
  • NFC near field communications
  • the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • device 500 may be configured by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are implemented for executing the above method.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable Gate array
  • controller microcontroller, microprocessor or other electronic components are implemented for executing the above method.
  • a non-transitory computer-readable storage medium including instructions such as a memory 504 including instructions, which are executable by the processor 520 of the device 500 to complete the above method is also provided.
  • the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
  • a non-transitory computer-readable storage medium when instructions in the storage medium are executed by a processor of a terminal device, enable the terminal device to execute the above-mentioned policy mode-based item query method of the terminal device.
  • This application also discloses a computer program product, which includes a computer program that implements the policy pattern-based item query method as described in this embodiment when executed by a processor.
  • Various implementations of the systems and techniques described above may be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip implemented in a system (SOC), load programmable logic device (CPLD), computer hardware, firmware, software, and/or a combination thereof.
  • FPGAs field programmable gate arrays
  • ASICs application specific integrated circuits
  • ASSPs application specific standard products
  • SOC system
  • CPLD load programmable logic device
  • computer hardware firmware, software, and/or a combination thereof.
  • These various embodiments may include implementation in one or more computer programs executable and/or interpreted on a programmable system including at least one programmable processor, the programmable processor
  • the processor which may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • An output device may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • An output device may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • Program code for implementing the methods of the present application may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that the program codes, when executed by the processor or controller, cause the functions specified in the flowcharts and/or block diagrams/ The operation is implemented.
  • the program code may execute entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine or entirely on the remote machine or electronic device.
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with an instruction execution system, apparatus, or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, laptop disks, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM portable compact disk read-only memory
  • magnetic storage device or any suitable combination of the above.
  • the systems and techniques described herein may be implemented on a computer having a display device (eg, a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user ); and a keyboard and pointing device (eg, a mouse or a trackball) through which a user can provide input to the computer.
  • a display device eg, a CRT (cathode ray tube) or LCD (liquid crystal display) monitor
  • a keyboard and pointing device eg, a mouse or a trackball
  • Other kinds of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and may be provided in any form, including Acoustic input, voice input or tactile input) to receive input from the user.
  • the systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data electronics device), or a computing system that includes middleware components (e.g., an application electronics device), or a computing system that includes a front-end component (e.g., as a data electronics device).
  • back-end components e.g., as a data electronics device
  • middleware components e.g., an application electronics device
  • a front-end component e.g., as a data electronics device.
  • a user computer having a graphical user interface or a web browser through which the user can interact with implementations of the systems and technologies described herein), or including such backend components, middleware components, or any combination of front-end components in a computing system.
  • the components of the system may be interconnected by any form or medium of digital data communication (eg, a communications network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.
  • LAN local area network
  • Computer systems may include clients and electronic devices. Clients and electronic devices are generally remote from each other and typically interact through a communications network. The relationship of client and electronic device is created by computer programs running on respective computers and having a client-electronic device relationship with each other.
  • Electronic equipment can be cloud electronic equipment, also known as cloud computing electronic equipment or cloud host. It is a host product in the cloud computing service system to solve the problem of traditional physical host and VPS service ("Virtual Private Server", or "Virtual Private Server” for short) VPS”) has the disadvantages of difficult management and weak business scalability.
  • the electronic device can also be an electronic device of a distributed system, or an electronic device combined with a blockchain.

Landscapes

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

Abstract

本申请提供一种基于策略模式的物品查询方法、装置、设备及存储介质。该方法包括:响应于用户的物品查询指令,确定用户信息和待查询物品的物品信息;其中,物品查询指令用于表征对待查询物品进行查询;根据用户信息,从预设的策略对象中确定与用户信息关联的策略对象;其中,策略对象用于表征查询物品所需执行的逻辑代码;根据待查询物品的物品信息,执行与用户信息关联的策略对象中的逻辑代码,对待查询物品进行查询。

Description

基于策略模式的物品查询方法、装置、设备及存储介质
本申请要求于2022年5月24日提交中国专利局、申请号为2022105709767、申请名称为“基于策略模式的物品查询方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术,更为具体地,涉及一种基于策略模式的物品查询方法、装置、设备及存储介质。
背景技术
不同身份的用户对不同店铺类型中商品的查询逻辑类型不同,例如,消费者查询物品的逻辑与店主查询物品的逻辑类型不同,消费者可以查询店铺中所有展示出的物品,店主可以查询店铺库存中的物品。
但是,目前的物品查询方法中需要对物品查询的代码进行整体编排和测试,浪费开发测试的人力和时间,出现错误的概率高,影响物品查询的效率和精度。
发明内容
本申请的目的在于提供一种基于策略模式的物品查询方法、装置、设备及存储介质,用以提高物品查询的精度。
第一方面,本申请公开了一种基于策略模式的物品查询方法,包括:
响应于用户的物品查询指令,确定用户信息和待查询物品的物品信息;其中,所述物品查询指令用于表征对待查询物品进行查询;
根据所述用户信息,从预设的策略对象中确定与所述用户信息关联的策略对象;其中,所述策略对象用于表征查询物品所需执行的逻辑代码;
根据所述待查询物品的物品信息,执行与所述用户信息关联的策略对象中的逻辑代码,对所述待查询物品进行查询。
第二方面,本申请公开了一种基于策略模式的物品查询装置,包括:
物品查询指令响应模块,设置为响应于用户的物品查询指令,确定用户信息和待查询物品的物品信息;其中,所述物品查询指令用于表征对待查询物品进行查询;
策略对象确定模块,设置为根据所述用户信息,从预设的策略对象中确定与所述用户信息关联的策略对象;其中,所述策略对象用于表征查询物品所需执行的逻辑代码;
物品查询模块,设置为根据所述待查询物品的物品信息,执行与所述用户信息关联的策略对象中的逻辑代码,对所述待查询物品进行查询。
第三方面,本申请提供一种电子设备,包括:处理器,以及与所述处理器通信连接的存储器;
所述存储器存储计算机执行指令;
所述处理器执行所述存储器存储的计算机执行指令,以实现如本申请任意实施例所述的基于策略模式的物品查询方法。
第四方面,本申请提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现如本申请任意实施例所述的基于策略模式的物品查询方法。
第五方面,本申请提供一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现如本申请任意实施例所述的基于策略模式的物品查询方法。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。
图1为本申请实施例提供的一种基于策略模式的物品查询方法的流程示意图;
图2为本申请实施例提供的一种基于策略模式的物品查询方法的流程示意图;
图3为本申请实施例提供的一种基于策略模式的物品查询方法的流程示意图;
图4为本申请实施例提供的一种基于策略模式的物品查询装置的结构示意图;
图5为本申请实施例提供的一种电子设备的结构示意图。
通过上述附图,已示出本申请明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本申请构思的范围,而是通过参考特定实施例为本领域技术人员说明本申请的概念。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。
下面以具体地实施例对本申请的技术方案以及本申请的技术方案如何解决现有技术的问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本申请的实施例进行描述。
图1是根据本申请实施例提供的一种基于策略模式的物品查询方法的流程示意图,本实施例提供的方法由一种基于策略模式的物品查询装置执行。如图1所示,该方法包括以下步骤:
S101、响应于用户的物品查询指令,确定用户信息和待查询物品的物品信息;其中,物品查询指令用于表征对待查询物品进行查询。
其中,物品可以是店铺中的商品,用户可以是消费者、店主或合伙人等身份。同样的物品可以存在于不同的店铺中,即,各个店铺中的物品可以相同,也可以不同。本申请实施例中的店铺是线上店铺,店铺可以包括旗舰店、生态店和品牌店等。用户可以在线上店铺的系统中进行物品的查询或购买,例如,用户发出物品查询指令,可以对某个店铺中的物品进行查询,也可以不针对某一个店铺,对各个店铺中的物品进行查询。
用户发出物品查询指令,物品查询指令中可以包括用户信息和待查询物品的物品信息。 用户信息可以包括用户的账号名称和密码等,待查询物品的物品信息可以包括待查询物品的名称和型号等。响应到用户发起的物品查询指令,确定需要对待查询物品进行查询。例如,用户针对冰箱发起了物品查询请求,则可以确定需要对线上所有店铺中的冰箱进行查询。
用户信息中还可以包括用户身份,用户在线上店铺的系统上注册账号时,可以选择用户身份,即,用户身份可以与用户账号等信息进行关联。在接收到物品查询指令后,可以直接得到用户身份,也可以根据用户账号等信息确定用户身份。例如,用户可以作为消费者,对物品进行查询。
用户可以针对某一个店铺发出物品查询指令,例如,线上店铺的系统中有一号店和二号店,用户可以查询二号店中的物品。用户也可以对所有店铺中的物品进行查询,例如,用户想要查询冰箱,则可以对所有店铺的冰箱进行查询。若用户针对某一店铺进行物品查询,则查询结果可以是该店铺中的待查询物品;若用户没有针对某一店铺进行查询,则查询结果可以是所有店铺中的待查询物品,也可以为用户选择一个店铺,只展示该店铺中的待查询物品。例如,可以根据用户信息中的用户IP地址,为用户选择发货距离较近的店铺。
S102、根据用户信息,从预设的策略对象中确定与用户信息关联的策略对象;其中,策略对象用于表征查询物品所需执行的逻辑代码。
其中,可以预先设定多种策略对象,策略对象可以是封装的算法代码,用于表示在进行物品查询时,所需执行的逻辑代码。例如,策略对象中可以包括查询物品所需的数据库等。可以预先设置用户信息与策略对象之间的关联关系,例如,可以设置不同用户身份与策略对象之间的关联关系。若用户身份为店主,则可以采用策略对象一;若用户身份为消费者,则可以采用策略对象二。
在确定用户信息后,可以根据预设的用户信息与策略对象之间的关联关系,确定与用户信息关联的策略对象。
本实施例中,策略模式(Strategy Pattern)可以是定义一系列物品查询逻辑的算法,将每一个查询逻辑的算法封装起来,并让它们可以相互替换。策略模式通常把一个系列的算法封装到一系列的类里面,得到策略实现类,调用策略实现类可以得到策略对象。策略实现类中包括进行物品查询的逻辑代码,策略对象可以执行该代码。策略实现类也可以与用户信息进行关联存储。
可以在物品查询之前,预先调用一次各个策略实现类,得到各个策略实现类对应的策略对象,得到用户信息与策略对象之间的关联关系,从而根据用户信息得到对应的策略对象。也可以在物品查询时,先根据用户信息与策略实现类之间的关联关系,确定与用户信息对应的策略实现类,再根据策略实现类,得到策略对象。
使用策略模式封装不同查询逻辑类型的策略实现类,得到策略对象,可以实现在新增查询逻辑类型时,主程序的逻辑固定不动,开发时只需单独编写新增的逻辑代码进行封装。例如,主程序可以用于响应用户的物品查询指令,确定用户信息和待查询物品的物品信息等。公共的主程序在预设模板中已定义,整体不需要重新编排,测试也只需要测试新增的逻辑代码即可,极大降低出现问题的概率,减少了开发测试的时间成本。
S103、根据待查询物品的物品信息,执行与用户信息关联的策略对象中的逻辑代码,对待查询物品进行查询。
其中,策略对象中的逻辑代码可以表示如何进行物品查询,即物品查询的逻辑,待查询物品的物品信息表示待查询的物品。在确定与用户信息关联的策略对象后,根据待查询物品的物品信息和策略对象的逻辑代码,可以确定如何对待查询物品进行查询。例如,策略对象可以用于根据逻辑代码从数据库一中进行物品查询,物品信息为待查询物品的名称“冰箱”,则可以执行策略对象的逻辑代码,从数据库一种查询“冰箱”这一物品。查询结果可以是待查询物品的所在店铺或物品库存等信息,可以将查询结果进行展示,供用户参考。
本申请实施例提供了一种基于策略模式的物品查询方法,该方法中的策略模式是对算法的封装,策略模式可以将算法封装到策略实现类中,策略实现类可以生成策略对象,进行物品查询的逻辑代码的执行。本申请通过响应用户发出的物品查询指令,确定用户信息和待查询物品的物品信息。根据用户信息,从预设的多种策略对象中确定出一种策略对象,并根据待查询物品的物品信息,执行该策略对象中的逻辑代码。避免了现有技术中,根据主程序中选择分支的语句确定用户信息对应的逻辑代码的过程,使主程序的代码和物品查询的逻辑代码相互分离。当有新增的逻辑类型时,不需要改动主程序,节约开发测试的人力和时间,减少出现错误的概率,提高物品查询的效率和精度。
图2为本申请实施例提供的一种基于策略模式的物品查询方法的流程示意图,该实施例是在上述实施例基础上的可选实施例。
本实施例中,根据用户信息,从预设的策略对象中确定与用户信息关联的策略对象,可细化为:根据用户信息,从预设的查询逻辑类型中确定与用户信息关联的查询逻辑类型;其中,查询逻辑类型表征查询物品所需执行的逻辑的种类;根据与用户信息关联的查询逻辑类型,从预设的策略对象中确定与用户信息关联的查询逻辑类型所对应的策略对象。
如图2所示,该方法包括以下步骤:
S201、响应于用户的物品查询指令,确定用户信息和待查询物品的物品信息;其中,物品查询指令用于表征对待查询物品进行查询。
S202、根据用户信息,从预设的查询逻辑类型中确定与用户信息关联的查询逻辑类型;其中,查询逻辑类型表征查询物品所需执行的逻辑的种类。
其中,预先配置不同用户信息与查询逻辑类型之间的关联关系,查询逻辑类型可以是指查询物品时所需执行的逻辑的种类。例如,预先设置多种类型,作为查询逻辑类型,每种类型对应一种查询逻辑,各个类型的查询逻辑可以根据实际需求进行设定。例如,设置两种查询逻辑类型,第一种查询逻辑类型是从数据库一中查询物品,第二种查询逻辑类型是从数据表三中查询物品。
不同用户在查询物品时所应用的查询逻辑类型可以不同,例如,可以为不同的用户身份配置对应的查询逻辑类型。若增加了新的用户身份等用户信息,则可以配置新的查询逻辑类型。不同用户身份的用户在查询物品时,物品的查询逻辑类型可以不同;同样用户身份的用户在查询不同店铺的物品时,物品的查询逻辑类型也可以不同。
在得到用户信息后,可以从预设的多种查询逻辑类型中,查询与该用户信息关联的查询逻辑类型,作为目标查询逻辑类型。
S203、根据与用户信息关联的查询逻辑类型,从预设的策略对象中确定与用户信息关联的查询逻辑类型所对应的策略对象。
其中,工作人员预先对于不同的查询逻辑类型编写对应的策略实现类,即预先设置查询逻辑类型与策略实现类之间的关联关系。每个策略实现类可以生成一个策略对象,因此,可以得到查询逻辑类型与策略对象之间的关联关系。
预设的策略对象是已经调用过策略实现类,所生成的策略对象。每个策略实现类可以生成一个策略对象,在初次调用策略实现类时,会生成对应的策略对象,后续若还需要调用相同的策略实现类,则可以直接使用对应的策略对象。
在确定目标查询逻辑类型后,根据查询逻辑类型与策略对象之间的关联关系,确定与目标查询逻辑类型关联的策略对象,作为目标策略对象。目标策略对象即为与用户信息关联的策略对象。
本实施例中,根据与用户信息关联的查询逻辑类型,从预设的策略对象中确定与用户信息关联的查询逻辑类型所对应的策略对象,包括:根据与用户信息关联的查询逻辑类型,以及预设的查询逻辑类型与策略标识之间的关联关系,确定与用户信息关联的查询逻辑类型对应的目标策略标识;根据目标策略标识,以及预设的策略标识与策略对象之间的关联关系,确定与目标策略标识对应的策略对象。
具体的,为每个策略实现类配置一个策略标识,例如,每编写完成一个策略实现类就分配一个策略标识。即,每个策略对象可以对应一个策略标识。查询逻辑类型与策略实现类相互关联,因此,每个查询逻辑类型可以对应一个策略标识。例如,可以采用KV(key-Value,关键词-值)的格式存储查询逻辑类型和策略标识之间的关联关系。
在确定目标查询逻辑类型后,根据查询逻辑类型和策略标识之间的关联关系,确定与目标查询逻辑类型关联的策略标识,作为目标策略标识。再根据策略标识与策略对象之间的关联关系,确定与目标策略标识对应的策略对象,作为目标策略对象。
根据唯一的策略标识,可以快速确定目标策略对象,避免策略对象确定错误,提高策略对象的确定精度和效率,进而提高物品查询的效率和精度,也避免了程序中选择分支的语句的编写,减轻工作人员的开发测试的负担。
本实施例中,根据目标策略标识,以及预设的策略标识与策略对象之间的关联关系,确定与目标策略标识对应的策略对象,包括:若根据目标策略标识,以及预设的策略标识与策略对象之间的关联关系,确定不存在与目标策略标识对应的策略对象,则根据与用户信息关联的查询逻辑类型,从预先编写的策略实现类中确定目标策略实现类;调用目标策略实现类,生成与目标策略标识对应的策略对象。
具体的,策略对象在初次调用对应的策略实现类后才会生成,若没有调用过策略实现类,则不存在对应的策略对象。
在确定目标策略标识后,先判断是否存在与目标策略标识关联的策略对象,若存在,则直接得到与目标策略标识关联的目标策略对象;若不存在,则说明目标策略标识对应的策略实现类还未被调用过。从预先编写的多个策略实现类中确定与目标策略标识对应的策略实现类,作为目标策略实现类,目标策略实现类也与目标查询逻辑类型关联。调用目标策略实现类,得到目标策略实现类对应的策略对象,即为目标策略对象。在后续进行目标查询逻辑类型的物品查询时,可以直接使用目标策略对象。
策略对象只需要在初次调用对应的策略实现类时生成即可,在查找目标策略对象时,若没有目标策略对象,则可以初次调用对应的策略实现类,便于后续对目标策略对象的使 用,提高物品查询的效率。
本实施例中,在调用目标策略实现类,生成与目标策略标识对应的策略对象之后,还包括:采用哈希映射,将与目标策略实现类对应的策略对象和目标策略标识进行关联存储。
具体的,策略标识与策略实现类一一对应,在生成策略实现类的策略对象后,策略标识可以与策略对象一一对应。在生成目标策略对象后,将目标策略实现类的策略标识与目标策略对象进行关联存储。本实施例中,可以采用HashMap(哈希映射)存储唯一的策略标识和策略对象。
本实施例中,还可以使用HashMap存储查询逻辑类型与唯一策略标识之间的关联关系。当用户需要查询物品时,根据目标查询逻辑类型,从HashMap中获取目标策略标识,再根据目标策略标识确定对应的目标策略对象,执行查询商品的逻辑。
通过哈希映射,可以采用KV的方式进行关联关系的存储,便于找到目标策略对象,提高目标策略对象的确定精度和效率。
本实施例中,在根据Spring控制反转,从预设的工厂类中调用目标策略实现类,得到与目标策略标识对应的策略对象之前,还包括:获取预先编写的策略实现类,将策略实现类聚合至预设的工厂类中。
具体的,对于不同的查询逻辑类型编写策略实现类,获取预先编写的各个策略实现类,通过Spring IOC(Spring Inversion of Control,Spring控制反转)将所有的策略实现类聚合到工厂类。
策略实现类可以基于预设的接口实现,策略实现类为基础模板,可以定义通用的查询商品方法和填充店铺方法等。依据每个用户身份编写策略实现类,策略实现类可以一直扩展,可以在不修改原有主程序的基础上,提高商品查询的业务扩展能力。并简化了业务扩展的成本,主程序与逻辑分支实现隔离,主程序更加简洁,降低了代码后期的运维成本。
本实施例中,调用目标策略实现类,生成与目标策略标识对应的策略对象,包括:根据Spring控制反转,从预设的工厂类中调用目标策略实现类,得到与目标策略标识对应的策略对象。
具体的,通过Spring控制反转,从预设的工厂类中调用目标策略实现类,生成目标策略对象。将目标策略对象编排到策略工厂,通过配置的查询逻辑类型与策略标识的关系获取对应的策略对象,执行具体逻辑。通过生成策略对象,不需要在主程序中编写选择语句,避免主程序冗余,提高业务扩展的灵活性。
S204、根据待查询物品的物品信息,执行与用户信息关联的策略对象中的逻辑代码,对待查询物品进行查询。
本申请实施例中的策略模式是对算法的封装,策略模式可以将算法封装到策略实现类中,策略实现类可以生成策略对象,进行物品查询的逻辑代码的执行。本申请通过响应用户发出的物品查询指令,确定用户信息和待查询物品的物品信息。根据用户信息,从预设的多种策略对象中确定出一种策略对象,并根据待查询物品的物品信息,执行该策略对象中的逻辑代码。避免了现有技术中,根据主程序中选择分支的语句确定用户信息对应的逻辑代码的过程,使主程序的代码和物品查询的逻辑代码相互分离。当有新增的逻辑类型时,不需要改动主程序,节约开发测试的人力和时间,减少出现错误的概率,提高物品查询的效率和精度,以及业务扩展的灵活性。
图3为本申请实施例提供的一种基于策略模式的物品查询方法的流程示意图,该实施例是在上述实施例基础上的可选实施例。
本实施例中,根据待查询物品的物品信息,执行与用户信息关联的策略对象中的逻辑代码,可细化为:将待查询物品的名称作为与用户信息关联的策略对象的输入参数,并根据输入参数执行与用户信息关联的策略对象中的逻辑代码。
如图3所示,该方法包括以下步骤:
S301、响应于用户的物品查询指令,确定用户信息和待查询物品的物品信息;其中,物品查询指令用于表征对待查询物品进行查询。
S302、根据用户信息,从预设的策略对象中确定与用户信息关联的策略对象;其中,策略对象用于表征查询物品所需执行的逻辑代码。
S303、将待查询物品的名称作为与用户信息关联的策略对象的输入参数,并根据输入参数执行与用户信息关联的策略对象中的逻辑代码,对待查询物品进行查询。
其中,策略对象中的逻辑代码可以表示如何查询到待查询物品,但无法确定具体查询什么待查询物品。在确定与用户信息关联的策略对象后,即在确定目标策略对象后,待查询物品的物品信息可以作为目标策略对象的入参,即可以确定通过目标策略对象所需查询的物品。待查询物品的物品信息可以包括待查询物品的名称,将待查询物品的名称作为与用户信息关联的策略对象的入参,根据入参执行与用户信息关联的策略对象中的逻辑代码,实现对待查询物品进行查询。
例如,目标策略对象可以确定从数据库一种进行物品查询,但是数据库一中存在多种物品,目标策略对象无法直接通过逻辑代码从数据库一种查询其中的物品。将待查询物品的名称作为入参,待查询物品的名称可以是“空调”,则可以根据目标策略对象从数据库一中查找到“空调”。实现了通过同样的策略对象,对待查询物品进行精确查询。
本申请实施例中的策略模式是对算法的封装,策略模式可以将算法封装到策略实现类中,策略实现类可以生成策略对象,进行物品查询的逻辑代码的执行。本申请通过响应用户发出的物品查询指令,确定用户信息和待查询物品的物品信息。根据用户信息,从预设的多种策略对象中确定出一种策略对象,并根据待查询物品的物品信息,执行该策略对象中的逻辑代码。避免了现有技术中,根据主程序中选择分支的语句确定用户信息对应的逻辑代码的过程,使主程序的代码和物品查询的逻辑代码相互分离。当有新增的逻辑类型时,不需要改动主程序,节约开发测试的人力和时间,减少出现错误的概率,提高物品查询的效率和精度。
图4为本申请实施例提供的一种基于策略模式的物品查询装置的结构示意图,该装置可以通过软件、硬件或者两者的结合实现。如图4所示,该装置包括:物品查询指令响应模块401、策略对象确定模块402和物品查询模块403。
物品查询指令响应模块401,设置为响应于用户的物品查询指令,确定用户信息和待查询物品的物品信息;其中,所述物品查询指令用于表征对待查询物品进行查询;
策略对象确定模块402,设置为根据所述用户信息,从预设的策略对象中确定与所述用户信息关联的策略对象;其中,所述策略对象用于表征查询物品所需执行的逻辑代码;
物品查询模块403,设置为根据所述待查询物品的物品信息,执行与所述用户信息关联的策略对象中的逻辑代码,对所述待查询物品进行查询。
可选的,策略对象确定模块402,包括:
查询逻辑类型确定单元,设置为根据所述用户信息,从预设的查询逻辑类型中确定与所述用户信息关联的查询逻辑类型;其中,所述查询逻辑类型表征查询物品所需执行的逻辑的种类;
策略对象查找单元,设置为根据与所述用户信息关联的查询逻辑类型,从预设的策略对象中确定与所述用户信息关联的查询逻辑类型所对应的策略对象。
可选的,策略对象查找单元,包括:
目标策略标识确定子单元,设置为根据与所述用户信息关联的查询逻辑类型,以及预设的查询逻辑类型与策略标识之间的关联关系,确定与所述用户信息关联的查询逻辑类型对应的目标策略标识;
策略对象确认子单元,设置为根据所述目标策略标识,以及预设的策略标识与策略对象之间的关联关系,确定与所述目标策略标识对应的策略对象。
可选的,策略对象确认子单元,包括:
目标策略实现类确定从单元,设置为若根据所述目标策略标识,以及预设的策略标识与策略对象之间的关联关系,确定不存在与所述目标策略标识对应的策略对象,则根据与所述用户信息关联的查询逻辑类型,从预先编写的策略实现类中确定目标策略实现类;
策略对象生成从单元,设置为调用所述目标策略实现类,生成与所述目标策略标识对应的策略对象。
可选的,该装置还包括:
策略对象存储模块,设置为在调用所述目标策略实现类,生成与所述目标策略标识对应的策略对象之后,采用哈希映射,将与所述目标策略实现类对应的策略对象和所述目标策略标识进行关联存储。
可选的,策略对象生成从单元,具体设置为:
根据Spring控制反转,从预设的工厂类中调用所述目标策略实现类,得到与所述目标策略标识对应的策略对象。
可选的,该装置还包括:
策略实现类聚合模块,设置为在根据Spring控制反转,从预设的工厂类中调用所述目标策略实现类,得到与所述目标策略标识对应的策略对象之前,获取预先编写的策略实现类,将所述策略实现类聚合至预设的工厂类中。
可选的,用户信息包括用户身份,所述待查询物品的物品信息包括待查询物品的名称。
可选的,物品查询模块403,具体设置为:
将所述待查询物品的名称作为与所述用户信息关联的策略对象的输入参数,并根据所述输入参数执行与所述用户信息关联的策略对象中的逻辑代码。
本申请实施例中的策略模式是对算法的封装,策略模式可以将算法封装到策略实现类中,策略实现类可以生成策略对象,进行物品查询的逻辑代码的执行。本申请通过响应用户发出的物品查询指令,确定用户信息和待查询物品的物品信息。根据用户信息,从预设的多种策略对象中确定出一种策略对象,并根据待查询物品的物品信息,执行该策略对象中的逻辑代码。避免了现有技术中,根据主程序中选择分支的语句确定用户信息对应的逻辑代码的过程,使主程序的代码和物品查询的逻辑代码相互分离。当有新增的逻辑类型时, 不需要改动主程序,节约开发测试的人力和时间,减少出现错误的概率,提高物品查询的效率和精度。
图5是根据一示例性实施例示出的一种电子设备的结构示意图,该设备可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。
设备500可以包括以下一个或多个组件:处理组件502,存储器504,电源组件506,多媒体组件508,音频组件510,输入/输出(I/O)接口512,传感器组件514,以及通信组件516。
处理组件502通常控制设备500的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件502可以包括一个或多个处理器520来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件502可以包括一个或多个模块,便于处理组件502和其他组件之间的交互。例如,处理组件502可以包括多媒体模块,以方便多媒体组件508和处理组件502之间的交互。
存储器504被配置为存储各种类型的数据以支持在设备500的操作。这些数据的示例包括用于在设备500上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器504可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
电源组件506为设备500的各种组件提供电力。电源组件506可以包括电源管理系统,一个或多个电源,及其他与为设备500生成、管理和分配电力相关联的组件。
多媒体组件508包括在所述设备500和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件508包括一个前置摄像头和/或后置摄像头。当设备500处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。
音频组件510被配置为输出和/或输入音频信号。例如,音频组件510包括一个麦克风(MIC),当设备500处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器504或经由通信组件516发送。在一些实施例中,音频组件510还包括一个扬声器,用于输出音频信号。
I/O接口512为处理组件502和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。
传感器组件514包括一个或多个传感器,用于为设备500提供各个方面的状态评估。例如,传感器组件514可以检测到设备500的打开/关闭状态,组件的相对定位,例如所述组件为设备500的显示器和小键盘,传感器组件514还可以检测设备500或设备500一个 组件的位置改变,用户与设备500接触的存在或不存在,设备500方位或加速/减速和设备500的温度变化。传感器组件514可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件514还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件514还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。
通信组件516被配置为便于设备500和其他设备之间有线或无线方式的通信。设备500可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件516经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件516还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在示例性实施例中,设备500可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器504,上述指令可由设备500的处理器520执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。
一种非临时性计算机可读存储介质,当该存储介质中的指令由终端设备的处理器执行时,使得终端设备能够执行上述终端设备的基于策略模式的物品查询方法。
本申请还公开了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现如本实施例中所述的基于策略模式的物品查询方法。
本申请以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、负载可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。
用于实施本申请的方法的程序代码可以采用一个或多个编程语言的任何组合来编写。这些程序代码可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器或控制器,使得程序代码当由处理器或控制器执行时使流程图和/或框图中所规定的功能/操作被实施。程序代码可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或电子设备上执行。
在本申请的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任 何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。
可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据电子设备)、或者包括中间件部件的计算系统(例如,应用电子设备)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。
计算机系统可以包括客户端和电子设备。客户端和电子设备一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-电子设备关系的计算机程序来产生客户端和电子设备的关系。电子设备可以是云电子设备,又称为云计算电子设备或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务("Virtual Private Server",或简称"VPS")中,存在的管理难度大,业务扩展性弱的缺陷。电子设备也可以为分布式系统的电子设备,或者是结合了区块链的电子设备。应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本申请中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本申请公开的技术方案所期望的结果,本文在此不进行限制。
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求书指出。
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求书来限制。

Claims (21)

  1. 一种基于策略模式的物品查询方法,包括:
    响应于用户的物品查询指令,确定用户信息和待查询物品的物品信息;其中,所述物品查询指令用于表征对待查询物品进行查询;
    根据所述用户信息,从预设的策略对象中确定与所述用户信息关联的策略对象;其中,所述策略对象用于表征查询物品所需执行的逻辑代码;
    根据所述待查询物品的物品信息,执行与所述用户信息关联的策略对象中的逻辑代码,对所述待查询物品进行查询。
  2. 根据权利要求1所述的方法,其中,根据所述用户信息,从预设的策略对象中确定与所述用户信息关联的策略对象,包括:
    根据所述用户信息,从预设的查询逻辑类型中确定与所述用户信息关联的查询逻辑类型;其中,所述查询逻辑类型表征查询物品所需执行的逻辑的种类;
    根据与所述用户信息关联的查询逻辑类型,从预设的策略对象中确定与所述用户信息关联的查询逻辑类型所对应的策略对象。
  3. 根据权利要求2所述的方法,其中,根据与所述用户信息关联的查询逻辑类型,从预设的策略对象中确定与所述用户信息关联的查询逻辑类型所对应的策略对象,包括:
    根据与所述用户信息关联的查询逻辑类型,以及预设的查询逻辑类型与策略标识之间的关联关系,确定与所述用户信息关联的查询逻辑类型对应的目标策略标识;
    根据所述目标策略标识,以及预设的策略标识与策略对象之间的关联关系,确定与所述目标策略标识对应的策略对象。
  4. 根据权利要求3所述的方法,其中,根据所述目标策略标识,以及预设的策略标识与策略对象之间的关联关系,确定与所述目标策略标识对应的策略对象,包括:
    若根据所述目标策略标识,以及预设的策略标识与策略对象之间的关联关系,确定不存在与所述目标策略标识对应的策略对象,则根据与所述用户信息关联的查询逻辑类型,从预先编写的策略实现类中确定目标策略实现类;
    调用所述目标策略实现类,生成与所述目标策略标识对应的策略对象。
  5. 根据权利要求4所述的方法,其中,在调用所述目标策略实现类,生成与所述目标策略标识对应的策略对象之后,还包括:
    采用哈希映射,将与所述目标策略实现类对应的策略对象和所述目标策略标识进行关联存储。
  6. 根据权利要求4所述的方法,其中,调用所述目标策略实现类,生成与所述目标策略标识对应的策略对象,包括:
    根据Spring控制反转,从预设的工厂类中调用所述目标策略实现类,得到与所述目标策略标识对应的策略对象。
  7. 根据权利要求6所述的方法,其中,在根据Spring控制反转,从预设的工厂类中调用所述目标策略实现类,得到与所述目标策略标识对应的策略对象之前,还包括:
    获取预先编写的策略实现类,将所述策略实现类聚合至预设的工厂类中。
  8. 根据权利要求1-7中任一所述的方法,其中,所述用户信息包括用户身份,所述待查询物品的物品信息包括待查询物品的名称。
  9. 根据权利要求1-8中任一所述的方法,其中,根据所述待查询物品的物品信息,执行与所述用户信息关联的策略对象中的逻辑代码,包括:
    将所述待查询物品的名称作为与所述用户信息关联的策略对象的输入参数,并根据所述输入参数执行与所述用户信息关联的策略对象中的逻辑代码。
  10. 一种基于策略模式的物品查询装置,包括:
    物品查询指令响应模块,设置为响应于用户的物品查询指令,确定用户信息和待查询物品的物品信息;其中,所述物品查询指令用于表征对待查询物品进行查询;
    策略对象确定模块,设置为根据所述用户信息,从预设的策略对象中确定与所述用户信息关联的策略对象;其中,所述策略对象用于表征查询物品所需执行的逻辑代码;
    物品查询模块,设置为根据所述待查询物品的物品信息,执行与所述用户信息关联的策略对象中的逻辑代码,对所述待查询物品进行查询。
  11. 根据权利要求10所述的装置,其中,所述策略对象确定模块,包括:
    查询逻辑类型确定单元,设置为根据所述用户信息,从预设的查询逻辑类型中确定与所述用户信息关联的查询逻辑类型;其中,所述查询逻辑类型表征查询物品所需执行的逻辑的种类;
    策略对象查找单元,设置为根据与所述用户信息关联的查询逻辑类型,从预设的策略对象中确定与所述用户信息关联的查询逻辑类型所对应的策略对象。
  12. 根据权利要求11所述的装置,其中,所述策略对象查找单元,包括:
    目标策略标识确定子单元,设置为根据与所述用户信息关联的查询逻辑类型,以及预设的查询逻辑类型与策略标识之间的关联关系,确定与所述用户信息关联的查询逻辑类型对应的目标策略标识;
    策略对象确认子单元,设置为根据所述目标策略标识,以及预设的策略标识与策略对象之间的关联关系,确定与所述目标策略标识对应的策略对象。
  13. 根据权利要求12所述的装置,其中,所述策略对象确认子单元,包括:
    目标策略实现类确定从单元,设置为若根据所述目标策略标识,以及预设的策略标识与策略对象之间的关联关系,确定不存在与所述目标策略标识对应的策略对象,则根据与所述用户信息关联的查询逻辑类型,从预先编写的策略实现类中确定目标策略实现类;
    策略对象生成从单元,设置为调用所述目标策略实现类,生成与所述目标策略标识对应的策略对象。
  14. 根据权利要求13所述的装置,其中,所述装置还包括:
    策略对象存储模块,设置为在调用所述目标策略实现类,生成与所述目标策略标识对应的策略对象之后,采用哈希映射,将与所述目标策略实现类对应的策略对象和所述目标策略标识进行关联存储。
  15. 根据权利要求13所述的装置,其中,所述策略对象生成从单元,具体设置为:
    根据Spring控制反转,从预设的工厂类中调用所述目标策略实现类,得到与所述目标策略标识对应的策略对象。
  16. 根据权利要求15所述的装置,其中,所述装置还包括:
    策略实现类聚合模块,设置为在根据Spring控制反转,从预设的工厂类中调用所述目标策略实现类,得到与所述目标策略标识对应的策略对象之前,获取预先编写的策略实现类,将所述策略实现类聚合至预设的工厂类中。
  17. 根据权利要求10-16中任一所述的装置,其中,所述用户信息包括用户身份,所述待查询物品的物品信息包括待查询物品的名称。
  18. 根据权利要求10-17中任一所述的装置,其中,所述物品查询模块,具体设置为:
    将所述待查询物品的名称作为与所述用户信息关联的策略对象的输入参数,并根据所述输入参数执行与所述用户信息关联的策略对象中的逻辑代码。
  19. 一种电子设备,包括:处理器,以及与所述处理器通信连接的存储器;
    所述存储器存储计算机执行指令;
    所述处理器执行所述存储器存储的计算机执行指令,以实现如权利要求1-9中任一项所述的基于策略模式的物品查询方法。
  20. 一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现如权利要求1-9中任一项所述的基于策略模式的物品查询方法。
  21. 一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现如权利要求1-9中任一项所述的基于策略模式的物品查询方法。
PCT/CN2022/119705 2022-05-24 2022-09-19 基于策略模式的物品查询方法、装置、设备及存储介质 WO2023226255A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210570976.7A CN115033211A (zh) 2022-05-24 2022-05-24 基于策略模式的物品查询方法、装置、设备及存储介质
CN202210570976.7 2022-05-24

Publications (1)

Publication Number Publication Date
WO2023226255A1 true WO2023226255A1 (zh) 2023-11-30

Family

ID=83120757

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/119705 WO2023226255A1 (zh) 2022-05-24 2022-09-19 基于策略模式的物品查询方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN115033211A (zh)
WO (1) WO2023226255A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115033211A (zh) * 2022-05-24 2022-09-09 青岛海尔科技有限公司 基于策略模式的物品查询方法、装置、设备及存储介质
CN115858885B (zh) * 2023-02-28 2023-06-30 美云智数科技有限公司 账套数据查询方法、装置、计算机设备和存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180189354A1 (en) * 2016-12-29 2018-07-05 Microsoft Technology Licensing, Llc Replacing pronouns with focus-specific objects in search queries
CN112541009A (zh) * 2020-12-23 2021-03-23 平安普惠企业管理有限公司 数据查询方法、装置、电子设备及存储介质
CN113326034A (zh) * 2020-02-28 2021-08-31 浙江大搜车软件技术有限公司 策略实现的调用方法及装置、电子设备、存储介质
CN114417089A (zh) * 2021-12-30 2022-04-29 深圳价值在线信息科技股份有限公司 查询方法、装置、终端设备及计算机可读存储介质
CN115033211A (zh) * 2022-05-24 2022-09-09 青岛海尔科技有限公司 基于策略模式的物品查询方法、装置、设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180189354A1 (en) * 2016-12-29 2018-07-05 Microsoft Technology Licensing, Llc Replacing pronouns with focus-specific objects in search queries
CN113326034A (zh) * 2020-02-28 2021-08-31 浙江大搜车软件技术有限公司 策略实现的调用方法及装置、电子设备、存储介质
CN112541009A (zh) * 2020-12-23 2021-03-23 平安普惠企业管理有限公司 数据查询方法、装置、电子设备及存储介质
CN114417089A (zh) * 2021-12-30 2022-04-29 深圳价值在线信息科技股份有限公司 查询方法、装置、终端设备及计算机可读存储介质
CN115033211A (zh) * 2022-05-24 2022-09-09 青岛海尔科技有限公司 基于策略模式的物品查询方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN115033211A (zh) 2022-09-09

Similar Documents

Publication Publication Date Title
WO2023226255A1 (zh) 基于策略模式的物品查询方法、装置、设备及存储介质
RU2670786C9 (ru) Система, способ и аппарат для управления группировкой устройств
WO2021036594A1 (zh) 一种应用于投屏场景的控制方法以及相关设备
KR102036977B1 (ko) 디바이스를 제어하는 방법 및 장치, 및 단말 디바이스
US20210210091A1 (en) Method, device, and storage medium for waking up via speech
JP6228676B2 (ja) 接続状態プロンプティング方法および装置
CN105634881B (zh) 应用场景推荐方法及装置
US9189196B2 (en) Compartmentalized self registration of external devices
RU2618937C2 (ru) Способ, устройство обновления и устройство для обновления
US10548003B2 (en) Electronic device for controlling an external device using a number and method thereof
US20170019518A1 (en) Method and apparatus for controlling devices
US10701532B2 (en) System and method of providing sensing data to an electronic device using a template to identify a data type and format for the electronic device
JP2017504921A (ja) インスタントメッセージング方法、装置、プログラム及び記録媒体
KR102110257B1 (ko) 전화번호를 이용하여 외부 기기를 제어하는 전자 기기 및 방법
WO2023056766A1 (zh) 信息显示方法及装置
CN113254784A (zh) 信息显示方法、装置、电子设备及存储介质
WO2019223601A1 (zh) 一种数据库系统及其建立方法和装置
CN104951522B (zh) 一种进行搜索的方法和装置
CN106933111B (zh) 一种控制设备的方法及装置
US20230034462A1 (en) Display control method and apparatus for virtual item, and display method and apparatus for virtual item
WO2023173666A1 (zh) 人脸支付方法、装置、电子设备、存储介质、程序和产品
US20170048292A1 (en) Electronic device and method for providing content
US20160028669A1 (en) Method of providing content and electronic device thereof
WO2023206576A1 (zh) 图像处理方法及装置
CN114238728B (zh) 车辆数据的处理方法、装置和设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22943443

Country of ref document: EP

Kind code of ref document: A1