Files
bj_power/bj_power_mes/ent/sysconfig.go
T
SunYF f274da044c feat: 重构BOM架构,新增基础设置与虚拟工位管理功能
本次重构删除原有BOM物料清单表,改用工单工艺组合×工艺物料清单作为唯一用料来源;新增系统基础设置表支持WMS地址、日志保留天数等配置,新增虚拟工位作业管理后台接口与前端页签控制功能,同时优化工位号校验逻辑、事件日志自动清理与工单用料查询能力。
2026-09-23 11:41:28 +08:00

126 lines
3.7 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_mes/ent/sysconfig"
"fmt"
"strings"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// SysConfig is the model entity for the SysConfig schema.
type SysConfig struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// 配置键,如 wms.base_url
Key string `json:"key,omitempty"`
// 配置值
Value string `json:"value,omitempty"`
// 说明
Remark string `json:"remark,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*SysConfig) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case sysconfig.FieldID:
values[i] = new(sql.NullInt64)
case sysconfig.FieldKey, sysconfig.FieldValue, sysconfig.FieldRemark:
values[i] = new(sql.NullString)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the SysConfig fields.
func (_m *SysConfig) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case sysconfig.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
_m.ID = int(value.Int64)
case sysconfig.FieldKey:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field key", values[i])
} else if value.Valid {
_m.Key = value.String
}
case sysconfig.FieldValue:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field value", values[i])
} else if value.Valid {
_m.Value = value.String
}
case sysconfig.FieldRemark:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field remark", values[i])
} else if value.Valid {
_m.Remark = value.String
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// GetValue returns the ent.Value that was dynamically selected and assigned to the SysConfig.
// This includes values selected through modifiers, order, etc.
func (_m *SysConfig) GetValue(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this SysConfig.
// Note that you need to call SysConfig.Unwrap() before calling this method if this SysConfig
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *SysConfig) Update() *SysConfigUpdateOne {
return NewSysConfigClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the SysConfig entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (_m *SysConfig) Unwrap() *SysConfig {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: SysConfig is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *SysConfig) String() string {
var builder strings.Builder
builder.WriteString("SysConfig(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("key=")
builder.WriteString(_m.Key)
builder.WriteString(", ")
builder.WriteString("value=")
builder.WriteString(_m.Value)
builder.WriteString(", ")
builder.WriteString("remark=")
builder.WriteString(_m.Remark)
builder.WriteByte(')')
return builder.String()
}
// SysConfigs is a parsable slice of SysConfig.
type SysConfigs []*SysConfig