作者 陈志颖

合并分支 'dev' 到 'test'

Dev



查看合并请求 !34
... ... @@ -34,7 +34,7 @@ type CooperationContractRelevant struct {
// 更新时间
UpdatedAt time.Time `comment:"更新时间"`
// 删除时间
DeletedAt time.Time `comment:"删除时间"`
DeletedAt time.Time `comment:"删除时间" pg:",soft_delete"`
// 创建时间
CreatedAt time.Time `comment:"创建时间"`
}
... ...
... ... @@ -44,5 +44,5 @@ type CooperationContractUndertaker struct {
// 更新时间
UpdatedAt time.Time `comment:"更新时间"`
// 删除时间
DeletedAt time.Time `comment:"删除时间"`
DeletedAt time.Time `comment:"删除时间" pg:",soft_delete"`
}
... ...
... ... @@ -143,7 +143,16 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
// 新增承接人
var undertakersModel []*models.CooperationContractUndertaker
for _, undertaker := range cooperationContract.Undertakers {
if undertaker.Identify() == nil {
undertakerId, err := repository.nextIdentify()
if err != nil {
return nil, err
} else {
undertaker.UndertakerId = undertakerId
}
}
undertakersModel = append(undertakersModel, &models.CooperationContractUndertaker{
CooperationContractUndertakerId: undertaker.UndertakerId,
CooperationContractNumber: cooperationContract.CooperationContractNumber,
CooperationContractId: cooperationContract.CooperationContractId,
UserId: undertaker.UserId,
... ... @@ -1063,16 +1072,6 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string
if cooperationContractModel.CooperationContractId == 0 {
return nil, nil
} else {
// 获取共创模式
//cooperationModeModels := new(models.CooperationMode)
//cooperationModeQuery := tx.Model(cooperationModeModels)
//if err := cooperationModeQuery.
// Where("company->>'companyId' = '?'", cooperationContractModel.Company.CompanyId).
// Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId).
// Where("cooperation_mode_number = ?", cooperationContractModel.CooperationModeNumber).
// First(); err != nil {
// return nil, fmt.Errorf("共创合约关联的共创模式不存在")
//}
var cooperationModeModels []*models.CooperationMode
cooperationModeQuery := tx.Model(&cooperationModeModels)
if countMode, err := cooperationModeQuery.
... ... @@ -1151,7 +1150,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
query.Where("cooperation_contract_name like ?", fmt.Sprintf("%%%s%%", cooperationContractName))
}
if departmentName, ok := queryOptions["departmentName"]; ok && departmentName != "" {
query.Where(`(cooperation_contract.department->>'departmentName')::test LIKE ?`, fmt.Sprintf("%%%s%%", departmentName))
query.Where(`(cooperation_contract.department->>'departmentName')::text LIKE ?`, fmt.Sprintf("%%%s%%", departmentName))
}
if sponsorName, ok := queryOptions["sponsorName"]; ok && sponsorName != "" {
query.Where(`(cooperation_contract.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName))
... ...