作者 yangfu

配置组织修改

@@ -25,6 +25,8 @@ type ListOrgQuery struct { @@ -25,6 +25,8 @@ type ListOrgQuery struct {
25 ParentId int64 `cname:"父级ID" json:"parentId,omitempty"` 25 ParentId int64 `cname:"父级ID" json:"parentId,omitempty"`
26 // 是否是组织(是:1 不是:2) 26 // 是否是组织(是:1 不是:2)
27 IsOrg int `cname:"是否是组织(是:1 不是:2)" json:"isOrg,omitempty"` 27 IsOrg int `cname:"是否是组织(是:1 不是:2)" json:"isOrg,omitempty"`
  28 + // 模糊匹配组织名称
  29 + MatchOrgName string `cname:"部门名称" json:"matchOrgName,omitempty"`
28 } 30 }
29 31
30 func (listOrgQuery *ListOrgQuery) Valid(validation *validation.Validation) { 32 func (listOrgQuery *ListOrgQuery) Valid(validation *validation.Validation) {
@@ -14,9 +14,6 @@ type PgBatchAddOrgService struct { @@ -14,9 +14,6 @@ type PgBatchAddOrgService struct {
14 } 14 }
15 15
16 func (ptr *PgBatchAddOrgService) BatchAddOrg(optUser *domain.OperateInfo, orgList []*domain.BatchAddOrgItem) error { 16 func (ptr *PgBatchAddOrgService) BatchAddOrg(optUser *domain.OperateInfo, orgList []*domain.BatchAddOrgItem) error {
17 - var (  
18 - err error  
19 - )  
20 orgRepository, err := repository.NewOrgRepository(ptr.transactionContext) 17 orgRepository, err := repository.NewOrgRepository(ptr.transactionContext)
21 if err != nil { 18 if err != nil {
22 return err 19 return err
@@ -191,6 +191,9 @@ func (repository *OrgRepository) Find(queryOptions map[string]interface{}) (int6 @@ -191,6 +191,9 @@ func (repository *OrgRepository) Find(queryOptions map[string]interface{}) (int6
191 query.SetWhereByQueryOption("org_name = ?", "depName") 191 query.SetWhereByQueryOption("org_name = ?", "depName")
192 query.SetWhereByQueryOption("org_code = ?", "orgCode") 192 query.SetWhereByQueryOption("org_code = ?", "orgCode")
193 query.SetWhereByQueryOption("parent_id = ?", "parentId") 193 query.SetWhereByQueryOption("parent_id = ?", "parentId")
  194 + if v, ok := queryOptions["matchOrgName"]; ok && len(v.(string)) > 0 {
  195 + query.Where(fmt.Sprintf(`org_name like '%%%v%%'`, v))
  196 + }
194 query.SetOrderDirect("org_id", "ASC") 197 query.SetOrderDirect("org_id", "ASC")
195 if count, err := query.SelectAndCount(); err != nil { 198 if count, err := query.SelectAndCount(); err != nil {
196 return 0, orgs, err 199 return 0, orgs, err