当前位置:网站首页>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());
}
}
边栏推荐
- JS proxy
- On the usage of a magic function
- Entering Ruxin Town, digital intelligence transformation connects "future community"
- RichView TRVDocParameters 页面参数设置
- 人脸识别系统 —— OpenCV人脸检测
- Interview questions shared in today's group
- PowerDesigner design name and comment replacement
- 关于元宇宙下一代入口——脑机接口的实现
- Big factories are wolves, small factories are dogs?
- C # joint halcon Application - Dahua Camera Collection class
猜你喜欢

Solve the problem of slow or failed vscode download

Error in installing sharp

Realize pyramids through JS (asterisk pyramid, palindrome symmetric digital pyramid)

RichView TRVDocParameters 页面参数设置

Bind this of the current scope for callback functions in other cases such as timers and delayers

简单但现代的服务器仪表板Dashdot

3D panoramic model display visualization technology demonstration

Big factories are wolves, small factories are dogs?

Richview RichEdit srichviewedit PageSize page setup and synchronization

运动捕捉系统原理
随机推荐
【C语言】详解 memset() 函数用法
Common components of flask
cocoaPods 添加成功后,导入不了头文件或者not found file 报错
Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, builds an open source ecological road
Interesting! Database is also serverless!
qobject_ Cast usage
Set object value changes null value object
STC 32-bit 8051 single chip microcomputer development example tutorial II i/o working mode and its configuration
What else do you not know about new set()
一个悄然崛起的国产软件,低调又强大!
What if the win11 shortcut key switching input method doesn't respond? Shortcut key switching input method does not respond
On the next generation entrance of the metauniverse -- the implementation of brain computer interface
Bind this of the current scope for callback functions in other cases such as timers and delayers
Stack Overflow 2022 开发者调查:行业走向何方?
How can a programmer grow rapidly
EURA欧瑞E1000系列变频器使用PID实现恒压供水功能的相关参数设置及接线
Install redis under Linux and configure the environment
Problems encountered in installing MySQL in docker Ubuntu container
Win11暂停更新点不了怎么办?Win11暂停更新是灰色的如何解决?
ORA-01950