|
@ -1,5 +1,6 @@ |
|
|
package com.iflytop.handacid.app.controller; |
|
|
package com.iflytop.handacid.app.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.iflytop.handacid.app.model.dto.FormulationListDTO; |
|
|
import com.iflytop.handacid.app.model.dto.FormulationListDTO; |
|
|
import com.iflytop.handacid.app.model.vo.FormulationListVO; |
|
|
import com.iflytop.handacid.app.model.vo.FormulationListVO; |
|
|
import com.iflytop.handacid.common.base.BasePageQuery; |
|
|
import com.iflytop.handacid.common.base.BasePageQuery; |
|
@ -51,8 +52,14 @@ public class FormulationController { |
|
|
@PostMapping |
|
|
@PostMapping |
|
|
@Operation(summary = "创建配方") |
|
|
@Operation(summary = "创建配方") |
|
|
public Result<String> create(@RequestBody Formulation formulation) { |
|
|
public Result<String> create(@RequestBody Formulation formulation) { |
|
|
boolean flag = formulationService.save(formulation); |
|
|
|
|
|
return flag ? Result.success() : Result.failed(); |
|
|
|
|
|
|
|
|
Formulation existFormulation = formulationService.getOne(new LambdaQueryWrapper<Formulation>().eq(Formulation::getSolutionId, formulation.getSolutionId()) |
|
|
|
|
|
.eq(Formulation::getConcentration, formulation.getConcentration()).eq(Formulation::getVolume, formulation.getVolume()).last("limit 1")); |
|
|
|
|
|
if (existFormulation != null) { |
|
|
|
|
|
existFormulation.setRevolutions(formulation.getRevolutions()); |
|
|
|
|
|
return formulationService.updateById(existFormulation) ? Result.success() : Result.failed(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return formulationService.save(formulation) ? Result.success() : Result.failed(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@PutMapping |
|
|
@PutMapping |
|
|