优化全局变量
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"cutego/modules"
|
||||
"cutego/modules/core/api/v1/request"
|
||||
"cutego/modules/core/dataobject"
|
||||
"cutego/modules/core/entity"
|
||||
"cutego/pkg/common"
|
||||
"cutego/pkg/page"
|
||||
"cutego/refs"
|
||||
"github.com/go-xorm/xorm"
|
||||
)
|
||||
|
||||
@@ -18,9 +18,9 @@ func (d LoginInfoDao) sql(session *xorm.Session) *xorm.Session {
|
||||
}
|
||||
|
||||
// SelectPage 分页查询数据
|
||||
func (d LoginInfoDao) SelectPage(query request.LoginInfoQuery) (*[]dataobject.SysLoginInfo, int64) {
|
||||
loginInfos := make([]dataobject.SysLoginInfo, 0)
|
||||
session := d.sql(modules.SqlDB.NewSession())
|
||||
func (d LoginInfoDao) SelectPage(query request.LoginInfoQuery) (*[]entity.SysLoginInfo, int64) {
|
||||
loginInfos := make([]entity.SysLoginInfo, 0)
|
||||
session := d.sql(refs.SqlDB.NewSession())
|
||||
session.And("user_name = ?", query.UserName)
|
||||
total, _ := page.GetTotal(session.Clone())
|
||||
err := session.Limit(query.PageSize, page.StartSize(query.PageNum, query.PageSize)).Find(&loginInfos)
|
||||
@@ -32,8 +32,8 @@ func (d LoginInfoDao) SelectPage(query request.LoginInfoQuery) (*[]dataobject.Sy
|
||||
}
|
||||
|
||||
// Insert 添加登录记录
|
||||
func (d LoginInfoDao) Insert(body dataobject.SysLoginInfo) *dataobject.SysLoginInfo {
|
||||
session := modules.SqlDB.NewSession()
|
||||
func (d LoginInfoDao) Insert(body entity.SysLoginInfo) *entity.SysLoginInfo {
|
||||
session := refs.SqlDB.NewSession()
|
||||
session.Begin()
|
||||
_, err := session.Table("sys_login_info").Insert(&body)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user