package com.panzhihua.service_community.api;
|
|
import cn.hutool.core.bean.BeanUtil;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.panzhihua.common.controller.BaseController;
|
import com.panzhihua.common.model.dtos.community.sanshuo.ComMediateTypeDTO;
|
import com.panzhihua.common.model.dtos.community.sanshuo.ComSanshuoEventDTO;
|
import com.panzhihua.common.model.dtos.community.sanshuo.IndexDateDTO;
|
import com.panzhihua.common.model.vos.R;
|
import com.panzhihua.service_community.entity.ComMediateType;
|
import com.panzhihua.service_community.entity.ComSanshuoEvent;
|
import com.panzhihua.service_community.service.ComSanShuoEventService;
|
import com.panzhihua.service_community.service.CommediateTypeService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import java.util.Date;
|
import java.util.List;
|
|
/**
|
* 三说会堂事件类型管理控制器
|
* */
|
@RestController
|
@RequestMapping("/sanshuo/event")
|
public class ComSanShuoEventApi extends BaseController {
|
|
// @Resource
|
// private ComSanShuoEventService comSanShuoEventService;
|
|
@Resource
|
private CommediateTypeService commediateTypeService;
|
|
@GetMapping ("/list")
|
public R list(@RequestParam(value = "keyWord",required = false)String keyWord,
|
@RequestParam(value = "page",required = false)Integer page,
|
@RequestParam(value = "size",required = false)Integer size){
|
return commediateTypeService.listEvent(keyWord,page,size);
|
}
|
|
@GetMapping("/detail")
|
public R detail(@RequestParam("id")Long id){
|
return R.ok(commediateTypeService.getById(id));
|
}
|
|
@GetMapping("/appletsList")
|
public R appletList(){
|
return R.ok(commediateTypeService.list(new QueryWrapper<ComMediateType>().eq("enabled",1)));
|
}
|
|
/**
|
* 新增事件类型
|
* */
|
@PostMapping
|
public R add(@RequestBody ComMediateTypeDTO comMediateTypeDTO){
|
comMediateTypeDTO.setCreateUser(this.getLoginUserInfo().getUserId());
|
return commediateTypeService.addOrUpdate(comMediateTypeDTO);
|
}
|
|
/**
|
* 修改事件类型
|
* */
|
@PutMapping
|
public R update(@RequestBody ComMediateTypeDTO comMediateTypeDTO){
|
comMediateTypeDTO.setModifyUser(this.getLoginUserInfo().getUserId());
|
return commediateTypeService.addOrUpdate(comMediateTypeDTO);
|
}
|
|
/**
|
* 删除事件
|
* */
|
@DeleteMapping("/remove")
|
public R remove(@RequestParam("id")Long id){
|
ComMediateType comMediateType = commediateTypeService.getById(id);
|
comMediateType.setDeleteFlag(true);
|
comMediateType.setEnabled(false);
|
comMediateType.setModifyUser(this.getLoginUserInfo().getUserId());
|
return R.ok(commediateTypeService.updateById(comMediateType));
|
}
|
|
/**
|
* 大屏接口-事件统计
|
* */
|
@PostMapping("/indexDate")
|
public R indexDate(@RequestBody IndexDateDTO indexDateDTO){
|
return commediateTypeService.indexDate(indexDateDTO);
|
}
|
}
|