该语句可以实现 插入语句如果出现重复的主键或者指定的unique索引重复则会进行更新操作 可以是crud常用语法
@Transactional
@Modifying
@Query(value = "insert into video(dt_create, game_id, image_path, name, video_path) values(?1,?2,?3,?4,?5)" +
"on duplicate key update dt_create = ?1,game_id = ?2,image_path = ?3,video_path = ?5", nativeQuery = true)
void saveOrUpdateByName(Date dtCreate, Integer gameId, String imagePath, String name, String videoPath);
unique 索引指定 在entity中
@Entity
@Data
@Table(uniqueConstraints = @UniqueConstraint(columnNames = {