当前位置:网站首页>internship:逐渐迈向项目开发
internship:逐渐迈向项目开发
2022-07-01 19:00:00 【ahyo】
之前写的接口只是用于返回json格式数据,一开始不会去参与正式的项目编写代码,而是负责人会发一些文本具体内容就是json格式数据,先以集合框架来编写。之后在理解了一定的业务逻辑后编写接口实现数据回显,进一步再把之前用map list等集合框架实现的,封装成类其中需要加上swagger之类的注解,也即今天所需要做的。
经过几次的试错,逐渐把整个给参考的项目代码深入了解,具体的springboot在干什么以及MyBatis-Plus的便捷之处,以及建立在MyBatis使用基础之上如何的理解MyBatis-Plus的运作机制。以及整个项目所看见的实体类,一部分是依据数据库表建立的,一部分是word文档或者Excel表提取到的。当然这里给的是json格式数据文本,直接转实体类即可,蛮好的工具集成网站。分清Json格式数据的花括号和中括号 所代表的意思,是整个类包含了其他实体类的实例化 还是分开的单独实体类。
较之前的map写的 改为实体类来实现:
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接口实现类:
@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;
}
接口:
@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 = "详细坐标参数")
@ApiOperationSupport(order=2)
public ResponseData<List<ModuleDemoInfo>> listResponseData() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
return new ResponseData<>(demoService.arg2());
}
}
边栏推荐
- math_ Use differentiation to calculate approximate value
- Win11如何取消任务栏隐藏?Win11取消任务栏隐藏的方法
- Image acquisition and playback of coaxpress high speed camera based on pxie interface
- 3D全景模型展示可视化技术演示
- GC garbage collection
- Use of common built-in classes of JS
- 1592 example 1 King (sgu223 loj10170 luogu1896 increase + / provincial election -) violent thinking pressure DP 01 Backpack
- Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
- HLS4ML进入方法
- What if the win11 shortcut key switching input method doesn't respond? Shortcut key switching input method does not respond
猜你喜欢

STC 32位8051单片机开发实例教程 二 I/O工作模式及其配置

GC garbage collection

What if the win11 shortcut key switching input method doesn't respond? Shortcut key switching input method does not respond

MYSLQ十种锁,一篇文章带你全解析

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

强大、好用、适合程序员/软件开发者的专业编辑器/笔记软件综合评测和全面推荐

渗透工具-TrustedSec 公司的渗透测试框架 (PTF)

Interview questions shared in today's group

Redis installation and startup in Windows environment (background startup)

3D panoramic model display visualization technology demonstration
随机推荐
DS transunet: Dual Swing transformer u-net for medical image segmentation
Tensorflow reports an error, could not load dynamic library 'libcudnn so. eight
Technology T3 domestic platform! Successfully equipped with "Yihui domestic real-time system sylixos"
简单但现代的服务器仪表板Dashdot
SwiftUI 4 新功能大全之 Toggle与 Mixed Toggle 多个绑定组件
cocoaPods 添加成功后,导入不了头文件或者not found file 报错
Example explanation: move graph explorer to jupyterlab
C # joint Halcon application - Dahua camera acquisition class
Easycvr accesses the equipment through the national standard gb28181 protocol. What is the reason for the automatic streaming of the equipment?
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
振弦采集模塊測量振弦傳感器的流程步驟
人脸识别系统 —— OpenCV人脸检测
【蓝桥杯Web】2022年第十三届蓝桥杯Web大学组国赛真题解析
2022/5/23-2022/5/30
Arduino stepper library drive 28byj-48 stepper motor test program
Iframe 父子页面通信
windows环境 redis安装和启动(后台启动)
振弦采集模块测量振弦传感器的流程步骤
毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?