<if test="stringParam != null and stringParam != ''">
<if test="stringParam.indexOf(',') != -1">
and stringParam in
<foreach item="item" index="index" collection="stringParam.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="stringParam.indexOf(',') == -1">
and stringParam=#{stringParam}
</if>
</if>