Backend Development 8 min read

Simplifying CRUD and Complex Queries with APIJSON

This article demonstrates how APIJSON enables developers to implement full CRUD, query, and aggregation operations with just a few lines of code, reducing boilerplate, handling permissions, and supporting complex relational queries through a unified JSON request format.

Top Architect
Top Architect
Top Architect
Simplifying CRUD and Complex Queries with APIJSON

Many developers wonder why a simple SpringBoot interface still requires three lines of code, and a full set of CRUD endpoints can easily exceed dozens of lines when accounting for SQL, JDBC, ORM, and XML configurations. The traditional approach quickly becomes verbose and hard to maintain.

APIJSON offers a solution by allowing any table (e.g., User ) to be queried, inserted, updated, or deleted with only a few JSON statements, eliminating the need to write separate controller methods.

Example of a traditional SpringBoot endpoint:

@RequestMapping("test/{request}")
public String test(@PathVariable String request) {
    return request + ": Hello World";
}

Using APIJSON, the same operation can be performed with a single HTTP request to http://apijson.cn:8080/get and a JSON payload such as:

{
  "User": {
    "id": 82001
  }
}

The response returns the full user object, and similar JSON structures can retrieve lists, filter by conditions, or select specific columns using the @column directive.

APIJSON also supports unified endpoints for all CRUD actions:

增  base_url/post
删(包括批量)  base_url/delete
改(包括批量)  base_url/put
查(包括列表)  base_url/get
统计  base_url/head

For example, to add a comment:

{
  "Comment": {
    "userId": 82001,
    "momentId": 15,
    "content": "测试新增评论"
  },
  "tag": "Comment"
}

Deletion, batch deletion, updates, and aggregation follow the same pattern, simply changing the endpoint URL and JSON structure. Permission management is handled with a three‑line @MethodAccess annotation, e.g.:

@MethodAccess(POST = {UNKNOWN, ADMIN})
public class User {}

When a user logs in, their role automatically becomes LOGIN , satisfying the POST permission and allowing the request to succeed.

Because APIJSON abstracts the entire CRUD layer, developers can focus on business logic while the framework generates the necessary SQL, handles joins, pagination, ordering, grouping, and even complex relational queries—all defined in the JSON request.

In summary, APIJSON reduces the amount of boilerplate code to a handful of JSON statements, provides fine‑grained permission control, and enables rapid development of backend services without writing individual controller methods.

backendJavapermissionJSONCRUDRESTAPIJSON
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.