Files
bj_power/bj_power_mes/ent/processstep_update.go
T
SunYF b032f47fc7 feat: 新增产品工艺管理与工序审核功能
- 新增产品工艺(product_process)及明细(product_process_item)数据模型
- 新增工序审核开关(need_audit)与审核角色(audit_role)字段
- 新增待审核签字页面与路由
- 优化 WMS/MES 接口交互,增加业务错误处理与友好提示
- 补充库存过滤逻辑,避免返回已出库 SN 数据
- 调整默认查询时间范围为近一个月,优化用户体验
2026-10-09 13:46:33 +08:00

757 lines
23 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_mes/ent/predicate"
"bj_power_mes/ent/processstep"
"context"
"errors"
"fmt"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/dialect/sql/sqljson"
"entgo.io/ent/schema/field"
)
// ProcessStepUpdate is the builder for updating ProcessStep entities.
type ProcessStepUpdate struct {
config
hooks []Hook
mutation *ProcessStepMutation
modifiers []func(*sql.UpdateBuilder)
}
// Where appends a list predicates to the ProcessStepUpdate builder.
func (_u *ProcessStepUpdate) Where(ps ...predicate.ProcessStep) *ProcessStepUpdate {
_u.mutation.Where(ps...)
return _u
}
// SetFlowId sets the "flowId" field.
func (_u *ProcessStepUpdate) SetFlowId(v int) *ProcessStepUpdate {
_u.mutation.ResetFlowId()
_u.mutation.SetFlowId(v)
return _u
}
// SetNillableFlowId sets the "flowId" field if the given value is not nil.
func (_u *ProcessStepUpdate) SetNillableFlowId(v *int) *ProcessStepUpdate {
if v != nil {
_u.SetFlowId(*v)
}
return _u
}
// AddFlowId adds value to the "flowId" field.
func (_u *ProcessStepUpdate) AddFlowId(v int) *ProcessStepUpdate {
_u.mutation.AddFlowId(v)
return _u
}
// ClearFlowId clears the value of the "flowId" field.
func (_u *ProcessStepUpdate) ClearFlowId() *ProcessStepUpdate {
_u.mutation.ClearFlowId()
return _u
}
// SetSeq sets the "seq" field.
func (_u *ProcessStepUpdate) SetSeq(v int) *ProcessStepUpdate {
_u.mutation.ResetSeq()
_u.mutation.SetSeq(v)
return _u
}
// SetNillableSeq sets the "seq" field if the given value is not nil.
func (_u *ProcessStepUpdate) SetNillableSeq(v *int) *ProcessStepUpdate {
if v != nil {
_u.SetSeq(*v)
}
return _u
}
// AddSeq adds value to the "seq" field.
func (_u *ProcessStepUpdate) AddSeq(v int) *ProcessStepUpdate {
_u.mutation.AddSeq(v)
return _u
}
// SetName sets the "name" field.
func (_u *ProcessStepUpdate) SetName(v string) *ProcessStepUpdate {
_u.mutation.SetName(v)
return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
func (_u *ProcessStepUpdate) SetNillableName(v *string) *ProcessStepUpdate {
if v != nil {
_u.SetName(*v)
}
return _u
}
// SetCollectType sets the "collectType" field.
func (_u *ProcessStepUpdate) SetCollectType(v string) *ProcessStepUpdate {
_u.mutation.SetCollectType(v)
return _u
}
// SetNillableCollectType sets the "collectType" field if the given value is not nil.
func (_u *ProcessStepUpdate) SetNillableCollectType(v *string) *ProcessStepUpdate {
if v != nil {
_u.SetCollectType(*v)
}
return _u
}
// SetIsTorque sets the "isTorque" field.
func (_u *ProcessStepUpdate) SetIsTorque(v bool) *ProcessStepUpdate {
_u.mutation.SetIsTorque(v)
return _u
}
// SetNillableIsTorque sets the "isTorque" field if the given value is not nil.
func (_u *ProcessStepUpdate) SetNillableIsTorque(v *bool) *ProcessStepUpdate {
if v != nil {
_u.SetIsTorque(*v)
}
return _u
}
// SetNeedCheck sets the "needCheck" field.
func (_u *ProcessStepUpdate) SetNeedCheck(v bool) *ProcessStepUpdate {
_u.mutation.SetNeedCheck(v)
return _u
}
// SetNillableNeedCheck sets the "needCheck" field if the given value is not nil.
func (_u *ProcessStepUpdate) SetNillableNeedCheck(v *bool) *ProcessStepUpdate {
if v != nil {
_u.SetNeedCheck(*v)
}
return _u
}
// SetNeedOperatorSign sets the "needOperatorSign" field.
func (_u *ProcessStepUpdate) SetNeedOperatorSign(v bool) *ProcessStepUpdate {
_u.mutation.SetNeedOperatorSign(v)
return _u
}
// SetNillableNeedOperatorSign sets the "needOperatorSign" field if the given value is not nil.
func (_u *ProcessStepUpdate) SetNillableNeedOperatorSign(v *bool) *ProcessStepUpdate {
if v != nil {
_u.SetNeedOperatorSign(*v)
}
return _u
}
// SetNeedInspectorSign sets the "needInspectorSign" field.
func (_u *ProcessStepUpdate) SetNeedInspectorSign(v bool) *ProcessStepUpdate {
_u.mutation.SetNeedInspectorSign(v)
return _u
}
// SetNillableNeedInspectorSign sets the "needInspectorSign" field if the given value is not nil.
func (_u *ProcessStepUpdate) SetNillableNeedInspectorSign(v *bool) *ProcessStepUpdate {
if v != nil {
_u.SetNeedInspectorSign(*v)
}
return _u
}
// SetNeedAudit sets the "needAudit" field.
func (_u *ProcessStepUpdate) SetNeedAudit(v bool) *ProcessStepUpdate {
_u.mutation.SetNeedAudit(v)
return _u
}
// SetNillableNeedAudit sets the "needAudit" field if the given value is not nil.
func (_u *ProcessStepUpdate) SetNillableNeedAudit(v *bool) *ProcessStepUpdate {
if v != nil {
_u.SetNeedAudit(*v)
}
return _u
}
// SetAuditRole sets the "auditRole" field.
func (_u *ProcessStepUpdate) SetAuditRole(v string) *ProcessStepUpdate {
_u.mutation.SetAuditRole(v)
return _u
}
// SetNillableAuditRole sets the "auditRole" field if the given value is not nil.
func (_u *ProcessStepUpdate) SetNillableAuditRole(v *string) *ProcessStepUpdate {
if v != nil {
_u.SetAuditRole(*v)
}
return _u
}
// ClearAuditRole clears the value of the "auditRole" field.
func (_u *ProcessStepUpdate) ClearAuditRole() *ProcessStepUpdate {
_u.mutation.ClearAuditRole()
return _u
}
// SetAttachment sets the "attachment" field.
func (_u *ProcessStepUpdate) SetAttachment(v []map[string]string) *ProcessStepUpdate {
_u.mutation.SetAttachment(v)
return _u
}
// AppendAttachment appends value to the "attachment" field.
func (_u *ProcessStepUpdate) AppendAttachment(v []map[string]string) *ProcessStepUpdate {
_u.mutation.AppendAttachment(v)
return _u
}
// ClearAttachment clears the value of the "attachment" field.
func (_u *ProcessStepUpdate) ClearAttachment() *ProcessStepUpdate {
_u.mutation.ClearAttachment()
return _u
}
// SetRemark sets the "remark" field.
func (_u *ProcessStepUpdate) SetRemark(v string) *ProcessStepUpdate {
_u.mutation.SetRemark(v)
return _u
}
// SetNillableRemark sets the "remark" field if the given value is not nil.
func (_u *ProcessStepUpdate) SetNillableRemark(v *string) *ProcessStepUpdate {
if v != nil {
_u.SetRemark(*v)
}
return _u
}
// Mutation returns the ProcessStepMutation object of the builder.
func (_u *ProcessStepUpdate) Mutation() *ProcessStepMutation {
return _u.mutation
}
// Save executes the query and returns the number of nodes affected by the update operation.
func (_u *ProcessStepUpdate) Save(ctx context.Context) (int, error) {
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *ProcessStepUpdate) SaveX(ctx context.Context) int {
affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return affected
}
// Exec executes the query.
func (_u *ProcessStepUpdate) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *ProcessStepUpdate) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// check runs all checks and user-defined validators on the builder.
func (_u *ProcessStepUpdate) check() error {
if v, ok := _u.mutation.Name(); ok {
if err := processstep.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.name": %w`, err)}
}
}
if v, ok := _u.mutation.CollectType(); ok {
if err := processstep.CollectTypeValidator(v); err != nil {
return &ValidationError{Name: "collectType", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.collectType": %w`, err)}
}
}
if v, ok := _u.mutation.AuditRole(); ok {
if err := processstep.AuditRoleValidator(v); err != nil {
return &ValidationError{Name: "auditRole", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.auditRole": %w`, err)}
}
}
if v, ok := _u.mutation.Remark(); ok {
if err := processstep.RemarkValidator(v); err != nil {
return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.remark": %w`, err)}
}
}
return nil
}
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (_u *ProcessStepUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *ProcessStepUpdate {
_u.modifiers = append(_u.modifiers, modifiers...)
return _u
}
func (_u *ProcessStepUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(processstep.Table, processstep.Columns, sqlgraph.NewFieldSpec(processstep.FieldID, field.TypeInt))
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.FlowId(); ok {
_spec.SetField(processstep.FieldFlowId, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedFlowId(); ok {
_spec.AddField(processstep.FieldFlowId, field.TypeInt, value)
}
if _u.mutation.FlowIdCleared() {
_spec.ClearField(processstep.FieldFlowId, field.TypeInt)
}
if value, ok := _u.mutation.Seq(); ok {
_spec.SetField(processstep.FieldSeq, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedSeq(); ok {
_spec.AddField(processstep.FieldSeq, field.TypeInt, value)
}
if value, ok := _u.mutation.Name(); ok {
_spec.SetField(processstep.FieldName, field.TypeString, value)
}
if value, ok := _u.mutation.CollectType(); ok {
_spec.SetField(processstep.FieldCollectType, field.TypeString, value)
}
if value, ok := _u.mutation.IsTorque(); ok {
_spec.SetField(processstep.FieldIsTorque, field.TypeBool, value)
}
if value, ok := _u.mutation.NeedCheck(); ok {
_spec.SetField(processstep.FieldNeedCheck, field.TypeBool, value)
}
if value, ok := _u.mutation.NeedOperatorSign(); ok {
_spec.SetField(processstep.FieldNeedOperatorSign, field.TypeBool, value)
}
if value, ok := _u.mutation.NeedInspectorSign(); ok {
_spec.SetField(processstep.FieldNeedInspectorSign, field.TypeBool, value)
}
if value, ok := _u.mutation.NeedAudit(); ok {
_spec.SetField(processstep.FieldNeedAudit, field.TypeBool, value)
}
if value, ok := _u.mutation.AuditRole(); ok {
_spec.SetField(processstep.FieldAuditRole, field.TypeString, value)
}
if _u.mutation.AuditRoleCleared() {
_spec.ClearField(processstep.FieldAuditRole, field.TypeString)
}
if value, ok := _u.mutation.Attachment(); ok {
_spec.SetField(processstep.FieldAttachment, field.TypeJSON, value)
}
if value, ok := _u.mutation.AppendedAttachment(); ok {
_spec.AddModifier(func(u *sql.UpdateBuilder) {
sqljson.Append(u, processstep.FieldAttachment, value)
})
}
if _u.mutation.AttachmentCleared() {
_spec.ClearField(processstep.FieldAttachment, field.TypeJSON)
}
if value, ok := _u.mutation.Remark(); ok {
_spec.SetField(processstep.FieldRemark, field.TypeString, value)
}
_spec.AddModifiers(_u.modifiers...)
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{processstep.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return 0, err
}
_u.mutation.done = true
return _node, nil
}
// ProcessStepUpdateOne is the builder for updating a single ProcessStep entity.
type ProcessStepUpdateOne struct {
config
fields []string
hooks []Hook
mutation *ProcessStepMutation
modifiers []func(*sql.UpdateBuilder)
}
// SetFlowId sets the "flowId" field.
func (_u *ProcessStepUpdateOne) SetFlowId(v int) *ProcessStepUpdateOne {
_u.mutation.ResetFlowId()
_u.mutation.SetFlowId(v)
return _u
}
// SetNillableFlowId sets the "flowId" field if the given value is not nil.
func (_u *ProcessStepUpdateOne) SetNillableFlowId(v *int) *ProcessStepUpdateOne {
if v != nil {
_u.SetFlowId(*v)
}
return _u
}
// AddFlowId adds value to the "flowId" field.
func (_u *ProcessStepUpdateOne) AddFlowId(v int) *ProcessStepUpdateOne {
_u.mutation.AddFlowId(v)
return _u
}
// ClearFlowId clears the value of the "flowId" field.
func (_u *ProcessStepUpdateOne) ClearFlowId() *ProcessStepUpdateOne {
_u.mutation.ClearFlowId()
return _u
}
// SetSeq sets the "seq" field.
func (_u *ProcessStepUpdateOne) SetSeq(v int) *ProcessStepUpdateOne {
_u.mutation.ResetSeq()
_u.mutation.SetSeq(v)
return _u
}
// SetNillableSeq sets the "seq" field if the given value is not nil.
func (_u *ProcessStepUpdateOne) SetNillableSeq(v *int) *ProcessStepUpdateOne {
if v != nil {
_u.SetSeq(*v)
}
return _u
}
// AddSeq adds value to the "seq" field.
func (_u *ProcessStepUpdateOne) AddSeq(v int) *ProcessStepUpdateOne {
_u.mutation.AddSeq(v)
return _u
}
// SetName sets the "name" field.
func (_u *ProcessStepUpdateOne) SetName(v string) *ProcessStepUpdateOne {
_u.mutation.SetName(v)
return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
func (_u *ProcessStepUpdateOne) SetNillableName(v *string) *ProcessStepUpdateOne {
if v != nil {
_u.SetName(*v)
}
return _u
}
// SetCollectType sets the "collectType" field.
func (_u *ProcessStepUpdateOne) SetCollectType(v string) *ProcessStepUpdateOne {
_u.mutation.SetCollectType(v)
return _u
}
// SetNillableCollectType sets the "collectType" field if the given value is not nil.
func (_u *ProcessStepUpdateOne) SetNillableCollectType(v *string) *ProcessStepUpdateOne {
if v != nil {
_u.SetCollectType(*v)
}
return _u
}
// SetIsTorque sets the "isTorque" field.
func (_u *ProcessStepUpdateOne) SetIsTorque(v bool) *ProcessStepUpdateOne {
_u.mutation.SetIsTorque(v)
return _u
}
// SetNillableIsTorque sets the "isTorque" field if the given value is not nil.
func (_u *ProcessStepUpdateOne) SetNillableIsTorque(v *bool) *ProcessStepUpdateOne {
if v != nil {
_u.SetIsTorque(*v)
}
return _u
}
// SetNeedCheck sets the "needCheck" field.
func (_u *ProcessStepUpdateOne) SetNeedCheck(v bool) *ProcessStepUpdateOne {
_u.mutation.SetNeedCheck(v)
return _u
}
// SetNillableNeedCheck sets the "needCheck" field if the given value is not nil.
func (_u *ProcessStepUpdateOne) SetNillableNeedCheck(v *bool) *ProcessStepUpdateOne {
if v != nil {
_u.SetNeedCheck(*v)
}
return _u
}
// SetNeedOperatorSign sets the "needOperatorSign" field.
func (_u *ProcessStepUpdateOne) SetNeedOperatorSign(v bool) *ProcessStepUpdateOne {
_u.mutation.SetNeedOperatorSign(v)
return _u
}
// SetNillableNeedOperatorSign sets the "needOperatorSign" field if the given value is not nil.
func (_u *ProcessStepUpdateOne) SetNillableNeedOperatorSign(v *bool) *ProcessStepUpdateOne {
if v != nil {
_u.SetNeedOperatorSign(*v)
}
return _u
}
// SetNeedInspectorSign sets the "needInspectorSign" field.
func (_u *ProcessStepUpdateOne) SetNeedInspectorSign(v bool) *ProcessStepUpdateOne {
_u.mutation.SetNeedInspectorSign(v)
return _u
}
// SetNillableNeedInspectorSign sets the "needInspectorSign" field if the given value is not nil.
func (_u *ProcessStepUpdateOne) SetNillableNeedInspectorSign(v *bool) *ProcessStepUpdateOne {
if v != nil {
_u.SetNeedInspectorSign(*v)
}
return _u
}
// SetNeedAudit sets the "needAudit" field.
func (_u *ProcessStepUpdateOne) SetNeedAudit(v bool) *ProcessStepUpdateOne {
_u.mutation.SetNeedAudit(v)
return _u
}
// SetNillableNeedAudit sets the "needAudit" field if the given value is not nil.
func (_u *ProcessStepUpdateOne) SetNillableNeedAudit(v *bool) *ProcessStepUpdateOne {
if v != nil {
_u.SetNeedAudit(*v)
}
return _u
}
// SetAuditRole sets the "auditRole" field.
func (_u *ProcessStepUpdateOne) SetAuditRole(v string) *ProcessStepUpdateOne {
_u.mutation.SetAuditRole(v)
return _u
}
// SetNillableAuditRole sets the "auditRole" field if the given value is not nil.
func (_u *ProcessStepUpdateOne) SetNillableAuditRole(v *string) *ProcessStepUpdateOne {
if v != nil {
_u.SetAuditRole(*v)
}
return _u
}
// ClearAuditRole clears the value of the "auditRole" field.
func (_u *ProcessStepUpdateOne) ClearAuditRole() *ProcessStepUpdateOne {
_u.mutation.ClearAuditRole()
return _u
}
// SetAttachment sets the "attachment" field.
func (_u *ProcessStepUpdateOne) SetAttachment(v []map[string]string) *ProcessStepUpdateOne {
_u.mutation.SetAttachment(v)
return _u
}
// AppendAttachment appends value to the "attachment" field.
func (_u *ProcessStepUpdateOne) AppendAttachment(v []map[string]string) *ProcessStepUpdateOne {
_u.mutation.AppendAttachment(v)
return _u
}
// ClearAttachment clears the value of the "attachment" field.
func (_u *ProcessStepUpdateOne) ClearAttachment() *ProcessStepUpdateOne {
_u.mutation.ClearAttachment()
return _u
}
// SetRemark sets the "remark" field.
func (_u *ProcessStepUpdateOne) SetRemark(v string) *ProcessStepUpdateOne {
_u.mutation.SetRemark(v)
return _u
}
// SetNillableRemark sets the "remark" field if the given value is not nil.
func (_u *ProcessStepUpdateOne) SetNillableRemark(v *string) *ProcessStepUpdateOne {
if v != nil {
_u.SetRemark(*v)
}
return _u
}
// Mutation returns the ProcessStepMutation object of the builder.
func (_u *ProcessStepUpdateOne) Mutation() *ProcessStepMutation {
return _u.mutation
}
// Where appends a list predicates to the ProcessStepUpdate builder.
func (_u *ProcessStepUpdateOne) Where(ps ...predicate.ProcessStep) *ProcessStepUpdateOne {
_u.mutation.Where(ps...)
return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (_u *ProcessStepUpdateOne) Select(field string, fields ...string) *ProcessStepUpdateOne {
_u.fields = append([]string{field}, fields...)
return _u
}
// Save executes the query and returns the updated ProcessStep entity.
func (_u *ProcessStepUpdateOne) Save(ctx context.Context) (*ProcessStep, error) {
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *ProcessStepUpdateOne) SaveX(ctx context.Context) *ProcessStep {
node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return node
}
// Exec executes the query on the entity.
func (_u *ProcessStepUpdateOne) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *ProcessStepUpdateOne) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// check runs all checks and user-defined validators on the builder.
func (_u *ProcessStepUpdateOne) check() error {
if v, ok := _u.mutation.Name(); ok {
if err := processstep.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.name": %w`, err)}
}
}
if v, ok := _u.mutation.CollectType(); ok {
if err := processstep.CollectTypeValidator(v); err != nil {
return &ValidationError{Name: "collectType", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.collectType": %w`, err)}
}
}
if v, ok := _u.mutation.AuditRole(); ok {
if err := processstep.AuditRoleValidator(v); err != nil {
return &ValidationError{Name: "auditRole", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.auditRole": %w`, err)}
}
}
if v, ok := _u.mutation.Remark(); ok {
if err := processstep.RemarkValidator(v); err != nil {
return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.remark": %w`, err)}
}
}
return nil
}
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (_u *ProcessStepUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *ProcessStepUpdateOne {
_u.modifiers = append(_u.modifiers, modifiers...)
return _u
}
func (_u *ProcessStepUpdateOne) sqlSave(ctx context.Context) (_node *ProcessStep, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(processstep.Table, processstep.Columns, sqlgraph.NewFieldSpec(processstep.FieldID, field.TypeInt))
id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "ProcessStep.id" for update`)}
}
_spec.Node.ID.Value = id
if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, processstep.FieldID)
for _, f := range fields {
if !processstep.ValidColumn(f) {
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
if f != processstep.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, f)
}
}
}
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.FlowId(); ok {
_spec.SetField(processstep.FieldFlowId, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedFlowId(); ok {
_spec.AddField(processstep.FieldFlowId, field.TypeInt, value)
}
if _u.mutation.FlowIdCleared() {
_spec.ClearField(processstep.FieldFlowId, field.TypeInt)
}
if value, ok := _u.mutation.Seq(); ok {
_spec.SetField(processstep.FieldSeq, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedSeq(); ok {
_spec.AddField(processstep.FieldSeq, field.TypeInt, value)
}
if value, ok := _u.mutation.Name(); ok {
_spec.SetField(processstep.FieldName, field.TypeString, value)
}
if value, ok := _u.mutation.CollectType(); ok {
_spec.SetField(processstep.FieldCollectType, field.TypeString, value)
}
if value, ok := _u.mutation.IsTorque(); ok {
_spec.SetField(processstep.FieldIsTorque, field.TypeBool, value)
}
if value, ok := _u.mutation.NeedCheck(); ok {
_spec.SetField(processstep.FieldNeedCheck, field.TypeBool, value)
}
if value, ok := _u.mutation.NeedOperatorSign(); ok {
_spec.SetField(processstep.FieldNeedOperatorSign, field.TypeBool, value)
}
if value, ok := _u.mutation.NeedInspectorSign(); ok {
_spec.SetField(processstep.FieldNeedInspectorSign, field.TypeBool, value)
}
if value, ok := _u.mutation.NeedAudit(); ok {
_spec.SetField(processstep.FieldNeedAudit, field.TypeBool, value)
}
if value, ok := _u.mutation.AuditRole(); ok {
_spec.SetField(processstep.FieldAuditRole, field.TypeString, value)
}
if _u.mutation.AuditRoleCleared() {
_spec.ClearField(processstep.FieldAuditRole, field.TypeString)
}
if value, ok := _u.mutation.Attachment(); ok {
_spec.SetField(processstep.FieldAttachment, field.TypeJSON, value)
}
if value, ok := _u.mutation.AppendedAttachment(); ok {
_spec.AddModifier(func(u *sql.UpdateBuilder) {
sqljson.Append(u, processstep.FieldAttachment, value)
})
}
if _u.mutation.AttachmentCleared() {
_spec.ClearField(processstep.FieldAttachment, field.TypeJSON)
}
if value, ok := _u.mutation.Remark(); ok {
_spec.SetField(processstep.FieldRemark, field.TypeString, value)
}
_spec.AddModifiers(_u.modifiers...)
_node = &ProcessStep{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{processstep.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
_u.mutation.done = true
return _node, nil
}