README.md

February 26, 2025 · View on GitHub

OpenTiny Logo

Tiny Engine Web Service is a RESTful API responsible for providing data services, code generation services, and code release services to the front end. It does not directly operate on the database, and data operations request interfaces from TinyEngine Data Center.

English | 简体中文

Local Boot Steps:

  • Click the Fork button in the upper right corner of the tiny-engine-backend-java repository to fork the upstream repository to your personal repository
  • Clone personal warehouse to local
  • The installation depends on JDK 1.8 and Maven 3.5 or later
  • Modify the configuration of the connection database in the tiny-engine-backend-java/app/src/main/resources/application-dev.yml file
  • Start the project in tiny-engine-backend-java/app/src/main/java/com/tinyengine/it/TinyEngineApplication for local development

For details, please refer to TinyEngine Official Website - User Manual - Platform Development Guide - Local Startup Joint Debugging of Front-end and Backend Codes.

Directory Rules

Before development, you need to understand the overall directory structure of the project and compile code according to the following rules

├── README.md
├── app                                                            // Basic services
│   └── src                      
│       └── main 
│           └── java 
│               ├── com.tinyengine.it
│               │            ├── config                           // Profiles
│               │            └── TinyEngineApplication            // Startup class, main entrance
│               └── resource 
│                      ├── sql                                    // SQL files, including table creation files and SQL files of basic data
│                      │   ├── h2                                 
│                      │   ├──mysql                               
│                      │   └──postgresql                          
│                      └── application.yml

│                                                                // Configuration information, some of the configurations that are mainly used to manage the Springboot application globally, some configurations related to MybatisPlus, etc
└── base                                                         // Business function services
    └── src 
        ├── main                    
        │   └── java          
        │       └── com
        │           └── tinyengine
        │               └── it
        │                   ├── common                            // Public Documents   
        │                   │   ├── base                          // Public entity classes
        │                   │   │   └── BaseEntity                
        │                   │   ├── enums                         // Public enumeration classes
        │                   │   │   └── Enums                     
        │                   │   ├── exception                     // Public anomaly classes
        │                   │   │   └── ExceptionEnum             
        │                   │   ├── handler                       // Data type processor
        │                   │   │   └── ListTypeHandler           
        │                   │   ├── log                           // System logs
        │                   │   │   └── SystemControllerLog       
        │                   │   └── utils                         // Utilities
        │                   │       └── Utils                     
        │                   ├── config                            // Configure the class
        │                   │   └── AiChatConfig                      
        │                   ├── controller                        // Business control layer
        │                   │   └── AppController                 
        │                   ├── gateway                           // gateway
        │                   │   └── ai
        │                   │       └── AiChatClient                  
        │                   ├── mapper                            // Data access layer
        │                   │   └── AppMapper                     
        │                   ├── model                             // Model entity class
        │                   │   ├── dto
        │                   │   │   └── BlockDto                  
        │                   │   └── entity
        │                   │       └── Block                     
        │                   └── service                           // Business logic layer
        │                       ├── app                           // app module
        │                       │   ├── impl                      // APP module business implementation class
        │                       │   │   └── AppServiceImpl        
        │                       │   └── AppService                // Business logic interface of the app module
        │                       ├── material                      // Material module
        │                       │   ├── impl                      // The business implementation class of the material module
        │                       │   │   └── BlockServiceImpl      
        │                       │   └── BlockService              // Taking blocks as an example, this layer is the business logic interface related to the material
        │                       └── platform                      // Designer module
        │                           ├── impl                      // The business implementation class of the designer module
        │                           │   └── PlatformServiceImpl   
        │                           └── PlatformService           // The business logic interface of the designer module
        └── test                                                  // The test directory is divided into test cases of different modules according to the above directory                 
            ├── java
            │    └── com 
            │        └── tinyengine
            │            └── it
            │                ├── common
            │                │   ├── base
            │                │   │   └── ResultTest
            │                │   ├── exception
            │                │   │   └── GlobalExceptionAdviceTest
            │                │   ├── handler
            │                │   │   └── ListTypeHandlerTest
            │                │   ├── log
            │                │   │   └── SystemLogAspectTest
            │                │   └── utils
            │                │       └── UtilsTest
            │                ├── controller
            │                │   └── AppControllerTest
            │                ├── gateway
            │                │   └── ai
            │                │       └── AiChatClientTest
            │                ├── mapper
            │                │   └── AppMapperTest
            │                └── service     
            │                    ├── app
            │                    │   └── impl
            │                    │       └── AppServiceImplTest
            │                    ├── material
            │                    │   └── impl
            │                    │       └── BlockServiceImplTest
            │                    └── platform
            │                        └── impl        
            │                            └── PlatformServiceImplTest              
            └── resources                    

Interface Return Specifications

1.Return Format
  • Correct data
{
        "data": {
        "id": 1,
        "createdBy": "1"
        }
        "code": "200",
        "message": "操作成功",
        "error": null,
        "errMsg": null,
        "success": true
        }
  • Error Data
{
        "data": null,
        "code": "CM003",
        "message": "重复创建,请修改传入参数。",
        "error": {
        "code": "CM003",
        "message": "重复创建,请修改传入参数。"
        },
        "errMsg": "重复创建,请修改传入参数。",
        "success": false
        }

Manual

For more information about how to use the server, please refer to TinyEngine Official Website - User Manual - Platform Development Guide

Local Runtime Configuration:

JDK1.8, Maven 3.5 or later is sufficient, mysql 8

Database table mapping before and after data migration

  • Blocks -------> historical association changes in blocks: After being refactored by the blocks__histories of nodejs, ref_id the block table associated with this property is directly added to the t_block_history table of the Java database, and there is no need to blocks__histories the associated table

  • Material -------> block association changes: The block-history_id field in the material block history relationship table of the block_histories_materials__materials_user_blocks of nodejs is used to find the primary key of the block in the block_id block_histories table, and then the block information is found in the block table through the block_id, in order to query more conveniently. In the Java database table, the relationship table between blocks and materials is directly created r_material_block

Summarizing the changes in the database table can be roughly divided into the following types

  • The definition of the field in the database table is more standardized, and the previous hump is changed to an underscore name, such as isDefault -> is_default
  • The meaning of the definition of the database table field is clearer, such as app -> app_id, created_at -> created_time
  • Most of the database tables have new tenant_id, site_id, renter_id, and platform_id fields, as well as designer tables t_platform and designer history tables t_platform_history due to tenant isolation
  • The database table relationship is clearer and clearer, and some useless table relationships are deleted, such as the table relationship between the block and the block history, which is directly t_block_history added to the block history table, that is, the ref_id as a foreign key
  • The block_categories block classification was deleted, and the block grouping and classification were merged into a block grouping, taking into account the similar functions and functions of grouping and classification
  • The t_business_category of the business classification table and the relationship table between the material and the business classification are reserved, and r_material_category
nodejs database tablesJava database tablesNew attributesDelete the attributeModify the attributes
app_extensionst_app_extensiontenant_id、site_id、renter_idapp -> app_id、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time、
appst_appsite_id、renter_idtpl-groups、created_by、updated_byplatform -> platform_id、platform_history -> platform_history_id、 obs_url -> publish_url、home_page -> home_page_id、tenant -> tenant_id、createdBy -> created_by、updatedBy -> last_updated_by、 created_at -> created_time、 updated_at -> last_updated_time
block_groupst_block_groupplatform_id、tenant_id、site_id、renter_idapp -> app_id、 dec -> description、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
block_historiest_block_historyframework、 tags、is_official、 public、is_default、tiny_reserved、platform_id、block_group_idcreated_app -> app_id、block_id -> ref_id、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time、
blockst_blocklatest_version、 i18ncreated_by、updated_by、author、name_cn -> name、current_history -> latest_history_id、occupier -> occupier_by、isOfficial -> is_official、isDefault -> is_default、createdBy -> created_by、updatedBy -> last_updated_by、 created_at -> created_time、 updated_at -> last_updated_time
blocks_groups__block_groups_blocksr_block_group_blockblock-group_id -> block_group_id、
blocks_carriers_relationst_block_carriers_relationtenant_id、site_id、renter_idblock -> block_id、 host ->host_id、created_at -> created_time、updated_by -> last_updated_by、updated_at -> last_updated_time
block_histories_material_histories__material_histories_blocksr_material_history_blockmaterial-history_id -> material_history_id、 block-history_id -> block_history_id
material_historiest_material_historyimage_url、build_info、tgz_url、 material_size、site_id、renter_idmaterial -> ref_id、 tenant -> tenant_id 、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
material_histories_components__user_components_mhsr_material_history_componentmaterial-history_id -> material_history_id、 user-component_id -> component_id
materialst_materialmaterial_category_id、material_size、tgz_url、unzip_tgz_root_path_url、unzip_tgz_files、tenant_id、site_id、renter_idname_cn、user_components、latestversion -> latest_version、material_histories -> latest_history_id、isOfficial -> is_official、isDefault ->is_default、component_library -> component_library_id、
materials_user_components__user_components_materialsr_material_componentuser-component_id -> component_id
pagest_pagelatest_version、latest_history_id、tenant_id、site_id、renter_idcreated_by、updated_byapp -> app_id、occupier -> occupier_by、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
pages_historiest_page_historyref_id、version、app_id、depth、is_page、is_default、is_published、tenant_id、site_id、renter_idtimeupdated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
templatest_page_templatename、status、is_preset、image_url、tenant_id、site_id、renter_id、platform_id、name_en、name_cn、thumbnail、tags、created_app、create_app、created_by、updated_bycontent ->page_content、tpl_type ->type、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
i18n_entriest_i18n_entrytenant_id、site_id、renter_idhost -> host_id、lang -> lang_id、 updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
i18n_langst_i18n_langupdated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
sourcest_datasourceplatform_id、tenant_id、site_id、renter_idapp -> app_id、desc -> description、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
task_recordt_task_recordbuild_id、tenant_id、site_id、renter_iduniqueId、created_by、updated_byteamId ->team_id、taskTypeId ->task_type、taskName ->task_name、taskStatus ->task_status、taskResult ->task_result、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
user_componentst_componentname_en、tenant_id、site_id、renter_idcomponentisOfficial ->is_official、isDefault -> is_default、library -> library_id、updated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
users-permissions_usert_userenable、tenant_id、site_id、renter_idprovider、password、resetPasswordToken、confirmationToken、confirmed、blockedupdated_by -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
tenantst_tenantcreated_by、updated_bytenant_id -> org_code、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、 updated_at -> last_updated_time
platformst_platformlatest_history_id、site_id、renter_idis_java、created_by、updated_bytheme -> theme_id、latest -> latest_version、material_history -> material_history_id、business_category -> business_category_id、tenant -> tenant_id、createdBy -> created_by、updatedBy -> last_updated_by、created_at -> created_time、updated_at -> last_updated_time
platform_historiest_platform_historypublish_url、image_url、tenant_id、site_id、renter_idplatform -> ref_id、material_history -> material_history_id、created_at -> created_time、updated_by -> last_updated_by、updated_at -> last_updated_time

🤝 Participating in contributions

If you are interested in our open source project, please join us!

Please read the Contribution Guide before participating in the contribution.

  • Add official assistant WeChat opentiny-official and join the technical exchange group
  • Join the mailing list opentiny@googlegroups.com

Open source protocol

MIT