新增app版本管理
This commit is contained in:
@ -103,7 +103,7 @@
|
||||
</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<#elseif column.columnType != 'Timestamp'>
|
||||
<#elseif column.columnType != 'Date'>
|
||||
<el-table-column v-if="columns.visible('${column.changeColumnName}')" prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" />
|
||||
<#else>
|
||||
<el-table-column v-if="columns.visible('${column.changeColumnName}')" prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>">
|
||||
|
@ -20,15 +20,20 @@ import co.yixiang.modules.activity.vo.YxStoreSeckillQueryVo;
|
||||
import co.yixiang.modules.mp.service.YxWechatLiveService;
|
||||
import co.yixiang.modules.product.service.YxStoreProductService;
|
||||
import co.yixiang.modules.product.vo.YxSystemStoreQueryVo;
|
||||
import co.yixiang.modules.shop.domain.YxAppVersion;
|
||||
import co.yixiang.modules.shop.param.YxSystemStoreQueryParam;
|
||||
import co.yixiang.modules.shop.service.YxAppVersionService;
|
||||
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
|
||||
import co.yixiang.modules.shop.service.YxSystemStoreService;
|
||||
import co.yixiang.modules.shop.vo.AppCheckVersion;
|
||||
import co.yixiang.modules.shop.vo.IndexVo;
|
||||
import co.yixiang.modules.shop.vo.YxAppVersionVo;
|
||||
import co.yixiang.utils.FileUtil;
|
||||
import co.yixiang.utils.RedisUtil;
|
||||
import co.yixiang.utils.ShopKeyUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.netty.handler.codec.http.multipart.HttpData;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -55,7 +60,7 @@ import java.util.Map;
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@Api(value = "首页模块", tags = "商城:首页模块", description = "首页模块")
|
||||
public class IndexController {
|
||||
|
||||
private final YxAppVersionService appVersionService;
|
||||
private final YxSystemGroupDataService systemGroupDataService;
|
||||
private final YxStoreProductService storeProductService;
|
||||
private final YxSystemStoreService systemStoreService;
|
||||
@ -136,6 +141,20 @@ public class IndexController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/version")
|
||||
@ApiOperation(value = "获取app版本信息",notes = "获取app版本信息")
|
||||
public ApiResult<YxAppVersionVo> storeList(AppCheckVersion param){
|
||||
YxAppVersion appVersion= appVersionService.lambdaQuery().orderByDesc(YxAppVersion::getCreateTime).one();
|
||||
YxAppVersionVo appVersionVo=new YxAppVersionVo();
|
||||
appVersionVo.setVersionCode(appVersion.getVersionCode());
|
||||
appVersionVo.setVersionInfo(appVersion.getVersionInfo());
|
||||
appVersionVo.setVersionName(appVersion.getVersionName());
|
||||
appVersionVo.setDownloadUrl(param.getType().equals("1101")?appVersion.getAndroidUrl():appVersion.getIosUrl());
|
||||
appVersionVo.setForceUpdate(appVersion.getForceUpdate()==0);
|
||||
if (!param.getVersionName().equals(appVersion.getVersionName())){
|
||||
return ApiResult.ok(appVersionVo);
|
||||
}
|
||||
return ApiResult.ok(new YxAppVersionVo());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.shop.domain;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.Date;
|
||||
import co.yixiang.domain.BaseDomain;
|
||||
|
||||
/**
|
||||
* @author lioncity
|
||||
* @date 2020-12-09
|
||||
*/
|
||||
@Data
|
||||
@TableName("yx_app_version")
|
||||
public class YxAppVersion extends BaseDomain {
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
|
||||
|
||||
|
||||
/** 版本code */
|
||||
private String versionCode;
|
||||
|
||||
/** 版本名称 */
|
||||
private String versionName;
|
||||
|
||||
/** 版本描述 */
|
||||
private String versionInfo;
|
||||
|
||||
/** 安卓下载链接 */
|
||||
private String androidUrl;
|
||||
|
||||
/** 是否强制升级 */
|
||||
private Integer forceUpdate;
|
||||
|
||||
/** ios store应用商店链接 */
|
||||
private String iosUrl;
|
||||
|
||||
|
||||
public void copy(YxAppVersion source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.shop.rest;
|
||||
import java.util.Arrays;
|
||||
import co.yixiang.dozer.service.IGenerator;
|
||||
import lombok.AllArgsConstructor;
|
||||
import co.yixiang.logging.aop.log.Log;
|
||||
import co.yixiang.modules.shop.domain.YxAppVersion;
|
||||
import co.yixiang.modules.shop.service.YxAppVersionService;
|
||||
import co.yixiang.modules.shop.service.dto.YxAppVersionQueryCriteria;
|
||||
import co.yixiang.modules.shop.service.dto.YxAppVersionDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import co.yixiang.domain.PageResult;
|
||||
/**
|
||||
* @author lioncity
|
||||
* @date 2020-12-09
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Api(tags = "app版本控制管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/yxAppVersion")
|
||||
public class YxAppVersionController {
|
||||
|
||||
private final YxAppVersionService yxAppVersionService;
|
||||
private final IGenerator generator;
|
||||
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('admin','yxAppVersion:list')")
|
||||
public void download(HttpServletResponse response, YxAppVersionQueryCriteria criteria) throws IOException {
|
||||
yxAppVersionService.download(generator.convert(yxAppVersionService.queryAll(criteria), YxAppVersionDto.class), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询app版本控制")
|
||||
@ApiOperation("查询app版本控制")
|
||||
@PreAuthorize("@el.check('admin','yxAppVersion:list')")
|
||||
public ResponseEntity<PageResult<YxAppVersionDto>> getYxAppVersions(YxAppVersionQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(yxAppVersionService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增app版本控制")
|
||||
@ApiOperation("新增app版本控制")
|
||||
@PreAuthorize("@el.check('admin','yxAppVersion:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody YxAppVersion resources){
|
||||
return new ResponseEntity<>(yxAppVersionService.save(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改app版本控制")
|
||||
@ApiOperation("修改app版本控制")
|
||||
@PreAuthorize("@el.check('admin','yxAppVersion:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody YxAppVersion resources){
|
||||
yxAppVersionService.updateById(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除app版本控制")
|
||||
@ApiOperation("删除app版本控制")
|
||||
@PreAuthorize("@el.check('admin','yxAppVersion:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> deleteAll(@RequestBody Integer[] ids) {
|
||||
Arrays.asList(ids).forEach(id->{
|
||||
yxAppVersionService.removeById(id);
|
||||
});
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.shop.service;
|
||||
import co.yixiang.common.service.BaseService;
|
||||
import co.yixiang.modules.shop.domain.YxAppVersion;
|
||||
import co.yixiang.modules.shop.service.dto.YxAppVersionDto;
|
||||
import co.yixiang.modules.shop.service.dto.YxAppVersionQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import co.yixiang.domain.PageResult;
|
||||
/**
|
||||
* @author lioncity
|
||||
* @date 2020-12-09
|
||||
*/
|
||||
public interface YxAppVersionService extends BaseService<YxAppVersion>{
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
PageResult<YxAppVersionDto> queryAll(YxAppVersionQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<YxAppVersionDto>
|
||||
*/
|
||||
List<YxAppVersion> queryAll(YxAppVersionQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<YxAppVersionDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.shop.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lioncity
|
||||
* @date 2020-12-09
|
||||
*/
|
||||
@Data
|
||||
public class YxAppVersionDto implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer isDel;
|
||||
|
||||
/** 更新时间 */
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
/** 版本code */
|
||||
private String versionCode;
|
||||
|
||||
/** 版本名称 */
|
||||
private String versionName;
|
||||
|
||||
/** 版本描述 */
|
||||
private String versionInfo;
|
||||
|
||||
/** 安卓下载链接 */
|
||||
private String androidUrl;
|
||||
|
||||
/** 是否强制升级 */
|
||||
private Integer forceUpdate;
|
||||
|
||||
/** ios store应用商店链接 */
|
||||
private String iosUrl;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.shop.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
import co.yixiang.annotation.Query;
|
||||
|
||||
/**
|
||||
* @author lioncity
|
||||
* @date 2020-12-09
|
||||
*/
|
||||
@Data
|
||||
public class YxAppVersionQueryCriteria{
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.shop.service.impl;
|
||||
|
||||
import co.yixiang.modules.shop.domain.YxAppVersion;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import co.yixiang.dozer.service.IGenerator;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import co.yixiang.common.utils.QueryHelpPlus;
|
||||
import co.yixiang.utils.ValidationUtil;
|
||||
import co.yixiang.utils.FileUtil;
|
||||
import co.yixiang.modules.shop.service.YxAppVersionService;
|
||||
import co.yixiang.modules.shop.service.dto.YxAppVersionDto;
|
||||
import co.yixiang.modules.shop.service.dto.YxAppVersionQueryCriteria;
|
||||
import co.yixiang.modules.shop.service.mapper.YxAppVersionMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
// 默认不使用缓存
|
||||
//import org.springframework.cache.annotation.CacheConfig;
|
||||
//import org.springframework.cache.annotation.CacheEvict;
|
||||
//import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import co.yixiang.domain.PageResult;
|
||||
/**
|
||||
* @author lioncity
|
||||
* @date 2020-12-09
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
//@CacheConfig(cacheNames = "yxAppVersion")
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class YxAppVersionServiceImpl extends BaseServiceImpl<YxAppVersionMapper, YxAppVersion> implements YxAppVersionService {
|
||||
|
||||
private final IGenerator generator;
|
||||
|
||||
@Override
|
||||
//@Cacheable
|
||||
public PageResult<YxAppVersionDto> queryAll(YxAppVersionQueryCriteria criteria, Pageable pageable) {
|
||||
getPage(pageable);
|
||||
PageInfo<YxAppVersion> page = new PageInfo<>(queryAll(criteria));
|
||||
return generator.convertPageInfo(page,YxAppVersionDto.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
//@Cacheable
|
||||
public List<YxAppVersion> queryAll(YxAppVersionQueryCriteria criteria){
|
||||
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxAppVersion.class, criteria));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void download(List<YxAppVersionDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (YxAppVersionDto yxAppVersion : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put(" isDel", yxAppVersion.getIsDel());
|
||||
map.put("更新时间", yxAppVersion.getCreateTime());
|
||||
map.put(" updateTime", yxAppVersion.getUpdateTime());
|
||||
map.put("版本code", yxAppVersion.getVersionCode());
|
||||
map.put("版本名称", yxAppVersion.getVersionName());
|
||||
map.put("版本描述", yxAppVersion.getVersionInfo());
|
||||
map.put("安卓下载链接", yxAppVersion.getAndroidUrl());
|
||||
map.put("是否强制升级", yxAppVersion.getForceUpdate());
|
||||
map.put("ios store应用商店链接", yxAppVersion.getIosUrl());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.shop.service.mapper;
|
||||
|
||||
import co.yixiang.common.mapper.CoreMapper;
|
||||
import co.yixiang.modules.shop.domain.YxAppVersion;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author lioncity
|
||||
* @date 2020-12-09
|
||||
*/
|
||||
@Repository
|
||||
public interface YxAppVersionMapper extends CoreMapper<YxAppVersion> {
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package co.yixiang.modules.shop.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author :LionCity
|
||||
* @date :Created in 2020-12-09 10:47
|
||||
* @description:
|
||||
* @modified By:
|
||||
* @version:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "app校验升级")
|
||||
public class AppCheckVersion implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ApiModelProperty(value = "类型 1101 安卓 1102 ios")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "app版本名称")
|
||||
private String versionName;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package co.yixiang.modules.shop.vo;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import co.yixiang.domain.BaseDomain;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author :LionCity
|
||||
* @date :Created in 2020-12-09 10:25
|
||||
* @description:
|
||||
* @modified By:
|
||||
* @version:
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class YxAppVersionVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
/** 版本code */
|
||||
private String versionCode;
|
||||
|
||||
/** 版本名称 */
|
||||
private String versionName;
|
||||
|
||||
/** 版本描述 */
|
||||
private String versionInfo;
|
||||
|
||||
/** 安卓下载链接 */
|
||||
private String downloadUrl;
|
||||
|
||||
/**是否强制升级*/
|
||||
private Boolean forceUpdate;
|
||||
|
||||
public void copy(co.yixiang.modules.shop.domain.YxAppVersion source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.shop.rest;
|
||||
|
||||
import co.yixiang.domain.PageResult;
|
||||
import co.yixiang.dozer.service.IGenerator;
|
||||
import co.yixiang.logging.aop.log.Log;
|
||||
import co.yixiang.modules.shop.domain.YxAppVersion;
|
||||
import co.yixiang.modules.shop.service.YxAppVersionService;
|
||||
import co.yixiang.modules.shop.service.dto.YxAppVersionDto;
|
||||
import co.yixiang.modules.shop.service.dto.YxAppVersionQueryCriteria;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author lioncity
|
||||
* @date 2020-12-09
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Api(tags = "app版本控制管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/yxAppVersion")
|
||||
public class YxAppVersionController {
|
||||
|
||||
private final YxAppVersionService yxAppVersionService;
|
||||
private final IGenerator generator;
|
||||
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('admin','yxAppVersion:list')")
|
||||
public void download(HttpServletResponse response, YxAppVersionQueryCriteria criteria) throws IOException {
|
||||
yxAppVersionService.download(generator.convert(yxAppVersionService.queryAll(criteria), YxAppVersionDto.class), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询app版本控制")
|
||||
@ApiOperation("查询app版本控制")
|
||||
@PreAuthorize("@el.check('admin','yxAppVersion:list')")
|
||||
public ResponseEntity<PageResult<YxAppVersionDto>> getYxAppVersions(YxAppVersionQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(yxAppVersionService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增app版本控制")
|
||||
@ApiOperation("新增app版本控制")
|
||||
@PreAuthorize("@el.check('admin','yxAppVersion:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody YxAppVersion resources){
|
||||
return new ResponseEntity<>(yxAppVersionService.save(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改app版本控制")
|
||||
@ApiOperation("修改app版本控制")
|
||||
@PreAuthorize("@el.check('admin','yxAppVersion:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody YxAppVersion resources){
|
||||
yxAppVersionService.updateById(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除app版本控制")
|
||||
@ApiOperation("删除app版本控制")
|
||||
@PreAuthorize("@el.check('admin','yxAppVersion:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> deleteAll(@RequestBody Integer[] ids) {
|
||||
Arrays.asList(ids).forEach(id->{
|
||||
yxAppVersionService.removeById(id);
|
||||
});
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user