mybatis注解if条件更新

# 条件更新
@Update({
            "<script> ",
            "update video_basic_info ",
            "<set> ",
            "<if test = \"Title != null and Title != '' \"> ",
            "title=#{Title}, ",
            "</if> ",
            "<if test = \"Desc != null and Desc != ''\"> ",
            "description=#{Desc}, ",
            "</if> ",
            "<if test = \"Tag != null and Tag != ''\"> ",
            "category_list=#{Tag} ",
            "</if> ",
            "</set> ",
            "where video_id=#{VideoID} and corp_id=#{CorpID}",
            "</script>"
    })
    int updateVideoBasicInfoTitleDescTag(@Param("VideoID") String videoId,
                                         @Param("CorpID") Integer corpId,
                                         @Param("Title") String title,
                                         @Param("Desc") String desc,
                                         @Param("Tag") String tag);

版权声明:本文为zhou_zhao_xu原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。