当前位置:网站首页>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));
}
}
边栏推荐
- Priority problem when local variables and global variables in C language have the same name (when local variables and global variables exist at the same time, local variables are preferred to be refer
- 《数据安全法》出台一周年,看哪四大变化来袭?
- return new int[]{i + 1, mid + 1};return {i + 1, mid + 1};
- JVM memory structure
- Autumn recruitment experience sharing | how to prepare for bank interview
- 5G NR MBS架构介绍
- jsp中获取session中的值
- Kaggle肠胃道图像分割比赛baseline
- 令人惊艳的NanoPC-T4(RK3399)作为工作站的初始配置和相关应用
- 2342
猜你喜欢

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

视频压缩处理之ffmpeg用法

H5 sunflower operation

数字藏品,万字长文,你想知道的大部分问题都讲清楚了从业者必看

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

腾讯汤道生:面向数实融合新世界,开发者是最重要的“建筑师”

Autumn recruitment experience sharing | how to prepare for bank interview

Bayesian Reference problem, mCMC and variational reference

如何通过W3school学习JS/如何使用W3school的JS参考手册

5G NR MBS架构介绍
随机推荐
为什么C语言用使用其他文件的结构体变量时,声明结构体别名还不行,必须使用本名?(使用别名时不能加struct)
Judge whether the string is empty
在arm版本rk3399中搭建halo博客
严重性 代码 说明 项目 文件 行 禁止显示状态 错误 C1047 对象或库文件“.lib”是使用与其他对象(如“x64\Release\main.obj”)不同的
Echart: category text position adjustment of horizontal histogram
MDM data analysis function description
秋招经验分享 | 银行笔面试该怎么准备
There are thousands of roads. Why did this innovative storage company choose this one?
Priority problem when local variables and global variables in C language have the same name (when local variables and global variables exist at the same time, local variables are preferred to be refer
Constrained Delaunay triangulation in MATLAB
Bayesian inference problem, MCMC and variational inference
5g NR MBS architecture introduction
腾讯汤道生:面向数实融合新世界,开发者是最重要的“建筑师”
如何通过W3school学习JS/如何使用W3school的JS参考手册
【算法篇】刷了两道大厂面试题,含泪 ”重学数组“
matlab 二维或三维三角剖分
Bayesian inference problem, MCMC and variational inference
Markdown mermaid种草(1)_ mermaid简介
视频压缩处理之ffmpeg用法
MDM数据分析功能说明