Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段启岩
beyond-clouds
Commits
574c2ebf
Commit
574c2ebf
authored
Mar 19, 2020
by
胡明森
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取最新版本
parent
54a06331
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
1 deletions
+59
-1
src/main/java/cn/meteor/beyondclouds/modules/app/controller/AppVersionApi.java
+19
-1
src/main/java/cn/meteor/beyondclouds/modules/app/mapper/AppVersionMapper.java
+8
-0
src/main/java/cn/meteor/beyondclouds/modules/app/mapper/xml/AppVersionMapper.xml
+4
-0
src/main/java/cn/meteor/beyondclouds/modules/app/service/IAppVersionService.java
+5
-0
src/main/java/cn/meteor/beyondclouds/modules/app/service/impl/AppVersionServiceImpl.java
+23
-0
No files found.
src/main/java/cn/meteor/beyondclouds/modules/app/controller/AppVersionApi.java
View file @
574c2ebf
package
cn
.
meteor
.
beyondclouds
.
modules
.
app
.
controller
;
import
cn.meteor.beyondclouds.core.annotation.Anonymous
;
import
cn.meteor.beyondclouds.core.api.Response
;
import
cn.meteor.beyondclouds.modules.app.entity.AppVersion
;
import
cn.meteor.beyondclouds.modules.app.service.IAppVersionService
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -21,10 +25,24 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping
(
"/api"
)
public
class
AppVersionApi
{
private
IAppVersionService
appVersionService
;
@Autowired
public
void
setAppVersionService
(
IAppVersionService
appVersionService
)
{
this
.
appVersionService
=
appVersionService
;
}
@Anonymous
@ApiOperation
(
"获取版本号"
)
@GetMapping
(
"/app/version/latest"
)
public
Response
<
AppVersion
>
getLatestVersion
()
{
// TODO 获取最新版本信息
return
null
;
AppVersion
appVersion
=
appVersionService
.
getAppVersion
();
if
(
appVersion
==
null
)
{
return
Response
.
error
();
}
return
Response
.
success
(
appVersion
);
}
}
...
...
src/main/java/cn/meteor/beyondclouds/modules/app/mapper/AppVersionMapper.java
View file @
574c2ebf
...
...
@@ -2,6 +2,9 @@ package cn.meteor.beyondclouds.modules.app.mapper;
import
cn.meteor.beyondclouds.modules.app.entity.AppVersion
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.mapstruct.Mapper
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.stereotype.Component
;
/**
* <p>
...
...
@@ -13,4 +16,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public
interface
AppVersionMapper
extends
BaseMapper
<
AppVersion
>
{
/**
* 通过sql语句根据时间降序排序数据后,限制返回最新一条
* @return
*/
AppVersion
getVersionMapper
();
}
src/main/java/cn/meteor/beyondclouds/modules/app/mapper/xml/AppVersionMapper.xml
View file @
574c2ebf
...
...
@@ -2,4 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.meteor.beyondclouds.modules.app.mapper.AppVersionMapper"
>
<select
id=
"getVersionMapper"
resultType=
"cn.meteor.beyondclouds.modules.app.entity.AppVersion"
>
select * from app_version order by create_time desc limit 1
</select>
</mapper>
src/main/java/cn/meteor/beyondclouds/modules/app/service/IAppVersionService.java
View file @
574c2ebf
...
...
@@ -13,4 +13,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public
interface
IAppVersionService
extends
IService
<
AppVersion
>
{
/**
* 根据时间倒序查询最新版本
* @return AppVersion
*/
AppVersion
getAppVersion
();
}
src/main/java/cn/meteor/beyondclouds/modules/app/service/impl/AppVersionServiceImpl.java
View file @
574c2ebf
...
...
@@ -3,7 +3,9 @@ package cn.meteor.beyondclouds.modules.app.service.impl;
import
cn.meteor.beyondclouds.modules.app.entity.AppVersion
;
import
cn.meteor.beyondclouds.modules.app.mapper.AppVersionMapper
;
import
cn.meteor.beyondclouds.modules.app.service.IAppVersionService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
...
...
@@ -17,4 +19,25 @@ import org.springframework.stereotype.Service;
@Service
public
class
AppVersionServiceImpl
extends
ServiceImpl
<
AppVersionMapper
,
AppVersion
>
implements
IAppVersionService
{
private
AppVersionMapper
appVersionMapper
;
@Autowired
public
void
setAppVersionMapper
(
AppVersionMapper
appVersionMapper
)
{
this
.
appVersionMapper
=
appVersionMapper
;
}
/**
* 根据时间倒序查询最新版本
* @return AppVersion
*/
@Override
public
AppVersion
getAppVersion
()
{
AppVersion
appVersion
=
appVersionMapper
.
getVersionMapper
();
if
(
appVersion
==
null
)
{
}
return
appVersion
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment