From 4b1205c3d3a079479964612e781ca08cdf70985c Mon Sep 17 00:00:00 2001 From: lifenlong Date: Fri, 21 May 2021 11:59:31 +0800 Subject: [PATCH] =?UTF-8?q?APP=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/AppVersionBuyerController.java | 36 +++++++++++++++++++ config/application.yml | 1 + .../{AppVersionDO.java => AppVersion.java} | 2 +- .../system/mapper/AppVersionMapper.java | 8 +++-- .../system/service/AppVersionService.java | 13 ++++--- .../serviceimpl/AppVersionServiceImpl.java | 8 +++-- .../setting/AppVersionManagerController.java | 20 +++++------ 7 files changed, 69 insertions(+), 19 deletions(-) create mode 100644 buyer-api/src/main/java/cn/lili/controller/other/AppVersionBuyerController.java rename framework/src/main/java/cn/lili/modules/system/entity/dos/{AppVersionDO.java => AppVersion.java} (98%) diff --git a/buyer-api/src/main/java/cn/lili/controller/other/AppVersionBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/other/AppVersionBuyerController.java new file mode 100644 index 00000000..7109bc27 --- /dev/null +++ b/buyer-api/src/main/java/cn/lili/controller/other/AppVersionBuyerController.java @@ -0,0 +1,36 @@ +package cn.lili.controller.other; + +import cn.lili.common.enums.ResultUtil; +import cn.lili.common.vo.ResultMessage; +import cn.lili.modules.system.service.AppVersionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +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.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 买家端,APP版本 + * + * @author Bulbasaur + * @date: 2021/5/21 11:15 上午 + */ +@RestController +@Api(tags = "买家端,APP版本") +@RequestMapping("/buyer/appVersion") +public class AppVersionBuyerController { + + @Autowired + private AppVersionService appVersionService; + + + @ApiOperation(value = "获取版本号") + @ApiImplicitParam(name = "appType", value = "app类型", required = true, paramType = "path") + @GetMapping("/{appType}") + public ResultMessage getAppVersion(@PathVariable String appType) { + return ResultUtil.data(appVersionService.getAppVersion(appType)); + } +} diff --git a/config/application.yml b/config/application.yml index aa79004d..56305085 100644 --- a/config/application.yml +++ b/config/application.yml @@ -149,6 +149,7 @@ ignored: - /buyer/promotion/pointsGoods/** - /buyer/memberEvaluation/**/goodsEvaluation - /buyer/memberEvaluation/**/evaluationNumber + - /buyer/appVersion/** - /store/login/** - /manager/user/login - /manager/user/refresh/** diff --git a/framework/src/main/java/cn/lili/modules/system/entity/dos/AppVersionDO.java b/framework/src/main/java/cn/lili/modules/system/entity/dos/AppVersion.java similarity index 98% rename from framework/src/main/java/cn/lili/modules/system/entity/dos/AppVersionDO.java rename to framework/src/main/java/cn/lili/modules/system/entity/dos/AppVersion.java index 7c6d08f6..b4619a59 100755 --- a/framework/src/main/java/cn/lili/modules/system/entity/dos/AppVersionDO.java +++ b/framework/src/main/java/cn/lili/modules/system/entity/dos/AppVersion.java @@ -30,7 +30,7 @@ import java.util.Date; @Table(name = "li_app_version") @TableName("li_app_version") @ApiModel(value = "app版本控制") -public class AppVersionDO{ +public class AppVersion { private static final long serialVersionUID = 3034686331756935L; diff --git a/framework/src/main/java/cn/lili/modules/system/mapper/AppVersionMapper.java b/framework/src/main/java/cn/lili/modules/system/mapper/AppVersionMapper.java index 2f48917c..5aab7101 100644 --- a/framework/src/main/java/cn/lili/modules/system/mapper/AppVersionMapper.java +++ b/framework/src/main/java/cn/lili/modules/system/mapper/AppVersionMapper.java @@ -1,7 +1,8 @@ package cn.lili.modules.system.mapper; -import cn.lili.modules.system.entity.dos.AppVersionDO; +import cn.lili.modules.system.entity.dos.AppVersion; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Select; /** * app版本控制数据处理层 @@ -9,6 +10,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @author Chopper * @date 2020/11/17 8:01 下午 */ -public interface AppVersionMapper extends BaseMapper { +public interface AppVersionMapper extends BaseMapper { + + @Select("SELECT * FROM li_app_version WHERE type=#{appType} ORDER BY version_update_date DESC LIMIT 1") + AppVersion getLatestVersion(String appType); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/system/service/AppVersionService.java b/framework/src/main/java/cn/lili/modules/system/service/AppVersionService.java index 46352afb..bf729275 100644 --- a/framework/src/main/java/cn/lili/modules/system/service/AppVersionService.java +++ b/framework/src/main/java/cn/lili/modules/system/service/AppVersionService.java @@ -1,15 +1,20 @@ package cn.lili.modules.system.service; -import cn.lili.modules.system.entity.dos.AppVersionDO; +import cn.lili.modules.system.entity.dos.AppVersion; import com.baomidou.mybatisplus.extension.service.IService; /** - * 物流公司业务层 + * app版本业务层 * * @author Chopper * @date 2020/11/17 8:02 下午 */ -public interface AppVersionService extends IService { - +public interface AppVersionService extends IService { + /** + * 获取当前最新的APP版本 + * 获取用户的APP类型,返回最新的数据的版本号 + * @return 最新的APP版本号 + */ + AppVersion getAppVersion(String appType); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/system/serviceimpl/AppVersionServiceImpl.java b/framework/src/main/java/cn/lili/modules/system/serviceimpl/AppVersionServiceImpl.java index 51ece980..12e0d198 100644 --- a/framework/src/main/java/cn/lili/modules/system/serviceimpl/AppVersionServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/system/serviceimpl/AppVersionServiceImpl.java @@ -1,6 +1,6 @@ package cn.lili.modules.system.serviceimpl; -import cn.lili.modules.system.entity.dos.AppVersionDO; +import cn.lili.modules.system.entity.dos.AppVersion; import cn.lili.modules.system.mapper.AppVersionMapper; import cn.lili.modules.system.service.AppVersionService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -16,6 +16,10 @@ import org.springframework.transaction.annotation.Transactional; */ @Service @Transactional -public class AppVersionServiceImpl extends ServiceImpl implements AppVersionService { +public class AppVersionServiceImpl extends ServiceImpl implements AppVersionService { + @Override + public AppVersion getAppVersion(String appType) { + return this.baseMapper.getLatestVersion(appType); + } } diff --git a/manager-api/src/main/java/cn/lili/controller/setting/AppVersionManagerController.java b/manager-api/src/main/java/cn/lili/controller/setting/AppVersionManagerController.java index 52f9f3b7..9d28b442 100755 --- a/manager-api/src/main/java/cn/lili/controller/setting/AppVersionManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/setting/AppVersionManagerController.java @@ -7,7 +7,7 @@ import cn.lili.common.enums.ResultUtil; import cn.lili.common.utils.StringUtils; import cn.lili.common.vo.PageVO; import cn.lili.common.vo.ResultMessage; -import cn.lili.modules.system.entity.dos.AppVersionDO; +import cn.lili.modules.system.entity.dos.AppVersion; import cn.lili.modules.system.service.AppVersionService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -34,33 +34,33 @@ public class AppVersionManagerController { private AppVersionService appVersionService; - @ApiOperation(value = "查询app升级消息", response = AppVersionDO.class) + @ApiOperation(value = "查询app升级消息", response = AppVersion.class) @GetMapping @ApiImplicitParams({ @ApiImplicitParam(name = "type", value = "APP类型", required = true, dataType = "type", paramType = "query") }) - public ResultMessage> getByPage(PageVO page, String type) { + public ResultMessage> getByPage(PageVO page, String type) { return ResultUtil.data(this.appVersionService.page(PageUtil.initPage(page), - new QueryWrapper().eq(StringUtils.isNotEmpty(type), "type", type).orderByDesc("create_time"))); + new QueryWrapper().eq(StringUtils.isNotEmpty(type), "type", type).orderByDesc("create_time"))); } - @ApiOperation(value = "添加app版本信息", response = AppVersionDO.class) + @ApiOperation(value = "添加app版本信息", response = AppVersion.class) @PostMapping - public ResultMessage add(@Valid AppVersionDO appVersionDO) { - if(this.appVersionService.save(appVersionDO)){ + public ResultMessage add(@Valid AppVersion appVersion) { + if(this.appVersionService.save(appVersion)){ return ResultUtil.success(); } throw new ServiceException(ResultCode.ERROR); } @PutMapping(value = "/{id}") - @ApiOperation(value = "修改app版本信息", response = AppVersionDO.class) + @ApiOperation(value = "修改app版本信息", response = AppVersion.class) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String", paramType = "path") }) - public ResultMessage edit(@Valid AppVersionDO appVersionDO, @PathVariable String id) { - if(this.appVersionService.updateById(appVersionDO)){ + public ResultMessage edit(@Valid AppVersion appVersion, @PathVariable String id) { + if(this.appVersionService.updateById(appVersion)){ return ResultUtil.success(); } throw new ServiceException(ResultCode.ERROR);