我创建了一个视图,下面的图片是它的查询:
import UIKit
import AVFoundation
class ViewController: UIViewController {
private var player: AVQueuePlayer?
private var playerLayer: AVPlayerLayer?
override func viewDidLoad() {
super.viewDidLoad()
super.view.backgroundColor = UIColor.lightGray
// Video file for demo
let mediaPath = URL(fileURLWithPath:Bundle.main.path(forResource: "ChoppedBipBop", ofType: "m4v")!)
startDemoVideo(videoURL: mediaPath)
}
public func startDemoVideo(videoURL: URL) {
player = AVQueuePlayer()
playerLayer = AVPlayerLayer(player: player)
guard let playerLayer = playerLayer else { fatalError("Error creating player layer") }
playerLayer.frame = view.layer.bounds
view.layer.addSublayer(playerLayer)
let videoAsset = AVURLAsset(url: videoURL)
videoAsset.loadValuesAsynchronously(forKeys: ["duration", "playable"]) {
DispatchQueue.main.async {
let loopItem = AVPlayerItem(asset: videoAsset)
self.player?.insert(loopItem, after: nil)
self.player?.play()
}
}
}
}
有没有办法合并相同的products_id?像这样的东西:
select * from order_extended
这是视图定义:
+-----+----------+----------------+---------+------+------+
| pid | quantity | product_name | Walmart | Sams | Ley |
+-----+----------+----------------+---------+------+------+
| 1 | 1.00 | ACEITE CAPULLO | 27.50 | 24.33| 29.90|
| 3 | 2.00 | ACEITE DE AJONJ| 40.00 | null | null |
| 5 | 2.00 | ACEITE DE COCO | 114.00 | null | null |
+-----+----------+----------------+---------+------+------+