Skip to content

codimiracle/basic-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backend Component - Basic Contract

Codacy Badge Build Status Codecov Badge

basic-contract is a simple controller reuse component. includes some reusable abstract for using in controller such as Page, PageSlice, Filter and Sorter.

Feature

Provided class as follows:

  • Page

    indicates page limit and size

  • PageSlice

    indicates page slice for specified Page

  • Filter

    indicates how to filter database row

  • Sorter

    sorting data for database query result

  • ApiResponse

    return any unified response for web api

  • FilterConverter

    convert string to Filter object

  • SorterConverter

    conver string to Sorter object

Installation

Maven

snapshot is uploaded.

<dependency>
    <groupId>com.codimiracle.web</groupId>
    <artifactId>basic-contract</artifactId>
    <version>1.0.1-SNAPSHOT</version>
</dependency>

Usages

Simply, you can use in everywhere, but those is design for spring boot controller layer. you can use those class like:

// in ExampleController.java
public ApiResponse query(Filter filter, Sorter sorter, @ModelAttribute Page page) {
    //...listing example
    PageSlice slice = null; 
    return new ApiResponse(0, "success", slice);
}

See also

mybatis-contract