mybatis sql判断多个元素不为空

   SELECT * FROM result co
        where
        <if test="projectId != null">
             co.projectId=#{projectId} and
        </if>
        <if test="startTime!=null and endTime!=null">
        modifyTime between #{startTime} and #{endTime}
        </if>
        <if test="startTime!=null and endTime==null ">
modifyTime>= #{startTime} </if> order by co.id desc;

 

posted @ 2023-06-30 17:35  苹果芒  阅读(52)  评论(0编辑  收藏  举报