|
|
package dao
|
|
|
|
|
|
import (
|
|
|
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
|
|
|
)
|
|
|
|
|
|
type MaterialK3cloudDao struct {
|
|
|
transactionContext *pgTransaction.TransactionContext
|
|
|
}
|
|
|
|
|
|
//SyncDataMaterialK3cloud 同步MaterialK3cloud表数据
|
|
|
func (d *MaterialK3cloudDao) SyncDataMaterialK3cloud(data []models.MaterialK3cloud) error {
|
|
|
// -- 插入或者更新
|
|
|
// INSERT INTO "manufacture"."material_k3cloud" (
|
|
|
// "material_id","name","number","specification","forbid_status",
|
|
|
// "erp_cls_id","base_unit_id","base_unit_name","create_date",
|
|
|
// "modify_date","forbid_date","approve_date","material_group",
|
|
|
// "material_group_number","material_group_name","ref_status ",
|
|
|
// "join_product_id","data_version" )
|
|
|
// VALUES
|
|
|
// (
|
|
|
// '1',2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
|
|
// NULL,NULL,NULL,NULL,nextval( 'manufacture.manufacture_seq_id_seq' ),NULL
|
|
|
// ) ON conflict ( material_id ) DO
|
|
|
// UPDATE
|
|
|
// SET (
|
|
|
// "name","number","specification","forbid_status","erp_cls_id",
|
|
|
// "base_unit_id","base_unit_name","create_date","modify_date",
|
|
|
// "forbid_date","approve_date","material_group","material_group_number",
|
|
|
// "material_group_name","ref_status ","data_version" ) = (
|
|
|
// EXCLUDED."name",EXCLUDED."number",EXCLUDED."specification",
|
|
|
// EXCLUDED."forbid_status",EXCLUDED."erp_cls_id",EXCLUDED."base_unit_id",
|
|
|
// EXCLUDED."base_unit_name",EXCLUDED."create_date",EXCLUDED."modify_date",
|
|
|
// EXCLUDED."forbid_date",EXCLUDED."approve_date",EXCLUDED."material_group",
|
|
|
// EXCLUDED."material_group_number",EXCLUDED."material_group_name",
|
|
|
// EXCLUDED."ref_status ",EXCLUDED."data_version" )
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//SyncDataProudct 同步Proudct表数据
|
|
|
func (d *MaterialK3cloudDao) SyncDataProudct(version int) error {
|
|
|
// -- 插入或者更新
|
|
|
// INSERT INTO "manufacture"."product"(
|
|
|
// "company_id", "org_id", "product_id", "product_code", "product_name",
|
|
|
// "product_category", "product_spec", "created_at", "updated_at"
|
|
|
// )
|
|
|
// SELECT 0,0,"join_product_id","number","name","material_group_name",'{}',now(),now()
|
|
|
// FROM "manufacture"."material_k3cloud" WHERE "data_version"=0000
|
|
|
// ON conflict ( product_id ) DO
|
|
|
// UPDATE
|
|
|
// SET (
|
|
|
// "company_id", "org_id", "product_id", "product_code", "product_name",
|
|
|
// "product_category", "product_spec", "created_at", "updated_at")=(
|
|
|
// EXCLUDED."company_id", EXCLUDED."org_id",EXCLUDED."product_id",
|
|
|
// EXCLUDED."product_code",EXCLUDED."product_name",EXCLUDED."product_category",
|
|
|
// EXCLUDED."product_spec", EXCLUDED."created_at", EXCLUDED."updated_at")
|
|
|
return nil
|
|
|
} |
...
|
...
|
|