当前位置:网站首页>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());
}
}
边栏推荐
猜你喜欢

EasyCVR集群视频广场页面切换时,请求流未能终止的问题优化

Simple but modern server dashboard dashdot

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

STC 32位8051单片机开发实例教程 三 程序编译设置与下载

Items in richview documents

开发那些事儿:EasyCVR平台添加播放地址鉴权功能

大厂做狼,小厂做狗?

GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速

关联线探究,如何连接流程图的两个节点

Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
随机推荐
What if the win11 shortcut key switching input method doesn't respond? Shortcut key switching input method does not respond
C#联合halcon应用——大华相机采集类
Understand the structure in C language in one article
网上开户是安全的吗?新手可以开炒股账户吗。
上大学后明白了哪些坑人的事?
渗透工具-TrustedSec 公司的渗透测试框架 (PTF)
Keras machine translation practice
Win11 how to hide the taskbar? Win11 method to hide the taskbar
优质笔记软件综合评测和详细盘点(一) Notion、Obsidian、RemNote、FlowUs
开发那些事儿:EasyCVR集群设备管理页面功能展示优化
Flask 常用组件
EasyCVR集群视频广场页面切换时,请求流未能终止的问题优化
【let var const】
Error in installing sharp
STC 32-bit 8051 single chip microcomputer development example tutorial II i/o working mode and its configuration
Related concepts of cookies and sessions
想得到股票开户的优惠链接,如何得知?在线开户是安全么?
Optimization of the problem that the request flow fails to terminate during page switching of easycvr cluster video Plaza
人脸识别系统 —— OpenCV人脸检测
300题线性代数 第四讲 线性方程组