TASK:aida;

This commit is contained in:
shahaibo
2024-06-25 10:59:58 +08:00
parent ba4388b87d
commit 9b589eece6
12 changed files with 70 additions and 10 deletions

View File

@@ -35,4 +35,6 @@ public interface PortfolioService extends IService<Portfolio> {
Boolean viewsIncrease(Long id);
Long viewsGet(Long id);
Boolean commentDelete(CommentDTO commentDTO);
}

View File

@@ -40,7 +40,7 @@ public interface WorkspaceService extends IService<Workspace> {
WorkspaceVO getByIdNew(Long id);
List<ModelsVO> getMannequins(String sex);
List<ModelsVO> getMannequins(String sex, String style);
void systemFileCopy();

View File

@@ -15,6 +15,7 @@ import com.ai.da.model.enums.Sex;
import com.ai.da.model.vo.*;
import com.ai.da.service.*;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -635,6 +636,29 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
return redisUtil.getViewCount(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean commentDelete(CommentDTO commentDTO) {
Long id = commentDTO.getId();
Portfolio portfolio = portfolioMapper.selectById(commentDTO.getPortfolioId());
Comment comment = commentMapper.selectById(id);
if (!Objects.equals(comment.getAccountId(), commentDTO.getAccountId()) || !Objects.equals(portfolio.getAccountId(), commentDTO.getAccountId())) {
throw new BusinessException("You do not have the permission to delete this comment");
}
// 删除主评论
commentMapper.deleteById(id);
// 删除子评论
LambdaQueryWrapper<Comment> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(Comment::getParentLevel1Id, id)
.or()
.eq(Comment::getParentLevel2Id, id);
commentMapper.delete(lambdaQueryWrapper);
return Boolean.TRUE;
}
private List<CommentVO> getChildCommentVOList(Long id) {
QueryWrapper<Comment> qw = new QueryWrapper<>();
qw.lambda().eq(Comment::getParentLevel1Id, id);

View File

@@ -310,7 +310,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
Long styleId = workspaceRelStyles.get(0).getStyleId();
Style style = styleMapper.selectById(styleId);
StyleEnum styleEnum = StyleEnum.fromName(style.getName());
vo.setStyle(styleEnum.name());
Map<String, List<String>> allKeywordsByStyle = StyleKeywordMapper.getAllKeywordsByStyle(styleEnum);
vo.setAllKeywordsByStyle(allKeywordsByStyle);
if (authPrincipalVo.getLanguage().equals(Language.ENGLISH.name())) {
@@ -323,7 +323,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
}
@Override
public List<ModelsVO> getMannequins(String sex) {
public List<ModelsVO> getMannequins(String sex, String style) {
AuthPrincipalVo userInfo = UserContext.getUserHolder();
List<ModelsVO> result = new ArrayList<>();
QueryWrapper<Library> libraryQueryWrapper = new QueryWrapper<>();
@@ -350,6 +350,11 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
// sysFileQueryWrapper.lambda().eq(SysFile::getLevel2Type, SysFileLevel2TypeEnum.BODY.getRealName());
sysFileQueryWrapper.lambda().eq(SysFile::getLevel1Type, "Models");
sysFileQueryWrapper.lambda().eq(SysFile::getLevel2Type, sex);
if (!StringUtils.isEmpty(style)) {
sysFileQueryWrapper.lambda().eq(SysFile::getLevel3Type, style);
}else {
sysFileQueryWrapper.lambda().isNull(SysFile::getLevel3Type);
}
List<SysFile> sysFileList = sysFileMapper.selectList(sysFileQueryWrapper);
if (!CollectionUtils.isEmpty(sysFileList)) {
List<ModelVO> modelVOList = new ArrayList<>();