Merge branch 'feature/admin' into preview
commit
4523a29c53
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource;
|
|||
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.Collect;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
import com.mcwl.resource.service.impl.CollectServiceImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -41,4 +42,11 @@ public class CollectController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public R selectCollect(@RequestBody PageVo pageVo){
|
||||
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.resource.domain.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
@ -80,4 +81,10 @@ public class ResponseModelProduct {
|
|||
@ApiModelProperty(value = "发布人头像")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 版本对象
|
||||
*/
|
||||
@ApiModelProperty(value = "版本对象")
|
||||
private ModelVersion modelVersion;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.resource.domain.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mcwl.resource.domain.WorkFlowVersion;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
@ -67,7 +68,7 @@ public class ResponseWorkFlow {
|
|||
* 作品点赞数量
|
||||
*/
|
||||
@ApiModelProperty(value = "作品点赞数量")
|
||||
private Integer likeCount = 0;
|
||||
private Integer likeNum = 0;
|
||||
|
||||
/**
|
||||
* 作品发布人
|
||||
|
@ -80,4 +81,10 @@ public class ResponseWorkFlow {
|
|||
*/
|
||||
@ApiModelProperty(value = "发布人头像")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 工作流版本
|
||||
*/
|
||||
@ApiModelProperty(value = "工作流版本")
|
||||
private WorkFlowVersion workFlowVersion;
|
||||
}
|
||||
|
|
|
@ -32,4 +32,7 @@ public class PageVo {
|
|||
private Integer order;
|
||||
@ApiModelProperty(value = "条件过滤")
|
||||
private Long type;
|
||||
|
||||
@ApiModelProperty("0查询 1不查询 是否收藏/下载")
|
||||
private Integer isCollect;
|
||||
}
|
||||
|
|
|
@ -25,4 +25,6 @@ public interface ModelVersionMapper extends BaseMapper<ModelVersion> {
|
|||
|
||||
ModelVersion selectByHash(@Param("hashCode") String hashCode);
|
||||
|
||||
ModelVersion selectByProductId(@Param("id") Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -28,4 +28,6 @@ public interface WorkFlowVersionMapper extends BaseMapper<WorkFlowVersion> {
|
|||
|
||||
WorkFlowVersion selectByHash(@Param("hashCode") String hashCode);
|
||||
|
||||
WorkFlowVersion selectByWorkFlowId(@Param("id") Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -17,10 +17,7 @@ import com.mcwl.common.core.page.TableDataInfo;
|
|||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.common.utils.baidu.BaiduCensor;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
import com.mcwl.resource.domain.SysUserAttention;
|
||||
import com.mcwl.resource.domain.WorkFlowLike;
|
||||
import com.mcwl.resource.domain.*;
|
||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||
import com.mcwl.resource.domain.request.RequestModel;
|
||||
import com.mcwl.resource.domain.response.ResponseModelProduct;
|
||||
|
@ -67,6 +64,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||
|
||||
|
@ -76,6 +74,9 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
@Autowired
|
||||
private ModelLikeMapper modelLikeMapper;
|
||||
|
||||
@Autowired
|
||||
private CollectServiceImpl collectService;
|
||||
|
||||
/**
|
||||
* 设置模型置顶状态
|
||||
*
|
||||
|
@ -104,12 +105,36 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
page.setPageNum(pageVo.getPageNumber());
|
||||
page.setPages(pageVo.getPageSize());
|
||||
|
||||
Long userIdMax = SecurityUtils.getUserIdMax();
|
||||
List<ResponseModelProduct> responseModelProductList = postMapper.modelSquare(pageVo);
|
||||
for (ResponseModelProduct responseModelProduct : responseModelProductList) {
|
||||
if (responseModelProduct.getModelType() != null){
|
||||
|
||||
responseModelProduct.setType(DictInit.getDictValue(DictConstants.MODEL_TYPE,responseModelProduct.getModelType()+""));
|
||||
}
|
||||
|
||||
//查询该模型第一个版本信息
|
||||
if (pageVo.getIsCollect() == 0){
|
||||
|
||||
ModelVersion modelVersion = modelVersionMapper.selectByProductId(responseModelProduct.getId());
|
||||
|
||||
if (userIdMax == 0){
|
||||
//收藏为空
|
||||
modelVersion.setIsCollect(0);
|
||||
}else {
|
||||
//查询是否收藏
|
||||
Collect collect = collectService.selectCollectById(modelVersion.getId(), userIdMax, 0);
|
||||
|
||||
if (collect == null){
|
||||
|
||||
modelVersion.setIsCollect(0);
|
||||
}
|
||||
modelVersion.setIsCollect(1);
|
||||
}
|
||||
|
||||
responseModelProduct.setModelVersion(modelVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new PageInfo<ResponseModelProduct>(responseModelProductList);
|
||||
|
|
|
@ -19,10 +19,7 @@ import com.mcwl.common.core.page.TableDataInfo;
|
|||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.common.utils.baidu.BaiduCensor;
|
||||
import com.mcwl.resource.domain.SysUserAttention;
|
||||
import com.mcwl.resource.domain.WorkFlow;
|
||||
import com.mcwl.resource.domain.WorkFlowLike;
|
||||
import com.mcwl.resource.domain.WorkFlowVersion;
|
||||
import com.mcwl.resource.domain.*;
|
||||
import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
|
||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||
import com.mcwl.resource.domain.request.RequestWorkFlow;
|
||||
|
@ -60,6 +57,9 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
@Autowired
|
||||
private WorkFlowMapper flowMapper;
|
||||
|
||||
@Autowired
|
||||
private CollectServiceImpl collectService;
|
||||
|
||||
@Autowired
|
||||
private WorkFlowVersionMapper workFlowVersionMapper;
|
||||
|
||||
|
@ -491,10 +491,35 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
|
||||
List<ResponseWorkFlow> responseWorkFlowList = baseMapper.workFlowList(pageVo);
|
||||
|
||||
Long userIdMax = SecurityUtils.getUserIdMax();
|
||||
|
||||
for (ResponseWorkFlow responseWorkFlow : responseWorkFlowList) {
|
||||
|
||||
responseWorkFlow.setType(DictInit.getDictValue(DictConstants.WORK_FLOW_TYPE_CHILD, responseWorkFlow.getType()));
|
||||
//查询工作流型第一个版本信息
|
||||
if (pageVo.getIsCollect() == 0){
|
||||
|
||||
WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectByWorkFlowId(responseWorkFlow.getId());
|
||||
|
||||
if (userIdMax == 0){
|
||||
//收藏为空
|
||||
workFlowVersion.setIsCollect(0);
|
||||
}else {
|
||||
//查询是否收藏
|
||||
Collect collect = collectService.selectCollectById(workFlowVersion.getId(), userIdMax, 1);
|
||||
|
||||
if (collect == null){
|
||||
|
||||
workFlowVersion.setIsCollect(0);
|
||||
}
|
||||
workFlowVersion.setIsCollect(1);
|
||||
}
|
||||
|
||||
responseWorkFlow.setWorkFlowVersion(workFlowVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return new PageInfo<ResponseWorkFlow>(responseWorkFlowList);
|
||||
|
||||
|
|
|
@ -55,4 +55,8 @@
|
|||
select * from model_version where file_hash = #{hashCode}
|
||||
</select>
|
||||
|
||||
<select id="selectByProductId" resultType="com.mcwl.resource.domain.ModelVersion">
|
||||
SELECT * FROM model_version WHERE model_id = #{id} LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -30,4 +30,8 @@
|
|||
<select id="selectByHash" resultType="com.mcwl.resource.domain.WorkFlowVersion">
|
||||
select * from work_flow_version where file_hash = #{hashCode}
|
||||
</select>
|
||||
|
||||
<select id="selectByWorkFlowId" resultType="com.mcwl.resource.domain.WorkFlowVersion">
|
||||
SELECT * FROM work_flow_version WHERE work_flow_id = #{id} LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue