const arr1 = [ { key: "cycleType", value: iperiod }, { key: "indexId", value: iid }, { key: "indexLevel", value: ilevel }, { key: "indexName", value: iname }, { key: "orgName", value: iunit }, { key: "queryDate", value: startEndTime } ]; const arr2: any = []; arr1.map(e => { if(e.value) { arr2.push(e) } return e; }); const arr3: any = []; for(let i = 0; i < arr2.length; i++){ const subString = `${arr2[i].key}='${arr2[i].value}'`; arr3.push(subString) }; const sqlstr = arr3.join("&");