Compare commits
7 Commits
3645f7894c
...
3e7a30d786
Author | SHA1 | Date |
---|---|---|
|
3e7a30d786 | |
|
b8bf961509 | |
|
1cdfb48ae3 | |
|
2d0a5dcb38 | |
|
2385b58bb0 | |
|
f445567505 | |
|
c8bc835644 |
|
@ -19,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -140,4 +141,16 @@ public class MemberController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据会员等级和活动计算支付金额
|
||||
*/
|
||||
@GetMapping("calculatePayment")
|
||||
public AjaxResult calculatePayment(@NotNull(message = "请选择会员") Long memberLevelId, @RequestParam(required = false) Long promotionId) {
|
||||
MemberLevel memberLevel = memberLevelService.getById(memberLevelId);
|
||||
Double unitPrice = memberLevel.getUnitPrice();
|
||||
unitPrice = memberService.calculatePayment(unitPrice, promotionId);
|
||||
return AjaxResult.success(unitPrice);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ import com.mcwl.common.core.page.TableDataInfo;
|
|||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||
import com.mcwl.resource.domain.request.RequestModel;
|
||||
import com.mcwl.resource.domain.request.RequestWorkFlow;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.service.ModelService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
|
@ -31,8 +33,7 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/model")
|
||||
public class MallProductController extends BaseController {
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ModelService modelService;
|
||||
|
@ -103,26 +104,29 @@ public class MallProductController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@PostMapping("insert")
|
||||
public AjaxResult insert(@RequestBody ModelProduct modelVersion)
|
||||
{
|
||||
|
||||
@PostMapping("/insert")
|
||||
public AjaxResult addupdateModel(@RequestBody RequestModel requestModel){
|
||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
modelVersion.setUserId(userId);
|
||||
modelVersion.setCreateBy(getUsername());
|
||||
modelService.save(modelVersion);
|
||||
return AjaxResult.success();
|
||||
modelProduct.setUserId(userId);
|
||||
modelProduct.setCreateBy(getUsername());
|
||||
return modelService.addModel(requestModel);
|
||||
}
|
||||
|
||||
@PostMapping("update")
|
||||
public AjaxResult update(@RequestBody ModelProduct modelVersion)
|
||||
{
|
||||
@PostMapping("/update")
|
||||
public AjaxResult updateModel(@RequestBody RequestModel requestModel){
|
||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
modelVersion.setUserId(userId);
|
||||
modelVersion.setUpdateBy(getUsername());
|
||||
modelService.updateById(modelVersion);
|
||||
return AjaxResult.success();
|
||||
modelProduct.setUserId(userId);
|
||||
modelProduct.setUpdateBy(getUsername());
|
||||
modelService.updaModel(requestModel);
|
||||
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("delete")
|
||||
public AjaxResult delete(@RequestBody ModelProduct modelVersion)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.memberCenter.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.memberCenter.domain.Member;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
public interface MemberService extends IService<Member> {
|
||||
|
@ -41,4 +42,6 @@ public interface MemberService extends IService<Member> {
|
|||
* @param consumePoints 消费积分
|
||||
*/
|
||||
void consumePoints(Double consumePoints);
|
||||
|
||||
Double calculatePayment(Double unitPrice, Long promotionId);
|
||||
}
|
||||
|
|
|
@ -214,6 +214,24 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double calculatePayment(Double unitPrice, Long promotionId) {
|
||||
if (Objects.isNull(promotionId)) {
|
||||
return unitPrice;
|
||||
}
|
||||
|
||||
Promotion promotion = promotionMapper.selectById(promotionId);
|
||||
if (Objects.isNull(promotion)) {
|
||||
return unitPrice;
|
||||
}
|
||||
PromotionEnum activityType = promotion.getActivityType();
|
||||
if (activityType == PromotionEnum.DISCOUNT) {
|
||||
return unitPrice * promotion.getActivityValue();
|
||||
}
|
||||
|
||||
return unitPrice;
|
||||
}
|
||||
|
||||
private void saveMemberConsume(Double consumePoints, Long userId, double points) {
|
||||
MemberConsume memberConsume = new MemberConsume();
|
||||
memberConsume.setUserId(userId);
|
||||
|
|
|
@ -85,4 +85,9 @@ public class ModelImage extends BaseEntity {
|
|||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否置顶
|
||||
*/
|
||||
private Integer isTop;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,10 @@ public class ModelProduct extends BaseEntity {
|
|||
* 下载次数
|
||||
*/
|
||||
private Integer numbers;
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
private Integer likeNum;
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
|
|
|
@ -29,12 +29,24 @@ public class SysUserInfo {
|
|||
private Long bean = 0L;
|
||||
|
||||
/**
|
||||
* 下载次数
|
||||
* 模型下载次数
|
||||
*/
|
||||
private Long download = 0L;
|
||||
private Long modelDownloadNum = 0L;
|
||||
|
||||
/**
|
||||
* 点赞次数
|
||||
* 模型运行次数
|
||||
*/
|
||||
private Long likeCount = 0L;
|
||||
private Long modelRunNum = 0L;
|
||||
|
||||
|
||||
/**
|
||||
* 模型点赞次数
|
||||
*/
|
||||
private Long modelLikeNum = 0L;
|
||||
|
||||
/**
|
||||
* 图片点赞次数
|
||||
*/
|
||||
private Long imageLikeNum = 0L;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
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 lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 模型入参 模型+版本
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/9
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class RequestModel {
|
||||
|
||||
private ModelProduct modelProduct;
|
||||
|
||||
private List<ModelVersion> modelVersionList;
|
||||
|
||||
}
|
|
@ -3,7 +3,9 @@ package com.mcwl.resource.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface ModelImageMapper extends BaseMapper<ModelImage> {
|
||||
Long sumLikeNumber(@Param("userId") Long userId);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
package com.mcwl.resource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
|
@ -20,12 +15,16 @@ import java.util.Date;
|
|||
* @Date:2024/12/30 18:23
|
||||
*/
|
||||
@Mapper
|
||||
public interface MallProductMapper extends BaseMapper<ModelProduct> {
|
||||
public interface ModelMapper extends BaseMapper<ModelProduct> {
|
||||
|
||||
|
||||
|
||||
Long sumNumber(@Param("userId") Long userId);
|
||||
|
||||
|
||||
void updateModel(ModelProduct modelProduct);
|
||||
|
||||
Long sumLikeNumber(@Param("userId") Long userId);
|
||||
|
||||
Long sumRunNumber(Long userId);
|
||||
}
|
|
@ -1,8 +1,12 @@
|
|||
package com.mcwl.resource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
|
@ -14,4 +18,8 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface ModelVersionMapper extends BaseMapper<ModelVersion> {
|
||||
void addModelVersion(@Param("modelProduct") ModelProduct modelProduct, @Param("modelVersionList") List<ModelVersion> modelVersionList);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,11 +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.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.request.RequestModel;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -27,4 +29,9 @@ public interface ModelService extends IService<ModelProduct> {
|
|||
|
||||
TableDataInfo listByPage(ModelImagePageRes imagePageRes);
|
||||
|
||||
AjaxResult addModel(RequestModel requestModel);
|
||||
|
||||
|
||||
void updaModel(RequestModel requestModel);
|
||||
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
|||
BeanUtil.copyProperties(modelImageRes, modelImage);
|
||||
modelImage.setUserId(SecurityUtils.getUserId());
|
||||
modelImage.setCreateBy(SecurityUtils.getUsername());
|
||||
modelImage.setCreateTime(new Date());
|
||||
modelImage.setUpdateBy(SecurityUtils.getUsername());
|
||||
modelImage.setUpdateTime(new Date());
|
||||
modelImage.setStatus(3);
|
||||
|
|
|
@ -4,14 +4,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.*;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.mapper.MallProductMapper;
|
||||
import com.mcwl.resource.mapper.ModelMapper;
|
||||
import com.mcwl.resource.mapper.ModelLikeMapper;
|
||||
import com.mcwl.resource.service.ModelLikeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import springfox.documentation.swagger2.mappers.ModelMapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
@ -29,12 +27,12 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
|||
|
||||
|
||||
@Autowired
|
||||
private MallProductMapper mallProductMapper;
|
||||
private ModelMapper modelMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void like(Long modelId) {
|
||||
ModelProduct model = mallProductMapper.selectById(modelId);
|
||||
ModelProduct model = modelMapper.selectById(modelId);
|
||||
if (Objects.isNull(model)) {
|
||||
throw new ServiceException("该模型不存在或已下架");
|
||||
}
|
||||
|
@ -51,7 +49,7 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
|||
// 更新点赞记录
|
||||
baseMapper.updateById(modelLike);
|
||||
// 更新图片点赞数
|
||||
mallProductMapper.updateById(model);
|
||||
modelMapper.updateById(model);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -66,6 +64,6 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
|||
|
||||
// 更新图片点赞数
|
||||
model.setNumbers(model.getNumbers() + 1);
|
||||
mallProductMapper.updateById(model);
|
||||
modelMapper.updateById(model);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,26 +2,29 @@ package com.mcwl.resource.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
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.domain.IdsParam;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||
import com.mcwl.resource.domain.request.RequestModel;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.domain.vo.ModelImageVo;
|
||||
import com.mcwl.resource.mapper.MallProductMapper;
|
||||
import com.mcwl.resource.mapper.ModelMapper;
|
||||
|
||||
import com.mcwl.resource.mapper.ModelVersionMapper;
|
||||
import com.mcwl.resource.service.ModelService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -38,13 +41,16 @@ import java.util.Objects;
|
|||
* @Description TODO
|
||||
* @Date:2024/12/30 18:22
|
||||
*/
|
||||
@Log4j2
|
||||
@Service
|
||||
public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,ModelProduct> implements ModelService {
|
||||
public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> implements ModelService {
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private MallProductMapper postMapper;
|
||||
private ModelVersionMapper modelVersionMapper;
|
||||
@Autowired
|
||||
private ModelMapper postMapper;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
|
@ -137,6 +143,41 @@ public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,ModelP
|
|||
return rspData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult addModel(RequestModel requestModel) {
|
||||
//添加模型表数据
|
||||
postMapper.insert(requestModel.getModelProduct());
|
||||
|
||||
log.info("获取到的入参:{}",requestModel.getModelProduct());
|
||||
|
||||
//批量添加版本
|
||||
modelVersionMapper.addModelVersion(requestModel.getModelProduct(),requestModel.getModelVersionList());
|
||||
|
||||
return AjaxResult.success("添加成功,等待审核");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updaModel(RequestModel requestModel) {
|
||||
//修改模版的信息
|
||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||
if (ObjectUtils.isEmpty(modelProduct)){
|
||||
|
||||
}
|
||||
if (StringUtils.isNotNull(modelProduct.getId())){
|
||||
modelProduct.setAuditSatus(3);
|
||||
postMapper.updateModel(requestModel.getModelProduct());
|
||||
}
|
||||
|
||||
//修改工作流版本的信息
|
||||
if (requestModel.getModelVersionList().size() != 0){
|
||||
|
||||
//批量修改
|
||||
for (ModelVersion modelVersion : requestModel.getModelVersionList()) {
|
||||
modelVersion.setAuditSatus(3);
|
||||
modelVersionMapper.updateById(modelVersion);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +1,18 @@
|
|||
package com.mcwl.resource.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.SysUserAttention;
|
||||
import com.mcwl.resource.domain.SysUserInfo;
|
||||
import com.mcwl.resource.mapper.MallProductLikeMapper;
|
||||
import com.mcwl.resource.mapper.MallProductMapper;
|
||||
import com.mcwl.resource.mapper.ModelImageMapper;
|
||||
import com.mcwl.resource.mapper.ModelMapper;
|
||||
import com.mcwl.resource.mapper.SysUserAttentionMapper;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import com.mcwl.resource.service.ModelService;
|
||||
import com.mcwl.resource.service.SysUserAttentionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -26,7 +32,7 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
|
|||
|
||||
|
||||
@Autowired
|
||||
private MallProductMapper mallProductMapper;
|
||||
private ModelMapper modelMapper;
|
||||
|
||||
@Autowired
|
||||
private MallProductLikeMapper mallProductLikeMapper;
|
||||
|
@ -34,14 +40,17 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
|
|||
@Autowired
|
||||
private SysUserAttentionMapper sysUserAttentionMapper;
|
||||
|
||||
@Autowired
|
||||
private ModelImageMapper modelImageMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult addAttention(Long userId) {
|
||||
|
||||
//查看是否已关注
|
||||
Boolean aBoolean = selectAttention(userId);
|
||||
if (aBoolean == true){
|
||||
if (aBoolean == true) {
|
||||
//取关
|
||||
sysUserAttentionMapper.deleteByUserId(SecurityUtils.getUserId(),userId);
|
||||
sysUserAttentionMapper.deleteByUserId(SecurityUtils.getUserId(), userId);
|
||||
return AjaxResult.success(false);
|
||||
}
|
||||
|
||||
|
@ -58,9 +67,9 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
|
|||
@Override
|
||||
public Boolean selectAttention(Long userId) {
|
||||
|
||||
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserId(),userId);
|
||||
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserId(), userId);
|
||||
|
||||
if (sysUserAttention == null){
|
||||
if (sysUserAttention == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -71,9 +80,30 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
|
|||
public SysUserInfo selectUserInfo() {
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return SysUserInfo.builder().bean(sysUserAttentionMapper.selectBean(userId))
|
||||
// .download(mallProductMapper.sumNumber(userId))
|
||||
.likeCount(mallProductLikeMapper.countLike(userId))
|
||||
.attention(sysUserAttentionMapper.selectAttentionCount(userId)).build();
|
||||
// 粉丝数
|
||||
Long userBeanNum = sysUserAttentionMapper.selectBean(userId);
|
||||
|
||||
// 关注数
|
||||
Long userAttentionNum = sysUserAttentionMapper.selectAttentionCount(userId);
|
||||
|
||||
// 模型下载数
|
||||
Long modelDownloadNum = modelMapper.sumNumber(userId);
|
||||
|
||||
// 模型运行次数
|
||||
Long modelRunNum = modelMapper.sumRunNumber(userId);
|
||||
|
||||
// 模型点赞次数
|
||||
Long modelLikeNum = modelMapper.sumLikeNumber(userId);
|
||||
|
||||
// 图片点赞次数
|
||||
Long imageLikeNum = modelImageMapper.sumLikeNumber(userId);
|
||||
|
||||
return SysUserInfo.builder().bean(userBeanNum)
|
||||
.attention(userAttentionNum)
|
||||
.modelDownloadNum(modelDownloadNum)
|
||||
.modelRunNum(modelRunNum)
|
||||
.modelLikeNum(modelLikeNum)
|
||||
.imageLikeNum(imageLikeNum)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mcwl.resource.mapper.MallProductMapper">
|
||||
|
||||
|
||||
|
||||
<select id="sumNumber" resultType="java.lang.Long">
|
||||
SELECT sum(number)sum FROM model where user_id = #{userId} ORDER BY(user_id);
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mcwl.resource.mapper.ModelImageMapper">
|
||||
|
||||
<select id="sumLikeNumber" resultType="java.lang.Long">
|
||||
SELECT sum(like_num)sum FROM model_image where user_id = #{userId} ORDER BY(user_id);
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mcwl.resource.mapper.ModelMapper">
|
||||
<update id="updateModel">
|
||||
update model
|
||||
<set>
|
||||
<if test="modelName != null and modelName != ''">
|
||||
model_name = #{modelName},
|
||||
</if>
|
||||
<if test="versionDescription != null and versionDescription != ''">
|
||||
version_description = #{versionDescription},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="modelTypeId != null">
|
||||
model_type_id = #{modelTypeId},
|
||||
</if>
|
||||
<if test="category != null and category != ''">
|
||||
category = #{category},
|
||||
</if>
|
||||
<if test="functions != null and functions != ''">
|
||||
functions = #{functions},
|
||||
</if>
|
||||
<if test="tags != null and tags != ''">
|
||||
tags = #{tags},
|
||||
</if>
|
||||
<if test="activityId != null and activityId != ''">
|
||||
activity_id = #{activityId},
|
||||
</if>
|
||||
<if test="isOriginal != null">
|
||||
is_original = #{isOriginal},
|
||||
</if>
|
||||
<if test="originalAuthorName != null and originalAuthorName != ''">
|
||||
original_author_name = #{originalAuthorName},
|
||||
</if>
|
||||
<if test="reals != null">
|
||||
reals = #{reals},
|
||||
</if>
|
||||
<if test="numbers != null">
|
||||
numbers = #{numbers},
|
||||
</if>
|
||||
<if test="auditSatus != null">
|
||||
audit_satus = #{auditSatus},
|
||||
</if>
|
||||
<if test="isRecommend != null">
|
||||
is_recommend = #{isRecommend},
|
||||
</if>
|
||||
<if test="delFlag != null and delFlag != ''">
|
||||
del_flag = #{delFlag},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
<if test="auditText != null and auditText != ''">
|
||||
audit_text = #{auditText},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="versionId != null">
|
||||
version_id = #{versionId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="sumNumber" resultType="java.lang.Long">
|
||||
SELECT sum(numbers)sum FROM model where user_id = #{userId} ORDER BY(user_id);
|
||||
</select>
|
||||
|
||||
<select id="sumLikeNumber" resultType="java.lang.Long">
|
||||
SELECT sum(like_num)sum FROM model where user_id = #{userId} ORDER BY(user_id);
|
||||
</select>
|
||||
<select id="sumRunNumber" resultType="java.lang.Long">
|
||||
SELECT sum(reals)sum FROM model where user_id = #{userId} ORDER BY(user_id);
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mcwl.resource.mapper.ModelVersionMapper">
|
||||
|
||||
|
||||
<insert id="addModelVersion">
|
||||
INSERT INTO model_version (
|
||||
version_name, model_type, file_path, trigger_words, sampling, high, vae, cfg,
|
||||
is_free, is_public, is_encrypt, is_online_use, allow_download_image,
|
||||
allow_software_use, allow_fusion, allow_commercial_use, allow_usage,
|
||||
is_exclusive_model, sample_image_paths, hide_image_gen_info, audit_status,
|
||||
audit_text, del_flag
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.versionName}, #{item.modelType}, #{item.filePath}, #{item.triggerWords},
|
||||
#{item.sampling}, #{item.high}, #{item.vae}, #{item.cfg},
|
||||
#{item.isFree}, #{item.isPublic}, #{item.isEncrypt}, #{item.isOnlineUse},
|
||||
#{item.allowDownloadImage}, #{item.allowSoftwareUse}, #{item.allowFusion},
|
||||
#{item.allowCommercialUse}, #{item.allowUsage}, #{item.isExclusiveModel},
|
||||
#{item.sampleImagePaths}, #{item.hideImageGenInfo}, #{item.auditStatus},
|
||||
#{item.auditText}, #{item.delFlag}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue