package com.ruoyi.web.controller.api; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.R; import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.model.*; import com.ruoyi.system.query.StoryListQuery; import com.ruoyi.system.query.WorkPresentationQuery; import com.ruoyi.system.service.*; import com.ruoyi.system.vo.ScreenUserVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.web.bind.annotation.*; /** * 数据统计面板 前端控制器 * * @author xiaochen * @since 2025-12-23 */ @RestController @RequestMapping("/work-presentation") @Api(tags = "工作展示") @RequiredArgsConstructor(onConstructor_ = @Lazy) public class WorkPresentationController { @Autowired private WorkPresentationService workPresentationService; @Autowired private TokenService tokenService; @ApiOperation(value = "获取工作展示列表",response = WorkPresentation.class) @PostMapping("/getWorkPresentationList") public R> getStoryList(@RequestBody WorkPresentationQuery query) { Page page = new Page<>(query.getPageNum(), query.getPageSize()); LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(WorkPresentation::getClientId,query.getClientId()); if(query.getType()!=null){ wrapper.eq(WorkPresentation::getType, query.getType()); } if(query.getTime()!=null && !query.getTime().isEmpty()){ String sTime = query.getTime().split(" - ")[0]+" 00:00:00"; String eTime = query.getTime().split(" - ")[1]+" 23:59:59"; wrapper.between(WorkPresentation::getCreateTime,sTime,eTime); } if(query.getContent()!=null && !query.getContent().isEmpty()){ wrapper.like(WorkPresentation::getTitle, query.getContent()); } wrapper.orderByDesc(WorkPresentation::getCreateTime); Page accidentBriefPage = workPresentationService.page(page, wrapper); return R.ok(accidentBriefPage); } @ApiOperation(value = "获取工作展示详情",response = WorkPresentation.class) @GetMapping("/getWorkPresentationDetail/{id}") public R getStoryDetail(@PathVariable Integer id) { WorkPresentation workPresentation = workPresentationService.getById(id); return R.ok(workPresentation); } @ApiOperation(value = "添加工作展示",response = WorkPresentation.class) @PostMapping("/addWorkPresentation") public R addWorkPresentation(@RequestBody WorkPresentation workPresentation) { workPresentationService.save(workPresentation); return R.ok(workPresentation); } @ApiOperation(value = "修改工作展示",response = WorkPresentation.class) @PostMapping("/updateWorkPresentation") public R updateWorkPresentation(@RequestBody WorkPresentation workPresentation) { workPresentationService.updateById(workPresentation); return R.ok(workPresentation); } @ApiOperation(value = "删除工作展示",response = WorkPresentation.class) @DeleteMapping("/deleteWorkPresentation/{id}") public R deleteWorkPresentation(@PathVariable Integer id ) { workPresentationService.removeById(id); return R.ok(); } @ApiOperation(value = "操作工作展示",response = WorkPresentation.class) @PostMapping("/operateWorkPresentation") public R operateWorkPresentation(@RequestParam Integer id) { WorkPresentation workPresentation = workPresentationService.getById(id); if(workPresentation.getState()==1){ workPresentation.setState(2); }else{ workPresentation.setState(1); } workPresentationService.updateById(workPresentation); return R.ok(workPresentation); } }