微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

myhabits where in foreach

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 ...

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐