liujie
2026-01-26 5371db8381f2d36ed6d628e7d9bd0dc96b547441
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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<Page<WorkPresentation>> getStoryList(@RequestBody WorkPresentationQuery query) {
        Page<WorkPresentation> page = new Page<>(query.getPageNum(), query.getPageSize());
 
        LambdaQueryWrapper<WorkPresentation> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(WorkPresentation::getClientId,query.getClientId());
        wrapper.eq(WorkPresentation::getState, 1);
        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<WorkPresentation> accidentBriefPage = workPresentationService.page(page, wrapper);
        return R.ok(accidentBriefPage);
    }
 
 
    @ApiOperation(value = "获取工作展示详情",response = WorkPresentation.class)
    @GetMapping("/getWorkPresentationDetail/{id}")
    public R<WorkPresentation> getStoryDetail(@PathVariable Integer id) {
        WorkPresentation workPresentation = workPresentationService.getById(id);
        return R.ok(workPresentation);
    }
 
 
    @ApiOperation(value = "添加工作展示",response = WorkPresentation.class)
    @PostMapping("/addWorkPresentation")
    public R<WorkPresentation> addWorkPresentation(@RequestBody WorkPresentation workPresentation) {
        workPresentationService.save(workPresentation);
        return R.ok(workPresentation);
    }
 
 
    @ApiOperation(value = "修改工作展示",response = WorkPresentation.class)
    @PostMapping("/updateWorkPresentation")
    public R<WorkPresentation> updateWorkPresentation(@RequestBody WorkPresentation workPresentation) {
        workPresentationService.updateById(workPresentation);
        return R.ok(workPresentation);
    }
 
 
    @ApiOperation(value = "删除工作展示",response = WorkPresentation.class)
    @DeleteMapping("/deleteWorkPresentation/{id}")
    public R<WorkPresentation> deleteWorkPresentation(@PathVariable Integer id ) {
        workPresentationService.removeById(id);
        return R.ok();
    }
 
 
    @ApiOperation(value = "操作工作展示",response = WorkPresentation.class)
    @PostMapping("/operateWorkPresentation")
    public R<WorkPresentation> 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);
    }
 
 
}