mysql otherwise,mapper.xml中编写sql语句使用choose when otherwise来判断
test后面只能使用boolean型的判断,最好是!null判断select * from t_blog where 1 = 1and title = #{title}and content = #{content}and owner = "owner1"自己写项目的时候updatearticle_collection_status = null,article_collection_status
test后面只能使用boolean型的判断,最好是!null判断
select * from t_blog where 1 = 1
and title = #{title}
and content = #{content}
and owner = "owner1"
自己写项目的时候
update
article_collection_status = null,
article_collection_status = 0,
where article_id = #{articleId}
其中的articleCollectionStatus要和articled一样,作为参数传递过来,并且在test使用#{articleCollectionStatus},不然会这个值相关的异常。可能是when或者otherwise后面的执行语句没有用到#{articleCollectionStatus}而是直接写的null和0。百度的例子基本都是content = #{content}这种的。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)