正在显示
7 个修改的文件
包含
67 行增加
和
66 行删除
| @@ -14,15 +14,15 @@ type ListContractUndertakerFeedbackQuery struct { | @@ -14,15 +14,15 @@ type ListContractUndertakerFeedbackQuery struct { | ||
| 14 | // 页面大小 | 14 | // 页面大小 |
| 15 | PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` | 15 | PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` |
| 16 | // 承接人uid | 16 | // 承接人uid |
| 17 | - UnderTakerUid string `cname:"承接人UID" json:"underTakerUid" valid:"Required"` | 17 | + UnderTakerUid string `cname:"承接人UID" json:"underTakerUid,omitempty"` |
| 18 | // 公司ID,通过集成REST上下文获取 | 18 | // 公司ID,通过集成REST上下文获取 |
| 19 | CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` | 19 | CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` |
| 20 | // 组织机构ID | 20 | // 组织机构ID |
| 21 | OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` | 21 | OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` |
| 22 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 22 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
| 23 | - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` | 23 | + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` |
| 24 | // 用户基础数据id | 24 | // 用户基础数据id |
| 25 | - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` | 25 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"` |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | func (listContractUndertakerFeedbackQuery *ListContractUndertakerFeedbackQuery) Valid(validation *validation.Validation) { | 28 | func (listContractUndertakerFeedbackQuery *ListContractUndertakerFeedbackQuery) Valid(validation *validation.Validation) { |
| @@ -240,10 +240,27 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) Sear | @@ -240,10 +240,27 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) Sear | ||
| 240 | defer func() { | 240 | defer func() { |
| 241 | _ = transactionContext.RollbackTransaction() | 241 | _ = transactionContext.RollbackTransaction() |
| 242 | }() | 242 | }() |
| 243 | + var contractUndertakerFeedbackRepository domain.ContractUndertakerFeedbackRepository | ||
| 244 | + if value, err := factory.CreateContractUndertakerFeedbackRepository(map[string]interface{}{ | ||
| 245 | + "transactionContext": transactionContext, | ||
| 246 | + }); err != nil { | ||
| 247 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 248 | + } else { | ||
| 249 | + contractUndertakerFeedbackRepository = value | ||
| 250 | + } | ||
| 251 | + if count, contractUndertakerFeedbacks, err := contractUndertakerFeedbackRepository.Find(tool_funs.SimpleStructToMap(searchContractUndertakerFeedbackQuery)); err != nil { | ||
| 252 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 253 | + } else { | ||
| 243 | if err := transactionContext.CommitTransaction(); err != nil { | 254 | if err := transactionContext.CommitTransaction(); err != nil { |
| 244 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 255 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 245 | } | 256 | } |
| 246 | - return nil, nil | 257 | + return map[string]interface{}{ |
| 258 | + "grid": map[string]interface{}{ | ||
| 259 | + "total": count, | ||
| 260 | + "list": contractUndertakerFeedbacks, | ||
| 261 | + }, | ||
| 262 | + }, nil | ||
| 263 | + } | ||
| 247 | } | 264 | } |
| 248 | 265 | ||
| 249 | // UpdateContractUndertakerFeedback 更新共创合约反馈服务 | 266 | // UpdateContractUndertakerFeedback 更新共创合约反馈服务 |
| @@ -14,8 +14,6 @@ type ContractUndertakerFeedback struct { | @@ -14,8 +14,6 @@ type ContractUndertakerFeedback struct { | ||
| 14 | CooperationContractNumber string `json:"cooperationContractNumber"` | 14 | CooperationContractNumber string `json:"cooperationContractNumber"` |
| 15 | // 共创合约承接人 | 15 | // 共创合约承接人 |
| 16 | ContractUndertaker *Undertaker `json:"contractUndertaker"` | 16 | ContractUndertaker *Undertaker `json:"contractUndertaker"` |
| 17 | - // 共创模式 | ||
| 18 | - CooperationMode *CooperationMode `json:"cooperationMode"` | ||
| 19 | // 数据所属组织机构 | 17 | // 数据所属组织机构 |
| 20 | Org *Org `json:"org"` | 18 | Org *Org `json:"org"` |
| 21 | // 公司 | 19 | // 公司 |
| @@ -52,11 +50,5 @@ func (contractUndertakerFeedback *ContractUndertakerFeedback) Update(data map[st | @@ -52,11 +50,5 @@ func (contractUndertakerFeedback *ContractUndertakerFeedback) Update(data map[st | ||
| 52 | if cooperationContractNumber, ok := data["cooperationContractNumber"]; ok { | 50 | if cooperationContractNumber, ok := data["cooperationContractNumber"]; ok { |
| 53 | contractUndertakerFeedback.CooperationContractNumber = cooperationContractNumber.(string) | 51 | contractUndertakerFeedback.CooperationContractNumber = cooperationContractNumber.(string) |
| 54 | } | 52 | } |
| 55 | - if status, ok := data["status"]; ok { | ||
| 56 | - contractUndertakerFeedback.CooperationMode.Status = status.(int32) | ||
| 57 | - } | ||
| 58 | - if remarks, ok := data["remarks"]; ok { | ||
| 59 | - contractUndertakerFeedback.CooperationMode.Remarks = remarks.(string) | ||
| 60 | - } | ||
| 61 | return nil | 53 | return nil |
| 62 | } | 54 | } |
| @@ -17,8 +17,6 @@ type ContractUndertakerFeedback struct { | @@ -17,8 +17,6 @@ type ContractUndertakerFeedback struct { | ||
| 17 | CooperationContractNumber string `comment:"共创合约编号"` | 17 | CooperationContractNumber string `comment:"共创合约编号"` |
| 18 | // 共创合约承接人 | 18 | // 共创合约承接人 |
| 19 | ContractUndertaker *domain.Undertaker `comment:"共创合约承接人"` | 19 | ContractUndertaker *domain.Undertaker `comment:"共创合约承接人"` |
| 20 | - // 共创模式编号 | ||
| 21 | - CooperationModeNumber string `comment:"共创模式编号"` | ||
| 22 | // 数据所属组织机构 | 20 | // 数据所属组织机构 |
| 23 | Org *domain.Org `comment:"数据所属组织机构"` | 21 | Org *domain.Org `comment:"数据所属组织机构"` |
| 24 | // 公司 | 22 | // 公司 |
| @@ -6,28 +6,27 @@ import ( | @@ -6,28 +6,27 @@ import ( | ||
| 6 | ) | 6 | ) |
| 7 | 7 | ||
| 8 | func TransformToContractUndertakerFeedbackDomainModelFromPgModels( | 8 | func TransformToContractUndertakerFeedbackDomainModelFromPgModels( |
| 9 | - contractUndertakerFeedbackModel *models.ContractUndertakerFeedback, | ||
| 10 | - cooperationMode *models.CooperationMode) (*domain.ContractUndertakerFeedback, error) { | 9 | + contractUndertakerFeedbackModel *models.ContractUndertakerFeedback) (*domain.ContractUndertakerFeedback, error) { |
| 11 | return &domain.ContractUndertakerFeedback{ | 10 | return &domain.ContractUndertakerFeedback{ |
| 12 | FeedbackId: contractUndertakerFeedbackModel.FeedbackId, | 11 | FeedbackId: contractUndertakerFeedbackModel.FeedbackId, |
| 13 | FeedbackAttachment: contractUndertakerFeedbackModel.FeedbackAttachment, | 12 | FeedbackAttachment: contractUndertakerFeedbackModel.FeedbackAttachment, |
| 14 | FeedbackContent: contractUndertakerFeedbackModel.FeedbackContent, | 13 | FeedbackContent: contractUndertakerFeedbackModel.FeedbackContent, |
| 15 | CooperationContractNumber: contractUndertakerFeedbackModel.CooperationContractNumber, | 14 | CooperationContractNumber: contractUndertakerFeedbackModel.CooperationContractNumber, |
| 16 | ContractUndertaker: contractUndertakerFeedbackModel.ContractUndertaker, | 15 | ContractUndertaker: contractUndertakerFeedbackModel.ContractUndertaker, |
| 17 | - CooperationMode: &domain.CooperationMode{ | ||
| 18 | - CooperationModeId: cooperationMode.CooperationModeId, | ||
| 19 | - CooperationModeNumber: cooperationMode.CooperationModeNumber, | ||
| 20 | - CooperationModeName: cooperationMode.CooperationModeName, | ||
| 21 | - Status: cooperationMode.Status, | ||
| 22 | - Org: cooperationMode.Org, | ||
| 23 | - Company: cooperationMode.Company, | ||
| 24 | - Remarks: cooperationMode.Remarks, | ||
| 25 | - Operator: cooperationMode.Operator, | ||
| 26 | - OperateTime: cooperationMode.OperateTime, | ||
| 27 | - UpdatedAt: cooperationMode.UpdatedAt, | ||
| 28 | - DeletedAt: cooperationMode.DeletedAt, | ||
| 29 | - CreatedAt: cooperationMode.CreatedAt, | ||
| 30 | - }, | 16 | + //CooperationMode: &domain.CooperationMode{ |
| 17 | + // CooperationModeId: cooperationMode.CooperationModeId, | ||
| 18 | + // CooperationModeNumber: cooperationMode.CooperationModeNumber, | ||
| 19 | + // CooperationModeName: cooperationMode.CooperationModeName, | ||
| 20 | + // Status: cooperationMode.Status, | ||
| 21 | + // Org: cooperationMode.Org, | ||
| 22 | + // Company: cooperationMode.Company, | ||
| 23 | + // Remarks: cooperationMode.Remarks, | ||
| 24 | + // Operator: cooperationMode.Operator, | ||
| 25 | + // OperateTime: cooperationMode.OperateTime, | ||
| 26 | + // UpdatedAt: cooperationMode.UpdatedAt, | ||
| 27 | + // DeletedAt: cooperationMode.DeletedAt, | ||
| 28 | + // CreatedAt: cooperationMode.CreatedAt, | ||
| 29 | + //}, | ||
| 31 | Org: contractUndertakerFeedbackModel.Org, | 30 | Org: contractUndertakerFeedbackModel.Org, |
| 32 | Company: contractUndertakerFeedbackModel.Company, | 31 | Company: contractUndertakerFeedbackModel.Company, |
| 33 | UpdatedAt: contractUndertakerFeedbackModel.UpdatedAt, | 32 | UpdatedAt: contractUndertakerFeedbackModel.UpdatedAt, |
| @@ -24,6 +24,7 @@ func (repository *ContractUndertakerFeedbackRepository) nextIdentify() (int64, e | @@ -24,6 +24,7 @@ func (repository *ContractUndertakerFeedbackRepository) nextIdentify() (int64, e | ||
| 24 | id, err := IdWorker.NextId() | 24 | id, err := IdWorker.NextId() |
| 25 | return id, err | 25 | return id, err |
| 26 | } | 26 | } |
| 27 | + | ||
| 27 | func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerFeedback *domain.ContractUndertakerFeedback) (*domain.ContractUndertakerFeedback, error) { | 28 | func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerFeedback *domain.ContractUndertakerFeedback) (*domain.ContractUndertakerFeedback, error) { |
| 28 | sqlBuildFields := []string{ | 29 | sqlBuildFields := []string{ |
| 29 | "feedback_id", | 30 | "feedback_id", |
| @@ -31,7 +32,6 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -31,7 +32,6 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
| 31 | "feedback_content", | 32 | "feedback_content", |
| 32 | "cooperation_contract_number", | 33 | "cooperation_contract_number", |
| 33 | "contract_undertaker", | 34 | "contract_undertaker", |
| 34 | - "cooperation_mode", | ||
| 35 | "org", | 35 | "org", |
| 36 | "company", | 36 | "company", |
| 37 | "updated_at", | 37 | "updated_at", |
| @@ -58,7 +58,6 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -58,7 +58,6 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
| 58 | &contractUndertakerFeedback.FeedbackContent, | 58 | &contractUndertakerFeedback.FeedbackContent, |
| 59 | &contractUndertakerFeedback.CooperationContractNumber, | 59 | &contractUndertakerFeedback.CooperationContractNumber, |
| 60 | &contractUndertakerFeedback.ContractUndertaker, | 60 | &contractUndertakerFeedback.ContractUndertaker, |
| 61 | - &contractUndertakerFeedback.CooperationMode, | ||
| 62 | &contractUndertakerFeedback.Org, | 61 | &contractUndertakerFeedback.Org, |
| 63 | &contractUndertakerFeedback.Company, | 62 | &contractUndertakerFeedback.Company, |
| 64 | &contractUndertakerFeedback.UpdatedAt, | 63 | &contractUndertakerFeedback.UpdatedAt, |
| @@ -71,11 +70,10 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -71,11 +70,10 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
| 71 | contractUndertakerFeedback.FeedbackContent, | 70 | contractUndertakerFeedback.FeedbackContent, |
| 72 | contractUndertakerFeedback.CooperationContractNumber, | 71 | contractUndertakerFeedback.CooperationContractNumber, |
| 73 | contractUndertakerFeedback.ContractUndertaker, | 72 | contractUndertakerFeedback.ContractUndertaker, |
| 74 | - contractUndertakerFeedback.CooperationMode, | ||
| 75 | contractUndertakerFeedback.Org, | 73 | contractUndertakerFeedback.Org, |
| 76 | contractUndertakerFeedback.Company, | 74 | contractUndertakerFeedback.Company, |
| 77 | contractUndertakerFeedback.UpdatedAt, | 75 | contractUndertakerFeedback.UpdatedAt, |
| 78 | - contractUndertakerFeedback.DeletedAt, | 76 | + nil, |
| 79 | contractUndertakerFeedback.CreatedAt, | 77 | contractUndertakerFeedback.CreatedAt, |
| 80 | ); err != nil { | 78 | ); err != nil { |
| 81 | return contractUndertakerFeedback, err | 79 | return contractUndertakerFeedback, err |
| @@ -88,7 +86,6 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -88,7 +86,6 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
| 88 | &contractUndertakerFeedback.FeedbackContent, | 86 | &contractUndertakerFeedback.FeedbackContent, |
| 89 | &contractUndertakerFeedback.CooperationContractNumber, | 87 | &contractUndertakerFeedback.CooperationContractNumber, |
| 90 | &contractUndertakerFeedback.ContractUndertaker, | 88 | &contractUndertakerFeedback.ContractUndertaker, |
| 91 | - &contractUndertakerFeedback.CooperationMode, | ||
| 92 | &contractUndertakerFeedback.Org, | 89 | &contractUndertakerFeedback.Org, |
| 93 | &contractUndertakerFeedback.Company, | 90 | &contractUndertakerFeedback.Company, |
| 94 | &contractUndertakerFeedback.UpdatedAt, | 91 | &contractUndertakerFeedback.UpdatedAt, |
| @@ -101,11 +98,10 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -101,11 +98,10 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
| 101 | contractUndertakerFeedback.FeedbackContent, | 98 | contractUndertakerFeedback.FeedbackContent, |
| 102 | contractUndertakerFeedback.CooperationContractNumber, | 99 | contractUndertakerFeedback.CooperationContractNumber, |
| 103 | contractUndertakerFeedback.ContractUndertaker, | 100 | contractUndertakerFeedback.ContractUndertaker, |
| 104 | - contractUndertakerFeedback.CooperationMode, | ||
| 105 | contractUndertakerFeedback.Org, | 101 | contractUndertakerFeedback.Org, |
| 106 | contractUndertakerFeedback.Company, | 102 | contractUndertakerFeedback.Company, |
| 107 | contractUndertakerFeedback.UpdatedAt, | 103 | contractUndertakerFeedback.UpdatedAt, |
| 108 | - contractUndertakerFeedback.DeletedAt, | 104 | + nil, |
| 109 | contractUndertakerFeedback.CreatedAt, | 105 | contractUndertakerFeedback.CreatedAt, |
| 110 | contractUndertakerFeedback.Identify(), | 106 | contractUndertakerFeedback.Identify(), |
| 111 | ); err != nil { | 107 | ); err != nil { |
| @@ -114,6 +110,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -114,6 +110,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
| 114 | } | 110 | } |
| 115 | return contractUndertakerFeedback, nil | 111 | return contractUndertakerFeedback, nil |
| 116 | } | 112 | } |
| 113 | + | ||
| 117 | func (repository *ContractUndertakerFeedbackRepository) Remove(contractUndertakerFeedback *domain.ContractUndertakerFeedback) (*domain.ContractUndertakerFeedback, error) { | 114 | func (repository *ContractUndertakerFeedbackRepository) Remove(contractUndertakerFeedback *domain.ContractUndertakerFeedback) (*domain.ContractUndertakerFeedback, error) { |
| 118 | tx := repository.transactionContext.PgTx | 115 | tx := repository.transactionContext.PgTx |
| 119 | contractUndertakerFeedbackModel := new(models.ContractUndertakerFeedback) | 116 | contractUndertakerFeedbackModel := new(models.ContractUndertakerFeedback) |
| @@ -123,11 +120,12 @@ func (repository *ContractUndertakerFeedbackRepository) Remove(contractUndertake | @@ -123,11 +120,12 @@ func (repository *ContractUndertakerFeedbackRepository) Remove(contractUndertake | ||
| 123 | } | 120 | } |
| 124 | return contractUndertakerFeedback, nil | 121 | return contractUndertakerFeedback, nil |
| 125 | } | 122 | } |
| 123 | + | ||
| 126 | func (repository *ContractUndertakerFeedbackRepository) FindOne(queryOptions map[string]interface{}) (*domain.ContractUndertakerFeedback, error) { | 124 | func (repository *ContractUndertakerFeedbackRepository) FindOne(queryOptions map[string]interface{}) (*domain.ContractUndertakerFeedback, error) { |
| 127 | tx := repository.transactionContext.PgTx | 125 | tx := repository.transactionContext.PgTx |
| 128 | contractUndertakerFeedbackModel := new(models.ContractUndertakerFeedback) | 126 | contractUndertakerFeedbackModel := new(models.ContractUndertakerFeedback) |
| 129 | query := sqlbuilder.BuildQuery(tx.Model(contractUndertakerFeedbackModel), queryOptions) | 127 | query := sqlbuilder.BuildQuery(tx.Model(contractUndertakerFeedbackModel), queryOptions) |
| 130 | - query.SetWhereByQueryOption("contract_undertaker_feedback.contract_undertaker_feedback_id = ?", "contractUndertakerFeedbackId") | 128 | + query.SetWhereByQueryOption("contract_undertaker_feedback.feedback_id = ?", "contractUndertakerFeedbackId") |
| 131 | if err := query.First(); err != nil { | 129 | if err := query.First(); err != nil { |
| 132 | if err.Error() == "pg: no rows in result set" { | 130 | if err.Error() == "pg: no rows in result set" { |
| 133 | return nil, fmt.Errorf("没有此资源") | 131 | return nil, fmt.Errorf("没有此资源") |
| @@ -138,41 +136,43 @@ func (repository *ContractUndertakerFeedbackRepository) FindOne(queryOptions map | @@ -138,41 +136,43 @@ func (repository *ContractUndertakerFeedbackRepository) FindOne(queryOptions map | ||
| 138 | if contractUndertakerFeedbackModel.FeedbackId == 0 { | 136 | if contractUndertakerFeedbackModel.FeedbackId == 0 { |
| 139 | return nil, nil | 137 | return nil, nil |
| 140 | } else { | 138 | } else { |
| 141 | - // 获取共创模式 | ||
| 142 | - cooperationModeModel := new(models.CooperationMode) | ||
| 143 | - cooperationModeQuery := tx.Model(cooperationModeModel) | ||
| 144 | - if err := cooperationModeQuery.Where("cooperation_mode_number = ?", contractUndertakerFeedbackModel.CooperationModeNumber).First(); err != nil { | ||
| 145 | - return nil, err | ||
| 146 | - } | ||
| 147 | - return transform.TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel, cooperationModeModel) | 139 | + //// 获取共创模式 |
| 140 | + //cooperationModeModel := new(models.CooperationMode) | ||
| 141 | + //cooperationModeQuery := tx.Model(cooperationModeModel) | ||
| 142 | + //if err := cooperationModeQuery.Where("cooperation_mode_number = ?", contractUndertakerFeedbackModel.CooperationModeNumber).First(); err != nil { | ||
| 143 | + // return nil, err | ||
| 144 | + //} | ||
| 145 | + return transform.TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel) | ||
| 148 | } | 146 | } |
| 149 | } | 147 | } |
| 148 | + | ||
| 150 | func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.ContractUndertakerFeedback, error) { | 149 | func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.ContractUndertakerFeedback, error) { |
| 151 | tx := repository.transactionContext.PgTx | 150 | tx := repository.transactionContext.PgTx |
| 152 | var contractUndertakerFeedbackModels []*models.ContractUndertakerFeedback | 151 | var contractUndertakerFeedbackModels []*models.ContractUndertakerFeedback |
| 153 | contractUndertakerFeedbacks := make([]*domain.ContractUndertakerFeedback, 0) | 152 | contractUndertakerFeedbacks := make([]*domain.ContractUndertakerFeedback, 0) |
| 154 | query := sqlbuilder.BuildQuery(tx.Model(&contractUndertakerFeedbackModels), queryOptions) | 153 | query := sqlbuilder.BuildQuery(tx.Model(&contractUndertakerFeedbackModels), queryOptions) |
| 155 | query.SetOffsetAndLimit(20) | 154 | query.SetOffsetAndLimit(20) |
| 156 | - query.SetOrderDirect("contract_undertaker_feedback_id", "DESC") | 155 | + query.SetOrderDirect("feedback_id", "DESC") |
| 157 | if count, err := query.SelectAndCount(); err != nil { | 156 | if count, err := query.SelectAndCount(); err != nil { |
| 158 | return 0, contractUndertakerFeedbacks, err | 157 | return 0, contractUndertakerFeedbacks, err |
| 159 | } else { | 158 | } else { |
| 160 | - for _, contractUndertakerFeedbackModel := range contractUndertakerFeedbackModels { | ||
| 161 | - // 获取共创模式 | ||
| 162 | - cooperationModeModel := new(models.CooperationMode) | ||
| 163 | - cooperationModeQuery := tx.Model(cooperationModeModel) | ||
| 164 | - if err := cooperationModeQuery.Where("cooperation_mode_number = ?", contractUndertakerFeedbackModel.CooperationModeNumber).First(); err != nil { | ||
| 165 | - return 0, nil, err | ||
| 166 | - } | ||
| 167 | - if contractUndertakerFeedback, err := transform.TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel, cooperationModeModel); err != nil { | ||
| 168 | - return 0, contractUndertakerFeedbacks, err | ||
| 169 | - } else { | ||
| 170 | - contractUndertakerFeedbacks = append(contractUndertakerFeedbacks, contractUndertakerFeedback) | ||
| 171 | - } | ||
| 172 | - } | 159 | + //for _, contractUndertakerFeedbackModel := range contractUndertakerFeedbackModels { |
| 160 | + // // 获取共创模式 | ||
| 161 | + // cooperationModeModel := new(models.CooperationMode) | ||
| 162 | + // cooperationModeQuery := tx.Model(cooperationModeModel) | ||
| 163 | + // if err := cooperationModeQuery.Where("cooperation_mode_number = ?", contractUndertakerFeedbackModel.CooperationModeNumber).First(); err != nil { | ||
| 164 | + // return 0, nil, err | ||
| 165 | + // } | ||
| 166 | + // if contractUndertakerFeedback, err := transform.TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel, cooperationModeModel); err != nil { | ||
| 167 | + // return 0, contractUndertakerFeedbacks, err | ||
| 168 | + // } else { | ||
| 169 | + // contractUndertakerFeedbacks = append(contractUndertakerFeedbacks, contractUndertakerFeedback) | ||
| 170 | + // } | ||
| 171 | + //} | ||
| 173 | return int64(count), contractUndertakerFeedbacks, nil | 172 | return int64(count), contractUndertakerFeedbacks, nil |
| 174 | } | 173 | } |
| 175 | } | 174 | } |
| 175 | + | ||
| 176 | func NewContractUndertakerFeedbackRepository(transactionContext *pgTransaction.TransactionContext) (*ContractUndertakerFeedbackRepository, error) { | 176 | func NewContractUndertakerFeedbackRepository(transactionContext *pgTransaction.TransactionContext) (*ContractUndertakerFeedbackRepository, error) { |
| 177 | if transactionContext == nil { | 177 | if transactionContext == nil { |
| 178 | return nil, fmt.Errorf("transactionContext参数不能为nil") | 178 | return nil, fmt.Errorf("transactionContext参数不能为nil") |
| @@ -14,7 +14,6 @@ func (controller *ContractUndertakerFeedbackController) CreateContractUndertaker | @@ -14,7 +14,6 @@ func (controller *ContractUndertakerFeedbackController) CreateContractUndertaker | ||
| 14 | contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil) | 14 | contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil) |
| 15 | createContractUndertakerFeedbackCommand := &command.CreateContractUndertakerFeedbackCommand{} | 15 | createContractUndertakerFeedbackCommand := &command.CreateContractUndertakerFeedbackCommand{} |
| 16 | _ = controller.Unmarshal(createContractUndertakerFeedbackCommand) | 16 | _ = controller.Unmarshal(createContractUndertakerFeedbackCommand) |
| 17 | - // 解析头部信息 | ||
| 18 | header := controller.GetRequestHeader(controller.Ctx) | 17 | header := controller.GetRequestHeader(controller.Ctx) |
| 19 | createContractUndertakerFeedbackCommand.CompanyId = header.CompanyId | 18 | createContractUndertakerFeedbackCommand.CompanyId = header.CompanyId |
| 20 | createContractUndertakerFeedbackCommand.OrgId = header.OrgId | 19 | createContractUndertakerFeedbackCommand.OrgId = header.OrgId |
| @@ -28,13 +27,11 @@ func (controller *ContractUndertakerFeedbackController) UpdateContractUndertaker | @@ -28,13 +27,11 @@ func (controller *ContractUndertakerFeedbackController) UpdateContractUndertaker | ||
| 28 | contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil) | 27 | contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil) |
| 29 | updateContractUndertakerFeedbackCommand := &command.UpdateContractUndertakerFeedbackCommand{} | 28 | updateContractUndertakerFeedbackCommand := &command.UpdateContractUndertakerFeedbackCommand{} |
| 30 | _ = controller.Unmarshal(updateContractUndertakerFeedbackCommand) | 29 | _ = controller.Unmarshal(updateContractUndertakerFeedbackCommand) |
| 31 | - // 解析头部信息 | ||
| 32 | header := controller.GetRequestHeader(controller.Ctx) | 30 | header := controller.GetRequestHeader(controller.Ctx) |
| 33 | updateContractUndertakerFeedbackCommand.CompanyId = header.CompanyId | 31 | updateContractUndertakerFeedbackCommand.CompanyId = header.CompanyId |
| 34 | updateContractUndertakerFeedbackCommand.OrgId = header.OrgId | 32 | updateContractUndertakerFeedbackCommand.OrgId = header.OrgId |
| 35 | updateContractUndertakerFeedbackCommand.UserId = header.UserId | 33 | updateContractUndertakerFeedbackCommand.UserId = header.UserId |
| 36 | updateContractUndertakerFeedbackCommand.UserBaseId = header.UserBaseId | 34 | updateContractUndertakerFeedbackCommand.UserBaseId = header.UserBaseId |
| 37 | - // 解析路径参数 | ||
| 38 | contractUndertakerFeedbackId := controller.GetString(":contractUndertakerFeedbackId") | 35 | contractUndertakerFeedbackId := controller.GetString(":contractUndertakerFeedbackId") |
| 39 | updateContractUndertakerFeedbackCommand.FeedbackId = contractUndertakerFeedbackId | 36 | updateContractUndertakerFeedbackCommand.FeedbackId = contractUndertakerFeedbackId |
| 40 | data, err := contractUndertakerFeedbackService.UpdateContractUndertakerFeedback(updateContractUndertakerFeedbackCommand) | 37 | data, err := contractUndertakerFeedbackService.UpdateContractUndertakerFeedback(updateContractUndertakerFeedbackCommand) |
| @@ -44,13 +41,11 @@ func (controller *ContractUndertakerFeedbackController) UpdateContractUndertaker | @@ -44,13 +41,11 @@ func (controller *ContractUndertakerFeedbackController) UpdateContractUndertaker | ||
| 44 | func (controller *ContractUndertakerFeedbackController) GetContractUndertakerFeedback() { | 41 | func (controller *ContractUndertakerFeedbackController) GetContractUndertakerFeedback() { |
| 45 | contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil) | 42 | contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil) |
| 46 | getContractUndertakerFeedbackQuery := &query.GetContractUndertakerFeedbackQuery{} | 43 | getContractUndertakerFeedbackQuery := &query.GetContractUndertakerFeedbackQuery{} |
| 47 | - // 解析头部信息 | ||
| 48 | header := controller.GetRequestHeader(controller.Ctx) | 44 | header := controller.GetRequestHeader(controller.Ctx) |
| 49 | getContractUndertakerFeedbackQuery.CompanyId = header.CompanyId | 45 | getContractUndertakerFeedbackQuery.CompanyId = header.CompanyId |
| 50 | getContractUndertakerFeedbackQuery.OrgId = header.OrgId | 46 | getContractUndertakerFeedbackQuery.OrgId = header.OrgId |
| 51 | getContractUndertakerFeedbackQuery.UserId = header.UserId | 47 | getContractUndertakerFeedbackQuery.UserId = header.UserId |
| 52 | getContractUndertakerFeedbackQuery.UserBaseId = header.UserBaseId | 48 | getContractUndertakerFeedbackQuery.UserBaseId = header.UserBaseId |
| 53 | - // 解析路径参数 | ||
| 54 | contractUndertakerFeedbackId := controller.GetString(":contractUndertakerFeedbackId") | 49 | contractUndertakerFeedbackId := controller.GetString(":contractUndertakerFeedbackId") |
| 55 | getContractUndertakerFeedbackQuery.FeedbackId = contractUndertakerFeedbackId | 50 | getContractUndertakerFeedbackQuery.FeedbackId = contractUndertakerFeedbackId |
| 56 | data, err := contractUndertakerFeedbackService.GetContractUndertakerFeedback(getContractUndertakerFeedbackQuery) | 51 | data, err := contractUndertakerFeedbackService.GetContractUndertakerFeedback(getContractUndertakerFeedbackQuery) |
| @@ -88,17 +83,17 @@ func (controller *ContractUndertakerFeedbackController) SearchContractUndertaker | @@ -88,17 +83,17 @@ func (controller *ContractUndertakerFeedbackController) SearchContractUndertaker | ||
| 88 | func (controller *ContractUndertakerFeedbackController) ListContractUndertakerFeedback() { | 83 | func (controller *ContractUndertakerFeedbackController) ListContractUndertakerFeedback() { |
| 89 | contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil) | 84 | contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil) |
| 90 | listContractUndertakerFeedbackQuery := &query.ListContractUndertakerFeedbackQuery{} | 85 | listContractUndertakerFeedbackQuery := &query.ListContractUndertakerFeedbackQuery{} |
| 91 | - // 解析头部信息 | ||
| 92 | header := controller.GetRequestHeader(controller.Ctx) | 86 | header := controller.GetRequestHeader(controller.Ctx) |
| 93 | listContractUndertakerFeedbackQuery.CompanyId = header.CompanyId | 87 | listContractUndertakerFeedbackQuery.CompanyId = header.CompanyId |
| 94 | listContractUndertakerFeedbackQuery.OrgId = header.OrgId | 88 | listContractUndertakerFeedbackQuery.OrgId = header.OrgId |
| 95 | listContractUndertakerFeedbackQuery.UserId = header.UserId | 89 | listContractUndertakerFeedbackQuery.UserId = header.UserId |
| 96 | listContractUndertakerFeedbackQuery.UserBaseId = header.UserBaseId | 90 | listContractUndertakerFeedbackQuery.UserBaseId = header.UserBaseId |
| 97 | - // 获取路径参数 | ||
| 98 | pageSize, _ := controller.GetInt64("pageSize") | 91 | pageSize, _ := controller.GetInt64("pageSize") |
| 99 | listContractUndertakerFeedbackQuery.PageSize = pageSize | 92 | listContractUndertakerFeedbackQuery.PageSize = pageSize |
| 100 | pageNumber, _ := controller.GetInt64("pageNumber") | 93 | pageNumber, _ := controller.GetInt64("pageNumber") |
| 101 | listContractUndertakerFeedbackQuery.PageNumber = pageNumber | 94 | listContractUndertakerFeedbackQuery.PageNumber = pageNumber |
| 95 | + underTakerUid := controller.GetString(":underTakerUid") | ||
| 96 | + listContractUndertakerFeedbackQuery.UnderTakerUid = underTakerUid | ||
| 102 | data, err := contractUndertakerFeedbackService.ListContractUndertakerFeedback(listContractUndertakerFeedbackQuery) | 97 | data, err := contractUndertakerFeedbackService.ListContractUndertakerFeedback(listContractUndertakerFeedbackQuery) |
| 103 | controller.Response(data, err) | 98 | controller.Response(data, err) |
| 104 | } | 99 | } |
-
请 注册 或 登录 后发表评论