APP版本升级

This commit is contained in:
lifenlong 2021-05-21 11:59:31 +08:00
parent 64add7e63f
commit 4b1205c3d3
7 changed files with 69 additions and 19 deletions

View File

@ -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<Object> getAppVersion(@PathVariable String appType) {
return ResultUtil.data(appVersionService.getAppVersion(appType));
}
}

View File

@ -149,6 +149,7 @@ ignored:
- /buyer/promotion/pointsGoods/**
- /buyer/memberEvaluation/**/goodsEvaluation
- /buyer/memberEvaluation/**/evaluationNumber
- /buyer/appVersion/**
- /store/login/**
- /manager/user/login
- /manager/user/refresh/**

View File

@ -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;

View File

@ -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<AppVersionDO> {
public interface AppVersionMapper extends BaseMapper<AppVersion> {
@Select("SELECT * FROM li_app_version WHERE type=#{appType} ORDER BY version_update_date DESC LIMIT 1")
AppVersion getLatestVersion(String appType);
}

View File

@ -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<AppVersionDO> {
public interface AppVersionService extends IService<AppVersion> {
/**
* 获取当前最新的APP版本
* 获取用户的APP类型返回最新的数据的版本号
* @return 最新的APP版本号
*/
AppVersion getAppVersion(String appType);
}

View File

@ -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<AppVersionMapper, AppVersionDO> implements AppVersionService {
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersion> implements AppVersionService {
@Override
public AppVersion getAppVersion(String appType) {
return this.baseMapper.getLatestVersion(appType);
}
}

View File

@ -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<IPage<AppVersionDO>> getByPage(PageVO page, String type) {
public ResultMessage<IPage<AppVersion>> getByPage(PageVO page, String type) {
return ResultUtil.data(this.appVersionService.page(PageUtil.initPage(page),
new QueryWrapper<AppVersionDO>().eq(StringUtils.isNotEmpty(type), "type", type).orderByDesc("create_time")));
new QueryWrapper<AppVersion>().eq(StringUtils.isNotEmpty(type), "type", type).orderByDesc("create_time")));
}
@ApiOperation(value = "添加app版本信息", response = AppVersionDO.class)
@ApiOperation(value = "添加app版本信息", response = AppVersion.class)
@PostMapping
public ResultMessage<Object> add(@Valid AppVersionDO appVersionDO) {
if(this.appVersionService.save(appVersionDO)){
public ResultMessage<Object> 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<Boolean> edit(@Valid AppVersionDO appVersionDO, @PathVariable String id) {
if(this.appVersionService.updateById(appVersionDO)){
public ResultMessage<Boolean> edit(@Valid AppVersion appVersion, @PathVariable String id) {
if(this.appVersionService.updateById(appVersion)){
return ResultUtil.success();
}
throw new ServiceException(ResultCode.ERROR);