...
|
...
|
@@ -3,7 +3,7 @@ package repository |
|
|
import (
|
|
|
"fmt"
|
|
|
"github.com/go-pg/pg/v10"
|
|
|
|
|
|
"github.com/go-pg/pg/v10/orm"
|
|
|
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
|
|
|
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
|
|
|
"github.com/linmadan/egglib-go/utils/snowflake"
|
...
|
...
|
@@ -31,6 +31,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF |
|
|
"feedback_attachment",
|
|
|
"feedback_content",
|
|
|
"cooperation_contract_number",
|
|
|
"cooperation_contract_name",
|
|
|
"contract_undertaker",
|
|
|
"org",
|
|
|
"company",
|
...
|
...
|
@@ -57,6 +58,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF |
|
|
&contractUndertakerFeedback.FeedbackAttachment,
|
|
|
&contractUndertakerFeedback.FeedbackContent,
|
|
|
&contractUndertakerFeedback.CooperationContractNumber,
|
|
|
&contractUndertakerFeedback.CooperationContractName,
|
|
|
&contractUndertakerFeedback.ContractUndertaker,
|
|
|
&contractUndertakerFeedback.Org,
|
|
|
&contractUndertakerFeedback.Company,
|
...
|
...
|
@@ -69,6 +71,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF |
|
|
contractUndertakerFeedback.FeedbackAttachment,
|
|
|
contractUndertakerFeedback.FeedbackContent,
|
|
|
contractUndertakerFeedback.CooperationContractNumber,
|
|
|
contractUndertakerFeedback.CooperationContractName,
|
|
|
contractUndertakerFeedback.ContractUndertaker,
|
|
|
contractUndertakerFeedback.Org,
|
|
|
contractUndertakerFeedback.Company,
|
...
|
...
|
@@ -85,6 +88,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF |
|
|
&contractUndertakerFeedback.FeedbackAttachment,
|
|
|
&contractUndertakerFeedback.FeedbackContent,
|
|
|
&contractUndertakerFeedback.CooperationContractNumber,
|
|
|
&contractUndertakerFeedback.CooperationContractName,
|
|
|
&contractUndertakerFeedback.ContractUndertaker,
|
|
|
&contractUndertakerFeedback.Org,
|
|
|
&contractUndertakerFeedback.Company,
|
...
|
...
|
@@ -97,6 +101,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF |
|
|
contractUndertakerFeedback.FeedbackAttachment,
|
|
|
contractUndertakerFeedback.FeedbackContent,
|
|
|
contractUndertakerFeedback.CooperationContractNumber,
|
|
|
contractUndertakerFeedback.CooperationContractName,
|
|
|
contractUndertakerFeedback.ContractUndertaker,
|
|
|
contractUndertakerFeedback.Org,
|
|
|
contractUndertakerFeedback.Company,
|
...
|
...
|
@@ -151,6 +156,15 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st |
|
|
if undertakerName, ok := queryOptions["undertakerName"]; ok && undertakerName != "" {
|
|
|
query.Where("contract_undertaker->>'userName' like ?", fmt.Sprintf("%%%s%%", undertakerName))
|
|
|
}
|
|
|
// 搜索内容包括项目合约名称、承接人姓名、承接内容关键字
|
|
|
if matchWord, ok := queryOptions["matchWord"]; ok && matchWord != "" {
|
|
|
query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
|
|
|
q.WhereOr("cooperation_contract_name like ?",fmt.Sprintf("%%%s%%", matchWord))
|
|
|
q.WhereOr("contract_undertaker->>'userName' like ?", fmt.Sprintf("%%%s%%", matchWord))
|
|
|
q.WhereOr("feedback_content like ?", fmt.Sprintf("%%%s%%", matchWord))
|
|
|
return q, nil
|
|
|
})
|
|
|
}
|
|
|
query.SetOffsetAndLimit(20)
|
|
|
query.SetOrderDirect("feedback_id", "DESC")
|
|
|
if count, err := query.SelectAndCount(); err != nil {
|
...
|
...
|
|