From c3921e625320712466cad5d018669c8dc2ac76f9 Mon Sep 17 00:00:00 2001 From: manailin <261030956@qq.com> Date: 星期日, 25 九月 2022 00:38:33 +0800 Subject: [PATCH] [修改] 三说代码事件流程代码提交 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoEventApi.java | 68 +++++++++++++++++++++------------- 1 files changed, 42 insertions(+), 26 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoEventApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoEventApi.java index 45a7c04..076ec73 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoEventApi.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComSanShuoEventApi.java @@ -3,10 +3,15 @@ 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.*; @@ -20,48 +25,59 @@ * */ @RestController @RequestMapping("/sanshuo/event") -public class ComSanShuoEventApi { +public class ComSanShuoEventApi extends BaseController { + +// @Resource +// private ComSanShuoEventService comSanShuoEventService; @Resource - private ComSanShuoEventService comSanShuoEventService; + private CommediateTypeService commediateTypeService; - /** - * 后台事件类型管理 - * */ - @PostMapping("/backStageList") - public R backList(@RequestBody ComSanshuoEventDTO comSanshuoEventDTO){ - return R.ok(comSanShuoEventService.backStageList(comSanshuoEventDTO)); + @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<List<ComSanshuoEvent>> appList(){ - return R.ok(comSanShuoEventService.list(new QueryWrapper<ComSanshuoEvent>().eq("status",1).eq("del_flag",1))); + public R appletList(){ + return R.ok(commediateTypeService.list(new QueryWrapper<ComMediateType>().eq("enabled",1))); } /** - * 添加或修改事件类型 + * 新增事件类型 * */ @PostMapping - public R add(@RequestBody ComSanshuoEventDTO comSanshuoEventDTO){ - ComSanshuoEvent event=new ComSanshuoEvent(); - BeanUtil.copyProperties(comSanshuoEventDTO,event); - return R.ok(comSanShuoEventService.addOrUpdate(event)); + public R add(@RequestBody ComMediateTypeDTO comMediateTypeDTO){ + comMediateTypeDTO.setCreateUser(this.getLoginUserInfo().getUserId()); + return commediateTypeService.addOrUpdate(comMediateTypeDTO); } /** - * 删除事件类型 + * 修改事件类型 * */ - @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)); + @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)); + } } -- Gitblit v1.7.1