加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

myhabits where in foreach

发布时间:2020-12-14 04:33:58 所属栏目:大数据 来源:网络整理
导读:myhabits传入参数:类,其中类中包含字符串数组String[] 当查询where in String[]时 select id ="selectData" parameterType ="DataDay"!-- 类名 -- resultMap ="DataResult" select * from data_day where if test ="selectStringName != null and selectSt

myhabits传入参数:类,其中类中包含字符串数组String[]

当查询where in String[]时

<select id="selectData" parameterType="DataDay"<!-- 类名 -->
        resultMap="DataResult">
       select * from
        data_day
        <where>
            <if test="selectStringName != null  and selectStringName!= ‘‘ and selectStringName.length!=0 ">
                and selectName in
                <foreach collection="selectStringName" <!-- 注意此处要写这个字符串数组的名称 -->

item="selectStringName"
 open="(" separator="," close=")"> #{selectStringName} </foreach>
            </if>
        </where>
    </select>

如果写成 collecton=“array”,会报错There is no getter for property named ‘array‘ in ‘class ...

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读