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 page = new Page<>(pageReq.getPage(), pageReq.getSize()); Page 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)); } }