tmpzcgfService.go 984 B

1234567891011121314151617181920212223242526272829
  1. package tmpzcgf
  2. import (
  3. . "dashoo.cn/backend/api/mydb"
  4. . "dashoo.cn/utils/db"
  5. "github.com/go-xorm/xorm"
  6. )
  7. type TmpzcgfService1 struct {
  8. MyServiceBase
  9. }
  10. func GetTmpzcgfService1(xormEngine *xorm.Engine) *TmpzcgfService1 {
  11. s := new(TmpzcgfService1)
  12. s.DBE = xormEngine
  13. return s
  14. }
  15. func (s *TmpzcgfService1) UpdateCertSubIsType3 () error {
  16. sql := "UPDATE OilSupplierCertSub b SET "+
  17. "b.SupplierId = (SELECT a.`SupplierId` FROM OilSupplierCertAppend a WHERE a.`OldId` = b.OldId AND a.AppendType = b.SupplierTypeCode AND a.ApplyDate = b.CreateOn ), "+
  18. "b.SupplierCertId = (SELECT a.`SupplierCertId` FROM OilSupplierCertAppend a WHERE a.`OldId` = b.OldId AND a.AppendType = b.SupplierTypeCode AND a.ApplyDate = b.CreateOn ), "+
  19. "b.SupplierCertAppendId = (SELECT a.`Id` FROM OilSupplierCertAppend a WHERE a.`OldId` = b.OldId AND a.AppendType = b.SupplierTypeCode AND a.ApplyDate = b.CreateOn ) "+
  20. "where b.Type='3'"
  21. _, err := s.DBE.Query(sql)
  22. LogError(err)
  23. return err
  24. }