// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved. package db import ( "fmt" "leit.com/leit_seat_aps/common" "xorm.io/core" ) type Pln_batchorder_intstatus struct { Finr int `xorm:"not null pk comment('车间编号') INT(0)" json:"finr"` Batchordernr string `xorm:"not null pk comment('批次单号') VARCHAR(18)" json:"batchordernr"` Releaseflag int `xorm:"not null comment('标记状态') INT(0)" json:"releaseflag"` Runningflag int `xorm:"not null comment('启动状态') INT(0)" json:"runningflag"` Finishflag int `xorm:"not null comment('结束状态') INT(0)" json:"finishflag"` Lastmodif string `xorm:"not null comment('上一次更改日期') VARCHAR(14)" json:"lastmodif"` Lastuser string `xorm:"not null comment('最后编辑人员') VARCHAR(20)" json:"lastuser"` Credatuz string `xorm:"not null comment('创建时间') VARCHAR(14)" json:"credatuz"` } func (t *Pln_batchorder_intstatus) TableName() string { return "pln_batchorder_intstatus" } // 清除string字段的右侧空格 func (t *Pln_batchorder_intstatus) Clipped() { common.TrimStruct(t, *t) } /****************************************************************************** * * @Function Name : *----------------------------------------------------------------------------- * * @Description : * * @Function Parameters: * * @Return Value : * * @Author : Lou Wenzhi * * @Date : 2021/3/10 11:18 * ******************************************************************************/ func (t *Pln_batchorder_intstatus) Add() error { e := G_DbEngine countrole := new(Pln_batchorder_intstatus) affw, err := e.Table("pln_batchorder_intstatus").ID(core.PK{G_FINR, t.Batchordernr}).Count(countrole) if err != nil { return err } if affw > 0 { return nil } _, err = e.Table("pln_batchorder_intstatus").Insert(t) if err != nil { fmt.Printf("err is :%v", err) return err } return nil }