4 Star 18 Fork 3

cristiane/micro-mall-pay

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
pay_record.go 1.19 KB
一键复制 编辑 原始数据 按行查看 历史
雨化田 提交于 2021-11-03 19:05 . 事务优化&搜索缓存
package repository
import (
"gitee.com/cristiane/micro-mall-pay/model/mysql"
"gitee.com/kelvins-io/kelvins"
"xorm.io/xorm"
)
func CreatePayRecord(tx *xorm.Session, model *mysql.PayRecord) (err error) {
_, err = tx.Table(mysql.TablePayRecord).Insert(model)
return
}
func GetPayRecordList(selectSql string, where interface{}, orderByAsc, orderByDesc []string, pageSize, pageNum int) ([]mysql.PayRecord, int64, error) {
var result = make([]mysql.PayRecord, 0)
session := kelvins.XORM_DBEngine.Table(mysql.TablePayRecord).Select(selectSql).
Where(where).
Asc(orderByAsc...).
Desc(orderByDesc...)
if pageSize > 0 && pageNum >= 1 {
session = session.Limit(pageSize, (pageNum-1)*pageSize)
}
total, err := session.FindAndCount(&result)
return result, total, err
}
func UpdatePayRecord(tx *xorm.Session, where map[string]interface{}, maps map[string]interface{}) (int64, error) {
return tx.Table(mysql.TablePayRecord).Where(where).Update(maps)
}
func FindPayRecordList(selectSql string, where interface{}) ([]mysql.PayRecord, error) {
var result = make([]mysql.PayRecord, 0)
err := kelvins.XORM_DBEngine.Table(mysql.TablePayRecord).Select(selectSql).Where(where).Find(&result)
return result, err
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/cristiane/micro-mall-pay.git
git@gitee.com:cristiane/micro-mall-pay.git
cristiane
micro-mall-pay
micro-mall-pay
5f6f923dbc21

搜索帮助

Cb406eda 1850385 E526c682 1850385