VUE uses the form input box of el-ui to search in batches <VUE Column 3>

For the batch query of the single number of the input box of the form form, the newline character is used to split here, and the v-model should not use .trim

 Front-end code:

<el-form-item label="SKU code:" prop="prodNumbers"> 
           <el-input type="textarea" :rows="4" placeholder="Please enter SKU code" v-model="addData.prodNumbers "></el-input> 
  </el-form-item>

Backend code:

        /**
         * sku支持批量查询,换行符分隔
         */
        queryDTO.setProdNumbers(StringUtils.trim(queryDTO.getProdNumbers()));
        if (StringUtils.isNotBlank( queryDTO.getProdNumbers())) {
            String[] prodNumberArr = StringUtils.split(queryDTO.getProdNumbers(), "\n");
            queryDTO.setProdNumberList(new ArrayList<String>());
            for (String prodNumber : prodNumberArr) {
                if (StringUtils.isNotBlank(prodNumber)) {
                    queryDTO.getProdNumberList().add(StringUtils.trim(prodNumber));
                }
            }
        }

mapper.xml

  <if test="prodNumberList != null and prodNumberList.size() != 0">
                AND erp_prod_in.prod_number IN
                <foreach collection="prodNumberList" index="index" open="(" close=")" separator=",">
                    #{prodNumberList[${index}]}
                </foreach>
            </if>

Guess you like

Origin blog.csdn.net/weixin_43167662/article/details/130056284