前端
/** 发起新增或修改的请求 */
requestAddOrEdit(formData) {
debugger
if(formData.id === undefined) {
formData.id = ''
}
getAction('/material/getNameModelStandard', {
standard: this.model.standard,
name: this.model.name,
model: this.model.model
}).then((res) => {
if (res && res.code === 200) {
console.log(res.data.rows.id,"ididiididiidd");
formData.id = res.data.rows.id
}
});
后端
/** ycw
* 查询商品名字 规格型号 存在修改 不存在 新增
* @param name
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getNameModelStandard")
@ApiOperation(value = "单据明细列表")
public BaseResponseInfo getNameModelStandard(@RequestParam("name") String name,@RequestParam("standard") String standard,
@RequestParam("model") String model,
HttpServletRequest request) throws Exception {
JSONObject outer = new JSONObject();
BaseResponseInfo res = new BaseResponseInfo();
try {
Material material1 = new Material();
if (name != null && !name.isEmpty()) {
material1.setName(name);
}
if (standard != null && !standard.isEmpty()) {
material1.setStandard(standard);
}
if (model != null && !model.isEmpty()) {
material1.setModel(model);
}
List<Material> dataList = materialMapper.getNameModelStandard(material1);
if (dataList != null && dataList.size() > 0) {
material1.setId(dataList.get(0).getId());
res.code = 200;
outer.put("rows", material1);
res.data = outer;
}else {
res.code = 500;
res.data = "获取数据失败";
}
} catch (Exception e) {
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
文章来源地址https://www.toymoban.com/news/detail-652596.html
文章来源:https://www.toymoban.com/news/detail-652596.html
到了这里,关于后端 springboot 给 vue 提供参数的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!