release_version代码生成

This commit is contained in:
2026-04-01 21:23:39 +08:00
parent 732b3c31be
commit f11d80f8f0
10 changed files with 502 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
package org.springblade.modules.common.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.common.pojo.entity.TourProductEntity;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
import org.springblade.modules.common.wrapper.CommonReleaseVersionWrapper;
import org.springblade.modules.common.service.ICommonReleaseVersionService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* APP版本发布管理 控制器
*
* @author BladeX
* @since 2026-04-01
*/
@RestController
@AllArgsConstructor
@RequestMapping("common/release-version")
@Tag(name = "APP版本发布管理", description = "APP版本发布管理接口")
public class CommonReleaseVersionController extends BladeController {
private final ICommonReleaseVersionService commonReleaseVersionService;
/**
* APP版本发布管理 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入commonReleaseversion")
public R<CommonReleaseVersionVO> detail(CommonReleaseVersionEntity commonReleaseVersion) {
CommonReleaseVersionEntity detail = commonReleaseVersionService.getOne(Condition.getQueryWrapper(commonReleaseVersion));
return R.data(CommonReleaseVersionWrapper.build().entityVO(detail));
}
/**
* APP版本发布管理 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入commonReleaseversion")
public R<IPage<CommonReleaseVersionVO>> list(CommonReleaseVersionEntity commonReleaseVersion, Query query) {
IPage<CommonReleaseVersionEntity> pages = commonReleaseVersionService.page(Condition.getPage(query), Condition.getQueryWrapper(commonReleaseVersion).orderByDesc("id"));
return R.data(CommonReleaseVersionWrapper.build().pageVO(pages));
}
/**
* APP版本发布管理 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入commonReleaseversion")
public R<IPage<CommonReleaseVersionVO>> page(CommonReleaseVersionVO commonReleaseVersion, Query query) {
IPage<CommonReleaseVersionVO> pages = commonReleaseVersionService.selectCommonReleaseVersionPage(Condition.getPage(query), commonReleaseVersion);
return R.data(pages);
}
/**
* APP版本发布管理 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入commonReleaseversion")
public R save(@Valid @RequestBody CommonReleaseVersionEntity commonReleaseVersion) {
return R.status(commonReleaseVersionService.save(commonReleaseVersion));
}
/**
* APP版本发布管理 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入commonReleaseversion")
public R update(@Valid @RequestBody CommonReleaseVersionEntity commonReleaseVersion) {
return R.status(commonReleaseVersionService.updateById(commonReleaseVersion));
}
/**
* APP版本发布管理 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入commonReleaseversion")
public R submit(@Valid @RequestBody CommonReleaseVersionEntity commonReleaseVersion) {
return R.status(commonReleaseVersionService.saveOrUpdate(commonReleaseVersion));
}
/**
* APP版本发布管理 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(commonReleaseVersionService.deleteLogic(Func.toLongList(ids)));
}
@PostMapping("/applyStatus")
@ApiOperationSupport(order = 8)
@Operation(summary = "上下架版本信息", description = "releaseVersion.id")
public R applyStatus(CommonReleaseVersionEntity releaseVersion) {
return R.status(commonReleaseVersionService.applyStatus(releaseVersion.getId()));
}
}

View File

@@ -0,0 +1,28 @@
package org.springblade.modules.common.mapper;
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* APP版本发布管理 Mapper 接口
*
* @author BladeX
* @since 2026-04-01
*/
public interface CommonReleaseVersionMapper extends BaseMapper<CommonReleaseVersionEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param commonReleaseVersion 查询参数
* @return List<CommonReleaseVersionVO>
*/
List<CommonReleaseVersionVO> selectCommonReleaseVersionPage(IPage page, CommonReleaseVersionVO commonReleaseVersion);
}

View File

@@ -0,0 +1,35 @@
<?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="org.springblade.modules.common.mapper.CommonReleaseVersionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="commonReleaseversionResultMap" type="org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity">
<result column="id" property="id"/>
<result column="version_code" property="versionCode"/>
<result column="version_name" property="versionName"/>
<result column="app_type" property="appType"/>
<result column="channel_code" property="channelCode"/>
<result column="package_type" property="packageType"/>
<result column="is_force_update" property="isForceUpdate"/>
<result column="download_url" property="downloadUrl"/>
<result column="update_content" property="updateContent"/>
<result column="privacy_agreement_url" property="privacyAgreementUrl"/>
<result column="user_agreement_url" property="userAgreementUrl"/>
<result column="dispatch_url" property="dispatchUrl"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>
<select id="selectCommonReleaseVersionPage" resultMap="commonReleaseversionResultMap">
select * from release_version where is_deleted = 0
</select>
</mapper>

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.dto;
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* APP版本发布管理 数据传输对象实体类
*
* @author BladeX
* @since 2026-04-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonReleaseVersionDTO extends CommonReleaseVersionEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,81 @@
package org.springblade.modules.common.pojo.entity;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* APP版本发布管理 实体类
*
* @author BladeX
* @since 2026-04-01
*/
@Data
@TableName("release_version")
@Schema(description = "CommonReleaseVersion对象")
@EqualsAndHashCode(callSuper = true)
public class CommonReleaseVersionEntity extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 内部版本号 (如: 10023)
*/
@Schema(description = "内部版本号 (如: 10023)")
private String versionCode;
/**
* 版本显示名称 (如: 1.2.3)
*/
@Schema(description = "版本显示名称 (如: 1.2.3)")
private String versionName;
/**
* 应用类型: 1-app, 2-market
*/
@Schema(description = "应用类型: 1-app, 2-market")
private Integer appType;
/**
* 渠道标识: xiaomi, huawei, honor, oppo, vivo, apple, qihoo, yingyongbao, pgyer, official
*/
@Schema(description = "渠道标识: xiaomi, huawei, honor, oppo, vivo, apple, qihoo, yingyongbao, pgyer, official")
private String channelCode;
/**
* 包类型: 1-应用市场包(含跳转链接), 2-OSS直连包(兜底)
*/
@Schema(description = "包类型: 1-应用市场包(含跳转链接), 2-OSS直连包(兜底)")
private Integer packageType;
/**
* 是否强制更新: 0-否, 1-是
*/
@Schema(description = "是否强制更新: 0-否, 1-是")
private Integer isForceUpdate;
/**
* 下载地址 (市场包通常为 schema 链接, OSS包为 http 链接)
*/
@Schema(description = "下载地址 (市场包通常为 schema 链接, OSS包为 http 链接)")
private String downloadUrl;
/**
* 更新日志内容
*/
@Schema(description = "更新日志内容")
private String updateContent;
/**
* 隐私协议地址
*/
@Schema(description = "隐私协议地址")
private String privacyAgreementUrl;
/**
* 用户协议地址
*/
@Schema(description = "用户协议地址")
private String userAgreementUrl;
/**
* 调度链接
*/
@Schema(description = "调度链接")
private String dispatchUrl;
}

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.pojo.vo;
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* APP版本发布管理 视图实体类
*
* @author BladeX
* @since 2026-04-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonReleaseVersionVO extends CommonReleaseVersionEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,26 @@
package org.springblade.modules.common.service;
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
/**
* APP版本发布管理 服务类
*
* @author BladeX
* @since 2026-04-01
*/
public interface ICommonReleaseVersionService extends BaseService<CommonReleaseVersionEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param commonReleaseVersion 查询参数
* @return IPage<CommonReleaseVersionVO>
*/
IPage<CommonReleaseVersionVO> selectCommonReleaseVersionPage(IPage<CommonReleaseVersionVO> page, CommonReleaseVersionVO commonReleaseVersion);
boolean applyStatus(Long id);
}

View File

@@ -0,0 +1,37 @@
package org.springblade.modules.common.service.impl;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
import org.springblade.modules.common.mapper.CommonReleaseVersionMapper;
import org.springblade.modules.common.service.ICommonReleaseVersionService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
/**
* APP版本发布管理 服务实现类
*
* @author BladeX
* @since 2026-04-01
*/
@Service
public class CommonReleaseVersionServiceImpl extends BaseServiceImpl<CommonReleaseVersionMapper, CommonReleaseVersionEntity> implements ICommonReleaseVersionService {
@Override
public IPage<CommonReleaseVersionVO> selectCommonReleaseVersionPage(IPage<CommonReleaseVersionVO> page, CommonReleaseVersionVO commonReleaseVersion) {
return page.setRecords(baseMapper.selectCommonReleaseVersionPage(page, commonReleaseVersion));
}
@Override
public boolean applyStatus(Long id) {
CommonReleaseVersionEntity releaseVersion = getById(id);
if (releaseVersion == null) {
throw new ServiceException("无效版本信息");
}
releaseVersion.setStatus(Math.abs(releaseVersion.getStatus() - 1));
return updateById(releaseVersion);
}
}

View File

@@ -0,0 +1,59 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.common.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
import java.util.Objects;
/**
* APP版本发布管理 包装类,返回视图层所需的字段
*
* @author BladeX
* @since 2026-04-01
*/
public class CommonReleaseVersionWrapper extends BaseEntityWrapper<CommonReleaseVersionEntity, CommonReleaseVersionVO> {
public static CommonReleaseVersionWrapper build() {
return new CommonReleaseVersionWrapper();
}
@Override
public CommonReleaseVersionVO entityVO(CommonReleaseVersionEntity commonReleaseversion) {
CommonReleaseVersionVO commonReleaseversionVO = Objects.requireNonNull(BeanUtil.copyProperties(commonReleaseversion, CommonReleaseVersionVO.class));
//User createUser = UserCache.getUser(commonReleaseversion.getCreateUser());
//User updateUser = UserCache.getUser(commonReleaseversion.getUpdateUser());
//commonReleaseversionVO.setCreateUserName(createUser.getName());
//commonReleaseversionVO.setUpdateUserName(updateUser.getName());
return commonReleaseversionVO;
}
}