Compare commits

..

2 Commits

Author SHA1 Message Date
9e97c1a576 Merge remote-tracking branch 'origin/main' 2025-12-09 19:41:42 +08:00
6cd3f4faef app版本控制的代码,相关的接口 2025-12-09 19:41:24 +08:00
6 changed files with 684 additions and 0 deletions

View File

@ -0,0 +1,104 @@
package com.zhyc.module.app.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.app.domain.AppVersion;
import com.zhyc.module.app.service.IAppVersionService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 应用版本信息Controller
*
* @author 漂泊
* @date 2025-12-09
*/
@RestController
@RequestMapping("/app/version")
public class AppVersionController extends BaseController
{
@Autowired
private IAppVersionService appVersionService;
/**
* 查询应用版本信息列表
*/
@PreAuthorize("@ss.hasPermi('app:version:list')")
@GetMapping("/list")
public TableDataInfo list(AppVersion appVersion)
{
startPage();
List<AppVersion> list = appVersionService.selectAppVersionList(appVersion);
return getDataTable(list);
}
/**
* 导出应用版本信息列表
*/
@PreAuthorize("@ss.hasPermi('app:version:export')")
@Log(title = "应用版本信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AppVersion appVersion)
{
List<AppVersion> list = appVersionService.selectAppVersionList(appVersion);
ExcelUtil<AppVersion> util = new ExcelUtil<AppVersion>(AppVersion.class);
util.exportExcel(response, list, "应用版本信息数据");
}
/**
* 获取应用版本信息详细信息
*/
@PreAuthorize("@ss.hasPermi('app:version:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(appVersionService.selectAppVersionById(id));
}
/**
* 新增应用版本信息
*/
@PreAuthorize("@ss.hasPermi('app:version:add')")
@Log(title = "应用版本信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AppVersion appVersion)
{
return toAjax(appVersionService.insertAppVersion(appVersion));
}
/**
* 修改应用版本信息
*/
@PreAuthorize("@ss.hasPermi('app:version:edit')")
@Log(title = "应用版本信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AppVersion appVersion)
{
return toAjax(appVersionService.updateAppVersion(appVersion));
}
/**
* 删除应用版本信息
*/
@PreAuthorize("@ss.hasPermi('app:version:remove')")
@Log(title = "应用版本信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(appVersionService.deleteAppVersionByIds(ids));
}
}

View File

@ -0,0 +1,237 @@
package com.zhyc.module.app.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 应用版本信息对象 app_version
*
* @author ruoyi
* @date 2025-12-09
*/
public class AppVersion extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 平台类型 */
@Excel(name = "平台类型")
private String platform;
/** 版本代码用于比较的数字如1000 */
@Excel(name = "版本代码", readConverterExp = "用=于比较的数字如1000")
private Long versionCode;
/** 版本名称如1.0.0 */
@Excel(name = "版本名称", readConverterExp = "如=1.0.0")
private String versionName;
/** 是否强制更新0否1是 */
@Excel(name = "是否强制更新", readConverterExp = "0=否1是")
private Integer isForceUpdate;
/** 是否最新版本 */
@Excel(name = "是否最新版本")
private Integer isLatest;
/** 最小兼容版本 */
@Excel(name = "最小兼容版本")
private Long minVersionCode;
/** 下载地址 */
@Excel(name = "下载地址")
private String downloadUrl;
/** 更新标题 */
@Excel(name = "更新标题")
private String updateTitle;
/** 更新内容 */
@Excel(name = "更新内容")
private String updateContent;
/** 文件大小(字节) */
@Excel(name = "文件大小", readConverterExp = "字=节")
private Long fileSize;
/** 文件MD5 */
@Excel(name = "文件MD5")
private String md5Hash;
/** 发布时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date publishTime;
/** 是否删除 */
@Excel(name = "是否删除")
private Integer isDeleted;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setPlatform(String platform)
{
this.platform = platform;
}
public String getPlatform()
{
return platform;
}
public void setVersionCode(Long versionCode)
{
this.versionCode = versionCode;
}
public Long getVersionCode()
{
return versionCode;
}
public void setVersionName(String versionName)
{
this.versionName = versionName;
}
public String getVersionName()
{
return versionName;
}
public void setIsForceUpdate(Integer isForceUpdate)
{
this.isForceUpdate = isForceUpdate;
}
public Integer getIsForceUpdate()
{
return isForceUpdate;
}
public void setIsLatest(Integer isLatest)
{
this.isLatest = isLatest;
}
public Integer getIsLatest()
{
return isLatest;
}
public void setMinVersionCode(Long minVersionCode)
{
this.minVersionCode = minVersionCode;
}
public Long getMinVersionCode()
{
return minVersionCode;
}
public void setDownloadUrl(String downloadUrl)
{
this.downloadUrl = downloadUrl;
}
public String getDownloadUrl()
{
return downloadUrl;
}
public void setUpdateTitle(String updateTitle)
{
this.updateTitle = updateTitle;
}
public String getUpdateTitle()
{
return updateTitle;
}
public void setUpdateContent(String updateContent)
{
this.updateContent = updateContent;
}
public String getUpdateContent()
{
return updateContent;
}
public void setFileSize(Long fileSize)
{
this.fileSize = fileSize;
}
public Long getFileSize()
{
return fileSize;
}
public void setMd5Hash(String md5Hash)
{
this.md5Hash = md5Hash;
}
public String getMd5Hash()
{
return md5Hash;
}
public void setPublishTime(Date publishTime)
{
this.publishTime = publishTime;
}
public Date getPublishTime()
{
return publishTime;
}
public void setIsDeleted(Integer isDeleted)
{
this.isDeleted = isDeleted;
}
public Integer getIsDeleted()
{
return isDeleted;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("platform", getPlatform())
.append("versionCode", getVersionCode())
.append("versionName", getVersionName())
.append("isForceUpdate", getIsForceUpdate())
.append("isLatest", getIsLatest())
.append("minVersionCode", getMinVersionCode())
.append("downloadUrl", getDownloadUrl())
.append("updateTitle", getUpdateTitle())
.append("updateContent", getUpdateContent())
.append("fileSize", getFileSize())
.append("md5Hash", getMd5Hash())
.append("publishTime", getPublishTime())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("isDeleted", getIsDeleted())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.app.mapper;
import java.util.List;
import com.zhyc.module.app.domain.AppVersion;
/**
* 应用版本信息Mapper接口
*
* @author ruoyi
* @date 2025-12-09
*/
public interface AppVersionMapper
{
/**
* 查询应用版本信息
*
* @param id 应用版本信息主键
* @return 应用版本信息
*/
public AppVersion selectAppVersionById(Long id);
/**
* 查询应用版本信息列表
*
* @param appVersion 应用版本信息
* @return 应用版本信息集合
*/
public List<AppVersion> selectAppVersionList(AppVersion appVersion);
/**
* 新增应用版本信息
*
* @param appVersion 应用版本信息
* @return 结果
*/
public int insertAppVersion(AppVersion appVersion);
/**
* 修改应用版本信息
*
* @param appVersion 应用版本信息
* @return 结果
*/
public int updateAppVersion(AppVersion appVersion);
/**
* 删除应用版本信息
*
* @param id 应用版本信息主键
* @return 结果
*/
public int deleteAppVersionById(Long id);
/**
* 批量删除应用版本信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteAppVersionByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.app.service;
import java.util.List;
import com.zhyc.module.app.domain.AppVersion;
/**
* 应用版本信息Service接口
*
* @author ruoyi
* @date 2025-12-09
*/
public interface IAppVersionService
{
/**
* 查询应用版本信息
*
* @param id 应用版本信息主键
* @return 应用版本信息
*/
public AppVersion selectAppVersionById(Long id);
/**
* 查询应用版本信息列表
*
* @param appVersion 应用版本信息
* @return 应用版本信息集合
*/
public List<AppVersion> selectAppVersionList(AppVersion appVersion);
/**
* 新增应用版本信息
*
* @param appVersion 应用版本信息
* @return 结果
*/
public int insertAppVersion(AppVersion appVersion);
/**
* 修改应用版本信息
*
* @param appVersion 应用版本信息
* @return 结果
*/
public int updateAppVersion(AppVersion appVersion);
/**
* 批量删除应用版本信息
*
* @param ids 需要删除的应用版本信息主键集合
* @return 结果
*/
public int deleteAppVersionByIds(Long[] ids);
/**
* 删除应用版本信息信息
*
* @param id 应用版本信息主键
* @return 结果
*/
public int deleteAppVersionById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.zhyc.module.app.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.app.mapper.AppVersionMapper;
import com.zhyc.module.app.domain.AppVersion;
import com.zhyc.module.app.service.IAppVersionService;
/**
* 应用版本信息Service业务层处理
*
* @author ruoyi
* @date 2025-12-09
*/
@Service
public class AppVersionServiceImpl implements IAppVersionService
{
@Autowired
private AppVersionMapper appVersionMapper;
/**
* 查询应用版本信息
*
* @param id 应用版本信息主键
* @return 应用版本信息
*/
@Override
public AppVersion selectAppVersionById(Long id)
{
return appVersionMapper.selectAppVersionById(id);
}
/**
* 查询应用版本信息列表
*
* @param appVersion 应用版本信息
* @return 应用版本信息
*/
@Override
public List<AppVersion> selectAppVersionList(AppVersion appVersion)
{
return appVersionMapper.selectAppVersionList(appVersion);
}
/**
* 新增应用版本信息
*
* @param appVersion 应用版本信息
* @return 结果
*/
@Override
public int insertAppVersion(AppVersion appVersion)
{
appVersion.setCreateTime(DateUtils.getNowDate());
return appVersionMapper.insertAppVersion(appVersion);
}
/**
* 修改应用版本信息
*
* @param appVersion 应用版本信息
* @return 结果
*/
@Override
public int updateAppVersion(AppVersion appVersion)
{
appVersion.setUpdateTime(DateUtils.getNowDate());
return appVersionMapper.updateAppVersion(appVersion);
}
/**
* 批量删除应用版本信息
*
* @param ids 需要删除的应用版本信息主键
* @return 结果
*/
@Override
public int deleteAppVersionByIds(Long[] ids)
{
return appVersionMapper.deleteAppVersionByIds(ids);
}
/**
* 删除应用版本信息信息
*
* @param id 应用版本信息主键
* @return 结果
*/
@Override
public int deleteAppVersionById(Long id)
{
return appVersionMapper.deleteAppVersionById(id);
}
}

View File

@ -0,0 +1,125 @@
<?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.zhyc.module.app.mapper.AppVersionMapper">
<resultMap type="AppVersion" id="AppVersionResult">
<result property="id" column="id" />
<result property="platform" column="platform" />
<result property="versionCode" column="version_code" />
<result property="versionName" column="version_name" />
<result property="isForceUpdate" column="is_force_update" />
<result property="isLatest" column="is_latest" />
<result property="minVersionCode" column="min_version_code" />
<result property="downloadUrl" column="download_url" />
<result property="updateTitle" column="update_title" />
<result property="updateContent" column="update_content" />
<result property="fileSize" column="file_size" />
<result property="md5Hash" column="md5_hash" />
<result property="publishTime" column="publish_time" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isDeleted" column="is_deleted" />
</resultMap>
<sql id="selectAppVersionVo">
select id, platform, version_code, version_name, is_force_update, is_latest, min_version_code, download_url, update_title, update_content, file_size, md5_hash, publish_time, create_time, update_time, is_deleted from app_version
</sql>
<select id="selectAppVersionList" parameterType="AppVersion" resultMap="AppVersionResult">
<include refid="selectAppVersionVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="platform != null and platform != ''"> and platform = #{platform}</if>
<if test="versionCode != null "> and version_code = #{versionCode}</if>
<if test="versionName != null and versionName != ''"> and version_name like concat('%', #{versionName}, '%')</if>
<if test="isForceUpdate != null "> and is_force_update = #{isForceUpdate}</if>
<if test="isLatest != null "> and is_latest = #{isLatest}</if>
<if test="minVersionCode != null "> and min_version_code = #{minVersionCode}</if>
<if test="downloadUrl != null and downloadUrl != ''"> and download_url = #{downloadUrl}</if>
<if test="updateTitle != null and updateTitle != ''"> and update_title = #{updateTitle}</if>
<if test="updateContent != null and updateContent != ''"> and update_content = #{updateContent}</if>
<if test="fileSize != null "> and file_size = #{fileSize}</if>
<if test="params.beginMd5Hash != null and params.beginMd5Hash != '' and params.endMd5Hash != null and params.endMd5Hash != ''"> and md5_hash between #{params.beginMd5Hash} and #{params.endMd5Hash}</if>
<if test="params.beginPublishTime != null and params.beginPublishTime != '' and params.endPublishTime != null and params.endPublishTime != ''"> and publish_time between #{params.beginPublishTime} and #{params.endPublishTime}</if>
<if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>
</where>
</select>
<select id="selectAppVersionById" parameterType="Long" resultMap="AppVersionResult">
<include refid="selectAppVersionVo"/>
where id = #{id}
</select>
<insert id="insertAppVersion" parameterType="AppVersion" useGeneratedKeys="true" keyProperty="id">
insert into app_version
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="platform != null">platform,</if>
<if test="versionCode != null">version_code,</if>
<if test="versionName != null">version_name,</if>
<if test="isForceUpdate != null">is_force_update,</if>
<if test="isLatest != null">is_latest,</if>
<if test="minVersionCode != null">min_version_code,</if>
<if test="downloadUrl != null">download_url,</if>
<if test="updateTitle != null">update_title,</if>
<if test="updateContent != null">update_content,</if>
<if test="fileSize != null">file_size,</if>
<if test="md5Hash != null">md5_hash,</if>
<if test="publishTime != null">publish_time,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDeleted != null">is_deleted,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="platform != null">#{platform},</if>
<if test="versionCode != null">#{versionCode},</if>
<if test="versionName != null">#{versionName},</if>
<if test="isForceUpdate != null">#{isForceUpdate},</if>
<if test="isLatest != null">#{isLatest},</if>
<if test="minVersionCode != null">#{minVersionCode},</if>
<if test="downloadUrl != null">#{downloadUrl},</if>
<if test="updateTitle != null">#{updateTitle},</if>
<if test="updateContent != null">#{updateContent},</if>
<if test="fileSize != null">#{fileSize},</if>
<if test="md5Hash != null">#{md5Hash},</if>
<if test="publishTime != null">#{publishTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isDeleted != null">#{isDeleted},</if>
</trim>
</insert>
<update id="updateAppVersion" parameterType="AppVersion">
update app_version
<trim prefix="SET" suffixOverrides=",">
<if test="platform != null">platform = #{platform},</if>
<if test="versionCode != null">version_code = #{versionCode},</if>
<if test="versionName != null">version_name = #{versionName},</if>
<if test="isForceUpdate != null">is_force_update = #{isForceUpdate},</if>
<if test="isLatest != null">is_latest = #{isLatest},</if>
<if test="minVersionCode != null">min_version_code = #{minVersionCode},</if>
<if test="downloadUrl != null">download_url = #{downloadUrl},</if>
<if test="updateTitle != null">update_title = #{updateTitle},</if>
<if test="updateContent != null">update_content = #{updateContent},</if>
<if test="fileSize != null">file_size = #{fileSize},</if>
<if test="md5Hash != null">md5_hash = #{md5Hash},</if>
<if test="publishTime != null">publish_time = #{publishTime},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDeleted != null">is_deleted = #{isDeleted},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAppVersionById" parameterType="Long">
delete from app_version where id = #{id}
</delete>
<delete id="deleteAppVersionByIds" parameterType="String">
delete from app_version where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>