123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- package com.chelvc.cloud.maintain.controller;
- import com.chelvc.cloud.vehicle.client.AttentionClient;
- import com.chelvc.cloud.vehicle.client.dto.AttentionTotalDTO;
- import com.chelvc.cloud.vehicle.client.dto.AttentionUserDTO;
- import com.chelvc.cloud.vehicle.client.param.QueryAttentionParam;
- import com.chelvc.framework.base.context.SessionContextHolder;
- import com.chelvc.framework.common.model.Pagination;
- import com.chelvc.framework.common.model.Paging;
- import com.chelvc.framework.security.annotation.Authorize;
- import lombok.RequiredArgsConstructor;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * 用户关注
- *
- * @PACKAGE_NAME: net.yeeu.collision.user.client.controller
- * @NAME: AttentionController
- * @USER: igl
- * @DATE: 2023/8/14 9:55
- */
- @Authorize
- @Validated
- @RestController
- @RequestMapping("/client/attention")
- @RequiredArgsConstructor(onConstructor = @__(@Autowired))
- public class AttentionController {
- private final AttentionClient attentionClient;
- /**
- * 关注/取关用户
- *
- * @param targetUserId 目标用户标识
- * @author igl
- * @date 2023/2/25 19:42
- * @apiNote 如果已关注,则会取消关注
- */
- @PostMapping("/concern")
- public void concern(@RequestParam("targetUserId") Long targetUserId) {
- attentionClient.concern(SessionContextHolder.getId(), targetUserId);
- }
- /**
- * 分页查看关注、粉丝、好友
- *
- * @param page
- * @param param
- * @author igl
- * @date 2023/8/14 12:42
- */
- @GetMapping("/list")
- public Pagination<AttentionUserDTO> page(Paging page, @Validated QueryAttentionParam param) {
- return attentionClient.page(page, param, SessionContextHolder.getId());
- }
- /**
- * 查看关注、粉丝、好友总数
- *
- * @author igl
- * @date 2023/8/15 19:42
- */
- @GetMapping("/total")
- public AttentionTotalDTO queryTotalByUserId() {
- return attentionClient.queryTotalByUserId(SessionContextHolder.getId());
- }
- }
|