manailin
2022-09-11 58e0679060b7421f30df7996b39b99f2d236854d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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));
    }
 
 
 
}