Advertisement

mybatis-plus:xml与sql拼接总结

阅读量:

一、foreach操作与map应用

复制代码
       <if test = "vo.map!= null and vo.map.size() > 0">
            <foreach item="item" index="key" collection="vo.map">
                <if test = "key != null and key != 'assetType'">
                	// jsonParam为json类型字段
                    and JSON_EXTRACT(jsonParam, '$.${key}') = #{item}
                </if>
                <if test = "key != null and key == 'assetType'">
                    and ${key} = #{item}
                </if>
            </foreach>
        </if>
    

全部评论 (0)

还没有任何评论哟~