mirror of
https://shylinux.com/x/education
synced 2025-04-25 10:08:05 +08:00
26 lines
615 B
Go
26 lines
615 B
Go
package jiaowuxitong
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
|
|
"shylinux.com/x/education/src/jiaowuxitong/model"
|
|
)
|
|
|
|
type school struct{ Table }
|
|
|
|
func (s school) List(m *ice.Message, arg ...string) {
|
|
if len(arg) == 0 {
|
|
s.Select(m)
|
|
}
|
|
}
|
|
func (s school) FindOrCreateByName(m *ice.Message, arg ...string) {
|
|
if msg := m.Cmd(s, s.Select, model.NAME, arg[3], arg[0], arg[1]); msg.Length() == 0 {
|
|
msg := m.Cmd(s, s.Create, model.NAME, arg[3], arg[0], arg[1])
|
|
arg[2], arg[3] = model.SCHOOL_UID, msg.Result()
|
|
} else {
|
|
arg[2], arg[3] = model.SCHOOL_UID, msg.Append(model.UID)
|
|
}
|
|
}
|
|
|
|
func init() { ice.TeamCtxCmd(school{}) }
|