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

posted on 2019-04-13 09:13  七七2020  阅读(513)  评论(0编辑  收藏  举报

导航