...
|
...
|
@@ -45,6 +45,8 @@ func (d *PrdMoK3cloudDao) SyncDataPrdMoK3cloud(data []models.PrdMoK3cloud) error |
|
|
strTemp = append(strTemp, `'`+data[i].CreateDate.Format("2006-01-02 15:04:05.999")+`'`)
|
|
|
strTemp = append(strTemp, `'`+data[i].ModifyDate.Format("2006-01-02 15:04:05.999")+`'`)
|
|
|
strTemp = append(strTemp, strconv.Itoa(int(data[i].DataVersion)))
|
|
|
strTemp = append(strTemp, strconv.Itoa(data[i].PrdOrgId))
|
|
|
strTemp = append(strTemp, `'`+data[i].PrdOrgName+`'`)
|
|
|
sqlValues = append(sqlValues, "("+strings.Join(strTemp, ",")+")")
|
|
|
}
|
|
|
var valueTemp []string
|
...
|
...
|
@@ -58,7 +60,8 @@ func (d *PrdMoK3cloudDao) SyncDataPrdMoK3cloud(data []models.PrdMoK3cloud) error |
|
|
"id","bill_no","work_shop_id","work_shop_name",
|
|
|
"material_id","material_name","material_number",
|
|
|
"plan_start_date","plan_finish_date","f_date",
|
|
|
"qty","create_date","modify_date","data_version" )
|
|
|
"qty","create_date","modify_date","data_version",
|
|
|
"prd_org_id","prd_org_name")
|
|
|
VALUES ` +
|
|
|
strings.Join(valueTemp, ",") +
|
|
|
` ON conflict ( "id" ) DO
|
...
|
...
|
@@ -67,13 +70,15 @@ func (d *PrdMoK3cloudDao) SyncDataPrdMoK3cloud(data []models.PrdMoK3cloud) error |
|
|
"bill_no","work_shop_id","work_shop_name",
|
|
|
"material_id","material_name","material_number",
|
|
|
"plan_start_date","plan_finish_date","f_date",
|
|
|
"qty","create_date","modify_date","data_version") = (
|
|
|
"qty","create_date","modify_date","data_version",
|
|
|
"prd_org_id","prd_org_name") = (
|
|
|
EXCLUDED."bill_no",EXCLUDED."work_shop_id",
|
|
|
EXCLUDED."work_shop_name",EXCLUDED."material_id",
|
|
|
EXCLUDED."material_name",EXCLUDED."material_number",
|
|
|
EXCLUDED."plan_start_date",EXCLUDED."plan_finish_date",
|
|
|
EXCLUDED."f_date",EXCLUDED."qty",EXCLUDED."create_date",
|
|
|
EXCLUDED."modify_date",EXCLUDED."data_version"
|
|
|
EXCLUDED."modify_date",EXCLUDED."data_version",
|
|
|
EXCLUDED."prd_org_id",EXCLUDED."prd_org_name"
|
|
|
)`
|
|
|
_, err := d.transactionContext.PgTx.Exec(sql)
|
|
|
if err != nil {
|
...
|
...
|
|