2019-11-02 14:48

@JFinal 可以了,我把动态sql模板贴出来

#sql("getPetCommunity")
select * from p_pet_community
#for(x : cond)
#(for.first ? "where": "and")
#for(y : x.value)
#(for.first ? "(": ",")#para(y.value)
#end
)
#end
#end


可以实现
select * from p_pet_community
where bodySize in ("小型犬" ,"大型犬")
and type in ('狩猎犬','家庭犬')

这种sql的动态传参

2019-11-01 19:19

单个type调试了一下获取到结果是空@JFinal

2019-11-01 19:18

Sql: select * from p_pet_community
where type=?


JFinal action report -------- 2019-11-01 19:17:56 ------------------------------
Url : POST /api/wx/pet/getPetCommunity
Controller : com.superpet.weixin.api.pet.PetController.(PetController.java:1)
Method : getPetCommunity
Parameter : type='狩猎犬'or'家庭犬' accessToken=kF4vFUGHz5CvOGwxiyFeLoWZe5wM-YtPXrxo4v5H0vek7HSYNhUQKmatonJlzZH4
--------------------------------------------------------------------------------

2019-11-01 19:13

@JFinal 先这样单个参数调试哈:只传一个type
#sql("getPetCommunity1")
select * from p_pet_community
where type=#para(0)
#end

2019-11-01 18:59

@JFinal 谢谢站长,意思是这样支持,且java代码也是对的哈

2019-11-01 18:58

我在postman里试了下,传参http://127.0.0.1:8090/superpet_dog_service/api/wx/pet/getPetCommunity?type='狩猎犬'|'家庭犬', 结果也是空。本身这个接口传单个是正常的