后端 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;
    }
相关推荐
白仑色2 小时前
Spring Cloud Gateway 实战指南
spring boot·微服务·路由转发·限流熔断
FreeBuf_7 小时前
黄金旋律IAB组织利用暴露的ASP.NET机器密钥实施未授权访问
网络·后端·asp.net
前端小趴菜057 小时前
React - createPortal
前端·vue.js·react.js
张小洛8 小时前
Spring AOP 是如何生效的(入口源码级解析)?
java·后端·spring
追风少年浪子彦9 小时前
mapstruct与lombok冲突原因及解决方案
java·spring boot·spring·spring cloud
军军君019 小时前
基于Springboot+UniApp+Ai实现模拟面试小工具四:后端项目基础框架搭建下
spring boot·spring·面试·elementui·typescript·uni-app·mybatis
why技术9 小时前
也是出息了,业务代码里面也用上算法了。
java·后端·算法
三原10 小时前
7000块帮朋友做了2个小程序加一个后台管理系统,值不值?
前端·vue.js·微信小程序
白仑色10 小时前
完整 Spring Boot + Vue 登录系统
vue.js·spring boot·后端
MZ_ZXD00111 小时前
flask校园学科竞赛管理系统-计算机毕业设计源码12876
java·spring boot·python·spring·django·flask·php