美文网首页
记录一次mybatis的xml传0取不到值的问题

记录一次mybatis的xml传0取不到值的问题

作者: 后端架构进阶 | 来源:发表于2019-08-26 11:15 被阅读0次

请求的参数为:
{"userId":"","operUserId":"","type":0}

中间中转了下,mybatis参数为prizeType

xml的参数如下:

<if test="prizeType!=null and prizeType!=''">
                and prize_type = ${prizeType}
            </if>

死活就是不行,查看了相关资料后,修改如下就ok了

<if test="prizeType!=null">
                and prize_type = ${prizeType}
            </if>

mybatis传0的时候,如果加了这样的校验and prizeType!='',默认会被置为空

特此记录下~

相关文章

网友评论

      本文标题:记录一次mybatis的xml传0取不到值的问题

      本文链接:https://www.haomeiwen.com/subject/helrectx.html