当前位置:网站首页>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());
}
}
边栏推荐
- Problems encountered in installing MySQL in docker Ubuntu container
- 【let var const】
- How can I know if I want to get the preferential link of stock account opening? Is it safe to open an account online?
- 【多线程】锁策略
- Win11暂停更新点不了怎么办?Win11暂停更新是灰色的如何解决?
- 由浅入深学会白盒测试用例设计
- A quietly rising domestic software, low-key and powerful!
- Face recognition system opencv face detection
- Win11如何取消任务栏隐藏?Win11取消任务栏隐藏的方法
- 对金额进行求和
猜你喜欢

STC 32-bit 8051 single chip microcomputer development example tutorial three program compilation setting and download

Servlet knowledge points

Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?

走进如心小镇,数智化变革连接“未来社区”

数据分析师听起来很高大上?了解这几点你再决定是否转型

Getting started with fastdfs

Easycvr accesses the equipment through the national standard gb28181 protocol. What is the reason for the automatic streaming of the equipment?

RichView RichEdit SRichViewEdit PageSize 页面设置与同步

基于图的 Affinity Propagation 聚类计算公式详解和代码示例

实战项目笔记(一)——虚拟机的创建
随机推荐
Sum the amount
[mysql] install mysql5.7
How can a programmer grow rapidly
Hls4ml/vivado HLS error reporting solution
Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
What else do you not know about new set()
使用Zadig从0到1搭建持续交付平台
C#聯合halcon應用——大華相機采集類
NSI脚本的测试
#yyds干货盘点#SQL聚合查询方法总结
math_ Use differentiation to calculate approximate value
The large list set is divided into multiple small list sets in equal proportion
Big factories are wolves, small factories are dogs?
Win11如何取消任务栏隐藏?Win11取消任务栏隐藏的方法
Error in installing sharp
Richview trvdocparameters page parameter settings
EURA欧瑞E1000系列变频器使用PID实现恒压供水功能的相关参数设置及接线
cocoaPods 添加成功后,导入不了头文件或者not found file 报错
What if win11 can't pause the update? Win11 pause update is gray. How to solve it?
Detailed configuration of network security "Splunk" in national vocational college skills competition