正在显示
1 个修改的文件
包含
101 行增加
和
27 行删除
| @@ -272,7 +272,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -272,7 +272,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 272 | // 查找相关人列表 | 272 | // 查找相关人列表 |
| 273 | var cooperationContractRelevantModelsFetched []*models.CooperationContractRelevant | 273 | var cooperationContractRelevantModelsFetched []*models.CooperationContractRelevant |
| 274 | cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModelsFetched) | 274 | cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModelsFetched) |
| 275 | - if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | 275 | + if err := cooperationContractRelevantQuery. |
| 276 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 277 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 278 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 279 | + Select(); err != nil { | ||
| 276 | return nil, err | 280 | return nil, err |
| 277 | } | 281 | } |
| 278 | 282 | ||
| @@ -368,7 +372,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -368,7 +372,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 368 | // 获取承接人列表 | 372 | // 获取承接人列表 |
| 369 | var cooperationContractUndertakersModelsFetched []*models.CooperationContractUndertaker | 373 | var cooperationContractUndertakersModelsFetched []*models.CooperationContractUndertaker |
| 370 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakersModelsFetched) | 374 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakersModelsFetched) |
| 371 | - if err := cooperationContractUndertakerQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | 375 | + if err := cooperationContractUndertakerQuery. |
| 376 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 377 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 378 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 379 | + Select(); err != nil { | ||
| 372 | return nil, err | 380 | return nil, err |
| 373 | } | 381 | } |
| 374 | 382 | ||
| @@ -497,7 +505,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -497,7 +505,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 497 | // 获取分红激励规则列表 | 505 | // 获取分红激励规则列表 |
| 498 | var dividendsIncentivesRulesFetched []*models.DividendsIncentivesRule | 506 | var dividendsIncentivesRulesFetched []*models.DividendsIncentivesRule |
| 499 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRulesFetched) | 507 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRulesFetched) |
| 500 | - if err := dividendsIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | 508 | + if err := dividendsIncentivesRuleQuery. |
| 509 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 510 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 511 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 512 | + Select(); err != nil { | ||
| 501 | return nil, err | 513 | return nil, err |
| 502 | } | 514 | } |
| 503 | 515 | ||
| @@ -616,7 +628,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -616,7 +628,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
| 616 | /********************** 更新金额激励规则 **************************/ | 628 | /********************** 更新金额激励规则 **************************/ |
| 617 | var moneyIncentivesRulesFetched []*models.MoneyIncentivesRule | 629 | var moneyIncentivesRulesFetched []*models.MoneyIncentivesRule |
| 618 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRulesFetched) | 630 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRulesFetched) |
| 619 | - if err := moneyIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | 631 | + if err := moneyIncentivesRuleQuery. |
| 632 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 633 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 634 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 635 | + Select(); err != nil { | ||
| 620 | return nil, err | 636 | return nil, err |
| 621 | } | 637 | } |
| 622 | 638 | ||
| @@ -815,27 +831,43 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | @@ -815,27 +831,43 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | ||
| 815 | // 获取分红激励规则列表 | 831 | // 获取分红激励规则列表 |
| 816 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule | 832 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule |
| 817 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRuleModels) | 833 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRuleModels) |
| 818 | - if err := dividendsIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | 834 | + if err := dividendsIncentivesRuleQuery. |
| 835 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 836 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 837 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 838 | + Select(); err != nil { | ||
| 819 | return nil, err | 839 | return nil, err |
| 820 | } else { | 840 | } else { |
| 841 | + if len(dividendsIncentivesRuleModels) > 0 { | ||
| 821 | if _, err := tx.Model(÷ndsIncentivesRuleModels).WherePK().Delete(); err != nil { | 842 | if _, err := tx.Model(÷ndsIncentivesRuleModels).WherePK().Delete(); err != nil { |
| 822 | return nil, err | 843 | return nil, err |
| 823 | } | 844 | } |
| 824 | } | 845 | } |
| 846 | + } | ||
| 825 | // 获取金额激励规则列表 | 847 | // 获取金额激励规则列表 |
| 826 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule | 848 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule |
| 827 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRuleModels) | 849 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRuleModels) |
| 828 | - if err := moneyIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | 850 | + if err := moneyIncentivesRuleQuery. |
| 851 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 852 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 853 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 854 | + Select(); err != nil { | ||
| 829 | return nil, err | 855 | return nil, err |
| 830 | } else { | 856 | } else { |
| 857 | + if len(moneyIncentivesRuleModels) > 0 { | ||
| 831 | if _, err := tx.Model(&moneyIncentivesRuleModels).WherePK().Delete(); err != nil { | 858 | if _, err := tx.Model(&moneyIncentivesRuleModels).WherePK().Delete(); err != nil { |
| 832 | return nil, err | 859 | return nil, err |
| 833 | } | 860 | } |
| 834 | } | 861 | } |
| 862 | + } | ||
| 835 | // 获取承接人列表 | 863 | // 获取承接人列表 |
| 836 | var cooperationContractUndertakerModels []*models.CooperationContractUndertaker | 864 | var cooperationContractUndertakerModels []*models.CooperationContractUndertaker |
| 837 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakerModels) | 865 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakerModels) |
| 838 | - if err := cooperationContractUndertakerQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | 866 | + if err := cooperationContractUndertakerQuery. |
| 867 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 868 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 869 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 870 | + Select(); err != nil { | ||
| 839 | return nil, err | 871 | return nil, err |
| 840 | } else { | 872 | } else { |
| 841 | if _, err := tx.Model(&cooperationContractUndertakerModels).WherePK().Delete(); err != nil { | 873 | if _, err := tx.Model(&cooperationContractUndertakerModels).WherePK().Delete(); err != nil { |
| @@ -845,14 +877,20 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | @@ -845,14 +877,20 @@ func (repository *CooperationContractRepository) Remove(cooperationContract *dom | ||
| 845 | // 获取相关人列表 | 877 | // 获取相关人列表 |
| 846 | var cooperationContractRelevantModels []*models.CooperationContractRelevant | 878 | var cooperationContractRelevantModels []*models.CooperationContractRelevant |
| 847 | cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModels) | 879 | cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModels) |
| 848 | - if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | 880 | + if err := cooperationContractRelevantQuery. |
| 881 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 882 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 883 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 884 | + Select(); err != nil { | ||
| 849 | return nil, err | 885 | return nil, err |
| 850 | } else { | 886 | } else { |
| 887 | + if len(cooperationContractRelevantModels) > 0 { | ||
| 851 | if _, err := tx.Model(&cooperationContractRelevantModels).WherePK().Delete(); err != nil { | 888 | if _, err := tx.Model(&cooperationContractRelevantModels).WherePK().Delete(); err != nil { |
| 852 | return nil, err | 889 | return nil, err |
| 853 | } | 890 | } |
| 854 | } | 891 | } |
| 855 | } | 892 | } |
| 893 | + } | ||
| 856 | return cooperationContract, nil | 894 | return cooperationContract, nil |
| 857 | } | 895 | } |
| 858 | 896 | ||
| @@ -872,8 +910,12 @@ func (repository *CooperationContractRepository) BatchRemove(cooperationContract | @@ -872,8 +910,12 @@ func (repository *CooperationContractRepository) BatchRemove(cooperationContract | ||
| 872 | // 获取分红激励规则列表 | 910 | // 获取分红激励规则列表 |
| 873 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule | 911 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule |
| 874 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRuleModels) | 912 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRuleModels) |
| 875 | - if err := dividendsIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | ||
| 876 | - return nil, err | 913 | + if err := dividendsIncentivesRuleQuery. |
| 914 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 915 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 916 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 917 | + Select(); err != nil { | ||
| 918 | + return nil, fmt.Errorf("分红激励规则不存在:" + err.Error()) | ||
| 877 | } else { | 919 | } else { |
| 878 | if len(dividendsIncentivesRuleModels) > 0 { | 920 | if len(dividendsIncentivesRuleModels) > 0 { |
| 879 | if _, err := tx.Model(÷ndsIncentivesRuleModels).WherePK().Delete(); err != nil { | 921 | if _, err := tx.Model(÷ndsIncentivesRuleModels).WherePK().Delete(); err != nil { |
| @@ -884,8 +926,12 @@ func (repository *CooperationContractRepository) BatchRemove(cooperationContract | @@ -884,8 +926,12 @@ func (repository *CooperationContractRepository) BatchRemove(cooperationContract | ||
| 884 | // 获取金额激励规则列表 | 926 | // 获取金额激励规则列表 |
| 885 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule | 927 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule |
| 886 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRuleModels) | 928 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRuleModels) |
| 887 | - if err := moneyIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | ||
| 888 | - return nil, err | 929 | + if err := moneyIncentivesRuleQuery. |
| 930 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 931 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 932 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 933 | + Select(); err != nil { | ||
| 934 | + return nil, fmt.Errorf("金额激励规则列表不存在:" + err.Error()) | ||
| 889 | } else { | 935 | } else { |
| 890 | if len(moneyIncentivesRuleModels) > 0 { | 936 | if len(moneyIncentivesRuleModels) > 0 { |
| 891 | if _, err := tx.Model(&moneyIncentivesRuleModels).WherePK().Delete(); err != nil { | 937 | if _, err := tx.Model(&moneyIncentivesRuleModels).WherePK().Delete(); err != nil { |
| @@ -896,8 +942,12 @@ func (repository *CooperationContractRepository) BatchRemove(cooperationContract | @@ -896,8 +942,12 @@ func (repository *CooperationContractRepository) BatchRemove(cooperationContract | ||
| 896 | // 获取承接人列表 | 942 | // 获取承接人列表 |
| 897 | var cooperationContractUndertakerModels []*models.CooperationContractUndertaker | 943 | var cooperationContractUndertakerModels []*models.CooperationContractUndertaker |
| 898 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakerModels) | 944 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakerModels) |
| 899 | - if err := cooperationContractUndertakerQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | ||
| 900 | - return nil, err | 945 | + if err := cooperationContractUndertakerQuery. |
| 946 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 947 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 948 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 949 | + Select(); err != nil { | ||
| 950 | + return nil, fmt.Errorf("合约承接人不存在:" + err.Error()) | ||
| 901 | } else { | 951 | } else { |
| 902 | if len(cooperationContractUndertakerModels) > 0 { | 952 | if len(cooperationContractUndertakerModels) > 0 { |
| 903 | if _, err := tx.Model(&cooperationContractUndertakerModels).WherePK().Delete(); err != nil { | 953 | if _, err := tx.Model(&cooperationContractUndertakerModels).WherePK().Delete(); err != nil { |
| @@ -908,8 +958,12 @@ func (repository *CooperationContractRepository) BatchRemove(cooperationContract | @@ -908,8 +958,12 @@ func (repository *CooperationContractRepository) BatchRemove(cooperationContract | ||
| 908 | // 获取相关人列表 | 958 | // 获取相关人列表 |
| 909 | var cooperationContractRelevantModels []*models.CooperationContractRelevant | 959 | var cooperationContractRelevantModels []*models.CooperationContractRelevant |
| 910 | cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModels) | 960 | cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModels) |
| 911 | - if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber).Select(); err != nil { | ||
| 912 | - return nil, err | 961 | + if err := cooperationContractRelevantQuery. |
| 962 | + Where("company->>'companyId' = '?'", cooperationContract.Company.CompanyId). | ||
| 963 | + Where("org->>'orgId' = '?'", cooperationContract.Org.OrgId). | ||
| 964 | + Where("cooperation_contract_number = ?", cooperationContract.CooperationContractNumber). | ||
| 965 | + Select(); err != nil { | ||
| 966 | + return nil, fmt.Errorf("合约相关人存在:" + err.Error()) | ||
| 913 | } else { | 967 | } else { |
| 914 | if len(cooperationContractRelevantModels) > 0 { | 968 | if len(cooperationContractRelevantModels) > 0 { |
| 915 | if _, err := tx.Model(&cooperationContractRelevantModels).WherePK().Delete(); err != nil { | 969 | if _, err := tx.Model(&cooperationContractRelevantModels).WherePK().Delete(); err != nil { |
| @@ -930,7 +984,7 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string | @@ -930,7 +984,7 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string | ||
| 930 | query.SetWhereByQueryOption("cooperation_contract.cooperation_contract_number = ?", "cooperationContractNumber") | 984 | query.SetWhereByQueryOption("cooperation_contract.cooperation_contract_number = ?", "cooperationContractNumber") |
| 931 | if err := query.First(); err != nil { | 985 | if err := query.First(); err != nil { |
| 932 | if err.Error() == "pg: no rows in result set" { | 986 | if err.Error() == "pg: no rows in result set" { |
| 933 | - return nil, fmt.Errorf("没有此资源") | 987 | + return nil, fmt.Errorf("共创合约不存在") |
| 934 | } else { | 988 | } else { |
| 935 | return nil, err | 989 | return nil, err |
| 936 | } | 990 | } |
| @@ -941,32 +995,52 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string | @@ -941,32 +995,52 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string | ||
| 941 | // 获取共创模式 | 995 | // 获取共创模式 |
| 942 | cooperationModeModels := new(models.CooperationMode) | 996 | cooperationModeModels := new(models.CooperationMode) |
| 943 | cooperationModeQuery := tx.Model(cooperationModeModels) | 997 | cooperationModeQuery := tx.Model(cooperationModeModels) |
| 944 | - if err := cooperationModeQuery.Where("cooperation_mode_number = ?", cooperationContractModel.CooperationModeNumber).First(); err != nil { | ||
| 945 | - return nil, err | 998 | + if err := cooperationModeQuery. |
| 999 | + Where("company->>'companyId' = '?'", cooperationContractModel.Company.CompanyId). | ||
| 1000 | + Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId). | ||
| 1001 | + Where("cooperation_mode_number = ?", cooperationContractModel.CooperationModeNumber). | ||
| 1002 | + First(); err != nil { | ||
| 1003 | + return nil, fmt.Errorf("共创合约关联的共创模式不存在") | ||
| 946 | } | 1004 | } |
| 947 | // 获取分红激励规则列表 | 1005 | // 获取分红激励规则列表 |
| 948 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule | 1006 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule |
| 949 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRuleModels) | 1007 | dividendsIncentivesRuleQuery := tx.Model(÷ndsIncentivesRuleModels) |
| 950 | - if err := dividendsIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil { | ||
| 951 | - return nil, err | 1008 | + if err := dividendsIncentivesRuleQuery. |
| 1009 | + Where("company->>'companyId' = '?'", cooperationContractModel.Company.CompanyId). | ||
| 1010 | + Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId). | ||
| 1011 | + Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber). | ||
| 1012 | + Select(); err != nil { | ||
| 1013 | + return nil, fmt.Errorf("共创合约关联的分红激励规则不存在") | ||
| 952 | } | 1014 | } |
| 953 | // 获取金额激励规则列表 | 1015 | // 获取金额激励规则列表 |
| 954 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule | 1016 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule |
| 955 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRuleModels) | 1017 | moneyIncentivesRuleQuery := tx.Model(&moneyIncentivesRuleModels) |
| 956 | - if err := moneyIncentivesRuleQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil { | ||
| 957 | - return nil, err | 1018 | + if err := moneyIncentivesRuleQuery. |
| 1019 | + Where("company->>'companyId' = '?'", cooperationContractModel.Company.CompanyId). | ||
| 1020 | + Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId). | ||
| 1021 | + Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber). | ||
| 1022 | + Select(); err != nil { | ||
| 1023 | + return nil, fmt.Errorf("共创合约关联的金额激励规则不存在") | ||
| 958 | } | 1024 | } |
| 959 | // 获取承接人列表 | 1025 | // 获取承接人列表 |
| 960 | var cooperationContractUndertakerModels []*models.CooperationContractUndertaker | 1026 | var cooperationContractUndertakerModels []*models.CooperationContractUndertaker |
| 961 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakerModels) | 1027 | cooperationContractUndertakerQuery := tx.Model(&cooperationContractUndertakerModels) |
| 962 | - if err := cooperationContractUndertakerQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil { | ||
| 963 | - return nil, err | 1028 | + if err := cooperationContractUndertakerQuery. |
| 1029 | + Where("company->>'companyId' = '?'", cooperationContractModel.Company.CompanyId). | ||
| 1030 | + Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId). | ||
| 1031 | + Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber). | ||
| 1032 | + Select(); err != nil { | ||
| 1033 | + return nil, fmt.Errorf("合约承接人不存在") | ||
| 964 | } | 1034 | } |
| 965 | // 获取相关人列表 | 1035 | // 获取相关人列表 |
| 966 | var cooperationContractRelevantModels []*models.CooperationContractRelevant | 1036 | var cooperationContractRelevantModels []*models.CooperationContractRelevant |
| 967 | cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModels) | 1037 | cooperationContractRelevantQuery := tx.Model(&cooperationContractRelevantModels) |
| 968 | - if err := cooperationContractRelevantQuery.Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).Select(); err != nil { | ||
| 969 | - return nil, err | 1038 | + if err := cooperationContractRelevantQuery. |
| 1039 | + Where("company->>'companyId' = '?'", cooperationContractModel.Company.CompanyId). | ||
| 1040 | + Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId). | ||
| 1041 | + Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber). | ||
| 1042 | + Select(); err != nil { | ||
| 1043 | + return nil, fmt.Errorf("合约相关人不存在") | ||
| 970 | } | 1044 | } |
| 971 | return transform.TransformToCooperationContractDomainModelFromPgModels( | 1045 | return transform.TransformToCooperationContractDomainModelFromPgModels( |
| 972 | cooperationContractModel, | 1046 | cooperationContractModel, |
-
请 注册 或 登录 后发表评论