Merge branch 'feature/admin' into preview

master
Diyu0904 2025-02-15 14:57:33 +08:00
commit 461b75cce2
20 changed files with 435 additions and 21 deletions

View File

@ -1,6 +1,7 @@
package com.mcwl.web.controller.resource;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageInfo;
import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R;
@ -10,7 +11,9 @@ import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.ModelVersion;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.response.ResponseModelProduct;
import com.mcwl.resource.domain.request.RequestModel;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.mapper.ModelVersionMapper;
import com.mcwl.resource.service.*;
import io.swagger.annotations.Api;
@ -221,5 +224,15 @@ public class MallProductController extends BaseController {
return modelImageLikeService.listByPage(pageDomain);
}
/**
* 广
*/
@ApiOperation(value = "模型广场列表")
@PostMapping("/modelSquare")
public R modelSquare(@RequestBody PageVo pageVo) {
PageInfo<ResponseModelProduct> modelProductPage = modelService.modelSquare(pageVo);
return R.ok(modelProductPage);
}
}

View File

@ -1,22 +1,23 @@
package com.mcwl.web.controller.resource;
import cn.hutool.core.bean.BeanUtil;
import com.github.pagehelper.PageInfo;
import com.mcwl.common.annotation.RepeatSubmit;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.dto.ModelImageRes;
import com.mcwl.resource.domain.response.ResponseModelImage;
import com.mcwl.resource.domain.vo.ModelImageVo;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.ModelImageLikeService;
import com.mcwl.resource.service.ModelImageService;
import com.mcwl.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@ -132,4 +133,16 @@ public class ModelImageController {
return R.ok(models);
}
/**
*
*
* @return
*/
@ApiOperation(value = "作品灵感")
@GetMapping("/imageList")
public R<PageInfo<ResponseModelImage>> imageList(PageVo pageVo) {
PageInfo<ResponseModelImage> models = modelImageLikeService.imageList(pageVo);
return R.ok(models);
}
}

View File

@ -1,19 +1,18 @@
package com.mcwl.web.controller.resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R;
import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
import com.mcwl.resource.domain.response.ResponseWorkFlow;
import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.WorkFlowService;
import com.mcwl.resource.service.impl.WorkFlowServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -168,4 +167,19 @@ public class WorkFlowController extends BaseController {
return workFlowService.selectWorkFlowVersionById(id);
}
/**
*
*
* @return
*/
@ApiOperation(value = "工作流列表")
@PostMapping("/workFlowList")
public R<PageInfo<ResponseWorkFlow>> workFlowList(@RequestBody PageVo pageVo) {
PageInfo<ResponseWorkFlow> responseWorkFlowPageInfo = workFlowService.workFlowList(pageVo);
return R.ok(responseWorkFlowPageInfo);
}
}

View File

@ -61,4 +61,9 @@ public class DictConstants {
*/
public static final String WORK_FLOW_TYPE_CHILD = "work_flow_type_child";
/**
*
*/
public static final String MODEL_TYPE = "model_type";
}

View File

@ -0,0 +1,68 @@
package com.mcwl.resource.domain.response;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
*
* @author DaiZibo
* @date 2025/2/15
* @apiNote
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public class ResponseModelImage {
/**
* ID
*/
@ApiModelProperty(value = "主键ID")
@TableId
private Long id;
/**
* ID
*/
@ApiModelProperty(value = "用户ID")
private Long userId;
/**
* 8
*/
@ApiModelProperty(value = "图片地址最多8张切割")
private String imagePaths;
/**
*
*/
@ApiModelProperty(value = "封面图")
private String path;
/**
*
*/
@ApiModelProperty(value = "点赞数")
private Integer likeNum;
/**
*
*/
@ApiModelProperty(value = "作品发布人")
private String nickName;
/**
*
*/
@ApiModelProperty(value = "发布人头像")
private String avatar;
/**
* 0 1
*/
@ApiModelProperty(value = "作品是否点赞 0未点赞 1点赞")
private Integer isLike;
}

View File

@ -0,0 +1,83 @@
package com.mcwl.resource.domain.response;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 广
*
* @author DaiZibo
* @date 2025/2/15
* @apiNote
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public class ResponseModelProduct {
/**
* ID
*/
@ApiModelProperty(value = "主键ID")
@TableId
private Long id;
/**
*
*/
@ApiModelProperty(value = "名称")
private String modelName;
/***
* id
*/
@ApiModelProperty(value = "用户id")
private Long userId;
/**
*
*/
@ApiModelProperty(value = "模型类型")
private Long modelType;
/**
*
*/
@ApiModelProperty(value = "生成图次数")
private Integer reals;
/**
*
*/
@ApiModelProperty(value = "封面图")
private String surfaceUrl;
/**
*
*/
@ApiModelProperty(value = "下载次数")
private Integer numbers;
/**
*
*/
@ApiModelProperty(value = "点赞数")
private Integer likeNum;
/**
*
*/
@ApiModelProperty(value = "翻译后类型")
private String type;
/**
*
*/
@ApiModelProperty(value = "作品发布人")
private String nickName;
/**
*
*/
@ApiModelProperty(value = "发布人头像")
private String avatar;
}

View File

@ -0,0 +1,83 @@
package com.mcwl.resource.domain.response;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 广
*
* @author DaiZibo
* @date 2025/2/15
* @apiNote
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResponseWorkFlow {
/**
* ID
*/
@ApiModelProperty(value = "主键ID")
@TableId
private Long id;
/**
* id
*/
@ApiModelProperty(value = "用户id")
private Long userId;
/**
* 30
*/
@ApiModelProperty(value = "名称最多30字")
private String workflowName;
/**
*
*/
@ApiModelProperty(value = "类别")
private String type;
/**
* 使
*/
@ApiModelProperty(value = "使用数量")
private Long useNumber = 0L;
/**
*
*/
@ApiModelProperty(value = "下载数量")
private Long downloadNumber = 0L;
/**
*
*/
@ApiModelProperty(value = "封面图地址")
private String coverPath;
/**
*
*/
@ApiModelProperty(value = "作品点赞数量")
private Integer likeCount = 0;
/**
*
*/
@ApiModelProperty(value = "作品发布人")
private String nickName;
/**
*
*/
@ApiModelProperty(value = "发布人头像")
private String avatar;
}

View File

@ -2,6 +2,8 @@ package com.mcwl.resource.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.response.ResponseModelImage;
import com.mcwl.resource.domain.vo.PageVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -16,4 +18,6 @@ public interface ModelImageMapper extends BaseMapper<ModelImage> {
void setModelImageTop(@Param("id") Long id, @Param("isTop") int i);
List<ResponseModelImage> imageList(PageVo pageVo);
}

View File

@ -3,6 +3,8 @@ package com.mcwl.resource.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.response.ResponseModelProduct;
import com.mcwl.resource.domain.vo.PageVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -35,5 +37,6 @@ public interface ModelMapper extends BaseMapper<ModelProduct> {
List<ModelProduct> selectAllModelsSortedByTopStatus();
List<ResponseModelProduct> modelSquare(PageVo pageVo);
}

View File

@ -2,6 +2,8 @@ package com.mcwl.resource.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.response.ResponseWorkFlow;
import com.mcwl.resource.domain.vo.PageVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -21,7 +23,8 @@ public interface WorkFlowMapper extends BaseMapper<WorkFlow> {
List<WorkFlow> fetchWorkFlowSortedByTopStatus();
void setworkFlowTop(@Param("id") Long id, @Param("i") int i);
List<ResponseWorkFlow> workFlowList(PageVo pageVo);
}

View File

@ -1,11 +1,13 @@
package com.mcwl.resource.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.ModelImageLike;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.response.ResponseModelImage;
import com.mcwl.resource.domain.vo.PageVo;
import java.util.List;
@ -25,4 +27,8 @@ public interface ModelImageLikeService extends IService<ModelImageLike> {
* @return
*/
TableDataInfo listByPage(PageDomain pageDomain);
PageInfo<ResponseModelImage> imageList(PageVo pageVo);
}

View File

@ -2,15 +2,15 @@ package com.mcwl.resource.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult;
import com.github.pagehelper.PageInfo;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.domain.IdsParam;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.ModelVersion;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.response.ResponseModelProduct;
import com.mcwl.resource.domain.request.RequestModel;
import com.mcwl.resource.domain.vo.MallProductVo;
import com.mcwl.resource.domain.vo.PageVo;
import java.util.List;
@ -42,5 +42,5 @@ public interface ModelService extends IService<ModelProduct> {
List<ModelProduct> fetchModelsSortedByTopStatus();
PageInfo<ResponseModelProduct> modelSquare(PageVo pageVo);
}

View File

@ -2,12 +2,13 @@ package com.mcwl.resource.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult;
import com.github.pagehelper.PageInfo;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.response.ResponseWorkFlow;
import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.vo.PageVo;
@ -42,4 +43,6 @@ public interface WorkFlowService extends IService<WorkFlow> {
Long selectWorkFlowByName(String name);
R<RequestWorkFlow> selectWorkFlowVersionById(Long id);
PageInfo<ResponseWorkFlow> workFlowList(PageVo pageVo);
}

View File

@ -36,7 +36,7 @@ public class FileServiceImpl implements FileService {
}
return AjaxResult.success(modelVersion);
}else if (type.equals("work")){
}else if (type.equals("workFlow")){
WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectByFileName(name);
if (workFlowVersion == null) {

View File

@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
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.HttpStatus;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.core.page.PageDomain;
@ -13,7 +15,9 @@ import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.ModelImageLike;
import com.mcwl.resource.domain.response.ResponseModelImage;
import com.mcwl.resource.domain.vo.ModelImageLikeVo;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.mapper.ModelImageLikeMapper;
import com.mcwl.resource.mapper.ModelImageMapper;
import com.mcwl.resource.service.ModelImageLikeService;
@ -150,4 +154,30 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
return rspData;
}
@Override
public PageInfo<ResponseModelImage> imageList(PageVo pageVo) {
PageHelper pageHelper = new PageHelper();
pageHelper.startPage(pageVo.getPageNumber(),pageVo.getPageSize());
List<ResponseModelImage> responseModelImageList = modelImageMapper.imageList(pageVo);
for (ResponseModelImage responseModelImage : responseModelImageList) {
String[] split = responseModelImage.getImagePaths().split(",");
responseModelImage.setPath(split[0]);
//查询模型是否点赞
ModelImageLike likeImage = baseMapper.getLikeImage(SecurityUtils.getUserId(), responseModelImage.getId());
if (likeImage == null){
responseModelImage.setIsLike(0);
}else {
responseModelImage.setIsLike(1);
}
}
return new PageInfo<>(responseModelImageList);
}
}

View File

@ -8,12 +8,12 @@ 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.PageInfo;
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.core.page.TableDataInfo;
import com.mcwl.common.core.redis.RedisCache;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.common.utils.baidu.BaiduCensor;
@ -22,9 +22,11 @@ import com.mcwl.resource.domain.ModelVersion;
import com.mcwl.resource.domain.SysUserAttention;
import com.mcwl.resource.domain.WorkFlowLike;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.response.ResponseModelProduct;
import com.mcwl.resource.domain.request.RequestModel;
import com.mcwl.resource.domain.vo.MallProductVo;
import com.mcwl.resource.domain.vo.ModelVo;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.mapper.ModelLikeMapper;
import com.mcwl.resource.mapper.ModelMapper;
import com.mcwl.resource.mapper.ModelVersionMapper;
@ -55,8 +57,6 @@ import java.util.Objects;
@Log4j2
@Service
public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> implements ModelService {
@Autowired
private RedisCache redisCache;
@Autowired
private ToActivityService toActivityService;
@ -97,6 +97,24 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
public List<ModelProduct> fetchModelsSortedByTopStatus() {
return postMapper.selectAllModelsSortedByTopStatus();
}
@Override
public PageInfo<ResponseModelProduct> modelSquare(PageVo pageVo) {
PageInfo<ResponseModelProduct> page = new PageInfo<>();
page.setPageNum(pageVo.getPageNumber());
page.setPages(pageVo.getPageSize());
List<ResponseModelProduct> responseModelProductList = postMapper.modelSquare(pageVo);
for (ResponseModelProduct responseModelProduct : responseModelProductList) {
if (responseModelProduct.getModelType() != null){
responseModelProduct.setType(DictInit.getDictValue(DictConstants.MODEL_TYPE,responseModelProduct.getModelType()+""));
}
}
return new PageInfo<ResponseModelProduct>(responseModelProductList);
}
@Override
public Page<ModelProduct> selectByUserId(MallProductVo mallProductVo) {

View File

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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;
import com.mcwl.common.core.domain.R;
@ -23,6 +25,7 @@ import com.mcwl.resource.domain.WorkFlowLike;
import com.mcwl.resource.domain.WorkFlowVersion;
import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.response.ResponseWorkFlow;
import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.domain.vo.WorkFlowVo;
@ -499,5 +502,18 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
return R.ok(requestWorkFlow);
}
@Override
public PageInfo<ResponseWorkFlow> workFlowList(PageVo pageVo) {
PageHelper pageHelper = new PageHelper();
pageHelper.startPage(pageVo.getPageNumber(),pageVo.getPageSize());
List<ResponseWorkFlow> responseWorkFlowList = baseMapper.workFlowList(pageVo);
return new PageInfo<ResponseWorkFlow>(responseWorkFlowList);
}
}

View File

@ -4,14 +4,35 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.resource.mapper.ModelImageMapper">
<update id="setModelImageTop">
UPDATE model_image SET is_top = #{isTop} WHERE id = #{id}
UPDATE model_image
SET is_top = #{isTop}
WHERE id = #{id}
</update>
<update id="fetchModelImageSortedByTopStatus">
SELECT is_top FROM model_image ORDER BY is_top DESC;
SELECT is_top
FROM model_image
ORDER BY is_top DESC;
</update>
<select id="sumLikeNumber" resultType="java.lang.Long">
SELECT sum(like_num)sum FROM model_image where user_id = #{userId} ORDER BY(user_id);
SELECT sum(like_num) sum
FROM model_image
where user_id = #{userId}
ORDER BY(user_id);
</select>
<select id="imageList" resultType="com.mcwl.resource.domain.response.ResponseModelImage">
SELECT id,m.user_id,image_paths,like_num,nick_name,avatar
FROM model_image as m
LEFT JOIN sys_user as u
on m.user_id = u.user_id
WHERE m.del_flag = '0'
<if test="name != null and name != ''">
and m.title like CONCAT('%', #{name}, '%')
</if>
<if test="type != null and type != ''">
and m.tags like CONCAT('%', #{type}, '%')
</if>
</select>
</mapper>

View File

@ -88,4 +88,17 @@
SELECT is_top FROM model ORDER BY is_top DESC;
</select>
<select id="modelSquare" resultType="com.mcwl.resource.domain.response.ResponseModelProduct">
SELECT id,model_name,m.user_id,model_type,reals,surface_url,numbers,like_num,nick_name,avatar FROM model as m
LEFT JOIN sys_user as u
on m.user_id = u.user_id
WHERE m.del_flag = 0
<if test="name != null and name != ''">
and m.model_name like CONCAT('%', #{name}, '%')
</if>
<if test="type != null and type != ''">
and m.model_type = #{type}
</if>
</select>
</mapper>

View File

@ -32,10 +32,28 @@
WHERE id = #{id}
</update>
<update id="setworkFlowTop">
UPDATE work_flow SET is_top = #{i} WHERE id = #{id}
UPDATE work_flow
SET is_top = #{i}
WHERE id = #{id}
</update>
<select id="fetchWorkFlowSortedByTopStatus" resultType="com.mcwl.resource.domain.WorkFlow">
SELECT is_top FROM work_flow ORDER BY is_top DESC;
SELECT is_top
FROM work_flow
ORDER BY is_top DESC;
</select>
<select id="workFlowList" resultType="com.mcwl.resource.domain.response.ResponseWorkFlow">
SELECT id,w.user_id,workflow_name,type,use_number,download_number,cover_path,like_count,nick_name,avatar
FROM work_flow as w
LEFT JOIN sys_user u
on w.user_id = u.user_id
where w.del_flag = '0'
<if test="name != null and name != ''">
and w.workflow_name like CONCAT('%', #{name}, '%')
</if>
<if test="type != null and type != ''">
and w.type like CONCAT('%', #{type}, '%')
</if>
</select>
</mapper>