欧美free性护士vide0shd,老熟女,一区二区三区,久久久久夜夜夜精品国产,久久久久久综合网天天,欧美成人护士h版

目錄

柚子快報(bào)激活碼778899分享:DBAPI如何使用數(shù)組類(lèi)型參數(shù)

柚子快報(bào)激活碼778899分享:DBAPI如何使用數(shù)組類(lèi)型參數(shù)

http://yzkb.51969.com/

DBAPI如何使用數(shù)組類(lèi)型參數(shù)

需求

根據(jù)多個(gè)id去查詢學(xué)生信息

API創(chuàng)建

在基本信息標(biāo)簽,創(chuàng)建參數(shù)ids ,參數(shù)類(lèi)型選擇 Array 在執(zhí)行器標(biāo)簽,填寫(xiě)sql,使用in查詢

select * from student where id in

#{item}

API請(qǐng)求

在請(qǐng)求測(cè)試頁(yè)面,點(diǎn)擊按鈕添加參數(shù)框,輸入3個(gè)id,發(fā)起請(qǐng)求發(fā)現(xiàn)返回了3條學(xué)生信息 如果想用代碼發(fā)起請(qǐng)求可以使用以下代碼

# python代碼

import requests

from urllib import parse

requestUrl = 'http://localhost:8520/api/student/idList'

headers = {

'Content-Type': 'application/x-www-form-urlencoded'

}

formData = {

"ids": [77,78,79]

}

data = parse.urlencode(formData, True)

response = requests.post(requestUrl, headers = headers, data = data)

print(response.status_code)

print(response.text)

# js 代碼

// npm install axios

// npm install qs

const axios = require('axios');

const qs = require('qs');

const data = qs.stringify({

ids: [77,78,79]

}, { indices: false })

axios({

method: 'post',

url: 'http://localhost:8520/api/student/idList',

headers: {

'Content-Type': 'application/x-www-form-urlencoded'

},

data: data,

}).then(response => {

console.log(response.data);

}).catch(error => {

console.log(error);

});

手動(dòng)取數(shù)組參數(shù)

也可以手動(dòng)取參數(shù)值,修改sql,使用ids[0]取數(shù)組參數(shù)的第一個(gè)元素,使用ids[1]取數(shù)組參數(shù)的第二個(gè)元素

select * from student where

id = #{ids[0]} or id = #{ids[1]}

柚子快報(bào)激活碼778899分享:DBAPI如何使用數(shù)組類(lèi)型參數(shù)

http://yzkb.51969.com/

相關(guān)文章

評(píng)論可見(jiàn),查看隱藏內(nèi)容

本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點(diǎn)和立場(chǎng)。

轉(zhuǎn)載請(qǐng)注明,如有侵權(quán),聯(lián)系刪除。

本文鏈接:http://gantiao.com.cn/post/19154129.html

發(fā)布評(píng)論

您暫未設(shè)置收款碼

請(qǐng)?jiān)谥黝}配置——文章設(shè)置里上傳

掃描二維碼手機(jī)訪問(wèn)

文章目錄