feat: 完成多模块功能迭代与优化

本次提交包含多模块功能更新:
1. 权限系统重构:移除硬编码admin放行逻辑,新增精细化权限控制,完善权限树形结构与用户/角色保护
2. 新增物料导入导出接口,补充台账查询条件
3. 优化列表查询排序逻辑,新增区域编码大小写不敏感搜索
4. 修复帮助抽屉重复弹出问题,补充页面权限控制
5. 新增弱密码提示逻辑,优化MES/WMS用户/角色管理权限
6. 调整路由结构,新增权限校验脚本与前端权限树重构
7. 补充数据库字段与依赖包更新
This commit is contained in:
SunYF
2026-09-03 18:13:59 +08:00
parent 572fa975bc
commit c1fc6d32b2
47 changed files with 1761 additions and 926 deletions
+1
View File
@@ -370,6 +370,7 @@ var (
{Name: "code", Type: field.TypeString, Unique: true, Size: 64},
{Name: "name", Type: field.TypeString, Size: 64},
{Name: "type", Type: field.TypeString, Size: 20, Default: "MENU"},
{Name: "parent_code", Type: field.TypeString, Nullable: true, Size: 64, Default: ""},
{Name: "path", Type: field.TypeString, Nullable: true, Size: 128, Default: ""},
{Name: "icon", Type: field.TypeString, Nullable: true, Size: 64, Default: ""},
{Name: "sort", Type: field.TypeInt, Nullable: true, Default: 0},
+74 -1
View File
@@ -9883,6 +9883,7 @@ type PermissionMutation struct {
code *string
name *string
_type *string
parent_code *string
_path *string
icon *string
sort *int
@@ -10104,6 +10105,55 @@ func (m *PermissionMutation) ResetType() {
m._type = nil
}
// SetParentCode sets the "parent_code" field.
func (m *PermissionMutation) SetParentCode(s string) {
m.parent_code = &s
}
// ParentCode returns the value of the "parent_code" field in the mutation.
func (m *PermissionMutation) ParentCode() (r string, exists bool) {
v := m.parent_code
if v == nil {
return
}
return *v, true
}
// OldParentCode returns the old "parent_code" field's value of the Permission entity.
// If the Permission object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *PermissionMutation) OldParentCode(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldParentCode is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldParentCode requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldParentCode: %w", err)
}
return oldValue.ParentCode, nil
}
// ClearParentCode clears the value of the "parent_code" field.
func (m *PermissionMutation) ClearParentCode() {
m.parent_code = nil
m.clearedFields[permission.FieldParentCode] = struct{}{}
}
// ParentCodeCleared returns if the "parent_code" field was cleared in this mutation.
func (m *PermissionMutation) ParentCodeCleared() bool {
_, ok := m.clearedFields[permission.FieldParentCode]
return ok
}
// ResetParentCode resets all changes to the "parent_code" field.
func (m *PermissionMutation) ResetParentCode() {
m.parent_code = nil
delete(m.clearedFields, permission.FieldParentCode)
}
// SetPath sets the "path" field.
func (m *PermissionMutation) SetPath(s string) {
m._path = &s
@@ -10467,7 +10517,7 @@ func (m *PermissionMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *PermissionMutation) Fields() []string {
fields := make([]string, 0, 9)
fields := make([]string, 0, 10)
if m.code != nil {
fields = append(fields, permission.FieldCode)
}
@@ -10477,6 +10527,9 @@ func (m *PermissionMutation) Fields() []string {
if m._type != nil {
fields = append(fields, permission.FieldType)
}
if m.parent_code != nil {
fields = append(fields, permission.FieldParentCode)
}
if m._path != nil {
fields = append(fields, permission.FieldPath)
}
@@ -10509,6 +10562,8 @@ func (m *PermissionMutation) Field(name string) (ent.Value, bool) {
return m.Name()
case permission.FieldType:
return m.GetType()
case permission.FieldParentCode:
return m.ParentCode()
case permission.FieldPath:
return m.Path()
case permission.FieldIcon:
@@ -10536,6 +10591,8 @@ func (m *PermissionMutation) OldField(ctx context.Context, name string) (ent.Val
return m.OldName(ctx)
case permission.FieldType:
return m.OldType(ctx)
case permission.FieldParentCode:
return m.OldParentCode(ctx)
case permission.FieldPath:
return m.OldPath(ctx)
case permission.FieldIcon:
@@ -10578,6 +10635,13 @@ func (m *PermissionMutation) SetField(name string, value ent.Value) error {
}
m.SetType(v)
return nil
case permission.FieldParentCode:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetParentCode(v)
return nil
case permission.FieldPath:
v, ok := value.(string)
if !ok {
@@ -10689,6 +10753,9 @@ func (m *PermissionMutation) AddField(name string, value ent.Value) error {
// mutation.
func (m *PermissionMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(permission.FieldParentCode) {
fields = append(fields, permission.FieldParentCode)
}
if m.FieldCleared(permission.FieldPath) {
fields = append(fields, permission.FieldPath)
}
@@ -10715,6 +10782,9 @@ func (m *PermissionMutation) FieldCleared(name string) bool {
// error if the field is not defined in the schema.
func (m *PermissionMutation) ClearField(name string) error {
switch name {
case permission.FieldParentCode:
m.ClearParentCode()
return nil
case permission.FieldPath:
m.ClearPath()
return nil
@@ -10744,6 +10814,9 @@ func (m *PermissionMutation) ResetField(name string) error {
case permission.FieldType:
m.ResetType()
return nil
case permission.FieldParentCode:
m.ResetParentCode()
return nil
case permission.FieldPath:
m.ResetPath()
return nil
+12 -1
View File
@@ -22,6 +22,8 @@ type Permission struct {
Name string `json:"name,omitempty"`
// 类型 MENU菜单/BUTTON按钮
Type string `json:"type,omitempty"`
// 所属菜单编码(BUTTON 填其所属 MENU 的 code;全局按钮填空)
ParentCode string `json:"parentCode,omitempty"`
// 前端路由(菜单类)
Path string `json:"path,omitempty"`
// 图标(菜单类)
@@ -44,7 +46,7 @@ func (*Permission) scanValues(columns []string) ([]any, error) {
switch columns[i] {
case permission.FieldID, permission.FieldSort, permission.FieldCreatedAt, permission.FieldUpdatedAt:
values[i] = new(sql.NullInt64)
case permission.FieldCode, permission.FieldName, permission.FieldType, permission.FieldPath, permission.FieldIcon, permission.FieldRemark:
case permission.FieldCode, permission.FieldName, permission.FieldType, permission.FieldParentCode, permission.FieldPath, permission.FieldIcon, permission.FieldRemark:
values[i] = new(sql.NullString)
default:
values[i] = new(sql.UnknownType)
@@ -85,6 +87,12 @@ func (_m *Permission) assignValues(columns []string, values []any) error {
} else if value.Valid {
_m.Type = value.String
}
case permission.FieldParentCode:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field parent_code", values[i])
} else if value.Valid {
_m.ParentCode = value.String
}
case permission.FieldPath:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field path", values[i])
@@ -166,6 +174,9 @@ func (_m *Permission) String() string {
builder.WriteString("type=")
builder.WriteString(_m.Type)
builder.WriteString(", ")
builder.WriteString("parent_code=")
builder.WriteString(_m.ParentCode)
builder.WriteString(", ")
builder.WriteString("path=")
builder.WriteString(_m.Path)
builder.WriteString(", ")
+12
View File
@@ -17,6 +17,8 @@ const (
FieldName = "name"
// FieldType holds the string denoting the type field in the database.
FieldType = "type"
// FieldParentCode holds the string denoting the parent_code field in the database.
FieldParentCode = "parent_code"
// FieldPath holds the string denoting the path field in the database.
FieldPath = "path"
// FieldIcon holds the string denoting the icon field in the database.
@@ -39,6 +41,7 @@ var Columns = []string{
FieldCode,
FieldName,
FieldType,
FieldParentCode,
FieldPath,
FieldIcon,
FieldSort,
@@ -66,6 +69,10 @@ var (
DefaultType string
// TypeValidator is a validator for the "type" field. It is called by the builders before save.
TypeValidator func(string) error
// DefaultParentCode holds the default value on creation for the "parent_code" field.
DefaultParentCode string
// ParentCodeValidator is a validator for the "parent_code" field. It is called by the builders before save.
ParentCodeValidator func(string) error
// DefaultPath holds the default value on creation for the "path" field.
DefaultPath string
// PathValidator is a validator for the "path" field. It is called by the builders before save.
@@ -109,6 +116,11 @@ func ByType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldType, opts...).ToFunc()
}
// ByParentCode orders the results by the parent_code field.
func ByParentCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldParentCode, opts...).ToFunc()
}
// ByPath orders the results by the path field.
func ByPath(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPath, opts...).ToFunc()
+80
View File
@@ -68,6 +68,11 @@ func Type(v string) predicate.Permission {
return predicate.Permission(sql.FieldEQ(FieldType, v))
}
// ParentCode applies equality check predicate on the "parent_code" field. It's identical to ParentCodeEQ.
func ParentCode(v string) predicate.Permission {
return predicate.Permission(sql.FieldEQ(FieldParentCode, v))
}
// Path applies equality check predicate on the "path" field. It's identical to PathEQ.
func Path(v string) predicate.Permission {
return predicate.Permission(sql.FieldEQ(FieldPath, v))
@@ -293,6 +298,81 @@ func TypeContainsFold(v string) predicate.Permission {
return predicate.Permission(sql.FieldContainsFold(FieldType, v))
}
// ParentCodeEQ applies the EQ predicate on the "parent_code" field.
func ParentCodeEQ(v string) predicate.Permission {
return predicate.Permission(sql.FieldEQ(FieldParentCode, v))
}
// ParentCodeNEQ applies the NEQ predicate on the "parent_code" field.
func ParentCodeNEQ(v string) predicate.Permission {
return predicate.Permission(sql.FieldNEQ(FieldParentCode, v))
}
// ParentCodeIn applies the In predicate on the "parent_code" field.
func ParentCodeIn(vs ...string) predicate.Permission {
return predicate.Permission(sql.FieldIn(FieldParentCode, vs...))
}
// ParentCodeNotIn applies the NotIn predicate on the "parent_code" field.
func ParentCodeNotIn(vs ...string) predicate.Permission {
return predicate.Permission(sql.FieldNotIn(FieldParentCode, vs...))
}
// ParentCodeGT applies the GT predicate on the "parent_code" field.
func ParentCodeGT(v string) predicate.Permission {
return predicate.Permission(sql.FieldGT(FieldParentCode, v))
}
// ParentCodeGTE applies the GTE predicate on the "parent_code" field.
func ParentCodeGTE(v string) predicate.Permission {
return predicate.Permission(sql.FieldGTE(FieldParentCode, v))
}
// ParentCodeLT applies the LT predicate on the "parent_code" field.
func ParentCodeLT(v string) predicate.Permission {
return predicate.Permission(sql.FieldLT(FieldParentCode, v))
}
// ParentCodeLTE applies the LTE predicate on the "parent_code" field.
func ParentCodeLTE(v string) predicate.Permission {
return predicate.Permission(sql.FieldLTE(FieldParentCode, v))
}
// ParentCodeContains applies the Contains predicate on the "parent_code" field.
func ParentCodeContains(v string) predicate.Permission {
return predicate.Permission(sql.FieldContains(FieldParentCode, v))
}
// ParentCodeHasPrefix applies the HasPrefix predicate on the "parent_code" field.
func ParentCodeHasPrefix(v string) predicate.Permission {
return predicate.Permission(sql.FieldHasPrefix(FieldParentCode, v))
}
// ParentCodeHasSuffix applies the HasSuffix predicate on the "parent_code" field.
func ParentCodeHasSuffix(v string) predicate.Permission {
return predicate.Permission(sql.FieldHasSuffix(FieldParentCode, v))
}
// ParentCodeIsNil applies the IsNil predicate on the "parent_code" field.
func ParentCodeIsNil() predicate.Permission {
return predicate.Permission(sql.FieldIsNull(FieldParentCode))
}
// ParentCodeNotNil applies the NotNil predicate on the "parent_code" field.
func ParentCodeNotNil() predicate.Permission {
return predicate.Permission(sql.FieldNotNull(FieldParentCode))
}
// ParentCodeEqualFold applies the EqualFold predicate on the "parent_code" field.
func ParentCodeEqualFold(v string) predicate.Permission {
return predicate.Permission(sql.FieldEqualFold(FieldParentCode, v))
}
// ParentCodeContainsFold applies the ContainsFold predicate on the "parent_code" field.
func ParentCodeContainsFold(v string) predicate.Permission {
return predicate.Permission(sql.FieldContainsFold(FieldParentCode, v))
}
// PathEQ applies the EQ predicate on the "path" field.
func PathEQ(v string) predicate.Permission {
return predicate.Permission(sql.FieldEQ(FieldPath, v))
+87
View File
@@ -47,6 +47,20 @@ func (_c *PermissionCreate) SetNillableType(v *string) *PermissionCreate {
return _c
}
// SetParentCode sets the "parent_code" field.
func (_c *PermissionCreate) SetParentCode(v string) *PermissionCreate {
_c.mutation.SetParentCode(v)
return _c
}
// SetNillableParentCode sets the "parent_code" field if the given value is not nil.
func (_c *PermissionCreate) SetNillableParentCode(v *string) *PermissionCreate {
if v != nil {
_c.SetParentCode(*v)
}
return _c
}
// SetPath sets the "path" field.
func (_c *PermissionCreate) SetPath(v string) *PermissionCreate {
_c.mutation.SetPath(v)
@@ -170,6 +184,10 @@ func (_c *PermissionCreate) defaults() {
v := permission.DefaultType
_c.mutation.SetType(v)
}
if _, ok := _c.mutation.ParentCode(); !ok {
v := permission.DefaultParentCode
_c.mutation.SetParentCode(v)
}
if _, ok := _c.mutation.Path(); !ok {
v := permission.DefaultPath
_c.mutation.SetPath(v)
@@ -222,6 +240,11 @@ func (_c *PermissionCreate) check() error {
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Permission.type": %w`, err)}
}
}
if v, ok := _c.mutation.ParentCode(); ok {
if err := permission.ParentCodeValidator(v); err != nil {
return &ValidationError{Name: "parent_code", err: fmt.Errorf(`ent: validator failed for field "Permission.parent_code": %w`, err)}
}
}
if v, ok := _c.mutation.Path(); ok {
if err := permission.PathValidator(v); err != nil {
return &ValidationError{Name: "path", err: fmt.Errorf(`ent: validator failed for field "Permission.path": %w`, err)}
@@ -282,6 +305,10 @@ func (_c *PermissionCreate) createSpec() (*Permission, *sqlgraph.CreateSpec) {
_spec.SetField(permission.FieldType, field.TypeString, value)
_node.Type = value
}
if value, ok := _c.mutation.ParentCode(); ok {
_spec.SetField(permission.FieldParentCode, field.TypeString, value)
_node.ParentCode = value
}
if value, ok := _c.mutation.Path(); ok {
_spec.SetField(permission.FieldPath, field.TypeString, value)
_node.Path = value
@@ -394,6 +421,24 @@ func (u *PermissionUpsert) UpdateType() *PermissionUpsert {
return u
}
// SetParentCode sets the "parent_code" field.
func (u *PermissionUpsert) SetParentCode(v string) *PermissionUpsert {
u.Set(permission.FieldParentCode, v)
return u
}
// UpdateParentCode sets the "parent_code" field to the value that was provided on create.
func (u *PermissionUpsert) UpdateParentCode() *PermissionUpsert {
u.SetExcluded(permission.FieldParentCode)
return u
}
// ClearParentCode clears the value of the "parent_code" field.
func (u *PermissionUpsert) ClearParentCode() *PermissionUpsert {
u.SetNull(permission.FieldParentCode)
return u
}
// SetPath sets the "path" field.
func (u *PermissionUpsert) SetPath(v string) *PermissionUpsert {
u.Set(permission.FieldPath, v)
@@ -590,6 +635,27 @@ func (u *PermissionUpsertOne) UpdateType() *PermissionUpsertOne {
})
}
// SetParentCode sets the "parent_code" field.
func (u *PermissionUpsertOne) SetParentCode(v string) *PermissionUpsertOne {
return u.Update(func(s *PermissionUpsert) {
s.SetParentCode(v)
})
}
// UpdateParentCode sets the "parent_code" field to the value that was provided on create.
func (u *PermissionUpsertOne) UpdateParentCode() *PermissionUpsertOne {
return u.Update(func(s *PermissionUpsert) {
s.UpdateParentCode()
})
}
// ClearParentCode clears the value of the "parent_code" field.
func (u *PermissionUpsertOne) ClearParentCode() *PermissionUpsertOne {
return u.Update(func(s *PermissionUpsert) {
s.ClearParentCode()
})
}
// SetPath sets the "path" field.
func (u *PermissionUpsertOne) SetPath(v string) *PermissionUpsertOne {
return u.Update(func(s *PermissionUpsert) {
@@ -969,6 +1035,27 @@ func (u *PermissionUpsertBulk) UpdateType() *PermissionUpsertBulk {
})
}
// SetParentCode sets the "parent_code" field.
func (u *PermissionUpsertBulk) SetParentCode(v string) *PermissionUpsertBulk {
return u.Update(func(s *PermissionUpsert) {
s.SetParentCode(v)
})
}
// UpdateParentCode sets the "parent_code" field to the value that was provided on create.
func (u *PermissionUpsertBulk) UpdateParentCode() *PermissionUpsertBulk {
return u.Update(func(s *PermissionUpsert) {
s.UpdateParentCode()
})
}
// ClearParentCode clears the value of the "parent_code" field.
func (u *PermissionUpsertBulk) ClearParentCode() *PermissionUpsertBulk {
return u.Update(func(s *PermissionUpsert) {
s.ClearParentCode()
})
}
// SetPath sets the "path" field.
func (u *PermissionUpsertBulk) SetPath(v string) *PermissionUpsertBulk {
return u.Update(func(s *PermissionUpsert) {
+62
View File
@@ -69,6 +69,26 @@ func (_u *PermissionUpdate) SetNillableType(v *string) *PermissionUpdate {
return _u
}
// SetParentCode sets the "parent_code" field.
func (_u *PermissionUpdate) SetParentCode(v string) *PermissionUpdate {
_u.mutation.SetParentCode(v)
return _u
}
// SetNillableParentCode sets the "parent_code" field if the given value is not nil.
func (_u *PermissionUpdate) SetNillableParentCode(v *string) *PermissionUpdate {
if v != nil {
_u.SetParentCode(*v)
}
return _u
}
// ClearParentCode clears the value of the "parent_code" field.
func (_u *PermissionUpdate) ClearParentCode() *PermissionUpdate {
_u.mutation.ClearParentCode()
return _u
}
// SetPath sets the "path" field.
func (_u *PermissionUpdate) SetPath(v string) *PermissionUpdate {
_u.mutation.SetPath(v)
@@ -247,6 +267,11 @@ func (_u *PermissionUpdate) check() error {
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Permission.type": %w`, err)}
}
}
if v, ok := _u.mutation.ParentCode(); ok {
if err := permission.ParentCodeValidator(v); err != nil {
return &ValidationError{Name: "parent_code", err: fmt.Errorf(`ent: validator failed for field "Permission.parent_code": %w`, err)}
}
}
if v, ok := _u.mutation.Path(); ok {
if err := permission.PathValidator(v); err != nil {
return &ValidationError{Name: "path", err: fmt.Errorf(`ent: validator failed for field "Permission.path": %w`, err)}
@@ -286,6 +311,12 @@ func (_u *PermissionUpdate) sqlSave(ctx context.Context) (_node int, err error)
if value, ok := _u.mutation.GetType(); ok {
_spec.SetField(permission.FieldType, field.TypeString, value)
}
if value, ok := _u.mutation.ParentCode(); ok {
_spec.SetField(permission.FieldParentCode, field.TypeString, value)
}
if _u.mutation.ParentCodeCleared() {
_spec.ClearField(permission.FieldParentCode, field.TypeString)
}
if value, ok := _u.mutation.Path(); ok {
_spec.SetField(permission.FieldPath, field.TypeString, value)
}
@@ -387,6 +418,26 @@ func (_u *PermissionUpdateOne) SetNillableType(v *string) *PermissionUpdateOne {
return _u
}
// SetParentCode sets the "parent_code" field.
func (_u *PermissionUpdateOne) SetParentCode(v string) *PermissionUpdateOne {
_u.mutation.SetParentCode(v)
return _u
}
// SetNillableParentCode sets the "parent_code" field if the given value is not nil.
func (_u *PermissionUpdateOne) SetNillableParentCode(v *string) *PermissionUpdateOne {
if v != nil {
_u.SetParentCode(*v)
}
return _u
}
// ClearParentCode clears the value of the "parent_code" field.
func (_u *PermissionUpdateOne) ClearParentCode() *PermissionUpdateOne {
_u.mutation.ClearParentCode()
return _u
}
// SetPath sets the "path" field.
func (_u *PermissionUpdateOne) SetPath(v string) *PermissionUpdateOne {
_u.mutation.SetPath(v)
@@ -578,6 +629,11 @@ func (_u *PermissionUpdateOne) check() error {
return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Permission.type": %w`, err)}
}
}
if v, ok := _u.mutation.ParentCode(); ok {
if err := permission.ParentCodeValidator(v); err != nil {
return &ValidationError{Name: "parent_code", err: fmt.Errorf(`ent: validator failed for field "Permission.parent_code": %w`, err)}
}
}
if v, ok := _u.mutation.Path(); ok {
if err := permission.PathValidator(v); err != nil {
return &ValidationError{Name: "path", err: fmt.Errorf(`ent: validator failed for field "Permission.path": %w`, err)}
@@ -634,6 +690,12 @@ func (_u *PermissionUpdateOne) sqlSave(ctx context.Context) (_node *Permission,
if value, ok := _u.mutation.GetType(); ok {
_spec.SetField(permission.FieldType, field.TypeString, value)
}
if value, ok := _u.mutation.ParentCode(); ok {
_spec.SetField(permission.FieldParentCode, field.TypeString, value)
}
if _u.mutation.ParentCodeCleared() {
_spec.ClearField(permission.FieldParentCode, field.TypeString)
}
if value, ok := _u.mutation.Path(); ok {
_spec.SetField(permission.FieldPath, field.TypeString, value)
}
+12 -6
View File
@@ -212,34 +212,40 @@ func init() {
permission.DefaultType = permissionDescType.Default.(string)
// permission.TypeValidator is a validator for the "type" field. It is called by the builders before save.
permission.TypeValidator = permissionDescType.Validators[0].(func(string) error)
// permissionDescParentCode is the schema descriptor for parent_code field.
permissionDescParentCode := permissionFields[3].Descriptor()
// permission.DefaultParentCode holds the default value on creation for the parent_code field.
permission.DefaultParentCode = permissionDescParentCode.Default.(string)
// permission.ParentCodeValidator is a validator for the "parent_code" field. It is called by the builders before save.
permission.ParentCodeValidator = permissionDescParentCode.Validators[0].(func(string) error)
// permissionDescPath is the schema descriptor for path field.
permissionDescPath := permissionFields[3].Descriptor()
permissionDescPath := permissionFields[4].Descriptor()
// permission.DefaultPath holds the default value on creation for the path field.
permission.DefaultPath = permissionDescPath.Default.(string)
// permission.PathValidator is a validator for the "path" field. It is called by the builders before save.
permission.PathValidator = permissionDescPath.Validators[0].(func(string) error)
// permissionDescIcon is the schema descriptor for icon field.
permissionDescIcon := permissionFields[4].Descriptor()
permissionDescIcon := permissionFields[5].Descriptor()
// permission.DefaultIcon holds the default value on creation for the icon field.
permission.DefaultIcon = permissionDescIcon.Default.(string)
// permission.IconValidator is a validator for the "icon" field. It is called by the builders before save.
permission.IconValidator = permissionDescIcon.Validators[0].(func(string) error)
// permissionDescSort is the schema descriptor for sort field.
permissionDescSort := permissionFields[5].Descriptor()
permissionDescSort := permissionFields[6].Descriptor()
// permission.DefaultSort holds the default value on creation for the sort field.
permission.DefaultSort = permissionDescSort.Default.(int)
// permissionDescRemark is the schema descriptor for remark field.
permissionDescRemark := permissionFields[6].Descriptor()
permissionDescRemark := permissionFields[7].Descriptor()
// permission.DefaultRemark holds the default value on creation for the remark field.
permission.DefaultRemark = permissionDescRemark.Default.(string)
// permission.RemarkValidator is a validator for the "remark" field. It is called by the builders before save.
permission.RemarkValidator = permissionDescRemark.Validators[0].(func(string) error)
// permissionDescCreatedAt is the schema descriptor for created_at field.
permissionDescCreatedAt := permissionFields[7].Descriptor()
permissionDescCreatedAt := permissionFields[8].Descriptor()
// permission.DefaultCreatedAt holds the default value on creation for the created_at field.
permission.DefaultCreatedAt = permissionDescCreatedAt.Default.(func() int64)
// permissionDescUpdatedAt is the schema descriptor for updated_at field.
permissionDescUpdatedAt := permissionFields[8].Descriptor()
permissionDescUpdatedAt := permissionFields[9].Descriptor()
// permission.DefaultUpdatedAt holds the default value on creation for the updated_at field.
permission.DefaultUpdatedAt = permissionDescUpdatedAt.Default.(func() int64)
roleFields := schema.Role{}.Fields()