CN111967931A - Method and equipment for mixed arrangement of list data elements - Google Patents
Method and equipment for mixed arrangement of list data elements Download PDFInfo
- Publication number
- CN111967931A CN111967931A CN202010746284.4A CN202010746284A CN111967931A CN 111967931 A CN111967931 A CN 111967931A CN 202010746284 A CN202010746284 A CN 202010746284A CN 111967931 A CN111967931 A CN 111967931A
- Authority
- CN
- China
- Prior art keywords
- list
- mixed
- data element
- data
- shuffled
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/06—Buying, selling or leasing transactions
- G06Q30/0601—Electronic shopping [e-shopping]
- G06Q30/0641—Electronic shopping [e-shopping] utilising user interfaces specially adapted for shopping
- G06Q30/0643—Electronic shopping [e-shopping] utilising user interfaces specially adapted for shopping graphically representing goods, e.g. 3D product representation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/221—Column-oriented storage; Management thereof
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/252—Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Business, Economics & Management (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Economics (AREA)
- General Business, Economics & Management (AREA)
- Strategic Management (AREA)
- Marketing (AREA)
- Development Economics (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
与现有技术相比,本申请通过一种用于列表数据元素混排的方法与设备,首先获取多个数据元素属性信息不同的待混排列表,接着基于预设规则及所述待混排列表,确定混排后列表的每个数据元素,最后将所述每个数据元素顺序组装,构成混排后列表,以实现多个待混排列表数据元素混排。通过该方法,可将不同列表中属性信息不同的数据元素混排在一个列表中,大大减少了开发人员的工作量,而且提高了代码效率,可满足实际需要。
Compared with the prior art, the present application uses a method and device for shuffling list data elements, firstly acquiring a plurality of lists to be shuffled with different attribute information of data elements, and then based on preset rules and the to-be-shuffled lists. list, determine each data element of the list after shuffling, and finally assemble each data element in sequence to form a list after shuffling, so as to realize the shuffling of data elements of multiple lists to be shuffled. Through this method, data elements with different attribute information in different lists can be shuffled into one list, which greatly reduces the workload of developers, improves code efficiency, and can meet actual needs.
Description
技术领域technical field
本申请涉及计算机数据处理技术领域,尤其涉及一种用于列表数据元素混排的技术。The present application relates to the technical field of computer data processing, and in particular, to a technology for shuffling list data elements.
背景技术Background technique
在电商运营中,经常需要将多个商品在页面上顺序展示。前端页面通过查询、调用商品数据列表接口,从后端获取商品数据列表,在页面中展示商品信息。但是,如果这些商品数据的属性信息例如类型、数据格式或者结构不同,则很难将这些商品数据混排在一个列表中,前端页面需要通过多个商品数据列表接口才能从后端获取这些商品数据,大大增加了开发人员的工作量,效率也不高。In e-commerce operations, it is often necessary to display multiple products sequentially on the page. The front-end page obtains the product data list from the back-end by querying and calling the product data list interface, and displays the product information on the page. However, if the attribute information of these commodity data such as type, data format or structure is different, it is difficult to mix these commodity data in a list, and the front-end page needs to pass multiple commodity data list interfaces to obtain these commodity data from the backend , which greatly increases the workload of developers, and the efficiency is not high.
发明内容SUMMARY OF THE INVENTION
本申请的目的是提供一种用于列表数据元素混排的方法与设备,用以解决现有技术中由不同属性信息的数据元素构成的多个列表的数据元素不能混排在一个列表中的技术问题。The purpose of this application is to provide a method and device for shuffling list data elements, so as to solve the problem in the prior art that the data elements of multiple lists composed of data elements with different attribute information cannot be shuffled in one list. technical problem.
根据本申请的一个方面,提供了一种用于列表数据元素混排的方法,其中,所述方法包括:According to one aspect of the present application, a method for shuffling list data elements is provided, wherein the method includes:
获取多个待混排列表,其中,每个待混排列表包含若干数据元素,并且至少有两个待混排列表的数据元素的属性信息不同;Acquiring multiple lists to be shuffled, wherein each list to be shuffled contains several data elements, and at least two of the data elements of the lists to be shuffled have different attribute information;
基于预设规则及所述待混排列表,确定混排后列表的每个数据元素,其中,所述每个数据元素从所述待混排列表中获取;Determine each data element of the shuffled list based on the preset rule and the to-be-shuffled list, wherein each data element is obtained from the to-be-shuffled list;
将所述每个数据元素顺序组装,构成混排后列表,以实现多个待混排列表数据元素混排。Each of the data elements is sequentially assembled to form a shuffled list, so as to realize shuffling of the data elements of a plurality of lists to be shuffled.
优选地,其中,所述属性信息包括以下至少任一项:Preferably, the attribute information includes at least any one of the following:
数据类型;type of data;
数据格式;Data Format;
数据结构。data structure.
优选地,其中,所述预设规则包括:Preferably, wherein, the preset rules include:
占位规则,其中,所述占位规则是用以确定混排后列表中每个数据元素的占位码;A placeholder rule, wherein the placeholder rule is used to determine the placeholder code of each data element in the shuffled list;
来源规则,其中,所述来源规则是用以确定混排后列表中每个数据元素的来源。A source rule, wherein the source rule is used to determine the source of each data element in the shuffled list.
优选地,其中,所述基于预设规则及所述待混排列表,确定混排后列表的每个数据元素包括:Preferably, wherein, based on the preset rule and the to-be-shuffled list, determining that each data element of the shuffled list includes:
基于占位规则,确定混排后列表的每个数据元素来自对应的待混排列表;Based on the placeholder rule, it is determined that each data element of the shuffled list comes from the corresponding list to be shuffled;
基于来源规则,从对应的待混排列表中获取对应数据元素,以确定混排后列表的每个数据元素。Based on the source rule, the corresponding data element is obtained from the corresponding to-be-shuffled list to determine each data element of the shuffled list.
优选地,其中,若基于来源规则,从对应的待混排列表中获取对应数据元素不存在或者为空,则将预设数据元素确定为混排后列表中对应数据元素。Preferably, if the corresponding data element obtained from the corresponding to-be-shuffled list based on the source rule does not exist or is empty, the preset data element is determined as the corresponding data element in the shuffled list.
优选地,其中,所述将所述每个数据元素顺序组装,构成混排后列表,以实现多个待混排列表数据元素混排包括:Preferably, wherein the sequential assembling of each of the data elements to form a shuffled list, so as to realize the shuffling of the data elements of a plurality of lists to be shuffled, includes:
判断所述每个数据元素是否存在重复,若存在,则只保留按顺序第一个出现的该数据元素,将其它重复数据元素替换为预设数据元素,以优化混排后列表的数据元素;Judging whether there is repetition in each of the data elements, if there is, only the data element that appears first in order is retained, and other repeated data elements are replaced with preset data elements to optimize the data elements of the shuffled list;
将优化后的每个数据元素顺序组装,构成混排后列表,以实现多个待混排列表数据元素混排。Each optimized data element is sequentially assembled to form a shuffled list, so as to realize shuffling of data elements of multiple lists to be shuffled.
优选地,其中,所述方法还包括:Preferably, wherein, the method further comprises:
响应页面展示调用指令并返回所述混排后列表,以实现混排列表数据元素的页面展示。Responding to the page display calling instruction and returning the shuffled list, so as to realize page display of the shuffled list data elements.
优选地,其中,所述方法还包括:Preferably, wherein, the method further comprises:
响应后台列表管理调用指令并返回所述混排后列表,以实现后台列表管理。Responding to a background list management calling instruction and returning the shuffled list to implement background list management.
根据本申请的另一方面,还提供了一种用于列表数据元素混排的设备,其中,所述设备包括:According to another aspect of the present application, a device for shuffling list data elements is also provided, wherein the device includes:
第一装置,用于用于获取多个待混排列表,其中,每个待混排列表包含若干数据元素,并且至少有两个待混排列表的数据元素的属性信息不同;a first device, configured to obtain a plurality of lists to be shuffled, wherein each list to be shuffled contains several data elements, and at least two of the data elements of the to-be-shuffled lists have different attribute information;
第二装置,用于基于预设规则及所述待混排列表,确定混排后列表的每个数据元素,其中,所述每个数据元素从所述待混排列表中获取;a second device, configured to determine each data element of the shuffled list based on a preset rule and the to-be-shuffled list, wherein each data element is obtained from the to-be-shuffled list;
第三装置,用于将所述每个数据元素顺序组装,构成混排后列表,以实现多个待混排列表数据元素混排。The third device is configured to sequentially assemble each of the data elements to form a shuffled list, so as to realize shuffling of data elements of a plurality of lists to be shuffled.
优选地,其中,所述设备还包括:Preferably, wherein, the device further comprises:
第四装置,用于响应页面展示调用指令并返回所述混排后列表,以实现混排列表数据元素的页面展示。The fourth device is configured to respond to the page display calling instruction and return the shuffled list, so as to realize the page display of the shuffled list data elements.
优选地,其中,所述设备还包括:Preferably, wherein, the device further comprises:
第五装置,用于响应后台列表管理调用指令并返回所述混排后列表,以实现后台列表管理。The fifth device is used for responding to the background list management calling instruction and returning the shuffled list, so as to realize background list management.
附图说明Description of drawings
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本发明的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present invention will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
图1示出根据本申请一个方面的一种用于列表数据元素混排的方法流程图;1 shows a flowchart of a method for shuffling list data elements according to an aspect of the present application;
图2示出根据本申请另一个方面的一种用于列表数据元素混排的设备示意图;2 shows a schematic diagram of a device for shuffling list data elements according to another aspect of the present application;
附图中相同或相似的附图标记代表相同或相似的部件。The same or similar reference numbers in the drawings represent the same or similar parts.
具体实施方式Detailed ways
下面结合附图对本发明作进一步详细描述。The present invention will be described in further detail below with reference to the accompanying drawings.
在本申请一个典型的配置中,系统各模块和可信方均包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration of the present application, each module of the system and the trusted party include one or more processors (CPUs), input/output interfaces, network interfaces and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-persistent memory in computer readable media, random access memory (RAM) and/or non-volatile memory in the form of, for example, read only memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media includes both persistent and non-permanent, removable and non-removable media, and storage of information may be implemented by any method or technology. Information may be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape-disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, excludes non-transitory computer-readable media, such as modulated data signals and carrier waves.
为更进一步阐述本申请所采取的技术手段及取得的效果,下面结合附图及优选实施例,对本申请的技术方案,进行清楚和完整的描述。In order to further illustrate the technical means adopted in the present application and the obtained effects, the following describes the technical solutions of the present application in a clear and complete manner with reference to the accompanying drawings and preferred embodiments.
图1示出本申请一个方面的一种用于列表数据元素混排的方法流程图,其中,一个实施例的方法包括:1 shows a flowchart of a method for shuffling list data elements according to an aspect of the present application, wherein the method of an embodiment includes:
S11获取多个待混排列表,其中,每个待混排列表包含若干数据元素,并且至少有两个待混排列表的数据元素的属性信息不同;S11 obtains multiple lists to be shuffled, wherein each list to be shuffled contains several data elements, and at least two of the data elements of the lists to be shuffled have different attribute information;
S12基于预设规则及所述待混排列表,确定混排后列表的每个数据元素,其中,所述每个数据元素从所述待混排列表中获取;S12, based on a preset rule and the to-be-shuffled list, determine each data element of the shuffled list, wherein each data element is obtained from the to-be-shuffled list;
S13将所述每个数据元素顺序组装,构成混排后列表,以实现多个待混排列表数据元素混排。S13 sequentially assembles each of the data elements to form a shuffled list, so as to realize shuffling of data elements of a plurality of lists to be shuffled.
在本申请中,所述方法通过设备1执行,所述设备1为计算机设备和/或云,所述计算机设备包括但不限于个人计算机、笔记本电脑、工业计算机、网络主机、单个网络服务器、多个网络服务器集;所述云由基于云计算(Cloud Computing)的大量计算机或网络服务器构成,其中,云计算是分布式计算的一种,由一群松散耦合的计算机集组成的一个虚拟超级计算机。In this application, the method is performed by a device 1, which is a computer device and/or a cloud, and the computer device includes, but is not limited to, a personal computer, a laptop computer, an industrial computer, a network host, a single network server, multiple A network server set; the cloud is composed of a large number of computers or network servers based on cloud computing, wherein cloud computing is a kind of distributed computing, a virtual supercomputer composed of a group of loosely coupled computer sets.
在此,所述计算机设备和/或云仅为举例,其他现有的或者今后可能出现的设备和/或资源共享平台如适用于本申请也应包含在本申请的保护范围内,在此,以引用的方式包含于此。Here, the computer equipment and/or cloud are only examples, and other existing or future equipment and/or resource sharing platforms, if applicable to this application, should also be included in the protection scope of this application. Here, Incorporated herein by reference.
在该实施例中,在所述步骤S11中,设备1获取多个待混排列表,其中,在所述的多个待混排列表中,每个待混排列表都包含若干数据元素,并且至少有两个待混排列表的数据元素的属性信息不同。In this embodiment, in the step S11, the device 1 acquires multiple lists to be shuffled, wherein, in the multiple lists to be shuffled, each list to be shuffled includes several data elements, and At least two data elements of the to-be-shuffled list have different attribute information.
例如,电商需要根据营运策略及包装展示规则,设计Web页面中商品的展示。与商品对应的商品数据包装存放在后台商品列表中,一个待混排的商品列表包含属性信息相同的若干商品元素,比如,商品列表L1包含n个普通电商商品数据{a1,a2,a3,……,an},商品列表L2包含m个二手优品数据{b1,b2,b3,……,bm},商品列表L3包含k个特价商品数据{c1,c2,c3,……,ck}。For example, an e-commerce company needs to design the display of products on the Web page according to the operation strategy and packaging display rules. The product data package corresponding to the product is stored in the back-end product list. A product list to be shuffled contains several product elements with the same attribute information. For example, the product list L1 contains n ordinary e-commerce product data {a1, a2, a3, ...,an}, the product list L2 contains m second-hand excellent product data {b1,b2,b3,...,bm}, the product list L3 contains k special product data {c1,c2,c3,...,ck} .
优选地,其中,所述属性信息包括以下至少任一项:Preferably, the attribute information includes at least any one of the following:
数据类型;type of data;
数据格式;Data Format;
数据结构。data structure.
例如,电商的商品通常包括普通电商商品、备件库商品、二手优品、广告商品、特价商品等类型,所述商品对应的商品数据的属性信息还包括但不限于数据格式、结构、商品价格、库存商品数量等。For example, e-commerce commodities usually include common e-commerce commodities, spare parts warehouse commodities, second-hand premium products, advertising commodities, special offer commodities, etc. The attribute information of commodity data corresponding to the commodities also includes, but is not limited to, data format, structure, commodity Price, quantity of items in stock, etc.
继续在该实施例中,在所述步骤S12中,设备1根据预设规则,从多个待混排列表中获取数据元素,以确定混排后列表的每个数据元素。Continuing in this embodiment, in the step S12, the device 1 acquires data elements from a plurality of lists to be shuffled according to a preset rule, so as to determine each data element of the shuffled list.
例如,电商根据营运策略及包装展示规则等,需要在Web页面中展示不同属性的商品,那么商品对应的商品数据存放在不同的商品列表中,前端Web页面根据设计好的规则,访问在Web页面中要展示的商品对应的商品列表接口,获取到相应的不同属性的商品,包装后统一输出到Web页面。比如,需要在Web页面展示商品对应的列表为L,列表L包含8个商品数据元素{a1,a2,b1,b2,b3,a3,c2,c3},这8个商品数据元素是基于预设好的规则,分别从列表L1、L2和L3中获取的。For example, an e-commerce company needs to display products with different attributes on the Web page according to the operation strategy and packaging display rules, etc., then the product data corresponding to the product is stored in different product lists, and the front-end Web page can be accessed on the Web page according to the designed rules. The product list interface corresponding to the product to be displayed on the page, obtains the corresponding product with different attributes, and outputs it to the Web page after packaging. For example, the list corresponding to the product that needs to be displayed on the web page is L, and the list L contains 8 product data elements {a1, a2, b1, b2, b3, a3, c2, c3}. These 8 product data elements are based on preset Good rules, taken from lists L1, L2 and L3 respectively.
优选地,其中,所述预设规则包括:Preferably, wherein, the preset rules include:
占位规则,其中,所述占位规则是用以确定混排后列表中每个数据元素的占位码;A placeholder rule, wherein the placeholder rule is used to determine the placeholder code of each data element in the shuffled list;
来源规则,其中,所述来源规则是用以确定混排后列表中每个数据元素的来源。A source rule, wherein the source rule is used to determine the source of each data element in the shuffled list.
比如,在Web页面展示商品对应的列表为L,列表L包含8个商品数据元素{a1,a2,b1,b2,b3,a3,c1,c2},这8个商品数据元素是基于预设的占位规则和来源规则,分别从列表L1、L2和L3中获取的。For example, the list corresponding to the products displayed on the Web page is L, and the list L contains 8 commodity data elements {a1, a2, b1, b2, b3, a3, c1, c2}, and these 8 commodity data elements are based on preset Placeholder rules and source rules, obtained from lists L1, L2, and L3, respectively.
优选地,其中,所述基于预设规则及所述待混排列表,确定混排后列表的每个数据元素包括:Preferably, wherein, based on the preset rule and the to-be-shuffled list, determining that each data element of the shuffled list includes:
基于占位规则,确定混排后列表的每个数据元素来自对应的待混排列表;Based on the placeholder rule, it is determined that each data element of the shuffled list comes from the corresponding list to be shuffled;
基于来源规则,从对应的待混排列表中获取对应数据元素,以确定混排后列表的每个数据元素。Based on the source rule, the corresponding data element is obtained from the corresponding to-be-shuffled list to determine each data element of the shuffled list.
在基于java或其他程序设计代码的应用场景中,其中,占位规则可定义为数组,数组中每个元素标识列表L中对应位置的占位码,即列表L中对应位置的数据元素是从列表L1、L2和L3中的哪个列表中获取的,比如列表L对应的占位码数组若设计为(1,1,2,2,2,1,3,3),则列表L中第1、2、6这3个位置对应的数据元素来自列表L1,列表L中第3、4、5这3个位置对应的数据元素来自列表L2,列表L中第7、8这2个位置对应的数据元素来自列表L3。In an application scenario based on java or other programming codes, the placeholder rule can be defined as an array, and each element in the array identifies the placeholder code at the corresponding position in the list L, that is, the data element at the corresponding position in the list L is from Which of the lists L1, L2, and L3 is obtained from, for example, if the placeholder code array corresponding to list L is designed as (1,1,2,2,2,1,3,3), then the first place in list L The data elements corresponding to the three positions of , 2 and 6 come from the list L1, the data elements corresponding to the 3rd, 4th, and 5th positions in the list L come from the list L2, and the 7th and 8th positions in the list L correspond to the two positions. The data elements are from list L3.
在基于java或其他程序设计代码的应用场景中,其中,来源规则也可定义为数组,数组中每个元素标识列表L中对应位置的来源,即列表L中对应位置的数据元素是基于占位码确定的列表中位置对应的数据元素。比如列表L对应的来源数组若设计为(1,2,1,2,3,3,1,2),则在占位码数组确定列表L中各位置对应的数据元素来自哪个列表基础上,可进一步确定列表L中各个数据元素:第1个位置对应的数据元素是列表L1中第1个数据元素a1,第2个位置对应的数据元素是列表L1中第2个数据元素a2,第3个位置对应的数据元素是列表L2中第1个数据元素b1,第4个位置对应的数据元素是列表L2中第2个数据元素b2,第5个位置对应的数据元素是列表L2中第3个数据元素b3,第6个位置对应的数据元素是列表L1中第3个数据元素a3,第7个位置对应的数据元素是列表L3中第1个数据元素c1,第8个位置对应的数据元素是列表L2中第2个数据元素c2。In the application scenario based on java or other programming code, the source rule can also be defined as an array, and each element in the array identifies the source of the corresponding position in the list L, that is, the data element in the corresponding position in the list L is based on the placeholder The data element corresponding to the position in the list determined by the code. For example, if the source array corresponding to list L is designed as (1, 2, 1, 2, 3, 3, 1, 2), then the placeholder code array determines which list the data elements corresponding to each position in list L come from. Each data element in the list L can be further determined: the data element corresponding to the first position is the first data element a1 in the list L1, the data element corresponding to the second position is the second data element a2 in the list L1, the third The data element corresponding to the first position is the first data element b1 in the list L2, the data element corresponding to the fourth position is the second data element b2 in the list L2, and the data element corresponding to the fifth position is the third data element in the list L2. data element b3, the data element corresponding to the sixth position is the third data element a3 in the list L1, the data element corresponding to the seventh position is the first data element c1 in the list L3, and the data corresponding to the eighth position The element is the second data element c2 in list L2.
优选地,其中,若基于来源规则,从对应的待混排列表中获取对应数据元素不存在或者为空,则将预设数据元素确定为混排后列表中对应数据元素。Preferably, if the corresponding data element obtained from the corresponding to-be-shuffled list based on the source rule does not exist or is empty, the preset data element is determined as the corresponding data element in the shuffled list.
例如,在上述实施例中,若列表L2中只包含2个数据元素,根据预设规则,列表L中第5个位置对应的数据元素是列表L2中第3个数据元素,该数据元素不存在,则列表L中第5个位置对应的数据元素是预设数据元素,比如某个特价商品对应的数据元素A;或者若列表L2中第3个数据元素对应的是空数据元素,根据预设规则,列表L中第5个位置对应的数据元素是列表L2中第3个数据元素,但该数据元素是空数据元素,则列表L中第5个位置对应的数据元素也是预设数据元素,比如某个特价商品对应的数据元素A。采取此方式,以优化数据元素,在数据元素不全的情况下也可得到完整的混排列表。For example, in the above embodiment, if the list L2 contains only two data elements, according to the preset rule, the data element corresponding to the fifth position in the list L is the third data element in the list L2, and the data element does not exist , then the data element corresponding to the fifth position in the list L is a preset data element, such as the data element A corresponding to a special offer; or if the third data element in the list L2 corresponds to an empty data element, according to the preset Rule, the data element corresponding to the 5th position in the list L is the 3rd data element in the list L2, but the data element is an empty data element, then the data element corresponding to the 5th position in the list L is also a preset data element, For example, the data element A corresponding to a special offer. In this way, the data elements are optimized, and a complete shuffled list can be obtained even if the data elements are incomplete.
继续在该实施例中,在所述步骤S13中,设备1将根据预设规则从待混排列表中获得的每个数据元素顺序组装,构成混排后列表,以实现多个待混排列表数据元素混排。Continuing in this embodiment, in the step S13, the device 1 sequentially assembles each data element obtained from the to-be-shuffled list according to the preset rule to form a shuffled list, so as to realize multiple to-be-shuffled lists Data elements are shuffled.
例如,在基于java或其他程序设计代码的应用场景中,按照预设占位码数组(1,1,2,2,2,1,3,3)和来源数组(1,2,1,2,3,3,1,2),确定了混排后列表L每个位置对应的数据元素:第1个位置对应的数据元素是列表L1中第1个数据元素a1,第2个位置对应的数据元素是列表L1中第2个数据元素a2,第3个位置对应的数据元素是列表L2中第1个数据元素b1,第4个位置对应的数据元素是列表L2中第2个数据元素b2,第5个位置对应的数据元素是列表L2中第3个数据元素b3,第6个位置对应的数据元素是列表L1中第3个数据元素a3,第7个位置对应的数据元素是列表L3中第1个数据元素c1,第8个位置对应的数据元素是列表L2中第2个数据元素c2,将得到的这8个数据元素顺序组装,构成混排后列表L为{a1,a2,b1,b2,b3,a3,c1,c2}。如果列表L2中第3个数据元素不存在或者是空的数据元素,则列表L中第5个位置对应的数据元素是预设数据元素A,则在数据元素不全的情况下优化得到的完整混排列表L为{a1,a2,b1,b2,A,a3,c1,c2}。For example, in an application scenario based on java or other programming code, according to the preset placeholder code array (1,1,2,2,2,1,3,3) and source array (1,2,1,2 ,3,3,1,2), determine the data elements corresponding to each position of the list L after shuffling: the data element corresponding to the first position is the first data element a1 in the list L1, and the second position corresponds to The data element is the second data element a2 in the list L1, the data element corresponding to the third position is the first data element b1 in the list L2, and the data element corresponding to the fourth position is the second data element b2 in the list L2 , the data element corresponding to the fifth position is the third data element b3 in the list L2, the data element corresponding to the sixth position is the third data element a3 in the list L1, and the data element corresponding to the seventh position is the list L3 The first data element c1, the data element corresponding to the eighth position is the second data element c2 in the list L2, and the obtained eight data elements are assembled in sequence to form a shuffled list L as {a1, a2, b1,b2,b3,a3,c1,c2}. If the third data element in the list L2 does not exist or is an empty data element, then the data element corresponding to the fifth position in the list L is the preset data element A, and the optimized complete mixture is obtained in the case of incomplete data elements. The permutation table L is {a1,a2,b1,b2,A,a3,c1,c2}.
优选地,其中,所述将所述每个数据元素顺序组装,构成混排后列表,以实现多个待混排列表数据元素混排包括:Preferably, wherein the sequential assembling of each of the data elements to form a shuffled list, so as to realize the shuffling of the data elements of a plurality of lists to be shuffled, includes:
判断所述每个数据元素是否存在重复,若存在,则只保留按顺序第一个出现的该数据元素,将其它重复数据元素替换为预设数据元素,以优化混排后列表的数据元素;Judging whether there is repetition in each of the data elements, if there is, only the data element that appears first in order is retained, and other repeated data elements are replaced with preset data elements to optimize the data elements of the shuffled list;
将优化后的每个数据元素顺序组装,构成混排后列表,以实现多个待混排列表数据元素混排。Each optimized data element is sequentially assembled to form a shuffled list, so as to realize shuffling of data elements of multiple lists to be shuffled.
例如,在基于java或其他程序设计代码的应用场景中,按照预设占位码数组(1,1,2,2,2,1,3,3)和来源数组(1,2,1,2,3,3,1,2),确定了混排后列表L每个位置对应的数据元素:第1个位置对应的数据元素是列表L1中第1个数据元素a1,第2个位置对应的数据元素是列表L1中第2个数据元素a2,第3个位置对应的数据元素是列表L2中第1个数据元素b1,第4个位置对应的数据元素是列表L2中第2个数据元素b2,第5个位置对应的数据元素是列表L2中第3个数据元素b3,第6个位置对应的数据元素是列表L1中第3个数据元素a3,第7个位置对应的数据元素是列表L3中第1个数据元素c1,第8个位置对应的数据元素是列表L2中第2个数据元素c2。将得到的全部8个数据元素进行对比,或者在获得某个位置对应的数据元素时,与已获得的数据元素进行对比,比如,如果a2与c1相同,即混排后列表L的第2个位置对应的数据元素a2和第7个位置对应的数据元素c1重复,则只保留第2个位置对应的数据元素a2,将第7个位置对应的数据元素替换为预设数据元素A,以实现数据元素优化,然后将优化后的每个数据元素顺序组装,构成混排后列表L为{a1,a2,b1,b2,a3,a3,A,c2}。For example, in an application scenario based on java or other programming code, according to the preset placeholder code array (1,1,2,2,2,1,3,3) and source array (1,2,1,2 ,3,3,1,2), determine the data elements corresponding to each position of the list L after shuffling: the data element corresponding to the first position is the first data element a1 in the list L1, and the second position corresponds to The data element is the second data element a2 in the list L1, the data element corresponding to the third position is the first data element b1 in the list L2, and the data element corresponding to the fourth position is the second data element b2 in the list L2 , the data element corresponding to the fifth position is the third data element b3 in the list L2, the data element corresponding to the sixth position is the third data element a3 in the list L1, and the data element corresponding to the seventh position is the list L3 The first data element c1, the data element corresponding to the eighth position is the second data element c2 in the list L2. Compare all the 8 data elements obtained, or when obtaining the data element corresponding to a certain position, compare it with the obtained data element, for example, if a2 is the same as c1, that is, the second item in the list L after shuffling If the data element a2 corresponding to the position and the data element c1 corresponding to the seventh position are repeated, only the data element a2 corresponding to the second position is retained, and the data element corresponding to the seventh position is replaced with the preset data element A to achieve Data elements are optimized, and then each optimized data element is sequentially assembled to form a shuffled list L as {a1, a2, b1, b2, a3, a3, A, c2}.
优选地,其中,所述一种用于列表数据元素混排的方法还包括:Preferably, the method for shuffling list data elements further includes:
响应页面展示调用指令并返回所述混排后列表,以实现混排列表数据元素的页面展示。Responding to the page display calling instruction and returning the shuffled list, so as to realize page display of the shuffled list data elements.
例如,在基于java或其他程序设计代码的应用场景中,需要在Web页面中展示不同类型商品,触发Web页面链接后,Web页面向后台发出页面展示调用指令,后台在接收到该页面展示调用指令后,基于预设规则从不同类型的列表中获取商品对应的数据元素,混排后得到与Web页面中展示商品对应的混排后列表,通过列表接口返回商品对应的混排后列表,经渲染后在Web页面上展示。For example, in an application scenario based on java or other programming code, it is necessary to display different types of products on the web page. After triggering the web page link, the web page sends a page display call instruction to the background, and the background receives the page display call instruction. Then, based on the preset rules, the data elements corresponding to the products are obtained from different types of lists. After shuffling, the shuffled list corresponding to the products displayed on the Web page is obtained, and the shuffled list corresponding to the products is returned through the list interface. After rendering and then displayed on the web page.
优选地,其中,所述一种用于列表数据元素混排的方法还包括:Preferably, the method for shuffling list data elements further includes:
响应后台列表管理调用指令并返回所述混排后列表,以实现后台列表管理。Responding to a background list management calling instruction and returning the shuffled list to implement background list management.
例如,在基于java或其他程序设计代码的应用场景中,需要调用商品对应数据元素属性不同的一个混排后列表作为待混排列表,用于其它列表的混排或其它管理需求,则在后台接收到列表管理调用指令后,返回相应的混排后列表,以满足其它列表的混排或管理要求。For example, in an application scenario based on java or other programming code, it is necessary to call a shuffled list with different attributes of the corresponding data elements of the product as the to-be-shuffled list for shuffling of other lists or other management requirements, then in the background After receiving the list management calling instruction, return the corresponding shuffled list to meet the shuffling or management requirements of other lists.
图2示出根据本申请另一个方面的一种用于列表数据元素混排的设备示意图,其中,所述设备包括:2 shows a schematic diagram of a device for shuffling list data elements according to another aspect of the present application, wherein the device includes:
第一装置21,用于获取多个待混排列表,其中,每个待混排列表包含若干数据元素,其中,至少有两个待混排列表的数据元素的属性信息不同;a
第二装置22,用于基于预设规则及所述待混排列表,确定混排后列表的每个数据元素,其中,所述每个数据元素从所述待混排列表中获取;A
第三装置23,用于将所述每个数据元素顺序组装,构成混排后列表,以实现多个待混排列表数据元素混排。The
在该实施例中,设备1包含第一装置、第二装置和第三装置,以实现上述图1实施例的方法。In this embodiment, the apparatus 1 includes a first device, a second device and a third device, so as to implement the method of the above-mentioned embodiment of FIG. 1 .
优选地,所述设备还包括:Preferably, the device further includes:
第四装置24(未示出),用于响应页面展示调用指令并返回所述混排后列表,以实现混排列表数据元素的页面展示。The fourth device 24 (not shown) is configured to respond to the page display invocation instruction and return the shuffled list, so as to realize page display of the shuffled list data elements.
优选地,所述设备还包括:Preferably, the device further includes:
第五装置25(未示出),用于响应后台列表管理调用指令并返回所述混排后列表,以实现后台列表管理。The fifth device 25 (not shown) is configured to respond to the background list management calling instruction and return the shuffled list, so as to realize background list management.
根据本申请的又一方面,还提供了一种计算机可读介质,所述计算机可读介质存储有计算机可读指令,所述计算机可读指令可被处理器执行以实现前述方法。According to yet another aspect of the present application, there is also provided a computer-readable medium storing computer-readable instructions executable by a processor to implement the aforementioned method.
根据本申请的又一方面,还提供了用于列表数据元素混排的设备,其中,该设备包括:According to yet another aspect of the present application, an apparatus for shuffling list data elements is also provided, wherein the apparatus includes:
一个或多个处理器;以及one or more processors; and
存储有计算机可读指令的存储器,所述计算机可读指令在被执行时使所述处理器执行如前述方法的操作。A memory storing computer readable instructions which, when executed, cause the processor to perform operations as the aforementioned methods.
例如,计算机可读指令在被执行时使所述一个或多个处理器:获取多个待混排列表,基于预设规则及所述待混排列表,确定混排后列表的每个数据元素,将所述每个数据元素顺序组装,构成混排后列表,以实现多个待混排列表数据元素混排。For example, the computer-readable instructions, when executed, cause the one or more processors to: obtain a plurality of lists to be shuffled, and based on preset rules and the lists to be shuffled, determine each data element of the shuffled list , assemble each data element in sequence to form a shuffled list, so as to realize shuffling of data elements of multiple lists to be shuffled.
对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本发明内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。装置权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。It will be apparent to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, but that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments are to be regarded in all respects as illustrative and not restrictive, and the scope of the invention is to be defined by the appended claims rather than the foregoing description, which are therefore intended to fall within the scope of the claims. All changes within the meaning and range of the equivalents of , are included in the present invention. Any reference signs in the claims shall not be construed as limiting the involved claim. Furthermore, it is clear that the word "comprising" does not exclude other units or steps and the singular does not exclude the plural. Several units or means recited in the device claims can also be realized by one unit or means by means of software or hardware. The terms first, second, etc. are used to denote names and do not denote any particular order.
Claims (13)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010746284.4A CN111967931B (en) | 2020-07-29 | 2020-07-29 | A method and device for shuffling list data elements |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010746284.4A CN111967931B (en) | 2020-07-29 | 2020-07-29 | A method and device for shuffling list data elements |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111967931A true CN111967931A (en) | 2020-11-20 |
| CN111967931B CN111967931B (en) | 2024-01-12 |
Family
ID=73363055
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010746284.4A Active CN111967931B (en) | 2020-07-29 | 2020-07-29 | A method and device for shuffling list data elements |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111967931B (en) |
Citations (12)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101359332A (en) * | 2008-09-02 | 2009-02-04 | 浙江大学 | Design method of visual search interface with semantic classification function |
| US20110154198A1 (en) * | 2009-12-18 | 2011-06-23 | Apple Inc. | Mixed source media playback |
| CN103136237A (en) * | 2011-11-28 | 2013-06-05 | 深圳市腾讯计算机系统有限公司 | Information search method and information search system based on multiple data sources |
| EP2608070A1 (en) * | 2011-12-22 | 2013-06-26 | Sap Ag | Hybrid database table stored as both row and column store |
| CN104714949A (en) * | 2013-12-11 | 2015-06-17 | 航天信息股份有限公司 | Method for customizing report dynamically |
| CN106651547A (en) * | 2017-01-04 | 2017-05-10 | 泰康保险集团股份有限公司 | Data processing method and device |
| CN106897285A (en) * | 2015-12-17 | 2017-06-27 | 北京宸瑞国新科技有限公司 | Data Elements extract analysis system and Data Elements extract analysis method |
| US20170323003A1 (en) * | 2016-05-06 | 2017-11-09 | International Business Machines Corporation | Value range synopsis in column-organized analytical databases |
| CN107992625A (en) * | 2017-12-25 | 2018-05-04 | 湖南星汉数智科技有限公司 | A kind of automatic abstracting method of web page form data and device |
| CN108205554A (en) * | 2016-12-16 | 2018-06-26 | 北京国双科技有限公司 | The sort method and device of array object |
| CN109271075A (en) * | 2018-09-06 | 2019-01-25 | 天津字节跳动科技有限公司 | Page elements autoplacement method and device |
| US20190129997A1 (en) * | 2017-10-26 | 2019-05-02 | Sap Se | Data separation and write redirection in multi-tenancy database systems |
-
2020
- 2020-07-29 CN CN202010746284.4A patent/CN111967931B/en active Active
Patent Citations (12)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101359332A (en) * | 2008-09-02 | 2009-02-04 | 浙江大学 | Design method of visual search interface with semantic classification function |
| US20110154198A1 (en) * | 2009-12-18 | 2011-06-23 | Apple Inc. | Mixed source media playback |
| CN103136237A (en) * | 2011-11-28 | 2013-06-05 | 深圳市腾讯计算机系统有限公司 | Information search method and information search system based on multiple data sources |
| EP2608070A1 (en) * | 2011-12-22 | 2013-06-26 | Sap Ag | Hybrid database table stored as both row and column store |
| CN104714949A (en) * | 2013-12-11 | 2015-06-17 | 航天信息股份有限公司 | Method for customizing report dynamically |
| CN106897285A (en) * | 2015-12-17 | 2017-06-27 | 北京宸瑞国新科技有限公司 | Data Elements extract analysis system and Data Elements extract analysis method |
| US20170323003A1 (en) * | 2016-05-06 | 2017-11-09 | International Business Machines Corporation | Value range synopsis in column-organized analytical databases |
| CN108205554A (en) * | 2016-12-16 | 2018-06-26 | 北京国双科技有限公司 | The sort method and device of array object |
| CN106651547A (en) * | 2017-01-04 | 2017-05-10 | 泰康保险集团股份有限公司 | Data processing method and device |
| US20190129997A1 (en) * | 2017-10-26 | 2019-05-02 | Sap Se | Data separation and write redirection in multi-tenancy database systems |
| CN107992625A (en) * | 2017-12-25 | 2018-05-04 | 湖南星汉数智科技有限公司 | A kind of automatic abstracting method of web page form data and device |
| CN109271075A (en) * | 2018-09-06 | 2019-01-25 | 天津字节跳动科技有限公司 | Page elements autoplacement method and device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111967931B (en) | 2024-01-12 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US20220051238A1 (en) | Method and apparatus for verifying commodities in batches based on blockchain, and electronic device | |
| EP3776249A1 (en) | Blockchain-based cross-chain data access method and apparatus | |
| US11294875B2 (en) | Data storage on tree nodes | |
| CN111898139B (en) | Data reading and writing method and device, and electronic equipment | |
| TW202016815A (en) | Method, apparatus and system for executing block chain transaction in parallelized manner | |
| WO2020082875A1 (en) | Blockchain-based cross-chain data access method and apparatus | |
| US20220300954A1 (en) | Decentralized tagging using tokenized strings | |
| CN111782725A (en) | Interaction method and device, system and electronic device across blockchain | |
| CN108599973B (en) | A log association method, device and device | |
| US11775507B2 (en) | Methods and apparatuses for reading and updating data structures, and electronic devices | |
| US11972465B2 (en) | Social network-based inventory management | |
| US12524623B2 (en) | Extensible digital assistant interface using natural language processing to respond to user intent | |
| CN113222667B (en) | Equity sharing processing method and device | |
| CN111756779B (en) | Data serialization processing method, device and computer system | |
| CN106250310A (en) | A kind of method for generating test case and device | |
| CN111506580B (en) | A transaction storage method based on a centralized blockchain ledger | |
| US12001395B2 (en) | Request handling in a multi-protocol cloud environment | |
| CN113298343A (en) | Task generation method, task execution method and device | |
| US20240420221A1 (en) | Order processing method and apparatus | |
| CN110008431B (en) | Page component construction method and device, page generation equipment and readable storage medium | |
| JP2019509567A (en) | Resource loading method, service function implementing method and apparatus for application (APP) | |
| US11526716B2 (en) | Barcode generation methods and apparatuses | |
| CN111967931B (en) | A method and device for shuffling list data elements | |
| CN113987322A (en) | Index data query method, device, computer equipment and computer program product | |
| US9230022B1 (en) | Customizable result sets for application program interfaces |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information | ||
| CB02 | Change of applicant information |
Address after: Room 1101-1103, No. 433, Songhu Road, Yangpu District, Shanghai Applicant after: Shanghai wanwansheng Environmental Protection Technology Group Co.,Ltd. Address before: Room 1101-1103, No. 433, Songhu Road, Yangpu District, Shanghai Applicant before: SHANGHAI YUEYI NETWORK INFORMATION TECHNOLOGY Co.,Ltd. |
|
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP03 | Change of name, title or address | ||
| CP03 | Change of name, title or address |
Address after: Room 1101-1103, No. 433, Songhu Road, Yangpu District, Shanghai Patentee after: Shanghai Wanwu Xinsheng Information Technology Group Co.,Ltd. Country or region after: China Address before: Room 1101-1103, No. 433, Songhu Road, Yangpu District, Shanghai Patentee before: Shanghai wanwansheng Environmental Protection Technology Group Co.,Ltd. Country or region before: China |