首页>代码>基于SSM实现的社区论坛系统(附PPT、设计文档)>/源代码/leek_bbs/src/main/java/com/lindong/controller/AttentionController.java
package com.lindong.controller;

import com.lindong.domain.Post;
import com.lindong.domain.User;
import com.lindong.exception.ApiResult;
import com.lindong.exception.ResultCode;
import com.lindong.service.IAttentionService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("bbs/care")
public class AttentionController {

    @Resource
    private IAttentionService attentionService;

    @RequestMapping("/listCare")
    @ResponseBody
    public Map listCare(@RequestBody Map map){
        int total = attentionService.getCount(map);
        List<User> users = attentionService.paging(map);
        map.put("total",total);
        map.put("data",users);
        return map;
    }

    @RequestMapping(value = "/deleteCare",method = RequestMethod.POST)
    @ResponseBody
    public ApiResult deleteCare(@RequestBody Map map){
        System.out.println(map.get("uid") +"======"+ map.get("aid"));
        attentionService.deleteAttention((Integer)map.get("uid"),(Integer)map.get("aid"));
        return ApiResult.of(ResultCode.SUCCESS);
    }

    @RequestMapping(value = "/listCarePosts",method = RequestMethod.GET)
    @ResponseBody
    public List<Post> listCarePosts(Integer uid){
        return attentionService.getCarePosts(uid);
    }

    @RequestMapping(value = "/selectCare",method = RequestMethod.POST)
    @ResponseBody
    public ApiResult selectCare(@RequestBody Map map){
        attentionService.selectCare(map);
        return ApiResult.of(ResultCode.SUCCESS);
    }

}
最近下载更多
微信网友_7300424007897088  LV2 2024年12月17日
angaochong  LV5 2024年10月15日
2636804923  LV6 2024年6月13日
sweetlove  LV20 2024年6月13日
xiao1111  LV3 2024年5月15日
来一杯西瓜冰咩  LV6 2024年5月13日
JulyMagnolia  LV5 2024年4月29日
getset  LV8 2024年4月21日
微信网友_6444139264921600  LV8 2024年4月13日
xiaozhi丶  LV15 2024年3月28日
最近浏览更多
ma406805131  LV19 2024年12月18日
微信网友_7300424007897088  LV2 2024年12月17日
微信网友_7300409216405504 2024年12月17日
暂无贡献等级
微信网友_7300409508155392 2024年12月17日
暂无贡献等级
bankroll  LV5 2024年12月16日
按市场洒出C  LV1 2024年12月8日
krispeng  LV15 2024年11月14日
yayacui  LV2 2024年10月28日
angaochong  LV5 2024年10月15日
zhangjishao 2024年10月15日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友