| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package hobby
- import (
- "git.sxidc.com/go-framework/baize/framework/core/domain/entity"
- "git.sxidc.com/go-framework/baize/framework/core/tag/check"
- "git.sxidc.com/go-tools/utils/strutils"
- )
- type Entity struct {
- ID string `sqlmapping:"-" sqlresult:"-" check:"required,len=32"`
- StudentIDs []string `sqlmapping:"-" sqlresult:"-"`
- }
- func (e *Entity) DBSchema() string {
- return ""
- }
- func (e *Entity) GenerateID() error {
- e.ID = strutils.SimpleUUID()
- return nil
- }
- func (e *Entity) GetID() string {
- return e.ID
- }
- func (e *Entity) DomainCNName() string {
- return "爱好"
- }
- func (e *Entity) DomainCamelName() string {
- return "Hobby"
- }
- func (e *Entity) ForCreate() error {
- err := e.CheckFieldID()
- if err != nil {
- return err
- }
- return nil
- }
- func (e *Entity) ForDelete() error {
- return e.CheckFieldID()
- }
- func (e *Entity) ForUpdate() error {
- err := e.CheckFieldID()
- if err != nil {
- return err
- }
- return nil
- }
- func (e *Entity) CheckFieldID() error {
- checkResult := check.Struct(e, map[string]string{entity.FieldID: e.DomainCNName() + "ID"})
- err := entity.CheckFieldIDResult(checkResult)
- if err != nil {
- return err
- }
- return nil
- }
|