Nothing Special   »   [go: up one dir, main page]

CN106126564A - A kind of method rendered based on dynamic template language - Google Patents

A kind of method rendered based on dynamic template language Download PDF

Info

Publication number
CN106126564A
CN106126564A CN201610431674.6A CN201610431674A CN106126564A CN 106126564 A CN106126564 A CN 106126564A CN 201610431674 A CN201610431674 A CN 201610431674A CN 106126564 A CN106126564 A CN 106126564A
Authority
CN
China
Prior art keywords
xml
definition
template
file
sql syntax
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.)
Pending
Application number
CN201610431674.6A
Other languages
Chinese (zh)
Inventor
徐顺可
严立青
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Wanpeng Education Technology Co Ltd
Original Assignee
Zhejiang Wanpeng Education Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Wanpeng Education Technology Co Ltd filed Critical Zhejiang Wanpeng Education Technology Co Ltd
Priority to CN201610431674.6A priority Critical patent/CN106126564A/en
Publication of CN106126564A publication Critical patent/CN106126564A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The invention discloses a kind of method rendered based on dynamic template language.The present invention comprises the steps: (1): the template of definition common method set, uses preserving with vm form of Velocity engine, uses Freemarker engine to preserve with ftl form;(2): definition XML structure definition file xsd, this document, for describing the structure of XML document, is used for checking the legitimacy of XML document;(3): the XML configuration file of definition SQL syntax, concrete: according to the structure definition file of step 2, to configure conventional SQL syntax in xml, the one or more common methods in the template defined in step 1 can be quoted;(4): load XML configuration file, system code separates out SQL syntax according to dynamic resolution in XML configuration file, then according to SQL syntax, coordinates jdbcTemplate to operate data base simultaneously.By the SQL logic of Palingraphia is configured to XML file in the present invention, and providing conventional template method, allow developer's fast coding, improve development efficiency, another conveniently also contributes to the unified management of code, promotes software quality.

Description

A kind of method rendered based on dynamic template language
Technical field
The invention belongs to computer technology research field, a kind of method rendered based on dynamic template language of creation.
Background technology
Along with the development of society, informationalized requirement is increasingly paid attention to by society, and the speed of software development iteration is the most therefore Becoming increasingly faster, this just requires that software supplier puts into more manpower and materials to adapt to the rhythm of high speed development.According to Traditional research and development method, developer devotes a tremendous amount of time for encoding, and is some duplicated codes greatly Write.This method uses various template engine mode based on configuration dynamically to generate SQL syntax, and patrols the most reusable Collect and be packaged into the method that can call, greatly speed up the coding rate of software developer, thus improve the work efficiency of developer, This also makes the cycle of software development significantly to shorten.Developer can have the more time focus of work to be placed on more simultaneously Add in the software design that needs are paid attention to, contribute to the lifting of software quality.
Summary of the invention
It is an object of the invention to need to write a large amount of static SQL syntax for project, affect project development progress, derivative A kind of method rendered based on dynamic template language gone out.
The technical solution adopted for the present invention to solve the technical problems comprises the following specific steps that:
Step (1): the template of definition common method set, uses preserving with vm form of Velocity engine, uses Freemarker engine preserves with ftl form;
Described common method includes: the joining method of in parameter, batch insert the generation method etc. of grammer.
The definition of the template of described common method set: utilization rate grammer frequently combines template instruction extracts can The method Gong calling;
Step (2): definition XML structure definition file xsd, this document mainly describes the structure of XML document, is used for checking The legitimacy of XML document.
Step (3): the XML configuration file of definition SQL syntax is concrete: according to the structure definition file of step 2, at XML The SQL syntax that middle configuration is conventional, can quote the one or more common methods in the template defined in step 1;
Step (4): load XML configuration file, system code separates out SQL syntax according to dynamic resolution in XML configuration file, so Afterwards according to SQL syntax, coordinate jdbcTemplate that data base is operated simultaneously.
The present invention has the beneficial effect that:
By the SQL logic of Palingraphia is configured to XML file in the present invention, and provide conventional template side Method, allows developer's fast coding, improves development efficiency, and another conveniently also contributes to the unified management of code, promotes software matter Amount.
Present invention is primarily intended to need to write a large amount of static SQL syntax for project, affect project development progress, spread out A kind of method rendering generation SQL syntax based on dynamic template language born.Can use various template engine (Velocity, Freemarker etc.), based on [unification] configuration [when can run, change comes into force] mode, during operation, render SQL (NOT_ONLY_ SQL), frameless dependence, jdbc, jdbcTemplate etc. can be coordinated to use.
Accompanying drawing explanation
Fig. 1 is present invention flow chart when loading XML configuration file.
Detailed description of the invention
The present invention is further illustrated below.
A kind of method rendered based on dynamic template language, comprises the following specific steps that:
Step (1): the template of definition common method set, uses preserving with vm form of Velocity engine, uses Freemarker engine preserves with ftl form;
Described common method includes: the joining method of in parameter, batch insert the generation method etc. of grammer.
The definition of the template of described common method set is specific as follows:
Utilization rate grammer frequently is combined template instruction and extracts the method being available for calling;
// above-mentioned code is the template method using Velocity engine definitions, three methods of main definitions.bracket Method definition is to be presented with the form of bracket by calling around method by data set group.Quto method definition be Data set group is presented with the form of quotation marks by calling around method.Around method is by incoming group data Collection uses pre prefix, aft suffix, and join separator splices.
// above-mentioned code is the template method using Freemarker engine definitions, two methods of main definitions. The definition of bracket method is to be presented with the form of bracket by calling around method by data set collection. Around method is that right suffix, join separator splices by incoming collection data set left prefix.
Above-mentioned two file is conventional template method based on Velocity and Freemarker definition respectively, Main Function Being exactly the joining method defining some SQL syntax, only provide a part here, developer can sum up on stream Go out more template method.
Step (2): definition XML structure definition file, this document is used for checking the legitimacy of XML file structure, if not being inconsistent Close the definition of xsd file, change XML and will be unable to carry out correct parsing.Xsd file content example is as follows:
Step (3): the XML configuration file of definition SQL syntax is concrete: according to the XML format of xsd document definition, configuration The content of each element.Wherein the engine element arrangements of cmd-collection node is the engine type resolved, and cmd saves The id element arrangements of point is the method name called for system, and the configuration of pre-render node is concrete SQL syntax, grammer Part logic can quote the one or more common methods in the template defined in step 1;
XML file example is as follows:
In the past we by SQL with JAVA code definition in one file, and everybody fights separately, some conventional languages Method all can thorough repeat to write, and the most not only loses time but also searches the most comparatively laborious when going wrong when.And By XML configuration file, logical definition identical for different business is good, developer can directly invoke as required accordingly Method.
Step (4): load XML configuration file, system code separates out SQL syntax according to dynamic resolution in XML configuration file, so Afterwards according to SQL syntax, coordinate jdbcTemplate that data base is operated simultaneously.
The when of as it is shown in figure 1, XML configuration file is loaded, being described as follows of involved class:
ModelBuilder class is mainly used to resolve the XML configuration file of SQL, by the cmd node in configuration file Hold and be saved in the attribute commands of CommandCol class class after resolving, render through renderer interface Renderer (parsing to template method of the most different engines) calls for organizer Organizer afterwards.
During use, we realize an Organizer object defined in class at each Dao, it is intended that the XML file road of parsing Footpath.Organizer apoplexy due to endogenous wind definition XML file cmd node i d is the method for title, calls the method and gets SQL syntax, then Use in conjunction with jdbcTemplate, reach the additions and deletions of data base change the purpose looked into.

Claims (3)

1. the method rendered based on dynamic template language, it is characterised in that comprise the steps:
Step (1): the template of definition common method set, uses preserving with vm form of Velocity engine, uses Freemarker engine preserves with ftl form;
Step (2): definition XML structure definition file xsd, this document, for describing the structure of XML document, is used for checking XML literary composition The legitimacy of shelves;
Step (3): the XML configuration file of definition SQL syntax is concrete: according to the structure definition file of step 2, to join in xml Put conventional SQL syntax, the one or more common methods in the template defined in step 1 can be quoted;
Step (4): load XML configuration file, system code separates out SQL syntax, then root according to dynamic resolution in XML configuration file According to SQL syntax, coordinate jdbcTemplate that data base is operated simultaneously.
A kind of method rendered based on dynamic template language the most according to claim 1, it is characterised in that described is conventional Method includes: the joining method of in parameter, batch insert the generation method etc. of grammer.
A kind of method rendered based on dynamic template language the most according to claim 1, it is characterised in that described is conventional The definition of the template of method set: utilization rate grammer frequently is combined template instruction and extracts the method being available for calling.
CN201610431674.6A 2016-06-17 2016-06-17 A kind of method rendered based on dynamic template language Pending CN106126564A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610431674.6A CN106126564A (en) 2016-06-17 2016-06-17 A kind of method rendered based on dynamic template language

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610431674.6A CN106126564A (en) 2016-06-17 2016-06-17 A kind of method rendered based on dynamic template language

Publications (1)

Publication Number Publication Date
CN106126564A true CN106126564A (en) 2016-11-16

Family

ID=57469833

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610431674.6A Pending CN106126564A (en) 2016-06-17 2016-06-17 A kind of method rendered based on dynamic template language

Country Status (1)

Country Link
CN (1) CN106126564A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109726313A (en) * 2018-12-28 2019-05-07 中国银行股份有限公司 The method and device of operating database
CN109800331A (en) * 2018-12-19 2019-05-24 山东中创软件工程股份有限公司 Method for reading data and device, date storage method and device
CN110109939A (en) * 2018-01-05 2019-08-09 中兴通讯股份有限公司 Development approach, equipment and storage medium based on structured query language SQL
CN110427399A (en) * 2019-06-18 2019-11-08 深圳壹账通智能科技有限公司 Real-time data acquisition method, system, device and storage medium
CN112241261A (en) * 2019-07-16 2021-01-19 深圳易为控股有限公司 Method for dynamically adding content to popup window based on template engine rendering
CN114153909A (en) * 2021-11-26 2022-03-08 北京人大金仓信息技术股份有限公司 Database table structure translation method and device based on Velocity template engine

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7360202B1 (en) * 2002-06-26 2008-04-15 Microsoft Corporation User interface system and methods for providing notification(s)
US20080320441A1 (en) * 2007-06-23 2008-12-25 Azadeh Ahadian Extensible rapid application development for disparate data sources
CN104424265A (en) * 2013-08-29 2015-03-18 北大方正集团有限公司 Digital resource management method and system
CN105389339A (en) * 2015-10-20 2016-03-09 咸亨国际(杭州)物联网信息产业有限公司 Tool for rapid generation of database sql statement and entity class
CN105487864A (en) * 2015-11-26 2016-04-13 北京京东尚科信息技术有限公司 Method and device for automatically generating code

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7360202B1 (en) * 2002-06-26 2008-04-15 Microsoft Corporation User interface system and methods for providing notification(s)
US20080320441A1 (en) * 2007-06-23 2008-12-25 Azadeh Ahadian Extensible rapid application development for disparate data sources
CN104424265A (en) * 2013-08-29 2015-03-18 北大方正集团有限公司 Digital resource management method and system
CN105389339A (en) * 2015-10-20 2016-03-09 咸亨国际(杭州)物联网信息产业有限公司 Tool for rapid generation of database sql statement and entity class
CN105487864A (en) * 2015-11-26 2016-04-13 北京京东尚科信息技术有限公司 Method and device for automatically generating code

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
孙聚: "基于 FreeMarker引擎的代码生成工具的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110109939A (en) * 2018-01-05 2019-08-09 中兴通讯股份有限公司 Development approach, equipment and storage medium based on structured query language SQL
CN110109939B (en) * 2018-01-05 2023-12-22 中兴通讯股份有限公司 Development method, device and storage medium based on structured query language SQL
CN109800331A (en) * 2018-12-19 2019-05-24 山东中创软件工程股份有限公司 Method for reading data and device, date storage method and device
CN109726313A (en) * 2018-12-28 2019-05-07 中国银行股份有限公司 The method and device of operating database
CN110427399A (en) * 2019-06-18 2019-11-08 深圳壹账通智能科技有限公司 Real-time data acquisition method, system, device and storage medium
CN112241261A (en) * 2019-07-16 2021-01-19 深圳易为控股有限公司 Method for dynamically adding content to popup window based on template engine rendering
CN114153909A (en) * 2021-11-26 2022-03-08 北京人大金仓信息技术股份有限公司 Database table structure translation method and device based on Velocity template engine
CN114153909B (en) * 2021-11-26 2024-06-07 北京人大金仓信息技术股份有限公司 Database table structure translation method and device based on vector template engine

Similar Documents

Publication Publication Date Title
CN106126564A (en) A kind of method rendered based on dynamic template language
US10657111B2 (en) Computer-implemented method for storing unlimited amount of data as a mind map in relational database systems
CN110955410B (en) Code automatic generation method, device, equipment and medium
CN115617327A (en) Low code page building system, method and computer readable storage medium
US20140280030A1 (en) Method of converting query plans to native code
CN106293664A (en) Code generating method and device
CN101901265B (en) Objectification management system of virtual test data
CN104965714A (en) Code generation method and system of application software
CN104035754A (en) XML (Extensible Markup Language)-based custom code generation method and generator
CN106611037A (en) Method and device for distributed diagram calculation
CN106873974A (en) Smart code generates automotive engine system and method
CN104424018A (en) Distributed calculating transaction processing method and device
WO2021259290A1 (en) Stored procedure conversion method and apparatus, and device and storage medium
CN112860730A (en) SQL statement processing method and device, electronic equipment and readable storage medium
CN116628066B (en) Data transmission method, device, computer equipment and storage medium
CN105468793A (en) Automated management method for simulation model data
CN103077038B (en) The method of dynamic generation and compiling .NET project
WO2018001041A1 (en) Interface implementation method and device, set-top box, and storage medium
CN111176660A (en) Distributed architecture-oriented micro-service contract management method and device, computer equipment and readable storage medium
CN106383734A (en) Method for extracting detailed design from codes
CN109597611A (en) Front end data flow control Components Development system, method, equipment and storage medium
CN102779036B (en) For the Software tool of automatic technology
CN102999323B (en) A kind ofly generate the method for object code, the method for data processing and device
CN110674355B (en) DSL application system for describing data labeling task and method thereof
CN102968443A (en) Optimized interface resource management system for automatic train supervision (ATS) system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20161116

RJ01 Rejection of invention patent application after publication