五、MySql+Mybatis+Druid:报sql injection violation, comment not allow异常

  报错的sql语句:

"synchronizedStar" parameterType="Date">
        "lastUpdateTime == null">
            update business b,(
            #建立商户与星级的对应关系表
            select o.business_id,sum(a.star) totalStar,count(*) totalComment from orders o,
            #订单编号与star的对应关系表
            (select order_id,star from `comment` where createTime<;=#{currentTime})a
            where o.id=a.order_id group by o.business_id
            )temp
            set b.star=b.star + temp.totalStar,b.commentNum=b.commentNum+temp.totalComment where b.id=temp.business_id
        
        "lastUpdateTime != null">
            update business b,(
            select o.business_id,sum(a.star) totalStar,count(*) totalComment from orders o,
            (select order_id,star from `comment` where createTime>;#{lastUpdateTime} AND createTime<=#{currentTime})a
            where o.id=a.order_id group by o.business_id
            )temp
            set b.star=b.star + temp.totalStar,b.commentNum=b.commentNum+temp.totalComment where b.id=temp.business_id
        
    

  经查源码发现,在Mybatis的配置文件中,不能出现“#建立商户与星级的对应关系表”注解,删除掉即可!

你可能感兴趣的:(非常见异常的解决)