tyboot - Rapid development of scaffolding based on Spring Boot

tyboot

Source code:

https://gitee.com/magintursh/tyboot

https://github.com/magintursh/tyboot

If you like, you can give a star for more people to see.

introduce

tyboot is a springboot-based service-side scaffold for the rapid development of single services. You need a micro-service solution to see another project, tycloud (still under improvement)

Characteristic

1. Simplify the basic business development process
    a. For form queries, do not write sql.Lists, page breaks, no need to write.
    The mapper in the b.dao layer is just an empty interface, and most businesses do not need to write any code in the mapper (unless they have complex report queries) or mapper's xml files.
    c.baseService has a large number of generic methods for use, form object addition and deletion checks do not require code at the service level, and list and paging queries require only one line of code.
    d. Promote single-form operation.Complex sql is not recommended for complex business problems.
2. Lower learning costs.New people can quickly get started, and those who pass the basic knowledge can quickly enter the business development state.
3. Common component integration.redis, mq, events, mongodb, etc.
4. Implementation of a common business model.The out-of-the-box business model can greatly reduce the project development cycle.The generic business models planned for implementation are
  Order System, Virtual Account System, Payment Gateway, Dynamic Form, Reporting System, Universal Reservation System, Preferential Policy Customization,
  Basic Data (Authentication Code, Dictionary, Internal Message, Geographic Location Information, Generic File Information Storage, Operational Recording and Counting,)
5. Integrate common third-party systems.SMS (Ali Big Fish), Storage (Qiniu, Ali OSS), Payment (Weixin Public Platform, Alibaba)

technology stack

 1. SpringBoot 2.1.6.RELEASE
 2. MyBatis-Plus 3.x
 3. mybatis-spring-boot-starter 1.2.0
 5. Kaptcha 2.3.2
 6. jackson-databind 2.9.7
 7. springfox-swagger2 2.2.2
 8. HikariCP 2.7.9

Project structure

   tyboot 
    ├─tyboot-api
    │  ├─tyboot-api-boot                Sample project, which implements basic functions common to data dictionaries, rights management, and other projects
    ├─tyboot-component------assembly
    │  ├─tyboot-component-activemq------Integrate activemq
    │  ├─tyboot-component-amqp----------Yes spring Of amqp Simple integration
    │  ├─tyboot-component-cache---------Cache, for redis Further implementation and packaging, geographic location, pipeline, zset Implement Paging Query, Distributed Lock
    │  ├─tyboot-component-emq-----------Integrate mqtt service EMQ
    │  ├─tyboot-component-event---------utilize spring Event mechanism implementation is based on rest Event handling mechanisms for interfaces
    │  ├─tyboot-component-mongo---------Integrate mongo
    │  ├─tyboot-component-opendata------Integrate common third-party open interfaces, Qiniu, Ali Dayu, Tencent im,Jpush
    │  └─tyboot-component-validation----Parameter Check
    ├─tyboot-core-----------Core packages, typically referenced by instance projects
    │  ├─tyboot-core-auth---------------User authentication, session Share
    │  ├─tyboot-core-foundation---------Common tool class libraries, context encapsulation within threads; Bean,File,List tree structure, encryption and decryption, and so on.
    │  ├─tyboot-core-rdbms--------------Integrate mybatis,mybatisplus,Simplify orm And packaging servic General operation
    │  └─tyboot-core-restful------------Yes restful Style interface encapsulation, integration of interface documents, uniform exception handling, request interception handling, return data encapsulation, context encapsulation
    └─tyboot-prototype------General Business Model, encapsulated for specific business scenarios
        ├─tyboot-prototype-account------Virtual Account System
        ├─tyboot-prototype-order--------Universal Order System
        └─tyboot-prototype-trade--------Simple payment channel, Alipay, WeChat

Catalog conventions:

Example:
tyboot-api-privilege-------------------------------------- The following directories are the project conventions directory structure
        org.typroject.api.privilege.
                                controller------interface directory 
                                face. ------------------ Business layer
                                    model--------vo
                                    orm. -------- Data Operation
                                        Dao----mapper interface directory
                                        Entity--po directory
                                    service-------Business implementation class

Appointment

orm

1.entity needs to inherit BaseEntity
    The corresponding data table cannot be missing a common field

     SEQUENCE_NBR bigint 20 Physical Primary Key
     id of the last updater of REC_USER_id varchar 32
     REC_DATE datetime Last Update Time

2. mybatisplus is used, so there is no need to introduce mapper.xml in the instance project, and the baseMapper method is sufficient.
  xml files can be introduced unless complex queries are required 
3. Normally, the mapper subinterface of the dao layer is only an empty interface, unless you write sql yourself or introduce xml, you will write code in it.

service

1. Inherit baseService
    public class LocationInfoService extends BaseService<LocationInfoModel,LocationInfo,LocationInfoMapper> 
    {}
2. Do not overload methods in the service, because method instances are retrieved by reflection based on method names only.
3. The service layer only has implementation classes, which makes it cumbersome to throw away previous interfaces.
4. Form objects can operate without having to write methods in the service or introduce mapper s. Generic methods are sufficient.
  Paging and list queries also require only one line of code, as shown in the following examples:

-
Paging:

        public Page<DictionarieModel> queryDictPage(Page page, String agencyCode ,
                                                       String buType,
                                                       String dictAlias,
                                                       @Condition(Operator.like) String dictName,
                                                       String dictCode) throws Exception
            {
                return this.queryForPage(page,"sort field",false,agencyCode,buType,dictAlias,dictName,dictCode);
            }
      The name of the parameter used as the query condition needs to be the same as the property name in the corresponding model.
      The params parameter list passed into the baseService.queryForPage needs to be in the same order as the parameters of the preceding method (queryDictPage).
      The bottom level automatically resolves the pre-method parameter name and empties the value, then converts it to a database field name to build the conditional assembler.
      Annotation@Condition is used to define conditional operators, the implemented conditional operators are detailed in Operator, and the logical relationships of all query conditions are relationships to
      There is no plan to achieve or relate at this time.         

-
List: (parameter conventions are the same as paging methods)

      public List<DictionarieModel> queryDictList(String agencyCode ,
                                                     String buType,
                                                     String dictAlias,
                                                      @Condition(Operator.like)String dictName,
                                                     String dictCode) throws Exception
          {
              return this.queryForList("sort field",false,agencyCode,buType,dictAlias,dictName,dictCode);
          }

controller

1. Uniform return values, all interfaces use ResponseModel to encapsulate return values.
2. Custom Annotation @TycloudOperation defines the interface's access level ApiLevel, authentication control needAuth

About caching

1. Form object caching and form list caching are all integrated into the baseService's methods, which can be refreshed or deleted with object updates, and method notes can be viewed to choose whether to use them.
2. Other cached scenarios recommend operating directly with rediTemplate
 3. The tyboot-component-cache module provides redis Zset-based paging queries; geographic location calculations and queries; and the use of redis pipelines

Use of Code Generator

1. Use the code generator provided by mybatisplus as detailed in the sample project.

Best Practices

1. Package and publish component packages from tyboot-core and tyboot-component to maven private service nexus for unified management.
  Then each instance project is referenced and the business project is developed so that the business code of the instance project is clearer, packaged faster, and the referenced tyboot version can be upgraded at any time.

Follow-up plan

1. Perfect basic modules
 3. Perfect General Business Model
 4. Integrate the web side

Keywords: Programming xml Redis SQL Mybatis

Added by peterg012 on Sun, 03 May 2020 14:28:45 +0300