diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/UpgradeController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/UpgradeController.java new file mode 100644 index 0000000..9351b1d --- /dev/null +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/UpgradeController.java @@ -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> listAll() { + List result = service.listAll(); + return ResponseReult.success(result); + } + + @PostMapping("upload") + @ApiOperation("上传") + public ResponseReult 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 delete(@Validated @NotNull(message = "id不能为空!") Integer id) throws Exception { + if (id == null) { + throw new ApiException("id不能为空!"); + } + service.delete(id); + return ResponseReult.success("OK"); + } +} diff --git a/xymanager_admin/src/main/resources/application-test.yml b/xymanager_admin/src/main/resources/application-test.yml index 8301067..2164dab 100644 --- a/xymanager_admin/src/main/resources/application-test.yml +++ b/xymanager_admin/src/main/resources/application-test.yml @@ -89,6 +89,9 @@ swagger2: # excludes: /system/notice # # 匹配链接 # urlPatterns: /system/*,/monitor/*,/tool/* +#运维配置 +maintain: + apk: /home/xymp/apk cma: server: 127.0.0.1 diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnUpgrades.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnUpgrades.java new file mode 100644 index 0000000..cc9ed42 --- /dev/null +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnUpgrades.java @@ -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; + } +} \ No newline at end of file diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnUpgradesExample.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnUpgradesExample.java new file mode 100644 index 0000000..8df31d9 --- /dev/null +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnUpgradesExample.java @@ -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 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 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 criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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 values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List 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 values) { + addCriterion("title in", values, "title"); + return (Criteria) this; + } + + public Criteria andTitleNotIn(List 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 values) { + addCriterion("file_name in", values, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotIn(List 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 values) { + addCriterion("`path` in", values, "path"); + return (Criteria) this; + } + + public Criteria andPathNotIn(List 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 values) { + addCriterion("md5 in", values, "md5"); + return (Criteria) this; + } + + public Criteria andMd5NotIn(List 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 values) { + addCriterion("file_size in", values, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeNotIn(List 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 values) { + addCriterion("`type` in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List 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 values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List 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 values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List 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 values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List 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); + } + } +} \ No newline at end of file diff --git a/xymanager_dao/src/main/java/com/shxy/xymanager_dao/dao/MntnUpgradesMapper.java b/xymanager_dao/src/main/java/com/shxy/xymanager_dao/dao/MntnUpgradesMapper.java new file mode 100644 index 0000000..d8d0942 --- /dev/null +++ b/xymanager_dao/src/main/java/com/shxy/xymanager_dao/dao/MntnUpgradesMapper.java @@ -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 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); +} \ No newline at end of file diff --git a/xymanager_dao/src/main/resources/mappers/MntnUpgradesMapper.xml b/xymanager_dao/src/main/resources/mappers/MntnUpgradesMapper.xml new file mode 100644 index 0000000..5531829 --- /dev/null +++ b/xymanager_dao/src/main/resources/mappers/MntnUpgradesMapper.xml @@ -0,0 +1,350 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + id, title, file_name, `path`, md5, file_size, `type`, `status`, create_time, update_time + + + + + + delete from mntn_upgrades + where id = #{id,jdbcType=INTEGER} + + + + delete from mntn_upgrades + + + + + + + + SELECT LAST_INSERT_ID() + + 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} + ) + + + + + SELECT LAST_INSERT_ID() + + insert into mntn_upgrades + + + title, + + + file_name, + + + `path`, + + + md5, + + + file_size, + + + `type`, + + + `status`, + + + create_time, + + + update_time, + + + + + #{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}, + + + + + + + update mntn_upgrades + + + 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}, + + + + + + + + + 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} + + + + + + + update mntn_upgrades + + + 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 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} + + \ No newline at end of file diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/UpgradeServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/UpgradeServiceImpl.java new file mode 100644 index 0000000..91b7bce --- /dev/null +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/UpgradeServiceImpl.java @@ -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 listAll() { + MntnUpgradesExample example = new MntnUpgradesExample(); + MntnUpgradesExample.Criteria criteria = example.createCriteria(); + example.setOrderByClause("id desc"); + List 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); + } +} diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/UpgradeService.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/UpgradeService.java new file mode 100644 index 0000000..30c7f96 --- /dev/null +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/UpgradeService.java @@ -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 listAll(); + + boolean upload(MntnUpgrades item, MultipartFile file) throws Exception; + + void updateTitle(MntnUpgrades item) throws Exception; + + void delete(Integer id) throws Exception; + +}