xml写法mybatis 传List类型参数
1
List<Integer> identityTypeList=new ArrayList();
2
if (type == 0) {
3
//查找支付宝用户
4
u = userMapper.findUserByOpenid(code);
5
if (u != null){
6
identityTypeList.add(4);
7
identityTypeList.add(6);
8
mobileBase = userMapper.findMobile(u.getId(),identityTypeList);//支付宝绑定手机号auth为6
9
}
10
}
1
"<script>select distinct identifier from ycb_mcs_user_auth where user_id=#{id} and identity_type in " + (
2
"<foreach item='item' index='index' collection='identityTypeList' open='(' separator=',' close=')'> #{item} </foreach> Limit 1</script>")
3
String findMobile( ("id") Long id, ("identityTypeList") List<Integer> identityTypeList);
4
返回List类型参数
1
List<Refund> refundList = this.refundMapper.findRefunds(user.getId());
1
"SELECT id,refund,status,UNIX_TIMESTAMP(request_time) AS requestTime ,UNIX_TIMESTAMP(refund_time) AS refundTime\n" + (
2
" FROM ycb_mcs_refund_log WHERE uid = #{uid} ORDER BY id DESC LIMIT 0,20")
3
List<Refund> findRefunds(Long uid);