diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/DownloadRecordController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/DownloadRecordController.java index bd30612..49183dc 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/DownloadRecordController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/DownloadRecordController.java @@ -2,9 +2,11 @@ package com.mcwl.web.controller.resource; import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.DownloadRecord; +import com.mcwl.resource.domain.request.RequestDownload; import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.service.impl.DownloadRecordServiceImpl; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -76,4 +78,12 @@ public class DownloadRecordController { return downloadRecordService.deleteDownloadRecord(ids); } + + @ApiModelProperty(value = "根据文件名查询详情") + @PostMapping("/selectFileByName") + public R selectByFileName(@RequestBody RequestDownload requestDownload){ + + return downloadRecordService.selectByFileName(requestDownload); + } + } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/FileController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/FileController.java index 7cf201f..c7bb948 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/FileController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/FileController.java @@ -169,10 +169,17 @@ public class FileController { @RequestParam("file") MultipartFile file, @RequestParam("chunk") int chunk, @RequestParam("uploadId") String uploadId) throws Exception { - File file1 = multipartFileToFile(file); - Map map = uploadChunk(uploadId, file1, chunk, objectKey); - log.info("上传的文件大小:{}",file.getSize()); - return R.ok(map); + + long startTime = System.currentTimeMillis(); // 记录开始时间 + try { + File file1 = multipartFileToFile(file); + Map map = uploadChunk(uploadId, file1, chunk, objectKey); + log.info("上传的文件大小: {}", file.getSize()); + return R.ok(map); + } finally { + long duration = System.currentTimeMillis() - startTime; // 计算耗时 + log.info("方法 splitFileUpload 执行耗时: {} ms", duration); + } } /** diff --git a/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java b/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java index 3c30a25..532a959 100644 --- a/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java +++ b/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java @@ -71,4 +71,9 @@ public class DictConstants { * 举报类型 */ public static final String REPORT_LABEL = "report_label"; + + /** + * 版本-基础模型 + */ + public static final String MODE_VERSION_TYPE = "mode_version_type"; } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/DownloadRecord.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/DownloadRecord.java index ee76c6b..5ae7718 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/DownloadRecord.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/DownloadRecord.java @@ -94,4 +94,14 @@ public class DownloadRecord { @ApiModelProperty(value = "创建日期") private Date createTime; + @ApiModelProperty(value = "模型名称") + private String productName; + + @ApiModelProperty(value = "基础低模") + private String modelVersionType; + + + @ApiModelProperty(value = "下载类型(0模型 1工作流)") + private Integer downloadType; + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java index 8a03506..b23293b 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java @@ -199,7 +199,7 @@ public class ModelVersion extends BaseEntity { */ @ApiModelProperty(value = "是否收藏") @TableField(exist = false) - private Integer isCollect = 1; + private Integer isCollect = 0; /** * 文件hash diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlowVersion.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlowVersion.java index 364023d..e2b07b2 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlowVersion.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlowVersion.java @@ -103,7 +103,7 @@ public class WorkFlowVersion { */ @TableField(exist = false) @ApiModelProperty(value = "是否收藏") - private Integer isCollect =1; + private Integer isCollect =0; /** * 文件hash diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/PlatForm.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/PlatForm.java index b2894c5..c6502b7 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/PlatForm.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/PlatForm.java @@ -9,7 +9,9 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -/**平台官方app联系 +/** + * 平台官方app联系 + * * @Author:ChenYan * @Project:mcwl-ai * @Package:com.mcwl.resource.domain.request @@ -23,7 +25,7 @@ import lombok.NoArgsConstructor; @Data @TableName("g_pic") @ApiModel(description = "平台官方app联系") -public class PlatForm { +public class PlatForm { @ApiModelProperty(value = "主键ID") @TableId diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestDownload.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestDownload.java new file mode 100644 index 0000000..06177cc --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestDownload.java @@ -0,0 +1,30 @@ +package com.mcwl.resource.domain.request; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 查询本地下载入参 + * + * @author DaiZibo + * @date 2025/3/12 + * @apiNote + */ + +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Data +public class RequestDownload { + + @ApiModelProperty(value = "文件名字") + private List fileNameList; + + @ApiModelProperty(value = "类型 999为工作流") + private Integer type; +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestModel.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestModel.java index 9c794f5..8853916 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestModel.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestModel.java @@ -2,8 +2,6 @@ package com.mcwl.resource.domain.request; import com.mcwl.resource.domain.ModelProduct; import com.mcwl.resource.domain.ModelVersion; -import com.mcwl.resource.domain.WorkFlow; -import com.mcwl.resource.domain.WorkFlowVersion; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -15,6 +13,7 @@ import java.util.List; /** * 模型入参 模型+版本 + * * @author DaiZibo * @date 2025/1/9 * @apiNote @@ -25,9 +24,9 @@ import java.util.List; @NoArgsConstructor @Data public class RequestModel { -@ApiModelProperty(value = "模型信息") - private ModelProduct modelProduct; -@ApiModelProperty(value = "模型版本信息") - private List modelVersionList; + @ApiModelProperty(value = "模型信息") + private ModelProduct modelProduct; + @ApiModelProperty(value = "模型版本信息") + private List modelVersionList; } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestWorkFlow.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestWorkFlow.java index ae7af5b..387b801 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestWorkFlow.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestWorkFlow.java @@ -25,6 +25,7 @@ import java.util.List; @Data @ApiModel(description = "工作流入参 工作流+版本") public class RequestWorkFlow { + @ApiModelProperty(value = "工作流信息") private WorkFlow workFlow; @ApiModelProperty(value = "工作流版本信息") diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseCollect.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseCollect.java new file mode 100644 index 0000000..17a4c1e --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseCollect.java @@ -0,0 +1,55 @@ +package com.mcwl.resource.domain.response; + +import com.fasterxml.jackson.annotation.JsonFormat; +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; + +/** + * 模型库出参 + * @author DaiZibo + * @date 2025/3/12 + * @apiNote + */ + +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Data +public class ResponseCollect { + + @ApiModelProperty(value = "版本id") + private Long id; + + @ApiModelProperty(value = "封面图") + private String filePath; + + @ApiModelProperty(value = "文件名") + private String fileName; + + @ApiModelProperty(value = "模型名") + private String productName; + + @ApiModelProperty(value = "作者名") + private String nickName; + + @ApiModelProperty(value = "文件大小") + private Long fileSize; + + @ApiModelProperty(value = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date createTime; + + @ApiModelProperty(value = "基础低模") + private String type; + + @ApiModelProperty(value = "是否下载") + private Integer isDownload; + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java index 80a0aef..48e229f 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java @@ -20,7 +20,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @Data @ApiModel(description = "分页+条件") -public class PageVo { +public class PageVo { @ApiModelProperty(value = "页码") private Integer pageNumber; diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/CollectMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/CollectMapper.java index 12f9b59..afc887f 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/CollectMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/CollectMapper.java @@ -2,9 +2,12 @@ package com.mcwl.resource.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.mcwl.resource.domain.Collect; +import com.mcwl.resource.domain.response.ResponseCollect; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * @author DaiZibo * @date 2025/3/5 @@ -17,4 +20,8 @@ public interface CollectMapper extends BaseMapper { Collect selectCollectById(@Param("modelId") Long modelId, @Param("userIdMax") Long userIdMax, @Param("type") Integer type); + List selectCollectWorkFlow(@Param("userIdMax") Long userIdMax); + + List selectCollectModel(@Param("userIdMax") Long userIdMax, @Param("type") Long type); + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/DownloadRecordMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/DownloadRecordMapper.java index 8c239df..4983b23 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/DownloadRecordMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/DownloadRecordMapper.java @@ -3,6 +3,7 @@ package com.mcwl.resource.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.mcwl.resource.domain.DownloadRecord; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * @author DaiZibo @@ -12,6 +13,9 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface DownloadRecordMapper extends BaseMapper { - void updateDownloadRecord(DownloadRecord downloadRecord); + + void updateDownloadRecord(DownloadRecord downloadRecord); + + DownloadRecord selectDownloadByUser(@Param("userIdMax") Long userIdMax, @Param("id") Long id, @Param("i") int i); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/DownloadRecordService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/DownloadRecordService.java index 7effcfb..babbc46 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/DownloadRecordService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/DownloadRecordService.java @@ -2,6 +2,7 @@ package com.mcwl.resource.service; import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.DownloadRecord; +import com.mcwl.resource.domain.request.RequestDownload; import com.mcwl.resource.domain.vo.PageVo; /** @@ -19,4 +20,8 @@ public interface DownloadRecordService { R updateDownloadRecord(DownloadRecord downloadRecord); R deleteDownloadRecord(String ids); + + Integer selectDownloadByUser(Long userIdMax, Long id, int i); + + R selectByFileName(RequestDownload requestDownload); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/CollectServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/CollectServiceImpl.java index 6484f8c..24faa7f 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/CollectServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/CollectServiceImpl.java @@ -1,15 +1,19 @@ package com.mcwl.resource.service.impl; +import com.mcwl.common.constant.DictConstants; import com.mcwl.common.core.domain.R; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.resource.domain.Collect; +import com.mcwl.resource.domain.response.ResponseCollect; import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.mapper.CollectMapper; import com.mcwl.resource.service.CollectService; +import com.mcwl.system.init.DictInit; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; +import java.util.List; /** * 收藏实现层 @@ -25,6 +29,9 @@ public class CollectServiceImpl implements CollectService { @Autowired private CollectMapper collectMapper; + @Autowired + private DownloadRecordServiceImpl downloadRecordService; + @Override public R addCollect(Collect collect) { @@ -34,12 +41,12 @@ public class CollectServiceImpl implements CollectService { if (collect1 == null){ //执行收藏 collectMapper.insert(collect); - return R.ok(0); + return R.ok(1); } //执行删除/取消收藏 collectMapper.deleteById(collect1.getId()); - return R.ok(1); + return R.ok(0); } @@ -55,12 +62,32 @@ public class CollectServiceImpl implements CollectService { //查询个人收藏 Long userIdMax = SecurityUtils.getUserIdMax(); - if (pageVo.getType() == 0){ + if (pageVo.getType() == 999){ + //查询工作流 + List responseCollectList = collectMapper.selectCollectWorkFlow(userIdMax); + //校验是否下载 + for (ResponseCollect collect : responseCollectList) { + collect.setIsDownload(downloadRecordService.selectDownloadByUser(userIdMax,collect.getId(),1)); + } + + + return R.ok(responseCollectList); + + }else { + + //查询模型 + List responseCollectList = collectMapper.selectCollectModel(userIdMax,pageVo.getType()); + //校验是否下载 + for (ResponseCollect collect : responseCollectList) { + + collect.setIsDownload(downloadRecordService.selectDownloadByUser(userIdMax,collect.getId(),0)); + //翻译类型 + collect.setType(DictInit.getDictValue(DictConstants.MODE_VERSION_TYPE,collect.getType())); + } + + return R.ok(responseCollectList); } - //查询模型 - - return R.ok(); } } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/DownloadRecordServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/DownloadRecordServiceImpl.java index 20ae02f..9d57c01 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/DownloadRecordServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/DownloadRecordServiceImpl.java @@ -2,15 +2,18 @@ package com.mcwl.resource.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.StringUtils; import com.mcwl.resource.domain.*; +import com.mcwl.resource.domain.request.RequestDownload; import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.mapper.*; import com.mcwl.resource.service.DownloadRecordService; +import com.mcwl.system.init.DictInit; import com.mcwl.system.mapper.SysUserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -63,10 +66,12 @@ public class DownloadRecordServiceImpl implements DownloadRecordService { ModelVersion modelVersion = modelVersionMapper.selectById(downloadRecord.getProductId()); downloadRecord.setFileName(modelVersion.getFileName()); downloadRecord.setFileSize(modelVersion.getFileSize()); + downloadRecord.setModelVersionType(modelVersion.getModelVersionType()+""); //根据版本查找封面信息 ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId()); downloadRecord.setCover(modelProduct.getSurfaceUrl()); + downloadRecord.setProductName(modelProduct.getModelName()); //查询作者信息 SysUser sysUser = sysUserMapper.selectUserById(modelProduct.getUserId()); @@ -79,9 +84,12 @@ public class DownloadRecordServiceImpl implements DownloadRecordService { downloadRecord.setFileName(workFlowVersion.getFileName()); downloadRecord.setFileSize(workFlowVersion.getFileSize()); + //根据版本查找封面信息 WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId()); downloadRecord.setCover(workFlow.getCoverPath()); + downloadRecord.setProductName(workFlow.getWorkflowName()); + //查询作者信息 SysUser sysUser = sysUserMapper.selectUserById(workFlow.getUserId()); @@ -136,4 +144,41 @@ public class DownloadRecordServiceImpl implements DownloadRecordService { return R.fail(HttpStatus.SHOW_ERROR_MSG,"请选择要删除的数据"); } + + @Override + public Integer selectDownloadByUser(Long userIdMax, Long id, int i) { + + DownloadRecord downloadRecord = downloadRecordMapper.selectDownloadByUser(userIdMax,id,i); + if (downloadRecord != null){ + return 1; + } + + return 0; + } + + @Override + public R selectByFileName(RequestDownload requestDownload) { + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(DownloadRecord::getUserId,SecurityUtils.getUserId()); + if (requestDownload.getType() == 999){ + //查询工作流 + wrapper.eq(DownloadRecord::getDownloadType,1); + wrapper.in(DownloadRecord::getFileName,requestDownload.getFileNameList()); + }else { + wrapper.eq(DownloadRecord::getDownloadType,0); + wrapper.eq(DownloadRecord::getProductType,requestDownload.getType()); + wrapper.in(DownloadRecord::getFileName,requestDownload.getFileNameList()); + } + + List downloadRecords = downloadRecordMapper.selectList(wrapper); + if (requestDownload.getType() != 999){ + //翻译底模 + for (DownloadRecord downloadRecord : downloadRecords) { + downloadRecord.setModelVersionType(DictInit.getDictValue(DictConstants.MODE_VERSION_TYPE,downloadRecord.getModelVersionType())); + } + } + + return R.ok(downloadRecords); + } } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java index fb3a80c..6ea5d7b 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.HttpStatus; @@ -101,9 +102,8 @@ public class ModelServiceImpl extends ServiceImpl impl @Override public PageInfo modelSquare(PageVo pageVo) { - PageInfo page = new PageInfo<>(); - page.setPageNum(pageVo.getPageNumber()); - page.setPages(pageVo.getPageSize()); + PageHelper pageHelper = new PageHelper(); + pageHelper.startPage(pageVo.getPageNumber(),pageVo.getPageSize()); Long userIdMax = SecurityUtils.getUserIdMax(); List responseModelProductList = postMapper.modelSquare(pageVo); @@ -128,8 +128,10 @@ public class ModelServiceImpl extends ServiceImpl impl if (collect == null){ modelVersion.setIsCollect(0); + }else { + modelVersion.setIsCollect(1); } - modelVersion.setIsCollect(1); + } responseModelProduct.setModelVersion(modelVersion); diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java index 916bbba..562d719 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java @@ -106,8 +106,10 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo //模型字典 0 工作流字典 1 Integer type = 0; //校验是否收藏 - Collect collect = collectService.selectCollectById(modelVersion.getModelId(),userIdMax,type); + Collect collect = collectService.selectCollectById(modelVersion.getId(),userIdMax,type); if (collect != null ){ + modelVersion.setIsCollect(1); + }else { modelVersion.setIsCollect(0); } } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java index 0d19252..f006ef6 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java @@ -511,8 +511,10 @@ public class WorkFlowServiceImpl extends ServiceImpl i if (collect == null){ workFlowVersion.setIsCollect(0); + }else { + workFlowVersion.setIsCollect(1); } - workFlowVersion.setIsCollect(1); + } responseWorkFlow.setWorkFlowVersion(workFlowVersion); diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java index b3b8b4b..c9284d5 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java @@ -50,11 +50,11 @@ public class WorkFlowVersionServiceImpl implements WorkFlowVersionService { for (WorkFlowVersion workFlowVersion : workFlowVersions) { workFlowVersion.setFilePath(""); //模型字典 0 工作流字典 1 - Integer type = 0; + Integer type = 1; //校验是否收藏 - Collect collect = collectService.selectCollectById(workFlowVersion.getWorkFlowId(), userIdMax, type); + Collect collect = collectService.selectCollectById(workFlowVersion.getId(), userIdMax, type); if (collect != null) { - workFlowVersion.setIsCollect(0); + workFlowVersion.setIsCollect(1); } } } diff --git a/mcwl-resource/src/main/resources/mapper/resource/CollectMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/CollectMapper.xml index 9319f48..76538f8 100644 --- a/mcwl-resource/src/main/resources/mapper/resource/CollectMapper.xml +++ b/mcwl-resource/src/main/resources/mapper/resource/CollectMapper.xml @@ -13,7 +13,25 @@ + + + + diff --git a/mcwl-resource/src/main/resources/mapper/resource/DownloadRecordMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/DownloadRecordMapper.xml index 362f921..7cc4434 100644 --- a/mcwl-resource/src/main/resources/mapper/resource/DownloadRecordMapper.xml +++ b/mcwl-resource/src/main/resources/mapper/resource/DownloadRecordMapper.xml @@ -11,4 +11,10 @@ status = #{status} WHERE id = #{id} + + diff --git a/mcwl-resource/src/main/resources/mapper/resource/ModelMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/ModelMapper.xml index 28924f5..e59617a 100644 --- a/mcwl-resource/src/main/resources/mapper/resource/ModelMapper.xml +++ b/mcwl-resource/src/main/resources/mapper/resource/ModelMapper.xml @@ -100,6 +100,13 @@ and m.model_type = #{type} + + ORDER BY m.create_time desc + + + + ORDER BY m.like_num desc +