正在显示
1 个修改的文件
包含
59 行增加
和
0 行删除
| 1 | +package dao | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models" | ||
| 6 | +) | ||
| 7 | + | ||
| 8 | +type MaterialK3cloudDao struct { | ||
| 9 | + transactionContext *pgTransaction.TransactionContext | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +//SyncDataMaterialK3cloud 同步MaterialK3cloud表数据 | ||
| 13 | +func (d *MaterialK3cloudDao) SyncDataMaterialK3cloud(data []models.MaterialK3cloud) error { | ||
| 14 | + // -- 插入或者更新 | ||
| 15 | + // INSERT INTO "manufacture"."material_k3cloud" ( | ||
| 16 | + // "material_id","name","number","specification","forbid_status", | ||
| 17 | + // "erp_cls_id","base_unit_id","base_unit_name","create_date", | ||
| 18 | + // "modify_date","forbid_date","approve_date","material_group", | ||
| 19 | + // "material_group_number","material_group_name","ref_status ", | ||
| 20 | + // "join_product_id","data_version" ) | ||
| 21 | + // VALUES | ||
| 22 | + // ( | ||
| 23 | + // '1',2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, | ||
| 24 | + // NULL,NULL,NULL,NULL,nextval( 'manufacture.manufacture_seq_id_seq' ),NULL | ||
| 25 | + // ) ON conflict ( material_id ) DO | ||
| 26 | + // UPDATE | ||
| 27 | + // SET ( | ||
| 28 | + // "name","number","specification","forbid_status","erp_cls_id", | ||
| 29 | + // "base_unit_id","base_unit_name","create_date","modify_date", | ||
| 30 | + // "forbid_date","approve_date","material_group","material_group_number", | ||
| 31 | + // "material_group_name","ref_status ","data_version" ) = ( | ||
| 32 | + // EXCLUDED."name",EXCLUDED."number",EXCLUDED."specification", | ||
| 33 | + // EXCLUDED."forbid_status",EXCLUDED."erp_cls_id",EXCLUDED."base_unit_id", | ||
| 34 | + // EXCLUDED."base_unit_name",EXCLUDED."create_date",EXCLUDED."modify_date", | ||
| 35 | + // EXCLUDED."forbid_date",EXCLUDED."approve_date",EXCLUDED."material_group", | ||
| 36 | + // EXCLUDED."material_group_number",EXCLUDED."material_group_name", | ||
| 37 | + // EXCLUDED."ref_status ",EXCLUDED."data_version" ) | ||
| 38 | + return nil | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +//SyncDataProudct 同步Proudct表数据 | ||
| 42 | +func (d *MaterialK3cloudDao) SyncDataProudct(version int) error { | ||
| 43 | + // -- 插入或者更新 | ||
| 44 | + // INSERT INTO "manufacture"."product"( | ||
| 45 | + // "company_id", "org_id", "product_id", "product_code", "product_name", | ||
| 46 | + // "product_category", "product_spec", "created_at", "updated_at" | ||
| 47 | + // ) | ||
| 48 | + // SELECT 0,0,"join_product_id","number","name","material_group_name",'{}',now(),now() | ||
| 49 | + // FROM "manufacture"."material_k3cloud" WHERE "data_version"=0000 | ||
| 50 | + // ON conflict ( product_id ) DO | ||
| 51 | + // UPDATE | ||
| 52 | + // SET ( | ||
| 53 | + // "company_id", "org_id", "product_id", "product_code", "product_name", | ||
| 54 | + // "product_category", "product_spec", "created_at", "updated_at")=( | ||
| 55 | + // EXCLUDED."company_id", EXCLUDED."org_id",EXCLUDED."product_id", | ||
| 56 | + // EXCLUDED."product_code",EXCLUDED."product_name",EXCLUDED."product_category", | ||
| 57 | + // EXCLUDED."product_spec", EXCLUDED."created_at", EXCLUDED."updated_at") | ||
| 58 | + return nil | ||
| 59 | +} |
-
请 注册 或 登录 后发表评论