新增删除方法

This commit is contained in:
weitang 2025-06-06 18:29:35 +08:00
parent cb340a99fc
commit 9a6cff1514

View File

@ -10,14 +10,12 @@ import com.yfd.platform.modules.algorithm.service.IAlgorithmArrangeService;
import com.yfd.platform.utils.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
@ -49,9 +47,10 @@ public class AlgorithmArrangeController {
Page<AlgorithmArrange> arrangePage = algorithmArrangeService.page(page, queryWrapper);
return ResponseResult.successData(arrangePage);
}
@GetMapping("/getAlgorithmArrangeById")
@ApiOperation("根据Id查询算法布点")
public ResponseResult getAlgorithmArrangeById (String id){
public ResponseResult getAlgorithmArrangeById(String id) {
AlgorithmArrange algorithmArrange = algorithmArrangeService.getById(id);
return ResponseResult.successData(algorithmArrange);
}
@ -94,7 +93,8 @@ public class AlgorithmArrangeController {
public ResponseResult updateAlgorithmArrange(AlgorithmArrange algorithmArrange, MultipartFile file) {
// 判断是否存在相同的方案
LambdaQueryWrapper<AlgorithmArrange> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ne(AlgorithmArrange::getId, algorithmArrange.getId()).eq(AlgorithmArrange::getArrangeName, algorithmArrange.getArrangeName());
queryWrapper.ne(AlgorithmArrange::getId, algorithmArrange.getId()).eq(AlgorithmArrange::getArrangeName,
algorithmArrange.getArrangeName());
if (algorithmArrangeService.getOne(queryWrapper) != null) {
return ResponseResult.error("方案名称已存在");
}
@ -118,12 +118,33 @@ public class AlgorithmArrangeController {
return ResponseResult.success();
}
@PostMapping("/deleteAlgorithmArrange")
@ApiOperation("删除布点数据")
public ResponseResult deleteAlgorithmArrange(String id) {
boolean b = algorithmArrangeService.removeById(id);
if (b) {
return ResponseResult.success();
} else {
return ResponseResult.error();
}
}
@PostMapping("/deleteAlgorithmArrange")
@ApiOperation("删除布点数据")
public ResponseResult deleteAlgorithmArrange(@RequestBody List<String> ids) {
boolean b = algorithmArrangeService.removeByIds(ids);
if (b) {
return ResponseResult.success();
} else {
return ResponseResult.error();
}
}
@PostMapping("/callAlgorithmArrange")
@ApiOperation("调用算法布点API")
public ResponseResult callAlgorithmArrange(String id) {
AlgorithmArrange algorithmArrange=algorithmArrangeService.callAlgorithmArrange(id);
AlgorithmArrange algorithmArrange = algorithmArrangeService.callAlgorithmArrange(id);
return ResponseResult.successData(algorithmArrange);
}
}