当前位置:网站首页>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));
}
}
边栏推荐
- PCL 环境下安装配置CGAL 5.4.1
- 腾讯汤道生:面向数实融合新世界,开发者是最重要的“建筑师”
- 团体程序设计天梯赛练习题-持续更新中
- Ali open source (easyexcel)
- How to learn JS through w3school / how to use the JS reference manual of w3school
- 100人成绩的平均
- MDM data analysis function description
- The first meta universe concept novel, meta universe 2086, won the upper attack meta universe award in 2022
- Time series forecasting based on trend and seasonality
- 视差js特效js轮播图插件
猜你喜欢

智能计算系统1 环境搭建

5g NR MBS architecture introduction

Ffmpeg usage in video compression processing

Chunfeng power and Huawei work together to build a smart Park benchmark, and the future factory innovation will reach a new level

Bayesian inference problem, MCMC and variational inference

easypoi

R language GLM generalized linear model: logistic regression, Poisson regression fitting mouse clinical trial data (dose and response) examples and self-test questions

i人事HR系统上架企业微信ISV,增强企微在服务连锁零售等行业深度应用

Variable autoencoders (vaes)

In which industries did the fire virtual human start to make efforts?
随机推荐
How to learn JS through w3school / how to use the JS reference manual of w3school
令人惊艳的NanoPC-T4(RK3399)作为工作站的初始配置和相关应用
Markdown mermaid种草(1)_ mermaid简介
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
Bayesian inference problem, MCMC and variational inference
严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2038 检测到“RuntimeLibrary”的不匹配项: 值“MD_DynamicRelease”不匹配值“MDd_DynamicDe
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"
Can only one task be submitted by one table if the flinkcdc is submitted by flinksql? When there are thousands of watches
Ffmpeg learning summary
Judge whether the string is empty
kettle(六):基于Kettle的数据库全量备份
判断字符串是否为空
Concours de segmentation des images gastro - intestinales de kaggle Baseline
math_ Proving common equivalent infinitesimal & Case & substitution
On the first anniversary of the data security law, which four major changes are coming?
2342
类加载机制与对象的创建
Bayesian inference problem, MCMC and variational inference
Fontawesome icon for color gradient
使用点云构建不规则三角网TIN