当前位置:网站首页>Internship: term understanding and handwriting interface
Internship: term understanding and handwriting interface
2022-06-28 19:47:00 【ahyo】
Multithreading and high concurrency : Multithreading is a way to accomplish tasks , High concurrency is a state of system operation , Multithreading helps the system to bear the realization of high concurrency state . Mainly occurs in web A large number of accesses are centralized in the system perhaps socket Received a large number of requests for port centralization
Multithreading is just one of the ways to solve the problem of high concurrency .
After touching the project code Before I realized what I had come into contact with MVC The specific content —— classic MVC In the pattern ,M The business model ,V User interface ,C Controller , Use MVC The goal is to M and V Implementation code separation of , So that the same program can use different forms of expression . among ,View The definition of , It's the user interface . That is to say module The details of the business model .
@Api In the properties of the tags Mainly based on api file ,tags Indicates the general function description of the business , Like list aggregate , This total function covers multiple functional modules , Equivalent understanding is The total function is the class Multiple function modules are the corresponding methods .
Based on the understanding of the overall project code 、 be familiar with . Understand that the creation of each class is based on the database table structure ( Field 、 Data types and so on ) also extends model< T >.
in addition to , Notes that need to be familiar with include ——
@Data( I don't need to introduce myself Used many times )
@ApiOperationSupport
Use ApiOperationSupport The premise is that we need to put swagger2 After configuration, use the following methods , Use in controller On the floor , Sort the control classes .
@EqualsAndHashCode(callSuper = true)
This annotation will generate equals(Object other) and hashCode() Method . Generally set as callSuper=true( Unless it is to judge whether the two objects are consistent )
It defaults to non-static , Non transient properties
You can use the parameters exclude Exclude some attributes
You can use the parameters of Specify which attributes to use only
By default, it only uses the properties defined in the class and does not call the methods of the parent class
@ApiParam(name = “username”, value = “ user name ”, required = true)
Parameters required Express Whether this parameter is required .
@Accessors(chain = true)
Accessor Chinese meaning is accessor ,@Accessors Used for configuration getter and setter Method generation result
chain In Chinese, it means chain , Set to true, be setter Method returns the current object
@ApiModel(value="BizExitInfo object ", description="")
Use scenarios
Use on entity classes , When marking a class swagger The parsing class of
@ApiModelProperty
Use scenarios
Used in being @ApiModel Annotated model class properties
summary
Add and manipulate data for model properties
@ApiModelProperty(value = " name ")// explain
@TableField("name")// Corresponding table structure field name
Put on properties
Except for the above, entity classes are created based on each table , So in api Response parameters in the document It needs to be established separately model Easy to call when writing interfaces .
The interface is generally return ResponseData class , Need to return data .
Secondly, in the aspect of general login authentication apache Security framework for shiro, Realize user identity authentication 、 Authority authorization 、 encryption 、 Session management and other functions .
Gradually understand what interface annotations are doing , It's actually for api Just document layout . such as @ApiSort Sort interfaces , Moreover, the interface is provided for the front end , Then the interface generation is completed after other creation ( such as service layer 、dao layer 、pojo And configuration files ) On the basis of , Therefore, when writing interfaces, you will find There are many abbreviations and comments in the code . utilize MyBatis-Plus After that, most of the classes that will be created will inherit MyBatis-Plus Existing .
package com.hyd.daring.api;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hyd.daring.common.response.ResponseData;
import com.hyd.daring.service.IBizAttendanceRecordService;
import com.hyd.daring.transfer.app.AttendanceIndexModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.ResultMap;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.time.YearMonth;
/** * Monthly expenses interface Demo * * @author yyp */
@RestController
@RequestMapping("/MonthPay")
@Api( tags =" Monthly sales interface ")
@Slf4j
public class DemoApi {
@Resource
private IBizAttendanceRecordService iBizAttendanceRecordService;
/** * * On the pin — home page ( Expenses of this month ) * */
@RequestMapping(value = "/thisYear/index")
@ApiOperation(value = " This month's expenses ")
@ApiOperationSupport(order = 1)
public ResponseData<AttendanceIndexModel> attendanceIndex(
@ApiParam(name="yearId",value=" Year ",required=true) Integer yearId )
{
return new ResponseData<>(iBizAttendanceRecordService.attendanceIndex(yearId));
}
}
边栏推荐
- 《数据安全法》出台一周年,看哪四大变化来袭?
- Installation and configuration of CGAL in PCL environment 5.4.1
- 如何通过W3school学习JS/如何使用W3school的JS参考手册
- 智能计算系统1 环境搭建
- 秋招经验分享 | 银行笔面试该怎么准备
- Technical methodology of new AI engine under the data infrastructure upgrade window
- C#应用程序界面开发基础——窗体控制
- How does redis implement inventory deduction? How to prevent oversold?
- Analysys analytics' 2022 China Banking privacy computing platform supplier strength matrix analysis' research activity was officially launched
- 团体程序设计天梯赛练习题-持续更新中
猜你喜欢
![return new int[]{i + 1, mid + 1}; return {i + 1, mid + 1};](/img/6a/45a4494276deba72ef9833818229f5.png)
return new int[]{i + 1, mid + 1}; return {i + 1, mid + 1};

Technical methodology of new AI engine under the data infrastructure upgrade window

Variational graph auto-encoders (VGAE)

Tencent tangdaosheng: facing the new world of digital and real integration, developers are the most important "architects"

Demo of integrated development of intelligent computing system 3 plugin

视差js特效js轮播图插件

Severity code description project file line suppress status error lnk2038 detected a mismatch of "runtimelibrary": the value "md\u dynamicrelease" does not match the value "mdd\u dynamicde"

Redis 如何实现库存扣减操作?如何防止商品被超卖?

Nanopc-t4 (rk3399) Game1 OLED (I2C) display time weather temperature

Autumn recruitment experience sharing | how to prepare for bank interview
随机推荐
echart:横向柱状图的类目文字位置调整
C语言-函数知识点
Double contextual relationship network for polyp segmentation
Huawei cloud onemeeting tells you that the whole scene meeting is held like this!
Wechat applet_ 8. View and logic
F(x)构建方程 ,梯度下降求偏导,损失函数确定偏导调整,激活函数处理非线性问题
秒杀系统设计
Digital collection, ten thousand words long text, most of the questions you want to know have been clearly explained, which must be seen by practitioners
Web3 that unleashes the value of the Internet
On the first anniversary of the data security law, which four major changes are coming?
图神经网络入门 (GNN, GCN)
Markdown mermaid种草(1)_ mermaid简介
ArrayList of collection
Matlab 2D or 3D triangulation
How strong a mathematical foundation does deep learning need?
Are there any regular and safe foreign exchange dealers in China?
颜色渐变的FontAwesome图标
The amazing nanopc-t4 (rk3399) is used as the initial configuration and related applications of the workstation
F (x) construct the equation, calculate the partial derivative by gradient descent, determine the partial derivative adjustment by loss function, and deal with nonlinear problems by activation functio
Kettle (VI): full database backup based on kettle