diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/PcVersionController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/PcVersionController.java new file mode 100644 index 0000000..8562950 --- /dev/null +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/PcVersionController.java @@ -0,0 +1,73 @@ +package com.mcwl.web.controller.resource; + +import com.mcwl.common.constant.HttpStatus; +import com.mcwl.common.core.domain.R; +import com.mcwl.resource.domain.PcVersion; +import com.mcwl.resource.service.impl.PcVersionServiceImpl; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * pc端版本 + * + * @author DaiZibo + * @date 2025/5/9 + * @apiNote + */ + +@Api(tags = "pc端版本") +@RequestMapping("/version") +@RestController +public class PcVersionController { + + @Autowired + private PcVersionServiceImpl pcVersionService; + + @ApiOperation(value = "查看pc版本列表") + @PostMapping("/list") + public R> selectList(){ + + List pcVersionList = pcVersionService.selectList(); + return R.ok(pcVersionList); + } + + @ApiOperation(value = "修改版本") + @PostMapping("/update") + public R update(@RequestBody PcVersion pcVersion){ + + pcVersionService.update(pcVersion); + return R.ok(); + } + + + @ApiOperation(value = "根据版本号查询版本") + @PostMapping("/selectVersion") + public R selectVersion(@RequestParam String versionNumber){ + + PcVersion pcVersion = pcVersionService.selectVersion(versionNumber); + + return R.ok(pcVersion); + } + + @ApiOperation(value = "新增版本") + @PostMapping("/addVersion") + public R addVersion(@RequestBody PcVersion pcVersion){ + + //校验版本号 + PcVersion pcVersion1 = pcVersionService.selectVersion(pcVersion.getVersionNumber()); + if (pcVersion1 != null){ + + return R.fail(HttpStatus.SHOW_ERROR_MSG,"版本号重复"); + } + pcVersionService.addVersion(pcVersion); + + return R.ok(); + } + + + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/PcVersion.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/PcVersion.java new file mode 100644 index 0000000..f700919 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/PcVersion.java @@ -0,0 +1,56 @@ +package com.mcwl.resource.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * pc端版本表 + * + * @author DaiZibo + * @date 2025/5/9 + * @apiNote + */ + +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +@ApiModel(description = "pc端版本表") +@TableName("pc_version") +public class PcVersion { + + @ApiModelProperty(value = "主键ID") + @TableId + private Long id; + + @ApiModelProperty(value = "版本号") + private String versionNumber; + + @ApiModelProperty(value = "版本路径") + private String path; + + @ApiModelProperty(value = "描述") + private String remark; + + @ApiModelProperty(value = "是否更新 0:不 1:强制") + private Integer isBug; + + + @ApiModelProperty(value = "创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; + + @ApiModelProperty(value = "hash值") + private String hashCode; +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/PcVersionMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/PcVersionMapper.java new file mode 100644 index 0000000..94d86b2 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/PcVersionMapper.java @@ -0,0 +1,15 @@ +package com.mcwl.resource.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mcwl.resource.domain.PcVersion; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author DaiZibo + * @date 2025/5/9 + * @apiNote + */ + +@Mapper +public interface PcVersionMapper extends BaseMapper { +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/PcVersionService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/PcVersionService.java new file mode 100644 index 0000000..7884c64 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/PcVersionService.java @@ -0,0 +1,21 @@ +package com.mcwl.resource.service; + +import com.mcwl.resource.domain.PcVersion; + +import java.util.List; + +/** + * @author DaiZibo + * @date 2025/5/9 + * @apiNote + */ + +public interface PcVersionService { + List selectList(); + + void update(PcVersion pcVersion); + + PcVersion selectVersion(String versionNumber); + + void addVersion(PcVersion pcVersion); +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/PcVersionServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/PcVersionServiceImpl.java new file mode 100644 index 0000000..25ddba7 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/PcVersionServiceImpl.java @@ -0,0 +1,61 @@ +package com.mcwl.resource.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.mcwl.resource.domain.PcVersion; +import com.mcwl.resource.mapper.PcVersionMapper; +import com.mcwl.resource.service.PcVersionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * pc端版本业务实现层 + * + * @author DaiZibo + * @date 2025/5/9 + * @apiNote + */ + +@Service +public class PcVersionServiceImpl implements PcVersionService { + + @Autowired + private PcVersionMapper pcVersionMapper; + + + @Override + public List selectList() { + + LambdaQueryWrapper pcVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); + pcVersionLambdaQueryWrapper.orderByDesc(PcVersion::getCreateTime); + + return pcVersionMapper.selectList(pcVersionLambdaQueryWrapper); + } + + @Override + public void update(PcVersion pcVersion) { + + + pcVersionMapper.updateById(pcVersion); + } + + @Override + public PcVersion selectVersion(String versionNumber) { + + LambdaQueryWrapper pcVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); + pcVersionLambdaQueryWrapper.eq(PcVersion::getVersionNumber, versionNumber); + + PcVersion pcVersion = pcVersionMapper.selectOne(pcVersionLambdaQueryWrapper); + + return pcVersion; + } + + @Override + public void addVersion(PcVersion pcVersion) { + + pcVersion.setCreateTime(new Date()); + pcVersionMapper.insert(pcVersion); + } +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java index 8a46fe5..b607204 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java @@ -63,6 +63,7 @@ public class ReportServiceImpl implements ReportService { //构造查询条件 LambdaQueryWrapper reportLambdaQueryWrapper = new LambdaQueryWrapper<>(); reportLambdaQueryWrapper.eq(Report::getDelFlag, 0); + reportLambdaQueryWrapper.orderByDesc(Report::getCreateTime); if (pageVo.getType() != null) { reportLambdaQueryWrapper.eq(Report::getStatus, 0); }