1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package configuration
- import (
- "git.sxidc.com/go-framework/baize/framework/core/domain"
- "git.sxidc.com/go-framework/baize/framework/core/domain/value_object"
- "git.sxidc.com/go-framework/baize/framework/core/tag/check"
- )
- const (
- FieldScope = "Scope"
- FieldGroup = "Group"
- FieldValue = "Value"
- )
- var (
- ColumnScope = domain.ColumnName(FieldScope)
- ColumnGroup = domain.ColumnName(FieldGroup)
- ColumnValue = domain.ColumnName(FieldValue)
- )
- var fieldMap = map[string]string{
- FieldScope: "范围",
- FieldGroup: "组",
- FieldValue: "值",
- }
- type ValueObject struct {
- value_object.Base
- Scope string `sqlmapping:"column:scope;key;notUpdate;" sqlresult:"column:scope;" check:"required,lte=256"`
- Group string `sqlmapping:"column:group;key;notUpdate;" sqlresult:"column:group;" check:"required,lte=256"`
- Value string `sqlmapping:"column:value;notUpdate;" sqlresult:"column:value;" check:"required,lte=256"`
- }
- func (valueObject *ValueObject) DomainCNName() string {
- return "配置"
- }
- func (valueObject *ValueObject) DomainCamelName() string {
- return "Configuration"
- }
- func (valueObject *ValueObject) CheckKeyFields() error {
- checkResult := check.Struct(valueObject, fieldMap)
- err := domain.CheckField(checkResult, valueObject.DomainCNName(), FieldScope)
- if err != nil {
- return err
- }
- err = domain.CheckField(checkResult, valueObject.DomainCNName(), FieldGroup)
- if err != nil {
- return err
- }
- return nil
- }
- func (valueObject *ValueObject) ForCreate() error {
- checkResult := check.Struct(valueObject, fieldMap)
- err := domain.CheckField(checkResult, valueObject.DomainCNName(), FieldScope)
- if err != nil {
- return err
- }
- err = domain.CheckField(checkResult, valueObject.DomainCNName(), FieldGroup)
- if err != nil {
- return err
- }
- err = domain.CheckField(checkResult, valueObject.DomainCNName(), FieldValue)
- if err != nil {
- return err
- }
- return nil
- }
|