作者 tangxuhui

日常提交保存

@@ -45,6 +45,8 @@ func (d *PrdMoK3cloudDao) SyncDataPrdMoK3cloud(data []models.PrdMoK3cloud) error @@ -45,6 +45,8 @@ func (d *PrdMoK3cloudDao) SyncDataPrdMoK3cloud(data []models.PrdMoK3cloud) error
45 strTemp = append(strTemp, `'`+data[i].CreateDate.Format("2006-01-02 15:04:05.999")+`'`) 45 strTemp = append(strTemp, `'`+data[i].CreateDate.Format("2006-01-02 15:04:05.999")+`'`)
46 strTemp = append(strTemp, `'`+data[i].ModifyDate.Format("2006-01-02 15:04:05.999")+`'`) 46 strTemp = append(strTemp, `'`+data[i].ModifyDate.Format("2006-01-02 15:04:05.999")+`'`)
47 strTemp = append(strTemp, strconv.Itoa(int(data[i].DataVersion))) 47 strTemp = append(strTemp, strconv.Itoa(int(data[i].DataVersion)))
  48 + strTemp = append(strTemp, strconv.Itoa(data[i].PrdOrgId))
  49 + strTemp = append(strTemp, `'`+data[i].PrdOrgName+`'`)
48 sqlValues = append(sqlValues, "("+strings.Join(strTemp, ",")+")") 50 sqlValues = append(sqlValues, "("+strings.Join(strTemp, ",")+")")
49 } 51 }
50 var valueTemp []string 52 var valueTemp []string
@@ -58,7 +60,8 @@ func (d *PrdMoK3cloudDao) SyncDataPrdMoK3cloud(data []models.PrdMoK3cloud) error @@ -58,7 +60,8 @@ func (d *PrdMoK3cloudDao) SyncDataPrdMoK3cloud(data []models.PrdMoK3cloud) error
58 "id","bill_no","work_shop_id","work_shop_name", 60 "id","bill_no","work_shop_id","work_shop_name",
59 "material_id","material_name","material_number", 61 "material_id","material_name","material_number",
60 "plan_start_date","plan_finish_date","f_date", 62 "plan_start_date","plan_finish_date","f_date",
61 - "qty","create_date","modify_date","data_version" ) 63 + "qty","create_date","modify_date","data_version",
  64 + "prd_org_id","prd_org_name")
62 VALUES ` + 65 VALUES ` +
63 strings.Join(valueTemp, ",") + 66 strings.Join(valueTemp, ",") +
64 ` ON conflict ( "id" ) DO 67 ` ON conflict ( "id" ) DO
@@ -67,13 +70,15 @@ func (d *PrdMoK3cloudDao) SyncDataPrdMoK3cloud(data []models.PrdMoK3cloud) error @@ -67,13 +70,15 @@ func (d *PrdMoK3cloudDao) SyncDataPrdMoK3cloud(data []models.PrdMoK3cloud) error
67 "bill_no","work_shop_id","work_shop_name", 70 "bill_no","work_shop_id","work_shop_name",
68 "material_id","material_name","material_number", 71 "material_id","material_name","material_number",
69 "plan_start_date","plan_finish_date","f_date", 72 "plan_start_date","plan_finish_date","f_date",
70 - "qty","create_date","modify_date","data_version") = ( 73 + "qty","create_date","modify_date","data_version",
  74 + "prd_org_id","prd_org_name") = (
71 EXCLUDED."bill_no",EXCLUDED."work_shop_id", 75 EXCLUDED."bill_no",EXCLUDED."work_shop_id",
72 EXCLUDED."work_shop_name",EXCLUDED."material_id", 76 EXCLUDED."work_shop_name",EXCLUDED."material_id",
73 EXCLUDED."material_name",EXCLUDED."material_number", 77 EXCLUDED."material_name",EXCLUDED."material_number",
74 EXCLUDED."plan_start_date",EXCLUDED."plan_finish_date", 78 EXCLUDED."plan_start_date",EXCLUDED."plan_finish_date",
75 EXCLUDED."f_date",EXCLUDED."qty",EXCLUDED."create_date", 79 EXCLUDED."f_date",EXCLUDED."qty",EXCLUDED."create_date",
76 - EXCLUDED."modify_date",EXCLUDED."data_version" 80 + EXCLUDED."modify_date",EXCLUDED."data_version",
  81 + EXCLUDED."prd_org_id",EXCLUDED."prd_org_name"
77 )` 82 )`
78 _, err := d.transactionContext.PgTx.Exec(sql) 83 _, err := d.transactionContext.PgTx.Exec(sql)
79 if err != nil { 84 if err != nil {
@@ -20,6 +20,6 @@ type PrdMoK3cloud struct { @@ -20,6 +20,6 @@ type PrdMoK3cloud struct {
20 CreateDate time.Time `comment:"创建时间" pg:"create_date"` 20 CreateDate time.Time `comment:"创建时间" pg:"create_date"`
21 ModifyDate time.Time `comment:"修改时间" pg:"modify_date"` 21 ModifyDate time.Time `comment:"修改时间" pg:"modify_date"`
22 DataVersion int64 `comment:"数据版本" pg:"data_version"` 22 DataVersion int64 `comment:"数据版本" pg:"data_version"`
23 - PrdOrgId int `comment:"生产组织" pg:"data_version"`  
24 - PrdOrgName string `comment:"生产组织名称" pg:"data_version"` 23 + PrdOrgId int `comment:"生产组织" pg:"prd_org_id"`
  24 + PrdOrgName string `comment:"生产组织名称" pg:"prd_org_name"`
25 } 25 }