wangchuanjin пре 1 година
родитељ
комит
7d06b080da
2 измењених фајлова са 6 додато и 2 уклоњено
  1. 3 1
      entity/workDesktop.go
  2. 3 1
      service/workDesktop.go

+ 3 - 1
entity/workDesktop.go

@@ -80,9 +80,11 @@ func (m *WorkDesktopMenu) GetMenuTreeData() error {
 		positionType = `AND available >= 2`
 		//P364 企业角色
 		if m.EntUserRole != "" {
+			positionType += ` AND (FIND_IN_SET('0',entrole)`
 			for _, entUserRole := range strings.Split(m.EntUserRole, ",") {
-				positionType += fmt.Sprintf(` AND (FIND_IN_SET('0',entrole) OR FIND_IN_SET('%d',entrole))`, MC.Int64All(entUserRole)+1)
+				positionType += fmt.Sprintf(` OR FIND_IN_SET('%d',entrole)`, MC.Int64All(entUserRole)+1)
 			}
+			positionType += `)`
 		} else {
 			positionType += fmt.Sprintf(` AND (FIND_IN_SET('0',entrole) OR FIND_IN_SET('%d',entrole))`, m.EntNicheDis)
 		}

+ 3 - 1
service/workDesktop.go

@@ -75,9 +75,11 @@ func RenewWorkDesktopMenuModeOrCommonly(in *WorkDesktopComprehensiveReq) (r *Wor
 				positionType = `AND available >= 2`
 				//P364 企业角色
 				if in.EntUserRole != "" {
+					positionType += ` AND (FIND_IN_SET('0',entrole)`
 					for _, entUserRole := range strings.Split(in.EntUserRole, ",") {
-						positionType += fmt.Sprintf(` AND (FIND_IN_SET('0',entrole) OR FIND_IN_SET('%d',entrole)) `, MC.Int64All(entUserRole)+1)
+						positionType += fmt.Sprintf(` OR FIND_IN_SET('%d',entrole)`, MC.Int64All(entUserRole)+1)
 					}
+					positionType += `)`
 				} else {
 					positionType += fmt.Sprintf(` AND (FIND_IN_SET('0',entrole) OR FIND_IN_SET('%d',entrole)) `, in.EntNicheDis+1)
 				}