insertSelective方法没有返回主键ID

    @Insert({
        "insert into h_video_source (category, ",
        "videoId, sourceType, ",
        "publishTime, context, ",
        "title, duration, ",
        "createTime, updateTime, ",
        "deleteFlag)",
        "values (#{category,jdbcType=INTEGER}, ",
        "#{videoid,jdbcType=INTEGER}, #{sourcetype,jdbcType=INTEGER}, ",
        "#{publishtime,jdbcType=TIMESTAMP}, #{context,jdbcType=VARCHAR}, ",
        "#{title,jdbcType=VARCHAR}, #{duration,jdbcType=INTEGER}, ",
        "#{createtime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP}, ",
        "#{deleteflag,jdbcType=TINYINT})",
        "ON DUPLICATE KEY update updateTime = now()"
        
    })
    @Options(useGeneratedKeys = true)
    int insertSelective(VideoSourceDto record);
    
    @Options(useGeneratedKeys = true),只需要有这一个配置项就可以

你可能感兴趣的:(JAVA)