ThemeController.java 2.99 KB
package com.tanpu.community.controller;


import com.tanpu.community.api.beans.ThemeDTO;
import com.tanpu.community.controller.convert.ThemeConvert;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.manager.ThemeManager;
import com.tanpu.community.service.FansRelService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping(value = "/api/theme")
public class ThemeController {

    @Autowired
    private ThemeManager themeManager;

    @Autowired
    private FansRelService fansRelService;

    @ApiOperation("新增主题")
    @RequestMapping(value = "/add")
    @ResponseBody
    public String insertTheme(@RequestBody ThemeDTO themeDTO){
        String userId="liujm";
        themeDTO.setAuthorId(userId);
        themeManager.insert(ThemeConvert.convertToEntity(themeDTO));
        return "success";
    }

    @ApiOperation("系统推荐主题列表")
    @RequestMapping(value = "/add")
    @ResponseBody
    public List<ThemeEntity> selectHotList(){
        return null;
    }

    @ApiOperation("用户关注主题列表")
    @RequestMapping(value = "/add")
    @ResponseBody
    public List<ThemeEntity> selectInterestList(){
        String userId="liujm012";
        return null;
    }

    @ApiOperation("评论")
    @RequestMapping(value = "/comment")
    @ResponseBody
    public String commetOnTheme(String themeId,String commet){
        String user="liujm";
        themeManager.comment(themeId,user,commet);
        return "success";
    }

    @ApiOperation("转发主题")
    @RequestMapping(value = "/forward")
    @ResponseBody
    public String forwardTheme(String themeId){
        return "success";
    }


    @ApiOperation("点赞主题")
    @RequestMapping(value = "/like")
    @ResponseBody
    public String likeOnTheme(String themeId){
        String user="liujm";
        themeManager.like(themeId,user);
        return "success";
    }

    @ApiOperation("分享主题")
    @RequestMapping(value = "/share")
    @ResponseBody
    public String shareTheme(String themeId){
        return "success";
    }

    @ApiOperation("收藏主题")
    @RequestMapping(value = "/book")
    @ResponseBody
    public String bookTheme(String themeId){
        String user="liujm";
        themeManager.book(themeId,user);
        return "success";
    }

    @ApiOperation("举报主题")
    @RequestMapping(value = "/complaint")
    @ResponseBody
    public String complaintTheme(String themeId){
        return "success";
    }

    @ApiOperation("屏蔽")
    @RequestMapping(value = "/conceal")
    @ResponseBody
    public String concealTheme(String themeId){
        return "success";
    }
}