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.model.dtos.community.sanshuo.ComSanshuoEventDTO;
|
import com.panzhihua.common.model.vos.R;
|
import com.panzhihua.service_community.entity.ComSanshuoEvent;
|
import com.panzhihua.service_community.service.ComSanShuoEventService;
|
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 {
|
|
@Resource
|
private ComSanShuoEventService comSanShuoEventService;
|
|
/**
|
* 后台事件类型管理
|
* */
|
@PostMapping("/backStageList")
|
public R backList(@RequestBody ComSanshuoEventDTO comSanshuoEventDTO){
|
return R.ok(comSanShuoEventService.backStageList(comSanshuoEventDTO));
|
}
|
|
/**
|
* 小程序获取可用事件类型
|
* */
|
@GetMapping("/appletsList")
|
public R<List<ComSanshuoEvent>> appList(){
|
return R.ok(comSanShuoEventService.list(new QueryWrapper<ComSanshuoEvent>().eq("status",1).eq("del_flag",1)));
|
}
|
|
/**
|
* 添加或修改事件类型
|
* */
|
@PostMapping
|
public R add(@RequestBody ComSanshuoEventDTO comSanshuoEventDTO){
|
ComSanshuoEvent event=new ComSanshuoEvent();
|
BeanUtil.copyProperties(comSanshuoEventDTO,event);
|
return R.ok(comSanShuoEventService.addOrUpdate(event));
|
}
|
|
/**
|
* 删除事件类型
|
* */
|
@DeleteMapping("remove/{id}")
|
public R remove(@PathVariable("id") Integer id){
|
ComSanshuoEvent comSanshuoEvent = comSanShuoEventService.getById(id);
|
comSanshuoEvent.setDelFlag(0);
|
comSanshuoEvent.setUpdateTime(new Date());
|
return R.ok(comSanShuoEventService.updateById(comSanshuoEvent));
|
}
|
|
|
|
}
|