package student import ( "git.sxidc.com/go-framework/baize/convenient/domain/query_rule/definition" "git.sxidc.com/go-framework/baize/framework/core/domain" "git.sxidc.com/go-framework/baize/framework/core/domain/entity" "git.sxidc.com/go-tools/utils/strutils" ) const ( FieldName = "Name" ) var ( ColumnName = domain.ColumnName(FieldName) ) var fieldMap = map[string]string{ FieldName: "学生姓名", } type Entity struct { entity.Base Name string `sqlmapping:"column:name" sqlresult:"column:name" check:"required,lte=128,when=create/update" rule:"column:name"` FamilyID string `sqlmapping:"column:family_id" sqlresult:"column:family_id" check:"required,len=32"` ClassID string `sqlmapping:"column:class_id" sqlresult:"column:class_id" check:"required,len=32"` IdentityIDs []string `sqlmapping:"-" sqlresult:"-"` HobbyIDs []string `sqlmapping:"-" sqlresult:"-"` entity.TimeFields } func RegisterQueryRule() error { return definition.RegisterByDomainEntity(definition.RegisterByEntityItem{ Entity: &Entity{}, FieldMap: fieldMap, }) } func (e *Entity) DomainCNName() string { return "学生" } func (e *Entity) DomainCamelName() string { return "Student" } func (e *Entity) GetFieldMap() map[string]string { return fieldMap } func (e *Entity) FormQueryRuleParams() map[string]any { ruleParams := make(map[string]any) if strutils.IsStringNotEmpty(e.Name) { ruleParams[ColumnName] = e.Name } return ruleParams }