Administrator
2025-07-10 a2c4af86b65f9c0b339bfcb37b1cc00b33f48b9e
feat(clothes): 添加社区评论功能

- 新增评论相关数据结构和接口
- 实现评论列表展示和评论状态切换
- 添加评论功能前端页面和交互逻辑
17 files modified
5 files added
556 ■■■■■ changed files
src/main/java/cc/mrbird/febs/common/utils/AppContants.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/clothes/AdminClothesTypeController.java 40 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesSocialController.java 19 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiAllCommentDto.java 28 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesSocialCommentDto.java 25 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/ClothesSocial.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialComment.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialCommentMapper.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/ApiClothesSocialService.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/ClothesTypeService.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java 109 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java 46 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesSocialCommentVo.java 29 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesSocialListVo.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiAllCommentVo.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiAllSocialVo.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiSocialInfoVo.java 12 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/ClothesSocialCommentMapper.xml 39 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/ClothesSocialMapper.xml 1 ●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/clothesType/socialComment.html 86 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/clothesType/socialList.html 30 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/common/utils/AppContants.java
@@ -7,6 +7,8 @@
    /**
     * 系统用户
     */
    public static final String SOCIAL_COMMENT = "SOCIAL_COMMENT";
    public static final String SYSTEM_USER = "system";
    
    public static final String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCzIfAF0gZs9zn9ENRtz6ocHa8MGljmMmCsjLsRvTIAilBMypMJz/VNooAOhd8GTdsWm8FNGVhRauv7RfxorFJ4Um2UbweUQBIZP2pzZMnclHxhUmYZsn/6IaPzijiUNfEjygtE7ezvso/67ecZJwqfrtlbEjqUbRgo17Qj23suwQIDAQAB";
src/main/java/cc/mrbird/febs/mall/controller/clothes/AdminClothesTypeController.java
@@ -6,10 +6,13 @@
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.common.enumerates.OrderDeliveryStateEnum;
import cc.mrbird.febs.common.enumerates.OrderStatusEnum;
import cc.mrbird.febs.common.utils.AppContants;
import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.common.utils.excl.ExcelSheetPO;
import cc.mrbird.febs.common.utils.excl.ExcelUtil;
import cc.mrbird.febs.common.utils.excl.ExcelVersion;
import cc.mrbird.febs.common.utils.excl.ResponseHeadUtil;
import cc.mrbird.febs.mall.controller.order.ViewMallOrderController;
import cc.mrbird.febs.mall.dto.AdminHappyActivityCategoryDto;
import cc.mrbird.febs.mall.dto.DeliverGoodsDto;
import cc.mrbird.febs.mall.dto.activity.AdminCategoryAddDto;
@@ -49,6 +52,7 @@
public class AdminClothesTypeController extends BaseController {
    private final ClothesTypeService clothesTypeService;
    private final RedisUtils redisUtils;
    /**
     * 分类列表
@@ -121,6 +125,20 @@
            }
        }
        Map<String, Object> data = getDataTable(clothesTypeService.getSocialListInPage(dto, request));
        return new FebsResponse().success().data(data);
    }
    /**
     * 社区列表-评论列表
     */
    @GetMapping("socialComment")
    public FebsResponse socialComment(ClothesSocialComment dto, QueryRequest request, Integer parentId) {
        String existToken = redisUtils.getString(AppContants.SOCIAL_COMMENT);
        long socialId = Long.parseLong(existToken);
        dto.setSocialId(socialId);
        Map<String, Object> data = getDataTable(clothesTypeService.socialComment(dto,request));
        return new FebsResponse().success().data(data);
    }
@@ -239,6 +257,28 @@
    }
    /**
     * 社区-开启评论
     */
    @GetMapping("commentStateSwitch/{id}/{state}")
    @ControllerEndpoint(operation = "社区-开启评论", exceptionMessage = "操作失败")
    public FebsResponse commentStateSwitch(@NotNull(message = "{required}") @PathVariable Long id,
                                    @NotNull(message = "{required}") @PathVariable Integer state) {
        return clothesTypeService.commentStateSwitch(id,state);
    }
    /**
     * 社区-评论-是否展示
     */
    @GetMapping("showStateSwitch/{id}/{state}")
    @ControllerEndpoint(operation = "社区-评论-是否展示", exceptionMessage = "操作失败")
    public FebsResponse showStateSwitch(@NotNull(message = "{required}") @PathVariable Long id,
                                    @NotNull(message = "{required}") @PathVariable Integer state) {
        return clothesTypeService.showStateSwitch(id,state);
    }
    /**
     * 社区-推荐首页
     */
    @GetMapping("socialHotState/{id}/{state}")
src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesSocialController.java
@@ -104,5 +104,24 @@
    }
    @ApiOperation(value = "评论", notes = "评论")
    @PostMapping(value = "/comment")
    public FebsResponse comment(@RequestBody @Validated ApiClothesSocialCommentDto dto) {
        return apiClothesSocialService.comment(dto);
    }
    @ApiOperation(value = "评论列表", notes = "评论列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = ApiAllCommentVo.class)
    })
    @PostMapping(value = "/allComment")
    public FebsResponse allComment(@RequestBody @Validated ApiAllCommentDto dto) {
        return apiClothesSocialService.allComment(dto);
    }
}
src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java
@@ -3,7 +3,9 @@
import cc.mrbird.febs.common.controller.BaseController;
import cc.mrbird.febs.common.entity.FebsConstant;
import cc.mrbird.febs.common.enumerates.SocialPatternLocationTypeEnum;
import cc.mrbird.febs.common.utils.AppContants;
import cc.mrbird.febs.common.utils.FebsUtil;
import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.mall.entity.*;
import cc.mrbird.febs.mall.mapper.*;
import cc.mrbird.febs.mall.service.ClothesTypeService;
@@ -59,6 +61,7 @@
    private final MallExpressInfoMapper mallExpressInfoMapper;
    private final ClothesPatternRemarkMapper clothesPatternRemarkMapper;
    private final ClothesLocationRemarkMapper clothesLocationRemarkMapper;
    private final RedisUtils redisUtils;
    /**
     * 社区分类列表
@@ -106,6 +109,27 @@
        return FebsUtil.view("modules/clothesType/socialList");
    }
    /**
     * 社区列表-查看评论
     * @return
     */
    @GetMapping("/socialComment/{id}")
    @RequiresPermissions("socialComment:view")
    public String socialComment(@PathVariable Long id, Model model) {
        String existToken = redisUtils.getString(AppContants.SOCIAL_COMMENT);
        if (StrUtil.isNotBlank(existToken)) {
            Object o = redisUtils.get(existToken);
            if (ObjectUtil.isNotEmpty(o)) {
                redisUtils.del(existToken);
            }
        }
        redisUtils.set(AppContants.SOCIAL_COMMENT, id, -1);
        return FebsUtil.view("modules/clothesType/socialComment");
    }
    /**
     * 社区-新增
     */
@@ -115,6 +139,8 @@
        return FebsUtil.view("modules/clothesType/socialAdd");
    }
    /**
     * 社区-修改
     */
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiAllCommentDto.java
New file
@@ -0,0 +1,28 @@
package cc.mrbird.febs.mall.dto.clothes;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel(value = "ApiAllCommentDto", description = "参数")
public class ApiAllCommentDto {
    @NotNull(message = "页码不能为空")
    @ApiModelProperty(value = "页码", example = "1")
    private Integer pageNow;
    @NotNull(message = "每页数量不能为空")
    @ApiModelProperty(value = "每页数量", example = "10")
    private Integer pageSize;
    @NotNull(message = "社区不能为空")
    @ApiModelProperty(value = "社区ID")
    private Long socialId;
    @ApiModelProperty(value = "评论ID,有值则代表查询子评论")
    private Long parentId;
}
src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiClothesSocialCommentDto.java
New file
@@ -0,0 +1,25 @@
package cc.mrbird.febs.mall.dto.clothes;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel(value = "ApiClothesSocialCommentDto", description = "参数")
public class ApiClothesSocialCommentDto {
    @NotNull(message = "社区不能为空")
    @ApiModelProperty(value = "社区ID")
    private Long socialId;
    @NotNull(message = "评论不能为空")
    @ApiModelProperty(value = "父级评论ID,没有就传0")
    private Long commentId;
    @NotNull(message = "内容不能为空")
    @ApiModelProperty(value = "内容")
    private String comment;
}
src/main/java/cc/mrbird/febs/mall/entity/ClothesSocial.java
@@ -20,6 +20,7 @@
     `del_flag` int(11) DEFAULT '0' COMMENT '删除标识 0-未删除 1-已删除',
     `state` int(11) DEFAULT '0' COMMENT '状态 0-不展示 1-展示',
     `order_cnt` int(11) DEFAULT '0' COMMENT '排序',
     `comment_state` int(11) DEFAULT '0' COMMENT '是否允许评论 0-不允许 1-允许',
     */
    private Long memberId;
    private String name;
@@ -30,6 +31,7 @@
    private Integer state;
    private Integer hotState;
    private Integer orderCnt;
    private Integer commentState;
    @TableField(exist = false)
    private String thumbs;
@@ -40,4 +42,5 @@
    @TableField(exist = false)
    private List<String> images;
}
src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialComment.java
@@ -11,6 +11,7 @@
     *
     `member_id` bigint(20) DEFAULT NULL,
     `social_id` bigint(20) DEFAULT NULL COMMENT '来源ID',
     `comment_id` bigint(20) DEFAULT NULL,
     `parent_id` bigint(20) DEFAULT NULL COMMENT '来源选项ID',
     `comment` text COMMENT '评论',
     `show_state` int(11) DEFAULT '0' COMMENT '展示状态 1:显示 0:隐藏',
@@ -18,6 +19,7 @@
    private Long memberId;
    private Long socialId;
    private Long commentId;
    private Long parentId;
    private String comment;
    private Integer showState;
src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialCommentMapper.java
@@ -1,7 +1,17 @@
package cc.mrbird.febs.mall.mapper;
import cc.mrbird.febs.mall.dto.clothes.ApiAllCommentDto;
import cc.mrbird.febs.mall.entity.ClothesSocialComment;
import cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialCommentVo;
import cc.mrbird.febs.mall.vo.clothes.ApiAllCommentVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
public interface ClothesSocialCommentMapper  extends BaseMapper<ClothesSocialComment> {
    Page<ApiAllCommentVo> selectPageInComment(Page<ApiAllCommentVo> page,  @Param("record")ApiAllCommentDto dto);
    IPage<AdminClothesSocialCommentVo> selectSocialCommentListInPage(Page<AdminClothesSocialCommentVo> page, @Param("record")ClothesSocialComment dto);
}
src/main/java/cc/mrbird/febs/mall/service/ApiClothesSocialService.java
@@ -23,4 +23,8 @@
    FebsResponse addCollect(ApiSocialCollectAddDto dto);
    FebsResponse museToDesign(ApiClothesSocialMuseDto dto);
    FebsResponse comment(ApiClothesSocialCommentDto dto);
    FebsResponse allComment(ApiAllCommentDto dto);
}
src/main/java/cc/mrbird/febs/mall/service/ClothesTypeService.java
@@ -8,6 +8,7 @@
import cc.mrbird.febs.mall.dto.clothes.*;
import cc.mrbird.febs.mall.entity.*;
import cc.mrbird.febs.mall.vo.clothes.AdminClothesOrderListVo;
import cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialCommentVo;
import cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialListVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -83,8 +84,14 @@
    IPage<AdminClothesSocialListVo> getSocialListInPage(AdminClothesSocialListDto dto, QueryRequest request);
    IPage<AdminClothesSocialCommentVo> socialComment(ClothesSocialComment dto, QueryRequest request);
    FebsResponse socialState(Long id, Integer state);
    FebsResponse commentStateSwitch(Long id, Integer state);
    FebsResponse showStateSwitch(Long id, Integer state);
    FebsResponse socialHotState(Long id, Integer state);
    FebsResponse socialDelete(Long id);
src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java
@@ -27,9 +27,7 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@@ -62,6 +60,7 @@
    private final ClothesTypeArtMapper clothesTypeArtMapper;
    private final ClothesLocationRemarkMapper clothesLocationRemarkMapper;
    private final ClothesPatternRemarkMapper clothesPatternRemarkMapper;
    private final ClothesSocialCommentMapper clothesSocialCommentMapper;
    @Override
@@ -114,8 +113,36 @@
        // 调用Mapper方法获取活动分页数据
        Page<ApiAllSocialVo> voPage = clothesSocialMapper.selectPageInSocial(page, dto);
        List<ApiAllSocialVo> vos = voPage.getRecords();
        if (CollUtil.isNotEmpty(vos)) {
            Set<Long> socialIds = vos.stream()
                    .map(ApiAllSocialVo::getId)
                    .filter(Objects::nonNull)
                    .collect(Collectors.toSet());
            if (CollUtil.isNotEmpty(socialIds)) {
                List<ClothesSocialFollow> clothesSocialFollows = clothesSocialFollowMapper.selectList(
                        Wrappers.lambdaQuery(ClothesSocialFollow.class)
                                .select(ClothesSocialFollow::getId, ClothesSocialFollow::getSourceId)
                                .in(ClothesSocialFollow::getSourceId, socialIds)
                                .eq(ClothesSocialFollow::getType, SocialTypeEnum.LIKE.getValue())
                );
                Map<Long, Long> likeCountBySocialIdMap = new HashMap<>();
                if (CollUtil.isNotEmpty(clothesSocialFollows)) {
                    likeCountBySocialIdMap = clothesSocialFollows.stream()
                            .collect(Collectors.groupingBy(ClothesSocialFollow::getSourceId, Collectors.counting()));
                }
                for (ApiAllSocialVo item : vos){
                    item.setLikeCnt(likeCountBySocialIdMap.getOrDefault(item.getId(), 0L).intValue());
                }
            }
        }
        return new FebsResponse().success().data(voPage);
    }
    @Override
    public FebsResponse socialInfo(ApiSocialInfoDto dto) {
@@ -130,6 +157,7 @@
            apiSocialInfoVo.setName(clothesSocial.getName());
            apiSocialInfoVo.setContent(clothesSocial.getContent());
            apiSocialInfoVo.setCreatedTime(clothesSocial.getCreatedTime());
            apiSocialInfoVo.setCommentState(clothesSocial.getCommentState());
            List<ClothesSocialFile> clothesSocialFiles = clothesSocialFileMapper.selectList(
                    Wrappers.lambdaQuery(ClothesSocialFile.class)
@@ -211,6 +239,29 @@
                    apiSocialMuseVo.setLocationRemarkList(locationRemarkList);
                }
                apiSocialMuseVo.setTotalAmount(totalAmount.setScale(2, RoundingMode.DOWN));
                List<ClothesSocialFollow> clothesSocialFollows = clothesSocialFollowMapper.selectList(
                        Wrappers.lambdaQuery(ClothesSocialFollow.class)
                                .select(ClothesSocialFollow::getType)
                                .eq(ClothesSocialFollow::getSourceId, socialId)
                );
                if (CollUtil.isNotEmpty(clothesSocialFollows)){
                    Map<Integer, Long> collect = clothesSocialFollows.stream()
                            .collect(Collectors.groupingBy(ClothesSocialFollow::getType, Collectors.counting()));
                    apiSocialInfoVo.setLikeCnt(collect.getOrDefault(SocialTypeEnum.LIKE.getValue(), 0L).intValue());
                    apiSocialInfoVo.setCollectCnt(collect.getOrDefault(SocialTypeEnum.COLLECT.getValue(), 0L).intValue());
                }
                List<ClothesSocialComment> clothesSocialComments = clothesSocialCommentMapper.selectList(
                        Wrappers.lambdaQuery(ClothesSocialComment.class)
                                .eq(ClothesSocialComment::getSocialId, socialId)
                                .eq(ClothesSocialComment::getShowState, ClothesEnum.UP.getCode())
                                .isNull(ClothesSocialComment::getParentId)
                );
                if (CollUtil.isNotEmpty(clothesSocialComments)){
                    apiSocialInfoVo.setCommentCnt(clothesSocialComments.size());
                }
            }
        }
@@ -496,6 +547,58 @@
        return new FebsResponse().success().data(record);
    }
    @Override
    public FebsResponse comment(ApiClothesSocialCommentDto dto) {
        Long memberId = LoginUserUtil.getLoginUser().getId();
        Long socialId = dto.getSocialId();
        Long commentId = dto.getCommentId();
        ClothesSocial clothesSocial = clothesSocialMapper.selectById(socialId);
        if (ObjectUtil.isNull(clothesSocial)){
            return new FebsResponse().fail().message("社区不存在");
        }
        if (ClothesEnum.DOWN.getCode() == clothesSocial.getCommentState()){
            return new FebsResponse().fail().message("禁止评论");
        }
        ClothesSocialComment entity = new ClothesSocialComment();
        entity.setMemberId(memberId);
        entity.setSocialId(socialId);
        entity.setComment(dto.getComment());
        ClothesSocialComment clothesSocialComment = clothesSocialCommentMapper.selectById(commentId);
        if(ObjectUtil.isNotNull(clothesSocialComment)){
            entity.setParentId(clothesSocialComment.getParentId());
            entity.setCommentId(clothesSocialComment.getId());
        }
        clothesSocialCommentMapper.insert(entity);
        return new FebsResponse().success().message("操作成功");
    }
    @Override
    public FebsResponse allComment(ApiAllCommentDto dto) {
        // 创建分页对象,传入当前页和每页大小
        Page<ApiAllCommentVo> page = new Page<>(dto.getPageNow(), dto.getPageSize());
        // 调用Mapper方法获取活动分页数据
        Page<ApiAllCommentVo> voPage = clothesSocialCommentMapper.selectPageInComment(page, dto);
        List<ApiAllCommentVo> records = voPage.getRecords();
        if (CollUtil.isNotEmpty(records)){
            Set<Long> collect = records.stream().map(ApiAllCommentVo::getCommentId).collect(Collectors.toSet());
            List<ClothesSocialComment> clothesSocialComments = clothesSocialCommentMapper.selectList(
                    Wrappers.lambdaQuery(ClothesSocialComment.class)
                            .select(ClothesSocialComment::getParentId)
                            .in(ClothesSocialComment::getParentId, collect)
            );
            if (CollUtil.isNotEmpty(clothesSocialComments)){
                Map<Long, Long> collect1 = clothesSocialComments.stream()
                        .collect(Collectors.groupingBy(ClothesSocialComment::getParentId, Collectors.counting()));
                for (ApiAllCommentVo vo : records){
                    vo.setCommentCnt(collect1.getOrDefault(vo.getCommentId(), 0L).intValue());
                }
            }
        }
        return new FebsResponse().success().data(voPage);
    }
    public static void main(String[] args) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.putByPath("text", "123");
src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java
@@ -16,10 +16,7 @@
import cc.mrbird.febs.mall.service.IApiMallMemberWalletService;
import cc.mrbird.febs.mall.service.IMallMoneyFlowService;
import cc.mrbird.febs.mall.vo.AdminMallOrderInfoVo;
import cc.mrbird.febs.mall.vo.clothes.AdminClothesLocationRemarkVo;
import cc.mrbird.febs.mall.vo.clothes.AdminClothesOrderListVo;
import cc.mrbird.febs.mall.vo.clothes.AdminClothesPatternRemarkVo;
import cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialListVo;
import cc.mrbird.febs.mall.vo.clothes.*;
import cc.mrbird.febs.pay.util.WeixinServiceUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
@@ -74,6 +71,7 @@
    private final ClothesPatternRemarkMapper clothesPatternRemarkMapper;
    private final ClothesLocationRemarkMapper clothesLocationRemarkMapper;
    private final ClothesSocialCommentMapper clothesSocialCommentMapper;
    private final IApiMallMemberWalletService memberWalletService;
    private final IMallMoneyFlowService mallMoneyFlowService;
@@ -752,6 +750,13 @@
    }
    @Override
    public IPage<AdminClothesSocialCommentVo> socialComment(ClothesSocialComment dto, QueryRequest request) {
        Page<AdminClothesSocialCommentVo> page = new Page<>(request.getPageNum(), request.getPageSize());
        IPage<AdminClothesSocialCommentVo> vos = clothesSocialCommentMapper.selectSocialCommentListInPage(page, dto);
        return vos;
    }
    @Override
    public FebsResponse socialState(Long id, Integer state) {
        ClothesSocial clothesSocial = clothesSocialMapper.selectById(id);
@@ -768,6 +773,39 @@
    }
    @Override
    public FebsResponse commentStateSwitch(Long id, Integer state) {
        ClothesSocial clothesSocial = clothesSocialMapper.selectById(id);
        if(ObjectUtil.isNull(clothesSocial)){
            throw new RuntimeException("内容不存在");
        }
        clothesSocialMapper.update(
                null,
                Wrappers.lambdaUpdate(ClothesSocial.class)
                        .set(ClothesSocial::getCommentState, state)
                        .eq(ClothesSocial::getId, id)
        );
        return new FebsResponse().success().message("操作成功");
    }
    @Override
    public FebsResponse showStateSwitch(Long id, Integer state) {
        ClothesSocialComment clothesSocialComment = clothesSocialCommentMapper.selectById(id);
        if(ObjectUtil.isNull(clothesSocialComment)){
            throw new RuntimeException("评论不存在");
        }
        clothesSocialCommentMapper.update(
                null,
                Wrappers.lambdaUpdate(ClothesSocialComment.class)
                        .set(ClothesSocialComment::getShowState, state)
                        .eq(ClothesSocialComment::getId, id)
        );
        return new FebsResponse().success().message("操作成功");
    }
    @Override
    public FebsResponse socialHotState(Long id, Integer state) {
        ClothesSocial clothesSocial = clothesSocialMapper.selectById(id);
src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesSocialCommentVo.java
New file
@@ -0,0 +1,29 @@
package cc.mrbird.febs.mall.vo.clothes;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class AdminClothesSocialCommentVo {
    @ApiModelProperty(value = "评论ID")
    private Long commentId;
    @ApiModelProperty(value = "昵称")
    private String memberName;
    @ApiModelProperty(value = "展示状态 1:显示 0:隐藏")
    private Integer showState;
    @ApiModelProperty(value = "内容")
    private String comment;
    @ApiModelProperty(value = "时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;
}
src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesSocialListVo.java
@@ -8,6 +8,8 @@
    private String name;
    private String socialTitle;
    private Integer socialState;
    private Integer commentState;
    private Integer hotState;
    private Integer delFlag;
}
src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiAllCommentVo.java
New file
@@ -0,0 +1,34 @@
package cc.mrbird.febs.mall.vo.clothes;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel(value = "ApiAllCommentVo", description = "参数")
public class ApiAllCommentVo {
    @ApiModelProperty(value = "评论ID")
    private Long commentId;
    @ApiModelProperty(value = "昵称")
    private String memberName;
    @ApiModelProperty(value = "头像")
    private String memberAvatar;
    @ApiModelProperty(value = "内容")
    private String comment;
    @ApiModelProperty(value = "时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;
    @ApiModelProperty(value = "评论数量")
    private Integer commentCnt = 0;
}
src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiAllSocialVo.java
@@ -18,5 +18,7 @@
    private String name;
    @ApiModelProperty(value = "封面")
    private String indexFile;
    @ApiModelProperty(value = "点赞数量")
    private Integer likeCnt;
}
src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiSocialInfoVo.java
@@ -33,4 +33,16 @@
    @ApiModelProperty(value = "我的灵感")
    private ApiSocialMuseVo muse;
    @ApiModelProperty(value = "点赞数量")
    private Integer likeCnt = 0;
    @ApiModelProperty(value = "收藏数量")
    private Integer collectCnt = 0;
    @ApiModelProperty(value = "评论数量")
    private Integer commentCnt = 0;
    @ApiModelProperty(value = "是否允许评论 0-禁止 1-允许")
    private Integer commentState;
}
src/main/resources/mapper/modules/ClothesSocialCommentMapper.xml
@@ -2,5 +2,44 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.mrbird.febs.mall.mapper.ClothesSocialCommentMapper">
    <select id="selectPageInComment" resultType="cc.mrbird.febs.mall.vo.clothes.ApiAllCommentVo">
        select
        b.name as memberName,
        b.avatar as memberAvatar,
        a.id as commentId,
        a.comment as comment,
        a.created_time as createdTime
        from clothes_social_comment a
        left join mall_member b on a.member_id = b.id
        left join clothes_social c on a.social_id = b.id
        <where>
            and a.show_state = 1
            and a.social_id = #{record.socialId}
            <if test="record != null">
                <if test="record.parentId != null">
                    and a.parent_id = #{record.parentId}
                </if>
                <if test="record.parentId == null">
                    and a.parent_id is null
                </if>
            </if>
        </where>
        order bya.created_time asc
    </select>
    <select id="selectSocialCommentListInPage" resultType="cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialCommentVo">
        select
        b.name as memberName,
        a.id as commentId,
        a.show_state as showState,
        a.comment as comment,
        a.created_time as createdTime
        from clothes_social_comment a
        left join mall_member b on a.member_id = b.id
        left join clothes_social c on a.social_id = b.id
        <where>
            and a.social_id = #{record.socialId}
        </where>
        order by a.created_time asc
    </select>
</mapper>
src/main/resources/mapper/modules/ClothesSocialMapper.xml
@@ -9,6 +9,7 @@
        a.name as socialTitle,
        a.del_flag as delFlag,
        a.hot_state as hotState,
        a.comment_state as commentState,
        a.state as socialState
        from clothes_social a
        left join mall_member b on a.member_id = b.id
src/main/resources/templates/febs/views/modules/clothesType/socialComment.html
New file
@@ -0,0 +1,86 @@
<div class="layui-fluid layui-anim febs-anim" id="febs-comment-child" lay-title="评论">
    <div class="layui-row febs-container">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body febs-table-full">
                    <form class="layui-form layui-table-form" lay-filter="comment-table-form">
                        <div class="layui-row">
                            <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query">
                                    <i class="layui-icon">&#xe848;</i>
                                </div>
                            </div>
                        </div>
                    </form>
                    <table lay-filter="commentChild" lay-data="{id: 'commentChild'}"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="showStateSwitch">
    {{# if(d.showState === 1) { }}
    <input type="checkbox" value={{d.commentId}} lay-text="显示|隐藏" checked lay-skin="switch" lay-filter="showStateSwitch">
    {{# } else { }}
    <input type="checkbox" value={{d.commentId}} lay-text="显示|隐藏" lay-skin="switch" lay-filter="showStateSwitch">
    {{# } }}
</script>
<script data-th-inline="none" type="text/javascript">
    layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs', 'treeSelect' ,'eleTree'], function () {
        var $ = layui.jquery,
            laydate = layui.laydate,
            febs = layui.febs,
            form = layui.form,
            table = layui.table,
            treeSelect = layui.treeSelect,
            dropdown = layui.dropdown,
            $view = $('#febs-comment-child'),
            $query = $view.find('#query'),
            sortObject = {field: 'createTime', type: null},
            tableIns,
            createTimeFrom,
            createTimeTo;
        form.render();
        // 查询按钮
        $query.on('click', function () {
            tableIns.reload({where: null, page: {curr: 1}});
        });
        form.on('switch(showStateSwitch)', function (data) {
            console.log(data.value);
            if (data.elem.checked) {
                showStateSwitch(data.value,1);
            } else {
                showStateSwitch(data.value,0);
            }
        })
        function showStateSwitch(id,state) {
            febs.get(ctx + 'admin/clothesType/showStateSwitch/' + id+'/' + state, null, function (data) {
                febs.alert.success(data.message);
                $query.click();
            });
        }
        initCommentTable();
        function initCommentTable() {
            tableIns = febs.table.init({
                elem: $view.find('table'),
                id: 'commentChild',
                url: ctx + 'admin/clothesType/socialComment?parentId=1',
                cols: [[
                    {field: 'commentId', title: '评论ID', minWidth: 80,align:'center'},
                    {field: 'showState', title: '是否显示', templet: '#showStateSwitch', minWidth: 130,align:'center'},
                    {field: 'memberName', title: '昵称', minWidth: 150,align:'center'},
                    {field: 'comment', title: '内容', minWidth: 150,align:'left'},
                    {field: 'createdTime', title: '时间', minWidth: 150,align:'left'},
                ]]
            });
        }
    })
</script>
src/main/resources/templates/febs/views/modules/clothesType/socialList.html
@@ -57,6 +57,13 @@
    <a lay-event="edit" shiro:hasPermission="votesActivityUpdate:update"><i
            class="layui-icon febs-edit-area febs-blue">&#xe7a5;</i></a>
</script>
<script type="text/html" id="commentStateSwitch">
    {{# if(d.commentState === 1) { }}
    <input type="checkbox" value={{d.id}} lay-text="允许|禁止" checked lay-skin="switch" lay-filter="commentStateSwitch">
    {{# } else { }}
    <input type="checkbox" value={{d.id}} lay-text="允许|禁止" lay-skin="switch" lay-filter="commentStateSwitch">
    {{# } }}
</script>
<script type="text/html" id="scStateSwitch">
    {{# if(d.socialState === 1) { }}
    <input type="checkbox" value={{d.id}} lay-text="展示|隐藏" checked lay-skin="switch" lay-filter="scStateSwitch">
@@ -91,6 +98,7 @@
<script type="text/html" id="activityOption">
    <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="scUpdateEvent">编辑</button>
    <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="museEvent">设计灵感</button>
    <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="commentEvent">查看评论</button>
    <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" lay-event="scDeleteEvent">删除</button>
</script>
@@ -154,6 +162,11 @@
                    }
                });
            }
            if (layEvent === 'commentEvent') {
                febs.modal.open('评论','modules/clothesType/socialComment/' + data.id, {
                    area:['100%','100%'],
                });
            }
            if (layEvent === 'museEvent') {
                febs.modal.open('编辑','modules/clothesType/socialMuseUpdate/' + data.id, {
                    btn: ['提交', '取消'],
@@ -195,6 +208,20 @@
                $query.click();
            });
        }
        form.on('switch(commentStateSwitch)', function (data) {
            if (data.elem.checked) {
                commentStateSwitch(data.value,1);
            } else {
                commentStateSwitch(data.value,0);
            }
        })
        function commentStateSwitch(id,state) {
            febs.get(ctx + 'admin/clothesType/commentStateSwitch/' + id+'/' + state, null, function (data) {
                febs.alert.success(data.message);
                $query.click();
            });
        }
        function delAct(id) {
            febs.get(ctx + 'admin/clothesType/socialDelete/' + id, null, function (data) {
                febs.alert.success(data.message);
@@ -230,9 +257,10 @@
                defaultToolbar:[],
                cols: [[
                    {type: 'numbers', title: '', width: 80},
                    {title: '操作', toolbar: '#activityOption', minWidth: 200, align: 'center'},
                    {title: '操作', toolbar: '#activityOption', minWidth: 400, align: 'center'},
                    {field: 'name', title: '发布人', minWidth: 150,align:'left'},
                    {field: 'socialTitle', title: '标题', minWidth: 150,align:'left'},
                    {field: 'commentState', title: '允许评论', templet: '#commentStateSwitch', minWidth: 130,align:'center'},
                    {field: 'socialState', title: '状态', templet: '#scStateSwitch', minWidth: 130,align:'center'},
                    {field: 'hotState', title: '显示首页', templet: '#scHotStateSwitch', minWidth: 130,align:'center'},
                    {templet:"#socialDelFlagFormat",  title: '是否删除', minWidth: 140,align:'left'},