feat: 增加升级上传apk相关接口

dev
huangfeng 1 year ago
parent 6c1edaa5d9
commit d2cd34ad5f

@ -0,0 +1,63 @@
package com.shxy.xymanager_admin.controller;
import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.entity.MntnUpgrades;
import com.shxy.xymanager_common.exception.ApiException;
import com.shxy.xymanager_service.service.UpgradeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;
@RestController
@Api(tags = {"升级相关接口"})
@RequestMapping("upgrade")
@Slf4j
public class UpgradeController extends BaseController {
@Resource
UpgradeService service;
@GetMapping("listAll")
@ApiOperation("查询全部列表")
public ResponseReult<List<MntnUpgrades>> listAll() {
List<MntnUpgrades> result = service.listAll();
return ResponseReult.success(result);
}
@PostMapping("upload")
@ApiOperation("上传")
public ResponseReult<String> upload(@RequestParam("file") MultipartFile file,
@RequestParam(value = "title", required = false) String title,
@RequestParam(value = "type", required = true) Integer type) throws Exception {
if (file == null) {
throw new ApiException("缺少上传的文件");
}
if (StringUtils.isBlank(file.getOriginalFilename()) || !file.getOriginalFilename().endsWith(".apk")) {
throw new ApiException("文件格式不正确");
}
MntnUpgrades record = new MntnUpgrades();
record.setTitle(title);
record.setType(type);
service.upload(record, file);
return ResponseReult.success("OK");
}
@PostMapping("delete")
@ApiOperation("删除")
public ResponseReult<String> delete(@Validated @NotNull(message = "id不能为空!") Integer id) throws Exception {
if (id == null) {
throw new ApiException("id不能为空!");
}
service.delete(id);
return ResponseReult.success("OK");
}
}

@ -89,6 +89,9 @@ swagger2:
# excludes: /system/notice
# # 匹配链接
# urlPatterns: /system/*,/monitor/*,/tool/*
#运维配置
maintain:
apk: /home/xymp/apk
cma:
server: 127.0.0.1

@ -0,0 +1,335 @@
package com.shxy.xymanager_common.entity;
import java.util.Date;
public class MntnUpgrades {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_upgrades.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_upgrades.title
*
* @mbg.generated
*/
private String title;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_upgrades.file_name
*
* @mbg.generated
*/
private String fileName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_upgrades.path
*
* @mbg.generated
*/
private String path;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_upgrades.md5
*
* @mbg.generated
*/
private String md5;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_upgrades.file_size
*
* @mbg.generated
*/
private Integer fileSize;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_upgrades.type
*
* @mbg.generated
*/
private Integer type;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_upgrades.status
*
* @mbg.generated
*/
private Integer status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_upgrades.create_time
*
* @mbg.generated
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_upgrades.update_time
*
* @mbg.generated
*/
private Date updateTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_upgrades.id
*
* @return the value of mntn_upgrades.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_upgrades.id
*
* @param id the value for mntn_upgrades.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_upgrades.title
*
* @return the value of mntn_upgrades.title
*
* @mbg.generated
*/
public String getTitle() {
return title;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_upgrades.title
*
* @param title the value for mntn_upgrades.title
*
* @mbg.generated
*/
public void setTitle(String title) {
this.title = title;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_upgrades.file_name
*
* @return the value of mntn_upgrades.file_name
*
* @mbg.generated
*/
public String getFileName() {
return fileName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_upgrades.file_name
*
* @param fileName the value for mntn_upgrades.file_name
*
* @mbg.generated
*/
public void setFileName(String fileName) {
this.fileName = fileName;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_upgrades.path
*
* @return the value of mntn_upgrades.path
*
* @mbg.generated
*/
public String getPath() {
return path;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_upgrades.path
*
* @param path the value for mntn_upgrades.path
*
* @mbg.generated
*/
public void setPath(String path) {
this.path = path;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_upgrades.md5
*
* @return the value of mntn_upgrades.md5
*
* @mbg.generated
*/
public String getMd5() {
return md5;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_upgrades.md5
*
* @param md5 the value for mntn_upgrades.md5
*
* @mbg.generated
*/
public void setMd5(String md5) {
this.md5 = md5;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_upgrades.file_size
*
* @return the value of mntn_upgrades.file_size
*
* @mbg.generated
*/
public Integer getFileSize() {
return fileSize;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_upgrades.file_size
*
* @param fileSize the value for mntn_upgrades.file_size
*
* @mbg.generated
*/
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_upgrades.type
*
* @return the value of mntn_upgrades.type
*
* @mbg.generated
*/
public Integer getType() {
return type;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_upgrades.type
*
* @param type the value for mntn_upgrades.type
*
* @mbg.generated
*/
public void setType(Integer type) {
this.type = type;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_upgrades.status
*
* @return the value of mntn_upgrades.status
*
* @mbg.generated
*/
public Integer getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_upgrades.status
*
* @param status the value for mntn_upgrades.status
*
* @mbg.generated
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_upgrades.create_time
*
* @return the value of mntn_upgrades.create_time
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_upgrades.create_time
*
* @param createTime the value for mntn_upgrades.create_time
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_upgrades.update_time
*
* @return the value of mntn_upgrades.update_time
*
* @mbg.generated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_upgrades.update_time
*
* @param updateTime the value for mntn_upgrades.update_time
*
* @mbg.generated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

@ -0,0 +1,942 @@
package com.shxy.xymanager_common.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class MntnUpgradesExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
public MntnUpgradesExample() {
oredCriteria = new ArrayList<>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;
}
public Criteria andTitleIsNotNull() {
addCriterion("title is not null");
return (Criteria) this;
}
public Criteria andTitleEqualTo(String value) {
addCriterion("title =", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotEqualTo(String value) {
addCriterion("title <>", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThan(String value) {
addCriterion("title >", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThanOrEqualTo(String value) {
addCriterion("title >=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThan(String value) {
addCriterion("title <", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThanOrEqualTo(String value) {
addCriterion("title <=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLike(String value) {
addCriterion("title like", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotLike(String value) {
addCriterion("title not like", value, "title");
return (Criteria) this;
}
public Criteria andTitleIn(List<String> values) {
addCriterion("title in", values, "title");
return (Criteria) this;
}
public Criteria andTitleNotIn(List<String> values) {
addCriterion("title not in", values, "title");
return (Criteria) this;
}
public Criteria andTitleBetween(String value1, String value2) {
addCriterion("title between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTitleNotBetween(String value1, String value2) {
addCriterion("title not between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andFileNameIsNull() {
addCriterion("file_name is null");
return (Criteria) this;
}
public Criteria andFileNameIsNotNull() {
addCriterion("file_name is not null");
return (Criteria) this;
}
public Criteria andFileNameEqualTo(String value) {
addCriterion("file_name =", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotEqualTo(String value) {
addCriterion("file_name <>", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameGreaterThan(String value) {
addCriterion("file_name >", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameGreaterThanOrEqualTo(String value) {
addCriterion("file_name >=", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameLessThan(String value) {
addCriterion("file_name <", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameLessThanOrEqualTo(String value) {
addCriterion("file_name <=", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameLike(String value) {
addCriterion("file_name like", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotLike(String value) {
addCriterion("file_name not like", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameIn(List<String> values) {
addCriterion("file_name in", values, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotIn(List<String> values) {
addCriterion("file_name not in", values, "fileName");
return (Criteria) this;
}
public Criteria andFileNameBetween(String value1, String value2) {
addCriterion("file_name between", value1, value2, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotBetween(String value1, String value2) {
addCriterion("file_name not between", value1, value2, "fileName");
return (Criteria) this;
}
public Criteria andPathIsNull() {
addCriterion("`path` is null");
return (Criteria) this;
}
public Criteria andPathIsNotNull() {
addCriterion("`path` is not null");
return (Criteria) this;
}
public Criteria andPathEqualTo(String value) {
addCriterion("`path` =", value, "path");
return (Criteria) this;
}
public Criteria andPathNotEqualTo(String value) {
addCriterion("`path` <>", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThan(String value) {
addCriterion("`path` >", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThanOrEqualTo(String value) {
addCriterion("`path` >=", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThan(String value) {
addCriterion("`path` <", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThanOrEqualTo(String value) {
addCriterion("`path` <=", value, "path");
return (Criteria) this;
}
public Criteria andPathLike(String value) {
addCriterion("`path` like", value, "path");
return (Criteria) this;
}
public Criteria andPathNotLike(String value) {
addCriterion("`path` not like", value, "path");
return (Criteria) this;
}
public Criteria andPathIn(List<String> values) {
addCriterion("`path` in", values, "path");
return (Criteria) this;
}
public Criteria andPathNotIn(List<String> values) {
addCriterion("`path` not in", values, "path");
return (Criteria) this;
}
public Criteria andPathBetween(String value1, String value2) {
addCriterion("`path` between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andPathNotBetween(String value1, String value2) {
addCriterion("`path` not between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andMd5IsNull() {
addCriterion("md5 is null");
return (Criteria) this;
}
public Criteria andMd5IsNotNull() {
addCriterion("md5 is not null");
return (Criteria) this;
}
public Criteria andMd5EqualTo(String value) {
addCriterion("md5 =", value, "md5");
return (Criteria) this;
}
public Criteria andMd5NotEqualTo(String value) {
addCriterion("md5 <>", value, "md5");
return (Criteria) this;
}
public Criteria andMd5GreaterThan(String value) {
addCriterion("md5 >", value, "md5");
return (Criteria) this;
}
public Criteria andMd5GreaterThanOrEqualTo(String value) {
addCriterion("md5 >=", value, "md5");
return (Criteria) this;
}
public Criteria andMd5LessThan(String value) {
addCriterion("md5 <", value, "md5");
return (Criteria) this;
}
public Criteria andMd5LessThanOrEqualTo(String value) {
addCriterion("md5 <=", value, "md5");
return (Criteria) this;
}
public Criteria andMd5Like(String value) {
addCriterion("md5 like", value, "md5");
return (Criteria) this;
}
public Criteria andMd5NotLike(String value) {
addCriterion("md5 not like", value, "md5");
return (Criteria) this;
}
public Criteria andMd5In(List<String> values) {
addCriterion("md5 in", values, "md5");
return (Criteria) this;
}
public Criteria andMd5NotIn(List<String> values) {
addCriterion("md5 not in", values, "md5");
return (Criteria) this;
}
public Criteria andMd5Between(String value1, String value2) {
addCriterion("md5 between", value1, value2, "md5");
return (Criteria) this;
}
public Criteria andMd5NotBetween(String value1, String value2) {
addCriterion("md5 not between", value1, value2, "md5");
return (Criteria) this;
}
public Criteria andFileSizeIsNull() {
addCriterion("file_size is null");
return (Criteria) this;
}
public Criteria andFileSizeIsNotNull() {
addCriterion("file_size is not null");
return (Criteria) this;
}
public Criteria andFileSizeEqualTo(Integer value) {
addCriterion("file_size =", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeNotEqualTo(Integer value) {
addCriterion("file_size <>", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeGreaterThan(Integer value) {
addCriterion("file_size >", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeGreaterThanOrEqualTo(Integer value) {
addCriterion("file_size >=", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeLessThan(Integer value) {
addCriterion("file_size <", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeLessThanOrEqualTo(Integer value) {
addCriterion("file_size <=", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeIn(List<Integer> values) {
addCriterion("file_size in", values, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeNotIn(List<Integer> values) {
addCriterion("file_size not in", values, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeBetween(Integer value1, Integer value2) {
addCriterion("file_size between", value1, value2, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeNotBetween(Integer value1, Integer value2) {
addCriterion("file_size not between", value1, value2, "fileSize");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table mntn_upgrades
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

@ -0,0 +1,97 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.MntnUpgrades;
import com.shxy.xymanager_common.entity.MntnUpgradesExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MntnUpgradesMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
long countByExample(MntnUpgradesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
int deleteByExample(MntnUpgradesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
int insert(MntnUpgrades row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
int insertSelective(MntnUpgrades row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
List<MntnUpgrades> selectByExample(MntnUpgradesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
MntnUpgrades selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("row") MntnUpgrades row, @Param("example") MntnUpgradesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
int updateByExample(@Param("row") MntnUpgrades row, @Param("example") MntnUpgradesExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(MntnUpgrades row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mntn_upgrades
*
* @mbg.generated
*/
int updateByPrimaryKey(MntnUpgrades row);
}

@ -0,0 +1,350 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.shxy.xymanager_dao.dao.MntnUpgradesMapper">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.MntnUpgrades">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="file_name" jdbcType="VARCHAR" property="fileName" />
<result column="path" jdbcType="VARCHAR" property="path" />
<result column="md5" jdbcType="VARCHAR" property="md5" />
<result column="file_size" jdbcType="INTEGER" property="fileSize" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, title, file_name, `path`, md5, file_size, `type`, `status`, create_time, update_time
</sql>
<select id="selectByExample" parameterType="com.shxy.xymanager_common.entity.MntnUpgradesExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from mntn_upgrades
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from mntn_upgrades
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from mntn_upgrades
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.shxy.xymanager_common.entity.MntnUpgradesExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from mntn_upgrades
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.MntnUpgrades">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into mntn_upgrades (title, file_name, `path`,
md5, file_size, `type`,
`status`, create_time, update_time
)
values (#{title,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR},
#{md5,jdbcType=VARCHAR}, #{fileSize,jdbcType=INTEGER}, #{type,jdbcType=INTEGER},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.MntnUpgrades">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into mntn_upgrades
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">
title,
</if>
<if test="fileName != null">
file_name,
</if>
<if test="path != null">
`path`,
</if>
<if test="md5 != null">
md5,
</if>
<if test="fileSize != null">
file_size,
</if>
<if test="type != null">
`type`,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="fileName != null">
#{fileName,jdbcType=VARCHAR},
</if>
<if test="path != null">
#{path,jdbcType=VARCHAR},
</if>
<if test="md5 != null">
#{md5,jdbcType=VARCHAR},
</if>
<if test="fileSize != null">
#{fileSize,jdbcType=INTEGER},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.shxy.xymanager_common.entity.MntnUpgradesExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from mntn_upgrades
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_upgrades
<set>
<if test="row.id != null">
id = #{row.id,jdbcType=INTEGER},
</if>
<if test="row.title != null">
title = #{row.title,jdbcType=VARCHAR},
</if>
<if test="row.fileName != null">
file_name = #{row.fileName,jdbcType=VARCHAR},
</if>
<if test="row.path != null">
`path` = #{row.path,jdbcType=VARCHAR},
</if>
<if test="row.md5 != null">
md5 = #{row.md5,jdbcType=VARCHAR},
</if>
<if test="row.fileSize != null">
file_size = #{row.fileSize,jdbcType=INTEGER},
</if>
<if test="row.type != null">
`type` = #{row.type,jdbcType=INTEGER},
</if>
<if test="row.status != null">
`status` = #{row.status,jdbcType=INTEGER},
</if>
<if test="row.createTime != null">
create_time = #{row.createTime,jdbcType=TIMESTAMP},
</if>
<if test="row.updateTime != null">
update_time = #{row.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_upgrades
set id = #{row.id,jdbcType=INTEGER},
title = #{row.title,jdbcType=VARCHAR},
file_name = #{row.fileName,jdbcType=VARCHAR},
`path` = #{row.path,jdbcType=VARCHAR},
md5 = #{row.md5,jdbcType=VARCHAR},
file_size = #{row.fileSize,jdbcType=INTEGER},
`type` = #{row.type,jdbcType=INTEGER},
`status` = #{row.status,jdbcType=INTEGER},
create_time = #{row.createTime,jdbcType=TIMESTAMP},
update_time = #{row.updateTime,jdbcType=TIMESTAMP}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.MntnUpgrades">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_upgrades
<set>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="fileName != null">
file_name = #{fileName,jdbcType=VARCHAR},
</if>
<if test="path != null">
`path` = #{path,jdbcType=VARCHAR},
</if>
<if test="md5 != null">
md5 = #{md5,jdbcType=VARCHAR},
</if>
<if test="fileSize != null">
file_size = #{fileSize,jdbcType=INTEGER},
</if>
<if test="type != null">
`type` = #{type,jdbcType=INTEGER},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.MntnUpgrades">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update mntn_upgrades
set title = #{title,jdbcType=VARCHAR},
file_name = #{fileName,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR},
md5 = #{md5,jdbcType=VARCHAR},
file_size = #{fileSize,jdbcType=INTEGER},
`type` = #{type,jdbcType=INTEGER},
`status` = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

@ -0,0 +1,83 @@
package com.shxy.xymanager_service.impl;
import com.shxy.xymanager_common.entity.MntnUpgrades;
import com.shxy.xymanager_common.entity.MntnUpgradesExample;
import com.shxy.xymanager_common.exception.ApiException;
import com.shxy.xymanager_common.util.DateUtil;
import com.shxy.xymanager_dao.dao.MntnUpgradesMapper;
import com.shxy.xymanager_service.service.UpgradeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class UpgradeServiceImpl implements UpgradeService {
@Value("${maintain.apk}")
private String path;
@Resource
MntnUpgradesMapper mapper;
@Override
public List<MntnUpgrades> listAll() {
MntnUpgradesExample example = new MntnUpgradesExample();
MntnUpgradesExample.Criteria criteria = example.createCriteria();
example.setOrderByClause("id desc");
List<MntnUpgrades> list = mapper.selectByExample(example);
for (MntnUpgrades item : list) {
}
return list;
}
@Override
public boolean upload(MntnUpgrades item, MultipartFile file) throws Exception {
String fileName = file.getOriginalFilename();
String ext = StringUtils.getFilenameExtension(fileName);
String path = DateUtil.format(new Date(), "yyyyMMdd") + "_upd_"
+ UUID.randomUUID().toString().substring(0, 13);
if (StringUtils.hasLength(ext)) {
path = path + "." + ext;
}
item.setFileName(fileName);
item.setPath(path);
item.setFileSize((int) file.getSize());
item.setCreateTime(new Date());
item.setUpdateTime(new Date());
File dest = new File(path + "/" + path);
file.transferTo(dest);
mapper.insert(item);
return true;
}
@Override
public void updateTitle(MntnUpgrades item) throws Exception {
MntnUpgrades record = mapper.selectByPrimaryKey(item.getId());
if (record == null) {
throw new ApiException("未找到该记录");
}
record.setTitle(item.getTitle());
record.setUpdateTime(new Date());
mapper.updateByPrimaryKey(record);
}
@Override
public void delete(Integer id) throws Exception {
mapper.deleteByPrimaryKey(id);
}
}

@ -0,0 +1,18 @@
package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.entity.MntnUpgrades;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
public interface UpgradeService {
List<MntnUpgrades> listAll();
boolean upload(MntnUpgrades item, MultipartFile file) throws Exception;
void updateTitle(MntnUpgrades item) throws Exception;
void delete(Integer id) throws Exception;
}
Loading…
Cancel
Save