CN-122020695-A - Authority application and SQLite data management method in android offline application and electronic equipment
Abstract
The application relates to the technical field of computers, in particular to a method for managing data of authority application and SQLite in the application of An Zhuo Lixian and electronic equipment, which comprises the steps of constructing project dependent environment and configuring scaffold tools; the method comprises the steps of creating a frame project based on a scaffold tool locally and introducing a basic development library, adding storage authority configuration corresponding to a current platform, adding routing configuration of an authority application page, setting the authority application page as a first application loading page, packaging a database operation tool in the frame project and defining database basic configuration information, integrating database operation logic in the authority application page, performing paging inquiry and single data inquiry to achieve reading of local data and page rendering, compiling the frame project into an application installation package corresponding to the current platform through a compiling operation tool, and operating the application installation package and verifying. The method has the effects of realizing intelligent application of authority, stable synchronization of the database and efficient operation.
Inventors
- YANG JUNFENG
- Chi Ziang
- SHEN JUE
- ZHANG YUYU
Assignees
- 华数(浙江)科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260415
Claims (10)
- 1. The method for managing the data by the authority application and the SQLite in the application of the An Zhuo Lixian is characterized by comprising the following steps of: constructing project dependent environments and configuring scaffold tools; locally creating a framework project based on the scaffold tool and introducing a basic development library; Adding a storage authority configuration corresponding to a current platform in an application configuration file in the frame item, wherein the storage authority configuration at least comprises a reading authority configuration and a writing authority configuration; adding a routing configuration of a permission application page in a page configuration file in the frame item, and setting the permission application page as a first application loading page based on the routing configuration; encapsulating database operation tools in the frame items and defining database basic configuration information; integrating database operation logic in the authority application page; calling the encapsulated database operation tool to perform paging inquiry and single data inquiry so as to realize reading of local data and page rendering; and compiling the frame item into an application installation package corresponding to the current platform through a compiling operation tool, and operating and verifying the application installation package.
- 2. The method for applying rights and SQLite management data in an android offline application as recited in claim 1, wherein the project dependent environment is constructed and the scaffold tool is configured, comprising the steps of: installing an operating environment, and installing the scaffold tool based on a package management command configured by the operating environment; Installing a compiling running tool to start a development plug-in corresponding to the current platform; and configuring a simulator corresponding to the current platform or connecting entity equipment corresponding to the current platform.
- 3. The method for rights application and SQLite management data in an android offline application as recited in claim 1, wherein a framework project is created locally based on the scaffold tool and a basic development library is introduced, comprising the steps of: acquiring project construction instructions and selecting a preset template to execute; And entering a root directory in the frame item and executing the package management command to download and install a basic dependency package and a style preprocessing library corresponding to the frame item.
- 4. The method for applying rights and SQLite management data in android offline application as recited in claim 3, wherein the step of adding the storage rights configuration corresponding to the current platform in the application configuration file in the framework item includes the following steps: searching the application configuration file in the root directory and opening a source code view; positioning a platform configuration node based on the source code view, and adding a configuration array in the platform configuration node; writing configuration codes corresponding to the read permission configuration and the write permission configuration in the configuration array; When the device version corresponds to the high system version, external storage access compatibility parameters are added in the platform configuration node.
- 5. The method for applying authority and SQLite management data in android offline application according to claim 4, wherein a routing configuration of an authority application page is added to a page configuration file in the framework item, and the authority application page is set as a first application loading page based on the routing configuration, comprising the following steps: Searching the page configuration file in the root directory, and adding a permission application route corresponding to the permission application page in the first position in a page array of the page configuration file, wherein the permission application route comprises a first page path and a first page title; and adding an application homepage route after the authority application route in the page array, wherein the application homepage route comprises a second page path and a second page title.
- 6. The method for applying rights and SQLite management data in an android offline application as recited in claim 1, wherein a database operation tool is encapsulated and database basic configuration information is defined in the framework item, comprising the steps of: newly building a tool file in a source code catalog in the frame item, and adding database basic configuration information in the tool file, wherein the database basic configuration information comprises a database name, a database source file path and a database target file path; And encapsulating the database operation tool formed by a plurality of database operation methods, and realizing database opening, single data inquiry, paging inquiry, cross-environment path adaptation and database file copying based on the database operation tool.
- 7. The method for managing data in application rights and SQLite in android offline application according to claim 6, wherein integrating database operation logic in said rights application page comprises the steps of: Adding a state variable in the authority application page, wherein the state variable is used for marking whether the authority application is executing or not; Adding trigger logic in the authority application page, setting the state variable as true if the state variable is false under the trigger logic, and calling an authority application method to apply for storage authorities to transmit authority identifiers; Acquiring a return result corresponding to the authority application from the authority application page, and generating corresponding prompt information based on the return result; Judging whether an old file exists in the database target file path or not in the authority application page, and if yes, deleting; If not, copying the source file into a target directory in the source file path of the database and monitoring a copying result; If the copying is successful, jumping to the application homepage, and if the copying is failed, recording error information and displaying.
- 8. The method for applying authority and managing data in SQLite in android offline application according to claim 7, wherein invoking the encapsulated database operation tool to perform paging query and single data query to implement local data reading and page rendering comprises the following steps: calling a paging query function in the database operation tool to return current page data and total data number; and calling a basic query function in the database operation tool to return a single piece of specific configuration data.
- 9. The method for managing data in authority application and SQLite in android offline application according to claim 8, wherein compiling the frame item into an application installation package corresponding to a current platform by a compiling running tool, running the application installation package and verifying, comprises the following steps: selecting and operating the frame items through a compiling operation tool, compiling the frame items into corresponding application installation packages, and deploying the corresponding application installation packages into a test environment; after the application is started, verifying whether the authority application page is popped up when the application is started for the first time and whether the returned result received based on the authority application page is matched with the prompt information; Triggering inquiry operation on the application homepage, verifying whether data can be read and rendering the data correctly in the application homepage; and respectively switching the test environment into a development environment and a generation environment, and verifying whether the database source file path is automatically switched.
- 10. An electronic device comprising one or more processors and storage means for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-9.
Description
Authority application and SQLite data management method in android offline application and electronic equipment Technical Field The application relates to the technical field of computers, in particular to a method for applying authority and managing data SQLite in the application of An Zhuo Lixian and electronic equipment. Background With the wide popularization of off-line application of a mobile terminal in government affair checking, on-site inspection, medical follow-up and other scenes, the stable storage and efficient management of local data become core requirements of the application. The offline application needs to rely on the local database SQLite to store the business data such as forms, records, configuration information and the like under the network-free environment, and meanwhile needs to acquire the equipment storage authority to complete the operations of reading, copying and initializing the database file so as to ensure the normal operation of the application. Uniapp is used as a main-stream cross-platform development framework, so that offline application adapting to Android and iOS systems can be quickly constructed, and cross-platform development cost is greatly reduced. However, in practical application, the prior art has obvious short boards in the linkage link of authority application-SQLite database management, uniapp original authority application interfaces lack of intelligent judgment logic, repeated triggering is easy to occur, SQLite database operation requires complex logics such as self-packaging path adaptation, paging inquiry and the like of developers, and the database file synchronization process is easy to be influenced by factors such as equipment system difference, path authority limitation and the like, so that synchronization failure is caused. At present, in the authority and SQLite management scheme of offline application, the authority application is often disjointed with the database initialization flow, a failure scene that the authority is not granted but the database operation is executed easily occurs, meanwhile, two redundant SQL sentences of 'list query' and 'total number statistics' are manually written for SQLite paging query, and when the cross-development environment and the production environment are switched, the database source path configuration is manually modified, and the problems all result in poor application stability and low development efficiency, so that the core requirements of the offline application on the data availability and the operation efficiency cannot be met. Disclosure of Invention In order to realize the intelligent application of authority, stable synchronization and efficient operation of a database, the application provides a method for managing data of authority application and SQLite in the application of An Zhuo Lixian and electronic equipment. In a first aspect, the present application provides a method for applying rights and managing data by SQLite in an application of a Zhuo Lixian, which adopts the following technical scheme: A method for managing data by authority application and SQLite in a Zhuo Lixian application comprises the following steps: constructing project dependent environments and configuring scaffold tools; locally creating a framework project based on the scaffold tool and introducing a basic development library; Adding a storage authority configuration corresponding to a current platform in an application configuration file in the frame item, wherein the storage authority configuration at least comprises a reading authority configuration and a writing authority configuration; adding a routing configuration of a permission application page in a page configuration file in the frame item, and setting the permission application page as a first application loading page based on the routing configuration; encapsulating database operation tools in the frame items and defining database basic configuration information; integrating database operation logic in the authority application page; calling the encapsulated database operation tool to perform paging inquiry and single data inquiry so as to realize reading of local data and page rendering; and compiling the frame item into an application installation package corresponding to the current platform through a compiling operation tool, and operating and verifying the application installation package. In some of these embodiments, building a project dependent environment and configuring a scaffold tool includes the steps of: installing an operating environment, and installing the scaffold tool based on a package management command configured by the operating environment; Installing a compiling running tool to start a development plug-in corresponding to the current platform; and configuring a simulator corresponding to the current platform or connecting entity equipment corresponding to the current platform. In some of these embodiments, creating a framework