浏览代码

切换分支

baishaojie 9 月之前
父节点
当前提交
bcd4ae84d4
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      http/handle/api/grfdApi.go

+ 4 - 3
http/handle/api/grfdApi.go

@@ -476,9 +476,10 @@ func GetFormula(pastureid string) error {
 					logging.Info("create SnowIds err", err)
 				}
 
-				_, err = tx.Exec("insert into feedtemplet(id,pastureid,ccid,tcode,backup1,backup2,tname,fttypeid,fttype)  values(?,?,null,?,?,?,?,1,'饲喂配方') "+
+				_, err = tx.Exec("insert into feedtemplet(id,pastureid,ccid,tcode,backup1,backup2,tname,fttypeid,fttype)  values(?,?,
+					(select ccid from feedtemplet where pastureid = ? limit 1),?,?,?,?,1,'饲喂配方') "+
 					" ON DUPLICATE KEY UPDATE tcode=?,backup2= ?",
-					ids, pastureid, ftId, ftId, modifiedAt, ftName, ftId, modifiedAt)
+					ids, pastureid,pastureid, ftId, ftId, modifiedAt, ftName, ftId, modifiedAt)
 
 				if err != nil {
 					return err
@@ -520,7 +521,7 @@ func GetFormula(pastureid string) error {
 						" (select id from feed where pastureid=? and backup1=? limit 1),?,?,?,(if(?='',0,?)),?,?) ",
 						ids, pastureid, pastureid, ftName, pastureid, fId, fName, fodderWeight, mixNo, autosecond, autosecond, autosecond, fName)
 					if err != nil {
-						logging.Info("3333333333", err)
+						logging.Info(err)
 						return err
 					}
 					_, err = tx.Exec("call updateFPbyFTChange((select id from feedtemplet where pastureid=? and tname=? limit 1),?,(select fttypeid from feedtemplet where pastureid=? and tname=? limit 1),1)", pastureid, ftName, pastureid, pastureid, ftName)