12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package cn.cslg.pas.controller;
- import cn.cslg.pas.common.core.base.Constants;
- import cn.cslg.pas.common.model.dto.EventAddNewDTO;
- import cn.cslg.pas.common.model.dto.EventQueryPageDTO;
- import cn.cslg.pas.common.utils.Response;
- import cn.cslg.pas.exception.XiaoShiException;
- import cn.cslg.pas.service.IEventService;
- import io.swagger.v3.oas.annotations.Operation;
- import io.swagger.v3.oas.annotations.tags.Tag;
- import lombok.RequiredArgsConstructor;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * 事件的Controller层
- *
- * @Author chenyu
- * @Date 2023/4/2
- */
- @Tag(name = "事件的管理模块")
- @RequiredArgsConstructor
- @Slf4j
- @RequestMapping(Constants.API_VERSION_V2 + "/event")
- @RestController
- public class EventController {
- private final IEventService eventService;
- @Operation(summary = "新增事件")
- @PostMapping("/addNew")
- public String addNew(@RequestBody EventAddNewDTO eventAddNewDTO) {
- log.info("开始处理【新增事件】的请求,请求参数为:{}", eventAddNewDTO);
- try {
- eventService.addNew(eventAddNewDTO);
- } catch (XiaoShiException e) {
- return Response.error(e.getMessage());
- }
- return Response.success("新增事件完成");
- }
- @Operation(summary = "查询事件")
- @PostMapping("/query")
- public String query(@RequestBody EventQueryPageDTO eventQueryPageDTO) {
- log.info("开始处理【分页查询事件】的业务,参数为:{}", eventQueryPageDTO);
- return eventService.query(eventQueryPageDTO);
- }
- }
|