package tmpzcgf import ( . "dashoo.cn/backend/api/mydb" . "dashoo.cn/utils/db" "github.com/go-xorm/xorm" ) type TmpzcgfService1 struct { MyServiceBase } func GetTmpzcgfService1(xormEngine *xorm.Engine) *TmpzcgfService1 { s := new(TmpzcgfService1) s.DBE = xormEngine return s } func (s *TmpzcgfService1) UpdateCertSubIsType3 () error { sql := "UPDATE OilSupplierCertSub b SET "+ "b.SupplierId = IFNULL((SELECT a.`SupplierId` FROM OilSupplierCertAppend a WHERE a.`OldId` = b.OldId AND a.AppendType = b.SupplierTypeCode AND a.ApplyDate = b.CreateOn limit 1), 0), "+ "b.SupplierCertId = IFNULL((SELECT a.`SupplierCertId` FROM OilSupplierCertAppend a WHERE a.`OldId` = b.OldId AND a.AppendType = b.SupplierTypeCode AND a.ApplyDate = b.CreateOn limit 1), 0), "+ "b.SupplierCertAppendId = IFNULL((SELECT a.`Id` FROM OilSupplierCertAppend a WHERE a.`OldId` = b.OldId AND a.AppendType = b.SupplierTypeCode AND a.ApplyDate = b.CreateOn limit 1), 0) "+ "where b.Type='3'" _, err := s.DBE.Query(sql) LogError(err) return err }