如何通过Java实现时间轴过程解析
这篇文章主要介绍了如何通过Java实现时间轴过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
1.需要添加FastJson的依赖处理数据。
com.alibaba fastjson 1.2.47
2.创建测试数据库和表。
3.创建entity、dao、service、controller各层,可以使用EasyCode快速生成(之前博客有教程),然后增减代码。
entity
privatestaticfinallongserialVersionUID=423496079020131231L; privateIntegerid; @JSONField(format="yyyy-MM-ddHH:mm:ss") privateDatetime; privateStringcontent; publicIntegergetId(){ returnid; } publicvoidsetId(Integerid){ this.id=id; } publicDategetTime(){ returntime; } publicvoidsetTime(Datetime){ this.time=time; } publicStringgetContent(){ returncontent; } publicvoidsetContent(Stringcontent){ this.content=content; }
dao
/** *获取所有数据 *@return */ ListgetAllData();
service
/** *获取所有数据 *@return */ ListgetAllData();
serviceimpl
@Resource privateInfoDaoinfoDao; /** *获取所有数据 *@return */ publicListgetAllData(){ returnthis.infoDao.getAllData(); }
controller
@Resource privateInfoDaoinfoDao; /** *获取所有数据 *@return */ publicListgetAllData(){ returnthis.infoDao.getAllData(); }
mapper
select*fromideatest.infoorderbytimedesc
4.前端js、css、html文件编写。
html
时间轴