优化请求格式

This commit is contained in:
liuchengqian 2022-03-11 16:30:05 +08:00
parent e78392efdc
commit 9f33ffdd1f
4 changed files with 8 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@ -20,8 +21,8 @@ public class QcSourceController {
* 添加检验数据
*/
@PostMapping("/insertQcSource")
public String insertQcSource(QcSourceQoInsert insertQo) {
return qcSourceService.insertQcSource(insertQo);
public String insertQcSource(QcSourceQoInsert insertQo, @RequestParam(required = false, value = "picture") MultipartFile picture) {
return qcSourceService.insertQcSource(insertQo, picture);
}
/**

View File

@ -2,13 +2,14 @@ package com.xkrs.newpro.service;
import com.xkrs.newpro.model.qo.QcSourceQoDelete;
import com.xkrs.newpro.model.qo.QcSourceQoInsert;
import org.springframework.web.multipart.MultipartFile;
public interface QcSourceService {
/**
* 添加检验数据
*/
String insertQcSource(QcSourceQoInsert insertQo);
String insertQcSource(QcSourceQoInsert insertQo, MultipartFile picture);
/**
* 删除检验数据

View File

@ -10,6 +10,7 @@ import com.xkrs.newpro.utils.LocalDateUtils;
import com.xkrs.newpro.utils.LocalStringUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;
@ -31,7 +32,7 @@ public class QcSourceServiceImpl implements QcSourceService {
* 添加检验数据
*/
@Override
public String insertQcSource(QcSourceQoInsert insertQo) {
public String insertQcSource(QcSourceQoInsert insertQo, MultipartFile picture) {
String batchNo = insertQo.getBatchNo();
String machineNo = insertQo.getMachineNo();

View File

@ -51,7 +51,7 @@ public class QcSpecServiceImpl implements QcSpecService {
Optional<QcItemEntity> entityByNo = qcItemDao.findByNo(qcItemNo);
if (entityByNo.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验规格,请先添加检验规格", locale);
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目", locale);
}
Optional<QcSpecEntity> entityByVarietyNoAndQcItemNo = qcSpecDao.findByVarietyNoAndQcItemNo(varietyNo, qcItemNo);