...
|
...
|
@@ -35,10 +35,28 @@ func (dao *CooperationContractDao) GenerateContractNumber() (string, error) { |
|
|
}
|
|
|
}
|
|
|
|
|
|
// CheckUndertakerTypesUncheckedAvailable TODO 校验合约承接对象是否可以删除
|
|
|
func (dao *CooperationContractDao) CheckUndertakerTypesUncheckedAvailable(queryOptions map[string]interface{}) ([]int32, error) {
|
|
|
|
|
|
return []int32{}, nil
|
|
|
// CheckUndertakerTypesUncheckedAvailable 校验合约承接对象是否可以删除
|
|
|
func (dao *CooperationContractDao) CheckUndertakerTypesUncheckedAvailable(queryOptions map[string]interface{}) (bool, error) {
|
|
|
tx := dao.transactionContext.PgTx
|
|
|
var cooperationContractUndertakerModels []*models.CooperationContractUndertaker
|
|
|
query := tx.Model(&cooperationContractUndertakerModels)
|
|
|
if cooperationContractNumber, ok := queryOptions["cooperationContractNumber"]; ok && cooperationContractNumber != "" {
|
|
|
query = query.Where("cooperation_contract_number = ?", cooperationContractNumber)
|
|
|
}
|
|
|
if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
|
|
|
query = query.Where(`cooperation_contract.company @> '{"companyId":"?"}'`, companyId)
|
|
|
}
|
|
|
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
|
|
|
query = query.Where(`cooperation_contract.org @> '{"orgId":"?"}'`, orgId)
|
|
|
}
|
|
|
if user, ok := queryOptions["user"]; ok && user.(bool) != false {
|
|
|
query = query.Where("user_type = ?", 1)
|
|
|
}
|
|
|
if partner, ok := queryOptions["partner"]; ok && partner.(bool) != false {
|
|
|
query = query.Where("user_type = ?", 2)
|
|
|
}
|
|
|
ok, err := query.Exists()
|
|
|
return !ok, err
|
|
|
}
|
|
|
|
|
|
// CheckContractNumberAvailable 检验合约编号唯一性
|
...
|
...
|
|