SJA APS后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.1 KiB

package db
import (
"errors"
"github.com/go-xorm/xorm"
"leit.com/leit_seat_aps/common"
"xorm.io/core"
)
//客户订单错误表
type Pln_custorder_errorlst struct {
Finr int `xorm:"pk"`
Custordernr string `xorm:"pk"`
Pos int `xorm:"pk"`
Errortype int
Partid string
Supplygroupid string
Partfamilyid string
Attrcode int
Errorstatus string
Errorinfo string
Lastmodif string
Lastuser string
Credatuz string
}
func (t *Pln_custorder_errorlst) Clipped() {
common.TrimStruct(t, *t)
}
func (t *Pln_custorder_errorlst) TableName() string {
return "pln_custorder_errorlst"
}
//增
func (t *Pln_custorder_errorlst) Add() error {
e := G_DbEngine
coerrtab := new(Pln_custorder_errorlst)
affw, err := e.Table("pln_custorder_errorlst").ID(core.PK{G_FINR, t.Custordernr, t.Pos}).Count(coerrtab)
if err != nil {
return err
}
if affw > 0 {
return errors.New("数据已经存在!")
}
_, err = e.Table("pln_custorder_errorlst").Insert(t)
if err != nil {
return err
}
return nil
}
//增
func (t *Pln_custorder_errorlst) Insert(session *xorm.Session) error {
coerrtab := new(Pln_custorder_errorlst)
affw, err := session.Table("pln_custorder_errorlst").ID(core.PK{G_FINR, t.Custordernr, t.Pos}).Count(coerrtab)
if err != nil {
return err
}
if affw > 0 {
return errors.New("数据已经存在!")
}
_, err = session.Table("pln_custorder_errorlst").Insert(t)
if err != nil {
return err
}
return nil
}
//删
func (t *Pln_custorder_errorlst) Del() bool {
e := G_DbEngine
_, err := e.ID(core.PK{G_FINR, t.Custordernr, t.Pos}).Delete(&Pln_custorder_errorlst{})
if err != nil {
return false
}
return true
}
//改
func (t *Pln_custorder_errorlst) Update() bool {
e := G_DbEngine
_, err := e.ID(core.PK{G_FINR, t.Custordernr, t.Pos}).Update(t)
if err != nil {
return false
}
return true
}
//查
func (t *Pln_custorder_errorlst) SelectOne() (data Pln_custorder_errorlst, err error) {
e := G_DbEngine
_, err = e.ID(core.PK{G_FINR, t.Custordernr, t.Pos}).Get(&data)
if err != nil {
return data, err
}
return data, nil
}