feat:完善信息,优化入驻接口
This commit is contained in:
@ -101,9 +101,14 @@ func (c *Research) Select(tenantID uint64) ([]*ResearchSelect, error) {
|
||||
|
||||
out := make([]*model2.ManageResearch, 0)
|
||||
|
||||
if err := model2.ScanFields(mManageResearch.ManageResearch, &out, []string{"id", "name"}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("tenant_id", tenantID)}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("examine_status", model2.ExamineStatusForAgree)}); err != nil {
|
||||
where := []*model2.ModelWhereOrder{
|
||||
&model2.ModelWhereOrder{Where: model2.NewWhere("examine_status", model2.ExamineStatusForAgree)},
|
||||
}
|
||||
if tenantID > 0 {
|
||||
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhere("tenant_id", tenantID)})
|
||||
}
|
||||
|
||||
if err := model2.ScanFields(mManageResearch.ManageResearch, &out, []string{"id", "name"}, where...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*ResearchSelect, 0)
|
||||
@ -135,8 +140,8 @@ func (c *Research) Form(params *BasicParams, other *config.IdentityForResearch)
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
} else {
|
||||
if mManageResearch.TenantID != params.TenantID {
|
||||
if isExist, err = params.isExist(mManageResearch.ManageResearch, model2.NewWhere("tenant_id", params.TenantID),
|
||||
if mManageResearch.Code != params.Code {
|
||||
if isExist, err = params.isExist(mManageResearch.ManageResearch,
|
||||
model2.NewWhere("code", params.Code)); err != nil {
|
||||
return err
|
||||
} else if isExist {
|
||||
@ -169,11 +174,10 @@ func (c *Research) Form(params *BasicParams, other *config.IdentityForResearch)
|
||||
mManageResearch.ExamineStatus = model2.ExamineStatusForAgree
|
||||
mManageResearch.ExamineRemark = "主动创建,无需审核"
|
||||
|
||||
if isExist, err := params.isExist(mManageResearch.ManageResearch, model2.NewWhere("tenant_id", params.TenantID),
|
||||
model2.NewWhere("code", params.Code)); err != nil {
|
||||
if isExist, err := params.isExist(mManageResearch.ManageResearch, model2.NewWhere("code", params.Code)); err != nil {
|
||||
return err
|
||||
} else if isExist {
|
||||
return errors.New("操作错误,当前站点下已存在同一研究机构代码")
|
||||
return errors.New("操作错误,已存在同一研究机构代码")
|
||||
}
|
||||
return model2.Create(mManageResearch.ManageResearch)
|
||||
}
|
||||
|
Reference in New Issue
Block a user