修改是否收藏逻辑

新增查询个人收藏
新增本地下载查询详情接口
master
Diyu0904 2025-03-12 19:47:01 +08:00
parent eeae4fb8ef
commit c34fe50549
25 changed files with 285 additions and 33 deletions

View File

@ -2,9 +2,11 @@ package com.mcwl.web.controller.resource;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.resource.domain.DownloadRecord; import com.mcwl.resource.domain.DownloadRecord;
import com.mcwl.resource.domain.request.RequestDownload;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.impl.DownloadRecordServiceImpl; import com.mcwl.resource.service.impl.DownloadRecordServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -76,4 +78,12 @@ public class DownloadRecordController {
return downloadRecordService.deleteDownloadRecord(ids); return downloadRecordService.deleteDownloadRecord(ids);
} }
@ApiModelProperty(value = "根据文件名查询详情")
@PostMapping("/selectFileByName")
public R selectByFileName(@RequestBody RequestDownload requestDownload){
return downloadRecordService.selectByFileName(requestDownload);
}
} }

View File

@ -169,10 +169,17 @@ public class FileController {
@RequestParam("file") MultipartFile file, @RequestParam("file") MultipartFile file,
@RequestParam("chunk") int chunk, @RequestParam("chunk") int chunk,
@RequestParam("uploadId") String uploadId) throws Exception { @RequestParam("uploadId") String uploadId) throws Exception {
File file1 = multipartFileToFile(file);
Map<String,String> map = uploadChunk(uploadId, file1, chunk, objectKey); long startTime = System.currentTimeMillis(); // 记录开始时间
log.info("上传的文件大小:{}",file.getSize()); try {
return R.ok(map); File file1 = multipartFileToFile(file);
Map<String, String> 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);
}
} }
/** /**

View File

@ -71,4 +71,9 @@ public class DictConstants {
* *
*/ */
public static final String REPORT_LABEL = "report_label"; public static final String REPORT_LABEL = "report_label";
/**
* -
*/
public static final String MODE_VERSION_TYPE = "mode_version_type";
} }

View File

@ -94,4 +94,14 @@ public class DownloadRecord {
@ApiModelProperty(value = "创建日期") @ApiModelProperty(value = "创建日期")
private Date createTime; private Date createTime;
@ApiModelProperty(value = "模型名称")
private String productName;
@ApiModelProperty(value = "基础低模")
private String modelVersionType;
@ApiModelProperty(value = "下载类型0模型 1工作流")
private Integer downloadType;
} }

View File

@ -199,7 +199,7 @@ public class ModelVersion extends BaseEntity {
*/ */
@ApiModelProperty(value = "是否收藏") @ApiModelProperty(value = "是否收藏")
@TableField(exist = false) @TableField(exist = false)
private Integer isCollect = 1; private Integer isCollect = 0;
/** /**
* hash * hash

View File

@ -103,7 +103,7 @@ public class WorkFlowVersion {
*/ */
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "是否收藏") @ApiModelProperty(value = "是否收藏")
private Integer isCollect =1; private Integer isCollect =0;
/** /**
* hash * hash

View File

@ -9,7 +9,9 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/**app /**
* app
*
* @AuthorChenYan * @AuthorChenYan
* @Projectmcwl-ai * @Projectmcwl-ai
* @Packagecom.mcwl.resource.domain.request * @Packagecom.mcwl.resource.domain.request
@ -23,7 +25,7 @@ import lombok.NoArgsConstructor;
@Data @Data
@TableName("g_pic") @TableName("g_pic")
@ApiModel(description = "平台官方app联系") @ApiModel(description = "平台官方app联系")
public class PlatForm { public class PlatForm {
@ApiModelProperty(value = "主键ID") @ApiModelProperty(value = "主键ID")
@TableId @TableId

View File

@ -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<String> fileNameList;
@ApiModelProperty(value = "类型 999为工作流")
private Integer type;
}

View File

@ -2,8 +2,6 @@ package com.mcwl.resource.domain.request;
import com.mcwl.resource.domain.ModelProduct; import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.ModelVersion; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -15,6 +13,7 @@ import java.util.List;
/** /**
* + * +
*
* @author DaiZibo * @author DaiZibo
* @date 2025/1/9 * @date 2025/1/9
* @apiNote * @apiNote
@ -25,9 +24,9 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@Data @Data
public class RequestModel { public class RequestModel {
@ApiModelProperty(value = "模型信息") @ApiModelProperty(value = "模型信息")
private ModelProduct modelProduct; private ModelProduct modelProduct;
@ApiModelProperty(value = "模型版本信息") @ApiModelProperty(value = "模型版本信息")
private List<ModelVersion> modelVersionList; private List<ModelVersion> modelVersionList;
} }

View File

@ -25,6 +25,7 @@ import java.util.List;
@Data @Data
@ApiModel(description = "工作流入参 工作流+版本") @ApiModel(description = "工作流入参 工作流+版本")
public class RequestWorkFlow { public class RequestWorkFlow {
@ApiModelProperty(value = "工作流信息") @ApiModelProperty(value = "工作流信息")
private WorkFlow workFlow; private WorkFlow workFlow;
@ApiModelProperty(value = "工作流版本信息") @ApiModelProperty(value = "工作流版本信息")

View File

@ -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;
}

View File

@ -20,7 +20,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@Data @Data
@ApiModel(description = "分页+条件") @ApiModel(description = "分页+条件")
public class PageVo { public class PageVo {
@ApiModelProperty(value = "页码") @ApiModelProperty(value = "页码")
private Integer pageNumber; private Integer pageNumber;

View File

@ -2,9 +2,12 @@ package com.mcwl.resource.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mcwl.resource.domain.Collect; import com.mcwl.resource.domain.Collect;
import com.mcwl.resource.domain.response.ResponseCollect;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @author DaiZibo * @author DaiZibo
* @date 2025/3/5 * @date 2025/3/5
@ -17,4 +20,8 @@ public interface CollectMapper extends BaseMapper<Collect> {
Collect selectCollectById(@Param("modelId") Long modelId, @Param("userIdMax") Long userIdMax, @Param("type") Integer type); Collect selectCollectById(@Param("modelId") Long modelId, @Param("userIdMax") Long userIdMax, @Param("type") Integer type);
List<ResponseCollect> selectCollectWorkFlow(@Param("userIdMax") Long userIdMax);
List<ResponseCollect> selectCollectModel(@Param("userIdMax") Long userIdMax, @Param("type") Long type);
} }

View File

@ -3,6 +3,7 @@ package com.mcwl.resource.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mcwl.resource.domain.DownloadRecord; import com.mcwl.resource.domain.DownloadRecord;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* @author DaiZibo * @author DaiZibo
@ -12,6 +13,9 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface DownloadRecordMapper extends BaseMapper<DownloadRecord> { public interface DownloadRecordMapper extends BaseMapper<DownloadRecord> {
void updateDownloadRecord(DownloadRecord downloadRecord);
void updateDownloadRecord(DownloadRecord downloadRecord);
DownloadRecord selectDownloadByUser(@Param("userIdMax") Long userIdMax, @Param("id") Long id, @Param("i") int i);
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.resource.service;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.resource.domain.DownloadRecord; import com.mcwl.resource.domain.DownloadRecord;
import com.mcwl.resource.domain.request.RequestDownload;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
/** /**
@ -19,4 +20,8 @@ public interface DownloadRecordService {
R updateDownloadRecord(DownloadRecord downloadRecord); R updateDownloadRecord(DownloadRecord downloadRecord);
R deleteDownloadRecord(String ids); R deleteDownloadRecord(String ids);
Integer selectDownloadByUser(Long userIdMax, Long id, int i);
R selectByFileName(RequestDownload requestDownload);
} }

View File

@ -1,15 +1,19 @@
package com.mcwl.resource.service.impl; package com.mcwl.resource.service.impl;
import com.mcwl.common.constant.DictConstants;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.Collect; import com.mcwl.resource.domain.Collect;
import com.mcwl.resource.domain.response.ResponseCollect;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.mapper.CollectMapper; import com.mcwl.resource.mapper.CollectMapper;
import com.mcwl.resource.service.CollectService; import com.mcwl.resource.service.CollectService;
import com.mcwl.system.init.DictInit;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* *
@ -25,6 +29,9 @@ public class CollectServiceImpl implements CollectService {
@Autowired @Autowired
private CollectMapper collectMapper; private CollectMapper collectMapper;
@Autowired
private DownloadRecordServiceImpl downloadRecordService;
@Override @Override
public R addCollect(Collect collect) { public R addCollect(Collect collect) {
@ -34,12 +41,12 @@ public class CollectServiceImpl implements CollectService {
if (collect1 == null){ if (collect1 == null){
//执行收藏 //执行收藏
collectMapper.insert(collect); collectMapper.insert(collect);
return R.ok(0); return R.ok(1);
} }
//执行删除/取消收藏 //执行删除/取消收藏
collectMapper.deleteById(collect1.getId()); 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(); Long userIdMax = SecurityUtils.getUserIdMax();
if (pageVo.getType() == 0){ if (pageVo.getType() == 999){
//查询工作流 //查询工作流
List<ResponseCollect> responseCollectList = collectMapper.selectCollectWorkFlow(userIdMax);
//校验是否下载
for (ResponseCollect collect : responseCollectList) {
collect.setIsDownload(downloadRecordService.selectDownloadByUser(userIdMax,collect.getId(),1));
}
return R.ok(responseCollectList);
}else {
//查询模型
List<ResponseCollect> 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();
} }
} }

View File

@ -2,15 +2,18 @@ package com.mcwl.resource.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.common.constant.DictConstants;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils; import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.*; import com.mcwl.resource.domain.*;
import com.mcwl.resource.domain.request.RequestDownload;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.mapper.*; import com.mcwl.resource.mapper.*;
import com.mcwl.resource.service.DownloadRecordService; import com.mcwl.resource.service.DownloadRecordService;
import com.mcwl.system.init.DictInit;
import com.mcwl.system.mapper.SysUserMapper; import com.mcwl.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -63,10 +66,12 @@ public class DownloadRecordServiceImpl implements DownloadRecordService {
ModelVersion modelVersion = modelVersionMapper.selectById(downloadRecord.getProductId()); ModelVersion modelVersion = modelVersionMapper.selectById(downloadRecord.getProductId());
downloadRecord.setFileName(modelVersion.getFileName()); downloadRecord.setFileName(modelVersion.getFileName());
downloadRecord.setFileSize(modelVersion.getFileSize()); downloadRecord.setFileSize(modelVersion.getFileSize());
downloadRecord.setModelVersionType(modelVersion.getModelVersionType()+"");
//根据版本查找封面信息 //根据版本查找封面信息
ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId()); ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId());
downloadRecord.setCover(modelProduct.getSurfaceUrl()); downloadRecord.setCover(modelProduct.getSurfaceUrl());
downloadRecord.setProductName(modelProduct.getModelName());
//查询作者信息 //查询作者信息
SysUser sysUser = sysUserMapper.selectUserById(modelProduct.getUserId()); SysUser sysUser = sysUserMapper.selectUserById(modelProduct.getUserId());
@ -79,9 +84,12 @@ public class DownloadRecordServiceImpl implements DownloadRecordService {
downloadRecord.setFileName(workFlowVersion.getFileName()); downloadRecord.setFileName(workFlowVersion.getFileName());
downloadRecord.setFileSize(workFlowVersion.getFileSize()); downloadRecord.setFileSize(workFlowVersion.getFileSize());
//根据版本查找封面信息 //根据版本查找封面信息
WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId()); WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId());
downloadRecord.setCover(workFlow.getCoverPath()); downloadRecord.setCover(workFlow.getCoverPath());
downloadRecord.setProductName(workFlow.getWorkflowName());
//查询作者信息 //查询作者信息
SysUser sysUser = sysUserMapper.selectUserById(workFlow.getUserId()); SysUser sysUser = sysUserMapper.selectUserById(workFlow.getUserId());
@ -136,4 +144,41 @@ public class DownloadRecordServiceImpl implements DownloadRecordService {
return R.fail(HttpStatus.SHOW_ERROR_MSG,"请选择要删除的数据"); 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<DownloadRecord> 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<DownloadRecord> 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);
}
} }

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.DictConstants;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
@ -101,9 +102,8 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
@Override @Override
public PageInfo<ResponseModelProduct> modelSquare(PageVo pageVo) { public PageInfo<ResponseModelProduct> modelSquare(PageVo pageVo) {
PageInfo<ResponseModelProduct> page = new PageInfo<>(); PageHelper pageHelper = new PageHelper();
page.setPageNum(pageVo.getPageNumber()); pageHelper.startPage(pageVo.getPageNumber(),pageVo.getPageSize());
page.setPages(pageVo.getPageSize());
Long userIdMax = SecurityUtils.getUserIdMax(); Long userIdMax = SecurityUtils.getUserIdMax();
List<ResponseModelProduct> responseModelProductList = postMapper.modelSquare(pageVo); List<ResponseModelProduct> responseModelProductList = postMapper.modelSquare(pageVo);
@ -128,8 +128,10 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
if (collect == null){ if (collect == null){
modelVersion.setIsCollect(0); modelVersion.setIsCollect(0);
}else {
modelVersion.setIsCollect(1);
} }
modelVersion.setIsCollect(1);
} }
responseModelProduct.setModelVersion(modelVersion); responseModelProduct.setModelVersion(modelVersion);

View File

@ -106,8 +106,10 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
//模型字典 0 工作流字典 1 //模型字典 0 工作流字典 1
Integer type = 0; Integer type = 0;
//校验是否收藏 //校验是否收藏
Collect collect = collectService.selectCollectById(modelVersion.getModelId(),userIdMax,type); Collect collect = collectService.selectCollectById(modelVersion.getId(),userIdMax,type);
if (collect != null ){ if (collect != null ){
modelVersion.setIsCollect(1);
}else {
modelVersion.setIsCollect(0); modelVersion.setIsCollect(0);
} }
} }

View File

@ -511,8 +511,10 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
if (collect == null){ if (collect == null){
workFlowVersion.setIsCollect(0); workFlowVersion.setIsCollect(0);
}else {
workFlowVersion.setIsCollect(1);
} }
workFlowVersion.setIsCollect(1);
} }
responseWorkFlow.setWorkFlowVersion(workFlowVersion); responseWorkFlow.setWorkFlowVersion(workFlowVersion);

View File

@ -50,11 +50,11 @@ public class WorkFlowVersionServiceImpl implements WorkFlowVersionService {
for (WorkFlowVersion workFlowVersion : workFlowVersions) { for (WorkFlowVersion workFlowVersion : workFlowVersions) {
workFlowVersion.setFilePath(""); workFlowVersion.setFilePath("");
//模型字典 0 工作流字典 1 //模型字典 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) { if (collect != null) {
workFlowVersion.setIsCollect(0); workFlowVersion.setIsCollect(1);
} }
} }
} }

View File

@ -13,7 +13,25 @@
<select id="selectCollectById" resultType="com.mcwl.resource.domain.Collect"> <select id="selectCollectById" resultType="com.mcwl.resource.domain.Collect">
select select
id,product_id,user_id,product_type id,product_id,user_id,product_type
FROM collect where product_id = #{modelId} and user_id = #{userIdMax} and product_type = #{type} FROM collect where product_id = #{modelId} and user_id = #{userIdMax} and collect_type = #{type}
</select>
<select id="selectCollectWorkFlow" resultType="com.mcwl.resource.domain.response.ResponseCollect">
SELECT w.cover_path as file_path,v.file_name,w.workflow_name as product_name,u.nick_name,v.file_size,c.create_time
FROM collect as c
LEFT JOIN work_flow_version as v on c.product_id = v.id
LEFT JOIN work_flow as w on v.work_flow_id = w.id
LEFT JOIN sys_user as u on w.user_id = u.user_id
WHERE c.user_id = #{userIdMax} and c.collect_type = 1
</select>
<select id="selectCollectModel" resultType="com.mcwl.resource.domain.response.ResponseCollect">
SELECT m.surface_url as file_path,v.file_name,m.model_name as product_name,u.nick_name,v.file_size,c.create_time,v.model_version_type as type
FROM collect as c
LEFT JOIN model_version as v on c.product_id = v.id
LEFT JOIN model as m on v.model_id = m.id
LEFT JOIN sys_user as u on m.user_id = u.user_id
WHERE c.user_id = #{userIdMax} and c.product_type = #{type} and c.collect_type = 0
</select> </select>
</mapper> </mapper>

View File

@ -11,4 +11,10 @@
status = #{status} status = #{status}
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<select id="selectDownloadByUser" resultType="com.mcwl.resource.domain.DownloadRecord">
SELECT * FROM download_record WHERE user_id = #{userIdMax}
and product_id = #{id}
and product_type = #{i}
</select>
</mapper> </mapper>

View File

@ -100,6 +100,13 @@
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and m.model_type = #{type} and m.model_type = #{type}
</if> </if>
<if test="order == 0">
ORDER BY m.create_time desc
</if>
<if test="order == 1">
ORDER BY m.like_num desc
</if>
</select> </select>
<select id="sumModelNumber" resultType="java.lang.Long"> <select id="sumModelNumber" resultType="java.lang.Long">
SELECT COALESCE(count(*), 0) SELECT COALESCE(count(*), 0)

View File

@ -48,13 +48,21 @@
FROM work_flow as w FROM work_flow as w
LEFT JOIN sys_user u LEFT JOIN sys_user u
on w.user_id = u.user_id on w.user_id = u.user_id
where w.del_flag = '0' where w.del_flag = '0' and w.audit_status = 1
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and w.workflow_name like CONCAT('%', #{name}, '%') and w.workflow_name like CONCAT('%', #{name}, '%')
</if> </if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and w.type like CONCAT('%', #{type}, '%') and w.type like CONCAT('%', #{type}, '%')
</if> </if>
<if test="order == 0">
ORDER BY w.create_time desc
</if>
<if test="order == 1">
ORDER BY w.like_num desc
</if>
</select> </select>
<select id="sumWorkFlowNumber" resultType="java.lang.Long"> <select id="sumWorkFlowNumber" resultType="java.lang.Long">
SELECT COALESCE(count(*), 0) sum SELECT COALESCE(count(*), 0) sum