ActivityController.java 3.3 KB
package com.example.client.controller;

import cn.bronet.admin.common.core.domain.AjaxResult;

import com.example.client.domain.bo.CActivityBo;
import com.example.client.service.ActivityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IDEA
 * author: MaDongXu
 * Date:2021/9/10
 * Time:10:12
 * */
@Slf4j
@Validated
@Api(tags = "我的活动,视频,作品,风采,文章")
@RestController
@RequestMapping("/tree/activity")
public class ActivityController {

	@Autowired
	private ActivityService activityService;

	@ApiImplicitParam(name = "type",value = "动态的类型",dataType = "Integer",required = true,paramType = "query")
	@ApiOperation("发布动态的初始化页面")
	@GetMapping("/sendActivity")
	public AjaxResult sendActivity(Integer type){

		return activityService.sendActivity(type);
	}

	@ApiOperation("存储用户发布动态")
	@PostMapping("/saveActivity")
	public AjaxResult saveActivity(@RequestBody CActivityBo bo){

		log.info("CActivityBo::"+bo.toString());

		return activityService.saveActivity(bo);
	}

	@ApiImplicitParam(name="activityId", value="动态ID",dataType="Long",required = true,paramType = "query")
	@ApiOperation("删除用户发布的动态和动态下的所有评论")
	@DeleteMapping("/deleteActivity")
	public AjaxResult deleteActivity(Long activityId){

		log.info("<<<<<<<activityId::"+activityId);

		return activityService.deleteActivity(activityId);
	}

	@ApiImplicitParams({
		@ApiImplicitParam(name = "type",value = "动态类型",dataType = "Integer",required = true,paramType = "query"),
		@ApiImplicitParam(name = "userId",value = "用户ID",dataType = "Long",required = false,paramType = "query")})
	@ApiOperation("查询用户的动态")
	@PostMapping("/selectActivities")
	public AjaxResult selectActivity(Integer type,Long userId){

		log.info("<<<<<<<type::"+type+",userId::"+userId);

		return activityService.selectActivities(type,userId);
	}


	@ApiImplicitParams({
		@ApiImplicitParam(name = "typeId",value = "动态的种类",required = true,dataType = "Intefer",paramType = "query")
	})
	@ApiOperation("首页的动态查询")
	@PostMapping("/selectAllActivities")
	public AjaxResult selectAllActivity(Integer typeId){

		log.info("<<<<<<typeId::"+typeId);

		return activityService.selectAllActivities(typeId);
	}

	@ApiOperation("查看单条动态")
	@PostMapping("/selectActivity")
	public AjaxResult selectActivity(Long activityId){

		log.info("<<<接收的参数<<<::"+activityId);

		return activityService.selectActivity(activityId);
	}

	@ApiOperation("查询学校")
	@PostMapping("/getSchools")
	public AjaxResult getSchools(){

		return activityService.getSchool();
	}

	@ApiOperation("动态的种类")
	@PostMapping("/getActivityType")
	public AjaxResult getActivityType(){

		return activityService.getActivityType();
	}

	@ApiOperation("模糊查询动态")
	@PostMapping("/searchActivities")
	public AjaxResult searchActivities(String title){

		log.info("<<<接收到的信息<<<::"+title);

		return activityService.searchActivities(title);

	}
}