Today, the DAO, Entity, Service, and Web in each function module are imitated when the function is actually written. When you write code yourself, you begin to understand what the code in each package does. This is mainly due to the improved understanding of Service, DAO layer and Controller in the Web.

dao

DAO layer is in the framework of MyBatis through @MyBatisDAO connection background code and database, mainly to connect to the operation of the database.

The DAO layer is used to define the method interface, and then implement the interface methods in the Service layer and ServiceImpl layer, so as to achieve the purpose of manipulating the database. Data persistence operation on the database, method statement is mainly for the database, mainly to achieve some add, delete, change and check operations, in MyBatis method is mainly in Xx. XML mapping each other.

Note: the interface

entity

The entity layer is the getter and setter methods used to define entities, define individual properties, and define individual properties.

The entity layer, which holds the entity classes, is basically consistent with the property values in the database, and implements the setter and getter methods.

service

The service layer is the concrete method used to implement the operation, including the code of the page operation module.

The Service layer is used to store business logic processing and also operate on the database, but it does not deal with the database directly. It provides method interfaces for the Controller layer. The Service layer not only has interfaces but also implementation methods of interfaces.

web

The controller in the Web layer mainly connects the background with the front end, acquires the operation of the background from the front end, and displays the operable data to the front end interface.

The control layer, which is responsible for the control of the business process of the specific module, needs to call the interface of the Service logic design layer to control the business process. Since the methods in the service are the ones that need to be used, the Controller does business by receiving the parameters from the front end and returning the processing results to the front end.