38 lines
665 B
Go
38 lines
665 B
Go
package service
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/modules/config/model"
|
|
)
|
|
|
|
type SignInService struct {
|
|
*cool.Service
|
|
}
|
|
|
|
func (s *SignInService) GetActive(signInID uint32) *model.SignIn {
|
|
m := cool.DBM(s.Model)
|
|
if signInID != 0 {
|
|
m.Where("sign_in_id", signInID)
|
|
}
|
|
m.Where("status", 1)
|
|
m.Order("sign_in_id", "asc")
|
|
|
|
var out *model.SignIn
|
|
m.Scan(&out)
|
|
return out
|
|
}
|
|
|
|
func NewSignInService() *SignInService {
|
|
return &SignInService{
|
|
&cool.Service{
|
|
Model: model.NewSignIn(),
|
|
ListQueryOp: &cool.QueryOp{
|
|
FieldEQ: []string{"sign_in_id", "status"},
|
|
},
|
|
PageQueryOp: &cool.QueryOp{
|
|
FieldEQ: []string{"sign_in_id", "status"},
|
|
},
|
|
},
|
|
}
|
|
}
|