后端 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;
    }
相关推荐
她说..17 分钟前
幂等问题分析
java·jvm·spring boot·spring·spring cloud·intellij-idea
冰美式只要糖4 小时前
同一个 Seed,为什么插入另一条请求会改变采样结果?
后端
Xmi5 小时前
LLM 多步任务总是漏步骤?一次 Prompt Chaining 改造的完整记录
后端
sean_wang125 小时前
Rust 轻量级虚拟机 smolvm 实战:200ms 冷启动、OCI 镜像直跑、单文件打包
开发语言·后端·rust·大鲸华章
badhope5 小时前
3 个 Agent 并行发文章:我用 SQLite 任务表止住重复
后端·python·ai编程
Gopher_HBo5 小时前
手写 cobra 命令树与 Find
后端
Xmi5 小时前
Windows容器部署EKS:从 Dockerfile 到 CloudFront 的一次打通
后端
青山木5 小时前
JVM 类加载全解:Class 文件结构、加载链接初始化与双亲委派
java·jvm·后端·类加载·双亲委派机制
考虑考虑7 小时前
EMQX认证回调
运维·后端·自动化运维
hryou09228 小时前
10分钟看懂嵌入模型选型:6个维度+1张存储账单
人工智能·后端·机器学习