feat(mall): 添加我的社区收藏功能
- 新增 myCollect接口用于获取用户收藏的社区内容
- 实现 ApiClothesSocialService 接口的 myCollect 方法
- 添加 ApiSocialMyCollectAddDto 和 ApiSocialMyCollectVo 类用于处理我的收藏相关数据- 在 ClothesSocialFollowMapper 中添加 selectPageInMyComment 方法用于查询用户收藏的社区内容
- 在 ClothesSocialFollowMapper.xml 中添加对应的 SQL 查询语句
5 files modified
2 files added
| | |
| | | return apiClothesSocialService.addCollect(dto); |
| | | } |
| | | |
| | | @ApiOperation(value = "我的社区收藏", notes = "我的社区收藏") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = ApiSocialMyCollectVo.class) |
| | | }) |
| | | @PostMapping(value = "/myCollect") |
| | | public FebsResponse myCollect(@RequestBody @Validated ApiSocialMyCollectAddDto dto) { |
| | | |
| | | return apiClothesSocialService.myCollect(dto); |
| | | } |
| | | |
| | | @ApiOperation(value = "我的灵感-跳转到开始设计", notes = "我的灵感-跳转到开始设计") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = ApiClothesSocialMuseVo.class) |
New file |
| | |
| | | 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 = "ApiSocialMyCollectAddDto", description = "参数") |
| | | public class ApiSocialMyCollectAddDto { |
| | | |
| | | @NotNull(message = "页码不能为空") |
| | | @ApiModelProperty(value = "页码", example = "1") |
| | | private Integer pageNow; |
| | | |
| | | @NotNull(message = "每页数量不能为空") |
| | | @ApiModelProperty(value = "每页数量", example = "10") |
| | | private Integer pageSize; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long memberId; |
| | | |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.dto.clothes.ApiSocialMyCollectAddDto; |
| | | import cc.mrbird.febs.mall.entity.ClothesSocialFollow; |
| | | import cc.mrbird.febs.mall.vo.clothes.ApiSocialMyCollectVo; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface ClothesSocialFollowMapper extends BaseMapper<ClothesSocialFollow> { |
| | | |
| | | Page<ApiSocialMyCollectVo> selectPageInMyComment(Page<ApiSocialMyCollectVo> page, @Param("record")ApiSocialMyCollectAddDto dto); |
| | | |
| | | } |
| | |
| | | |
| | | FebsResponse addCollect(ApiSocialCollectAddDto dto); |
| | | |
| | | FebsResponse myCollect(ApiSocialMyCollectAddDto dto); |
| | | |
| | | FebsResponse museToDesign(ApiClothesSocialMuseDto dto); |
| | | |
| | | FebsResponse comment(ApiClothesSocialCommentDto dto); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse myCollect(ApiSocialMyCollectAddDto dto) { |
| | | |
| | | Long memberId = LoginUserUtil.getLoginUser().getId(); |
| | | dto.setMemberId(memberId); |
| | | |
| | | // 创建分页对象,传入当前页和每页大小 |
| | | Page<ApiSocialMyCollectVo> page = new Page<>(dto.getPageNow(), dto.getPageSize()); |
| | | // 调用Mapper方法获取活动分页数据 |
| | | Page<ApiSocialMyCollectVo> voPage = clothesSocialFollowMapper.selectPageInMyComment(page, dto); |
| | | return new FebsResponse().success().data(voPage); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse museToDesign(ApiClothesSocialMuseDto dto) { |
| | | |
| | | Long memberId = LoginUserUtil.getLoginUser().getId(); |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo.clothes; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | @ApiModel(value = "ApiSocialMyCollectVo", description = "参数") |
| | | public class ApiSocialMyCollectVo { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "用户") |
| | | private String memberName; |
| | | |
| | | @ApiModelProperty(value = "头像") |
| | | private String memberAvatar; |
| | | |
| | | @ApiModelProperty(value = "标题") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "封面") |
| | | private String indexFile; |
| | | |
| | | } |
| | |
| | | <!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.ClothesSocialFollowMapper"> |
| | | |
| | | <select id="selectPageInMyComment" resultType="cc.mrbird.febs.mall.vo.clothes.ApiSocialMyCollectVo"> |
| | | select |
| | | c.id as id, |
| | | b.name as memberName, |
| | | b.avatar as memberAvatar, |
| | | c.name as name, |
| | | c.index_file as indexFile |
| | | from clothes_social_follow a |
| | | left join mall_member b on a.member_id = b.id |
| | | left join clothes_social c on a.source_id = c.id |
| | | where a.source_type = 1 |
| | | and a.type = 2 |
| | | and a.member_id = #{record.memberId} |
| | | group by c.id |
| | | order by a.created_time desc |
| | | </select> |
| | | |
| | | |
| | | </mapper> |