feat:app版本管理
This commit is contained in:
1 parent
1344217733
commit
5c98efcbc5
12 files changed
+420
-17
No files matched your search
@@ -17,21 +17,22 @@ CREATE TABLE `hard_panel_setting`
|
||||
-- app版本控制表
|
||||
CREATE TABLE `app_version`
|
||||
(
|
||||
`id` bigint NOT NULL COMMENT '主键ID',
|
||||
`platform` varchar(32) NOT NULL COMMENT '平台类型(android、ios)',
|
||||
`version_code` int NOT NULL COMMENT '内部版本号(用于比较大小)',
|
||||
`version_name` varchar(32) NOT NULL COMMENT '展示版本号(字符串)',
|
||||
`update_content` text COMMENT '更新内容/更新日志',
|
||||
`download_url` varchar(512) NOT NULL COMMENT '安装包下载地址(wgt、apk)',
|
||||
`is_force` varchar(32) NOT NULL COMMENT '是否强制更新',
|
||||
`is_silent` varchar(32) NOT NULL COMMENT '是否静默更新(WGT用)',
|
||||
`status` varchar(32) NOT NULL COMMENT '状态(已发布、未发布、已下架)',
|
||||
`create_by` varchar(50) DEFAULT NULL COMMENT '创建者',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_by` varchar(50) DEFAULT NULL COMMENT '更新者',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`del_flag` char(1) DEFAULT '0' COMMENT '是否删除(0=正常 1=删除)',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户编号',
|
||||
`id` bigint NOT NULL COMMENT '主键ID',
|
||||
`app_unique_code` varchar(32) DEFAULT NULL COMMENT 'app唯一编码',
|
||||
`platform` varchar(32) NOT NULL COMMENT '平台类型(android、ios)',
|
||||
`version_code` int NOT NULL COMMENT '内部版本号(用于比较大小)',
|
||||
`version_name` varchar(32) NOT NULL COMMENT '展示版本号(字符串)',
|
||||
`update_content` text COMMENT '更新内容/更新日志',
|
||||
`download_url` varchar(512) NOT NULL COMMENT '安装包下载地址(wgt、apk)',
|
||||
`is_force` varchar(32) NOT NULL COMMENT '是否强制更新',
|
||||
`is_silent` varchar(32) NOT NULL COMMENT '是否静默更新(WGT用)',
|
||||
`status` varchar(32) NOT NULL COMMENT '状态(已发布、未发布、已下架)',
|
||||
`create_by` varchar(50) DEFAULT NULL COMMENT '创建者',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_by` varchar(50) DEFAULT NULL COMMENT '更新者',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`del_flag` char(1) DEFAULT '0' COMMENT '是否删除(0=正常 1=删除)',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='app版本控制表';
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.bsd.pjcloud.integrated.constant.appmodule;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* App平台
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AppPlatformEnum {
|
||||
|
||||
ANDROID("1", "android"),
|
||||
IOS("2", "ios"),
|
||||
;
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
public static AppPlatformEnum valueOfByType(String code) {
|
||||
return Arrays.stream(AppPlatformEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getCode(), code))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public static AppPlatformEnum descOf(String description) {
|
||||
return Arrays.stream(AppPlatformEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getDesc(), description))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.bsd.pjcloud.integrated.constant.appmodule;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* App版本状态
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AppVersionStatusEnum {
|
||||
PUBLISHED("1", "已发布"),
|
||||
UNPUBLISHED("2", "未发布"),
|
||||
OFF_SHELF("3", "已下架"),
|
||||
;
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
public static AppVersionStatusEnum valueOfByType(String code) {
|
||||
return Arrays.stream(AppVersionStatusEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getCode(), code))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public static AppVersionStatusEnum descOf(String description) {
|
||||
return Arrays.stream(AppVersionStatusEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getDesc(), description))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package com.bsd.pjcloud.integrated.controller.appmodule;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.integrated.dto.appmodule.AppVersionDto;
|
||||
import com.bsd.pjcloud.integrated.entity.app.AppVersionEntity;
|
||||
import com.bsd.pjcloud.integrated.service.AppVersionService;
|
||||
import com.bsd.pjcloud.integrated.vo.appmodule.AppVersionVo;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* app版本控制表
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/app-version")
|
||||
@Tag(description = "app-version", name = "app版本控制表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppVersionController {
|
||||
|
||||
private final AppVersionService appVersionService;
|
||||
|
||||
/* ************************************* start 设备端 start ************************************* */
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/ad/page")
|
||||
public R<Page<AppVersionVo>> hardPage(@ParameterObject Page page, @ParameterObject AppVersionDto dto) {
|
||||
return R.ok(appVersionService.pageList(page, dto));
|
||||
}
|
||||
/* ************************************* end 设备端 end ************************************* */
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('integrated_appVersion_view')")
|
||||
public R<Page<AppVersionVo>> getAppVersionPage(@ParameterObject Page page, @ParameterObject AppVersionDto dto) {
|
||||
return R.ok(appVersionService.pageList(page, dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询app版本控制表
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('integrated_appVersion_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(appVersionService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增app版本控制表
|
||||
*/
|
||||
@Operation(summary = "新增app版本控制表", description = "新增app版本控制表")
|
||||
@SysLog("新增app版本控制表")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('integrated_appVersion_add')")
|
||||
public R save(@RequestBody AppVersionEntity appVersion) {
|
||||
return R.ok(appVersionService.save(appVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改app版本控制表
|
||||
*/
|
||||
@Operation(summary = "修改app版本控制表", description = "修改app版本控制表")
|
||||
@SysLog("修改app版本控制表")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('integrated_appVersion_edit')")
|
||||
public R updateById(@RequestBody AppVersionEntity appVersion) {
|
||||
return R.ok(appVersionService.updateById(appVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除app版本控制表
|
||||
*/
|
||||
@Operation(summary = "通过id删除app版本控制表", description = "通过id删除app版本控制表")
|
||||
@SysLog("通过id删除app版本控制表")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('integrated_appVersion_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(appVersionService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.integrated.dto.appmodule;
|
||||
|
||||
import com.bsd.pjcloud.integrated.entity.app.AppVersionEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppVersionDto extends AppVersionEntity {
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
package com.bsd.pjcloud.integrated.entity.app;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* app版本控制表
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("app_version")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "app版本控制表")
|
||||
public class AppVersionEntity extends Model<AppVersionEntity> {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* app唯一编码
|
||||
*/
|
||||
@Schema(description = "app唯一编码")
|
||||
private String appUniqueCode;
|
||||
|
||||
/**
|
||||
* 平台类型(android、ios)
|
||||
*/
|
||||
@Schema(description = "平台类型(android、ios)")
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 内部版本号(用于比较大小)
|
||||
*/
|
||||
@Schema(description = "内部版本号(用于比较大小)")
|
||||
private Integer versionCode;
|
||||
|
||||
/**
|
||||
* 展示版本号(字符串)
|
||||
*/
|
||||
@Schema(description = "展示版本号(字符串)")
|
||||
private String versionName;
|
||||
|
||||
/**
|
||||
* 更新内容/更新日志
|
||||
*/
|
||||
@Schema(description = "更新内容/更新日志")
|
||||
private String updateContent;
|
||||
|
||||
/**
|
||||
* 安装包下载地址(wgt、apk)
|
||||
*/
|
||||
@Schema(description = "安装包下载地址(wgt、apk)")
|
||||
private String downloadUrl;
|
||||
|
||||
/**
|
||||
* 是否强制更新
|
||||
*/
|
||||
@Schema(description = "是否强制更新")
|
||||
private String isForce;
|
||||
|
||||
/**
|
||||
* 是否静默更新(WGT用)
|
||||
*/
|
||||
@Schema(description = "是否静默更新(WGT用)")
|
||||
private String isSilent;
|
||||
|
||||
/**
|
||||
* 状态(已发布、未发布、已下架)
|
||||
*/
|
||||
@Schema(description = "状态(已发布、未发布、已下架)")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建者")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新者")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除(0=正常 1=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "是否删除(0=正常 1=删除)")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
@Schema(description = "租户编号")
|
||||
private Long tenantId;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.bsd.pjcloud.integrated.mapper.appmodule;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.integrated.dto.appmodule.AppVersionDto;
|
||||
import com.bsd.pjcloud.integrated.entity.app.AppVersionEntity;
|
||||
import com.bsd.pjcloud.integrated.vo.appmodule.AppVersionVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface AppVersionMapper extends PjcloudBaseMapper<AppVersionEntity> {
|
||||
|
||||
Page<AppVersionVo> pagList(Page page, @Param("dto") AppVersionDto dto);
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.bsd.pjcloud.integrated.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.integrated.dto.appmodule.AppVersionDto;
|
||||
import com.bsd.pjcloud.integrated.entity.app.AppVersionEntity;
|
||||
import com.bsd.pjcloud.integrated.vo.appmodule.AppVersionVo;
|
||||
|
||||
public interface AppVersionService extends IService<AppVersionEntity> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
Page<AppVersionVo> pageList(Page page, AppVersionDto dto);
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.bsd.pjcloud.integrated.service.impl.appmodule;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.integrated.dto.appmodule.AppVersionDto;
|
||||
import com.bsd.pjcloud.integrated.entity.app.AppVersionEntity;
|
||||
import com.bsd.pjcloud.integrated.mapper.appmodule.AppVersionMapper;
|
||||
import com.bsd.pjcloud.integrated.service.AppVersionService;
|
||||
import com.bsd.pjcloud.integrated.vo.appmodule.AppVersionVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* app版本控制表
|
||||
*/
|
||||
@Service
|
||||
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersionEntity> implements AppVersionService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@Override
|
||||
public Page<AppVersionVo> pageList(Page page, AppVersionDto dto) {
|
||||
return baseMapper.pagList(page, dto);
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.integrated.vo.appmodule;
|
||||
|
||||
import com.bsd.pjcloud.integrated.entity.app.AppVersionEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppVersionVo extends AppVersionEntity {
|
||||
}
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
<?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.bsd.pjcloud.integrated.mapper.appmodule.AppVersionMapper">
|
||||
<sql id="selectA">
|
||||
select a.id,
|
||||
a.app_unique_code,
|
||||
a.platform,
|
||||
a.version_code,
|
||||
a.version_name,
|
||||
a.update_content,
|
||||
a.download_url,
|
||||
a.is_force,
|
||||
a.is_silent,
|
||||
a.status,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.tenant_id
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = '0'
|
||||
<if test="dto.appUniqueCode != null and dto.appUniqueCode != '' ">
|
||||
and a.app_unique_code LIKE CONCAT('%',#{dto.appUniqueCode},'%')
|
||||
</if>
|
||||
<if test="dto.status != null and dto.status != '' ">
|
||||
and a.status = #{dto.status}
|
||||
</if>
|
||||
<if test="dto.platform != null and dto.platform != '' ">
|
||||
and a.platform = #{dto.platform}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="pagList" resultType="com.bsd.pjcloud.integrated.vo.appmodule.AppVersionVo">
|
||||
<include refid="selectA"/>
|
||||
from app_version a
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+2
-2
@@ -23,13 +23,13 @@ public enum ActCancelStatusEnum {
|
||||
public static ActCancelStatusEnum valueOfByType(String code) {
|
||||
return Arrays.stream(ActCancelStatusEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getCode(), code))
|
||||
.findFirst().get();
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public static ActCancelStatusEnum descOf(String description) {
|
||||
return Arrays.stream(ActCancelStatusEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getDesc(), description))
|
||||
.findFirst().get();
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user