关于MySql中choose when的用法


    select id, shop_id, order_id, user_id, detail, shop_score, quality_score, packaging_score, rider_score,
    del_flag, create_time, update_time,evaluate_img from evaluate_info
    <where>
        <if test="vo.score!=null and vo.score !=''">
            <if test="vo.score == 2">
                and 1=1
            </if>
            and shop_score=#{vo.score}
        </if>
        <if test="vo.reply!=null and vo.reply != '' ">
            <choose>
                <when test="vo.reply = '1' ">
                    and apply = '1'
                </when>
                <when test="vo.reply = '2' ">
                    and apply = '0'
                </when>
            </choose>
        </if>
        <if test="vo.content != null and vo.content != '' ">
            <choose>
                <when test="vo.content = '1' ">
                    and evaluate_img is not null
                </when>
                <when test="vo.content = '2' ">
                    and evaluate_img is null
                </when>
            </choose>
        </if>
        <if test="vo.month!=null and vo.month !=''">
            and date_format (create_time,'%Y-%m-%d') between date_format (#{vo.firstDay},'%Y-%m-%d') and
            date_format (#{vo.lastDay},'%Y-%m-%d')
        </if>
    </where>
</select>

在查询时,当我reply或content传值为1时,sql正常运行,当传值为2时,拼接出来的sql出现问题,仍然是传值为1时的sql

test里面的表达式要用==,你只用了一个=