Skip to content

Join Select方法

Tuuz edited this page Jun 20, 2022 · 2 revisions

GiftModel.go文件

const Table = "gift"

GiftLogModel.go文件

const Table = "gift_log"


func Api_joinGift_select_byUid(uid interface{}, limit, page int) []gorose.Data {
	db := tuuz.Db().Table(Table)
	where := map[string]interface{}{
		"uid": uid,
	}
	db.Where(where)
	db.LeftJoin(GiftModel.Table, Table+".gid="+GiftModel.Table+".id")
	db.Limit(limit)
	db.Page(page)
	ret, err := db.Get()
	if err != nil {
		Log.Dbrr(err, tuuz.FUNCTION_ALL())
		return nil
	} else {
		return ret
	}
}