mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 16:30:25 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package persistence
 | 
						|
 | 
						|
import (
 | 
						|
	"mayfly-go/base/biz"
 | 
						|
	"mayfly-go/base/model"
 | 
						|
	"mayfly-go/server/sys/domain/entity"
 | 
						|
	"mayfly-go/server/sys/domain/repository"
 | 
						|
)
 | 
						|
 | 
						|
type accountRepo struct{}
 | 
						|
 | 
						|
var AccountDao repository.Account = &accountRepo{}
 | 
						|
 | 
						|
func (a *accountRepo) GetAccount(condition *entity.Account, cols ...string) error {
 | 
						|
	return model.GetBy(condition, cols...)
 | 
						|
}
 | 
						|
 | 
						|
func (m *accountRepo) GetPageList(condition *entity.Account, pageParam *model.PageParam, toEntity interface{}, orderBy ...string) *model.PageResult {
 | 
						|
	sql := "SELECT * FROM t_sys_account "
 | 
						|
	username := condition.Username
 | 
						|
	if username != "" {
 | 
						|
		sql = sql + " WHERE username LIKE '%" + username + "%'"
 | 
						|
	}
 | 
						|
	return model.GetPageBySql(sql, pageParam, toEntity)
 | 
						|
	// return model.GetPage(pageParam, condition, toEntity, orderBy...)
 | 
						|
}
 | 
						|
 | 
						|
func (m *accountRepo) Insert(account *entity.Account) {
 | 
						|
	biz.ErrIsNil(model.Insert(account), "新增账号信息失败")
 | 
						|
}
 | 
						|
 | 
						|
func (m *accountRepo) Update(account *entity.Account) {
 | 
						|
	biz.ErrIsNil(model.UpdateById(account), "更新账号信息失败")
 | 
						|
}
 |