liujie
2026-01-26 753097b2693fec43c8bbbd766b8c1b32d73d7e43
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
package com.estate.expert.admin.controller.admin;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.estate.expert.admin.domain.business.accidentbrief.AccidentBrief;
import com.estate.expert.admin.domain.business.projectprogress.ProjectProgress;
import com.estate.expert.admin.domain.common.request.PageReq;
import com.estate.expert.admin.service.AccidentBriefService;
import com.estate.expert.admin.service.ProjectProgressService;
import com.estate.expert.common.rpc.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
@Slf4j
@CrossOrigin
@Api(tags = "管理后台/项目进度")
@RequestMapping("/admin/project-progress")
@RestController
@Validated
public class ProjectProgressController {
 
    @Resource
    private ProjectProgressService projectProgressService;
 
    @ApiOperation(value = "列表")
    @PostMapping("/list")
    public Result list(@ApiParam(value = "项目名称") @RequestParam(value = "name", required = false) String name,
                       @ApiParam(value = "委托方id") @RequestParam(value = "clientId", required = false) Integer clientId,
                       @ApiParam(value = "时间xxxx - xxxx") @RequestParam(value = "time", required = false) String time,
                       @Validated @RequestBody PageReq pageReq) {
        Page<ProjectProgress> page = new Page<>(pageReq.getPage(), pageReq.getSize());
        Page<ProjectProgress> res = projectProgressService.pageList(page, name, clientId, time);
        return Result.success(res);
    }
 
 
    @ApiOperation(value = "详情")
    @GetMapping("/detail/{id}")
    public Result detail(@PathVariable Integer id) {
        ProjectProgress projectProgress = projectProgressService.detail(id);
        return Result.success(projectProgress);
    }
 
 
    @ApiOperation(value = "新增")
    @PostMapping("/add")
    public Result add(@Validated @RequestBody ProjectProgress projectProgress) {
        return Result.success(projectProgressService.save(projectProgress));
    }
 
 
    @ApiOperation(value = "编辑")
    @PostMapping("/edit")
    public Result edit(@Validated @RequestBody ProjectProgress projectProgress) {
        ProjectProgress res = projectProgressService.getById(projectProgress.getId());
        if (res == null) {
            return Result.error("项目进度不存在");
        }
        BeanUtils.copyProperties(projectProgress, res);
        return Result.success(projectProgressService.updateById(res));
    }
 
 
    @ApiOperation(value = "删除")
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Integer id) {
        ProjectProgress res = projectProgressService.getById(id);
        if (res == null) {
            return Result.error("项目进度不存在");
        }
        res.setDeleted(1);
        return Result.success(projectProgressService.updateById(res));
    }
 
 
 
 
}