后端 springboot 给 vue 提供参数

前端

c 复制代码
      /** 发起新增或修改的请求 */
      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
          }
        });

后端

c 复制代码
    /** 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;
    }
相关推荐
GetcharZp4 小时前
GitHub 49K+ Star!C++ 开发者必知的 JSON 神级库:从零到精通全指北
后端
xujinwei_gingko4 小时前
SpringBoot整合WebSocket
spring boot·后端·websocket
智码看视界5 小时前
现代Web开发基础:全栈工程师的起航点
前端·后端·c5全栈
程序员cxuan5 小时前
Claude Fable 5 来了
人工智能·后端·程序员
JS菌5 小时前
手写一个 AI Agent 全栈项目:从沙箱执行到子智能体的完整实现
前端·人工智能·后端
wang09075 小时前
自己动手写一个spring之IOC_2
java·后端·spring
来杯@Java5 小时前
学生选课管理系统(基于springboot+vue前后端分离的项目)计算机毕业设计java
java·spring boot·spring·vue·毕业设计·maven·mybatis
ltl6 小时前
推理退化:为什么大模型会输出乱码、死循环和无意义文本
后端
ltl6 小时前
架构视图与文档:C4 模型从入门到实战
后端
invicinble6 小时前
easyexcel开发全域理解
spring boot