当前位置:网站首页>Internship: gradually moving towards project development
Internship: gradually moving towards project development
2022-07-01 20:11:00 【ahyo】
The interface written before is only used to return json Format data , At first, I won't participate in formal project coding , Instead, the person in charge will send some text, the specific content is json Format data , First write with the collection framework . After understanding a certain business logic, write an interface to realize data echo , Further, use the previous map list And so on , Encapsulated into classes, which need to add swagger Notes like that , That is, what we need to do today .
After several trial and error , Gradually understand the whole project code for reference , Concrete springboot What are you doing and MyBatis-Plus The convenience of , And built on MyBatis How to understand on the basis of use MyBatis-Plus The operating mechanism of . And the entity classes seen by the whole project , One part is based on the database table , Part of it is word Document or Excel Table extracted . Of course, here is json Format data text , Just transfer to entity class , Great tool integration website . Distinguish between Json Curly brackets and brackets for format data What do you mean , The whole class contains the instantiation of other entity classes Or separate entity classes .
Earlier map Written Change to entity class to realize :
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
public class ModuleDemoInfo {
@ApiModelProperty(value = "xaxis")
private List<Integer> xaxis;
private Yaxis1 yaxis=new Yaxis1();
private Yaxis1 yaxis11=new Yaxis1();
private Yaxis1 yaxis12=new Yaxis1();
@ApiModelProperty(value = "yaxis1")
private List<Yaxis1> yaxis1;
@ApiModelProperty(value = "yaxis2")
private List yaxis2;
public ModuleDemoInfo()
{
}
@Data
@Accessors(chain = true)
public class Yaxis1
{
@ApiModelProperty(value = "ybgg")
private double ybgg;
@ApiModelProperty(value = "zfxjj")
private double zfxjj;
@ApiModelProperty(value = "gyzcjy")
private double gyzcjy;
@ApiModelProperty(value = "shbzjj")
private double shbzjj;
@ApiModelProperty(value = "total")
private double total;
public Yaxis1()
{
}
}
}
service Interface implementation class :
@Override
public List<ModuleDemoInfo> arg2() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
List<ModuleDemoInfo> list=new ArrayList<>();
List<Integer> intList=new ArrayList<>();
ModuleDemoInfo moduleDemoInfo=new ModuleDemoInfo();
List list1=new ArrayList();
moduleDemoInfo.getYaxis().setGyzcjy(0.29);
moduleDemoInfo.getYaxis().setZfxjj(1404.3);
moduleDemoInfo.getYaxis().setShbzjj(0.0);
moduleDemoInfo.getYaxis().setYbgg(137631.17);
moduleDemoInfo.getYaxis().setTotal(139035.76);
moduleDemoInfo.getYaxis11().setGyzcjy(0.0);
moduleDemoInfo.getYaxis11().setZfxjj(0.0);
moduleDemoInfo.getYaxis11().setShbzjj(0.0);
moduleDemoInfo.getYaxis11().setYbgg(0.0);
moduleDemoInfo.getYaxis11().setTotal(0.0);
moduleDemoInfo.getYaxis12().setGyzcjy(0.0);
moduleDemoInfo.getYaxis12().setZfxjj(0.0);
moduleDemoInfo.getYaxis12().setShbzjj(0.0);
moduleDemoInfo.getYaxis12().setYbgg(0.0);
moduleDemoInfo.getYaxis12().setTotal(0.0);
list1.add(moduleDemoInfo.getYaxis());
list1.add( moduleDemoInfo.getYaxis11());
list1.add(moduleDemoInfo.getYaxis12());
intList.add(2022);
intList.add(2021);
intList.add(2020);
moduleDemoInfo.setXaxis(intList);
moduleDemoInfo.setYaxis1(list1);
moduleDemoInfo.setYaxis2(list1);
list.add(moduleDemoInfo);
return list;
}
Interface :
@RequestMapping("/Demo")
@RestController
@Api(tags = "demo 1/2")
@Validated
@Slf4j
public class DemoController {
@Resource
private DemoService demoService;
@RequestMapping(value = "/arg1",method = RequestMethod.GET)
@ApiOperation(value = " Detailed coordinate parameters ")
@ApiOperationSupport(order=2)
public ResponseData<List<ModuleDemoInfo>> listResponseData() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
return new ResponseData<>(demoService.arg2());
}
}
边栏推荐
- SQL getting started plan-1-select
- List is divided into sets that meet and do not meet conditions (partitioningby)
- 【多线程】 实现单例模式 ( 饿汉、懒汉 ) 实现线程安全的单例模式 (双重效验锁)
- Powerful, easy-to-use, professional editor / notebook software suitable for programmers / software developers, comprehensive evaluation and comprehensive recommendation
- 由浅入深学会白盒测试用例设计
- Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
- Exclusive news: Alibaba cloud quietly launched RPA cloud computer and has opened cooperation with many RPA manufacturers
- Niuke programming question -- must brush the string of 101 (brush the question efficiently, draw inferences from one instance)
- 关联线探究,如何连接流程图的两个节点
- math_ Use differentiation to calculate approximate value
猜你喜欢
STC 32位8051单片机开发实例教程 二 I/O工作模式及其配置
8K HDR!|为 Chromium 实现 HEVC 硬解 - 原理/实测指南
fastDFS入门
Is Dao safe? Build finance encountered a malicious governance takeover and was looted!
Detailed configuration of network security "Splunk" in national vocational college skills competition
RichView TRVDocParameters 页面参数设置
独家消息:阿里云悄然推出RPA云电脑,已与多家RPA厂商开放合作
math_利用微分算近似值
Win11 how to hide the taskbar? Win11 method to hide the taskbar
Review the collection container again
随机推荐
2022/6/8-2022/6/12
ORA-01950
Stack Overflow 2022 开发者调查:行业走向何方?
February 15, 2022: sweeping robot. There is a floor sweeping robot in the room (represented by a grid). Each grid in the grid has two possibilities: empty and obstacles. The sweeping robot provides fo
STC 32位8051单片机开发实例教程 二 I/O工作模式及其配置
运动捕捉系统原理
JS proxy
internship:逐渐迈向项目开发
Process steps of vibrating wire acquisition module for measuring vibrating wire sensor
PHP gets the external chain address of wechat applet and applet store
基于图的 Affinity Propagation 聚类计算公式详解和代码示例
Understand the structure in C language in one article
fastDFS入门
全国职业院校技能大赛网络安全“splunk“详细配置
switch 有四样写法你知道么
墨天轮沙龙 | 清华乔嘉林:Apache IoTDB,源于清华,建设开源生态之路
RichView 文档中的 ITEM
How to turn off the boot auto start software in win11
Keras机器翻译实战