2
3
Просмотр исходного кода

后:信息变更改曾用名问题

dubch 5 лет назад
Родитель
Сommit
c26a4bd89a
1 измененных файлов с 15 добавлено и 13 удалено
  1. 15 13
      src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

+ 15 - 13
src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

@@ -1882,19 +1882,21 @@ func (this *InfoChangeController) CommonAuditEntity() {
 		var info infochange.OilInfoChangeItem
 		svc := supplier.GetOilSupplierService(utils.DBE)
 		svc.GetEntityByWhere(OilInfoChangeItemName, "SelectItem = 'SupplierName' and InfoId = "+infoId, &info)
-		// 曾用名存到主表
-		oilSupplier.OldSupplierName = info.BeChangeInfo
-		svc.UpdateEntityBywheretbl(OilSupplierName, &oilSupplier, []string{"OldSupplierName"}, "Id = "+strconv.Itoa(infoChangeEntityAfterUpdate.SupplierId))
-
-		oldName.OldName = info.BeChangeInfo
-		oldName.Name = info.ChangeInfo
-		oldName.SupplierId = infoChangeEntityAfterUpdate.SupplierId
-		oldName.GfId = 0
-		oldName.CreateOn = info.CreateOn
-		oldName.CreateBy = info.CreateBy
-		oldName.CreateUserId = info.CreateUserId
-		// 曾用名存到子表
-		svc.InsertEntityBytbl("OilSupplierOldName", &oldName)
+		if info.Id > 0 {
+			// 曾用名存到主表
+			oilSupplier.OldSupplierName = info.BeChangeInfo
+			svc.UpdateEntityBywheretbl(OilSupplierName, &oilSupplier, []string{"OldSupplierName"}, "Id = "+strconv.Itoa(infoChangeEntityAfterUpdate.SupplierId))
+
+			oldName.OldName = info.BeChangeInfo
+			oldName.Name = info.ChangeInfo
+			oldName.SupplierId = infoChangeEntityAfterUpdate.SupplierId
+			oldName.GfId = 0
+			oldName.CreateOn = info.CreateOn
+			oldName.CreateBy = info.CreateBy
+			oldName.CreateUserId = info.CreateUserId
+			// 曾用名存到子表
+			svc.InsertEntityBytbl("OilSupplierOldName", &oldName)
+		}
 
 		this.updateChangeInfo(infoChangeEntityAfterUpdate.SupplierId, infoId)
 	}