mysql的引号在xml文件的问题?

<select id="getListByFullDiscountReductionId" resultType="com.yhc.common.domain.pojo.Goods" parameterType="string">    select * from tb_goods
    <where>
        <if test="fullDiscountReductionId != null">
            JSON_CONTAINS(full_discount_reduction_id_list, #{fullDiscountReductionId})
        </if>
    </where>
</select>
在数据库用这个语句里面是没问题的
select * from tb_goods WHERE JSON_CONTAINS(full_discount_reduction_id_list, '"1615237656678371329"')但是到了java里面的xml文件就不行了,感觉是少了单引号和双引号的包裹,但是在xml里面使用单引号和双引号需要转义,这个怎么转义呀
回答:
{}换成${}
回答:
XML没问题,而是你应该在调用方法时把 fullDiscountReductionId 这个参数的值用引号包起来:
Goods g = getListByFullDiscountReductionId("\"1615237656678371329\"");以上是 mysql的引号在xml文件的问题? 的全部内容, 来源链接: utcz.com/p/945058.html
