当前位置:网站首页>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());
}
}
边栏推荐
- EURA欧瑞E1000系列变频器使用PID实现恒压供水功能的相关参数设置及接线
- Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
- STC 32-bit 8051 single chip microcomputer development example tutorial three program compilation setting and download
- 数据分析师听起来很高大上?了解这几点你再决定是否转型
- 上大学后明白了哪些坑人的事?
- Interview questions shared in today's group
- Hls4ml/vivado HLS error reporting solution
- C # joint halcon Application - Dahua Camera Collection class
- Richview RichEdit srichviewedit PageSize page setup and synchronization
- qobject_ Cast usage
猜你喜欢

fastDFS入门

NSI脚本的测试

RichView TRVDocParameters 页面参数设置

Detailed configuration of network security "Splunk" in national vocational college skills competition

Richview trvdocparameters page parameter settings

GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
![[multithreading] lock strategy](/img/97/5cacfd2de73d3c3b8acabf6b5c5ce3.png)
[multithreading] lock strategy

Is Dao safe? Build finance encountered a malicious governance takeover and was looted!

math_ Use differentiation to calculate approximate value

Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
随机推荐
[C language] explain the usage of memset() function in detail
Optimization of the problem that the request flow fails to terminate during page switching of easycvr cluster video Plaza
[untitled]
internship:逐渐迈向项目开发
Use of common built-in classes of JS
list大集合等比分割成多个小list集合
RichView TRVDocParameters 页面参数设置
振弦采集模塊測量振弦傳感器的流程步驟
Interview question 1
qobject_ Cast usage
STC 32位8051单片机开发实例教程 二 I/O工作模式及其配置
The large list set is divided into multiple small list sets in equal proportion
Process steps of vibrating wire acquisition module for measuring vibrating wire sensor
Principle of motion capture system
人脸识别系统 —— OpenCV人脸检测
Is Dao safe? Build finance encountered a malicious governance takeover and was looted!
关于元宇宙下一代入口——脑机接口的实现
Using qeventloop to realize synchronous waiting for the return of slot function
PHP gets the external chain address of wechat applet and applet store