wangshan 2 سال پیش
والد
کامیت
8595218930
4فایلهای تغییر یافته به همراه26 افزوده شده و 12 حذف شده
  1. 2 1
      entity/user.go
  2. 11 6
      entity/workDesktop.go
  3. 1 1
      rpc/internal/logic/workdesktopcomprehensivelogic.go
  4. 12 4
      service/workDesktop.go

+ 2 - 1
entity/user.go

@@ -37,7 +37,8 @@ var (
 *待调整  调整为存redis
 *测试用例放的地方不对 待调整
  */
-//用户权限 初始化
+
+// AutoUserPowerInfo 用户权限 初始化
 func (m *WorkDesktopMenu) AutoUserPowerInfo() map[string]int {
 	/*
 	* 商机管理--》新版商机管理vs老版商机管理

+ 11 - 6
entity/workDesktop.go

@@ -26,7 +26,7 @@ type WorkDesktopMenu struct {
 	Platform     string    //平台来源
 	WorkStatus   int64     //菜单分组
 	AccountId    int64     //账户id
-	PositionType int64     //职位类型 @个人 1企业
+	PositionType int64     //职位类型 0:个人 1:企业
 	PositionId   int64     //职位id
 
 }
@@ -66,14 +66,19 @@ type Additional struct {
 
 // GetMenuTreeData 获取有效菜单数据
 func (m *WorkDesktopMenu) GetMenuTreeData() error {
+	//P278 身份切换
+	positionType := ``
+	switch m.PositionType { //职位类型 0:个人 1:企业
+	case 0:
+		positionType = `AND available <= 2`
+	case 1:
+		positionType = `AND available >= 2`
+	}
 	//tidb数据
-	//query := `SELECT * FROM ` + ConfigJson.WorkTableOut + ` WHERE  appid=? AND status=0 ORDER BY id ASC`
-	//if m.WorkStatus > 0 {
-	query := fmt.Sprintf(`SELECT * FROM `+ConfigJson.WorkTableOut+` WHERE  appid=? AND status=%d ORDER BY id ASC`, m.WorkStatus)
-	//}
+	query := fmt.Sprintf(`SELECT * FROM `+ConfigJson.WorkTableOut+` WHERE  appid=? AND status=%d %s  ORDER BY id ASC`, m.WorkStatus, positionType)
 	//是否开启内网访问数据权限---对应 api 配置文件
 	if m.IntranetBool {
-		query = `SELECT * FROM ` + ConfigJson.WorkTableInside + ` WHERE  appid=? AND status>=0 ORDER BY id ASC`
+		query = fmt.Sprintf(`SELECT * FROM `+ConfigJson.WorkTableInside+` WHERE  appid=? AND status>=0 %s ORDER BY id ASC`, positionType)
 	}
 	menuData := BaseMysql.SelectBySql(query, m.AppId)
 	if menuData == nil || len(*menuData) == 0 {

+ 1 - 1
rpc/internal/logic/workdesktopcomprehensivelogic.go

@@ -22,7 +22,7 @@ func NewWorkDesktopComprehensiveLogic(ctx context.Context, svcCtx *svc.ServiceCo
 	}
 }
 
-//工作桌面--菜单当前选择模式--全部:all/可用:usable
+// WorkDesktopComprehensive 工作桌面--菜单当前选择模式--全部:all/可用:usable
 //工作桌面--常用功能更新
 //工作桌面--常用功能列表
 func (l *WorkDesktopComprehensiveLogic) WorkDesktopComprehensive(in *pb.WorkDesktopComprehensiveReq) (*pb.WorkDesktopComprehensiveResp, error) {

+ 12 - 4
service/workDesktop.go

@@ -64,12 +64,20 @@ func RenewWorkDesktopMenuModeOrCommonly(in *WorkDesktopComprehensiveReq) (r *Wor
 			}
 		}
 		if len(pIds) > 0 {
+			//P278 身份切换
+			positionType := ``
+			switch in.PositionType { //职位类型 0:个人 1:企业
+			case "0":
+				positionType = `AND available <= 2`
+			case "1":
+				positionType = `AND available >= 2`
+			}
 			//常用功能存储是三级菜单id,需要四级菜单信息也查出来
 			//会出现 用户设置常用功能,此功能下线,用户设置依然保存的有此功能  查询不能加 AND status = 0
-			var menuSql = fmt.Sprintf(`SELECT * from %s WHERE id IN (%s)  OR (parentid IN (%s)  AND status = 0)  ORDER BY FIELD(id , %s);`, entity.ConfigJson.WorkTableInside, strings.Join(pIds, ","), strings.Join(pIds, ","), strings.Join(pIds, ","))
+			var menuSql = fmt.Sprintf(`SELECT * from %s WHERE (id IN (%s)  OR (parentid IN (%s)  AND status = 0)) %s  ORDER BY FIELD(id , %s);`, entity.ConfigJson.WorkTableInside, strings.Join(pIds, ","), strings.Join(pIds, ","), positionType, strings.Join(pIds, ","))
 			//外网访问
-			if entity.ConfigJson.WorkTableInside != entity.ConfigJson.WorkTableOut || in.IntranetBool {
-				menuSql = fmt.Sprintf(`SELECT * from %s WHERE id IN (%s)  OR (parentid IN (%s)  AND status = 0)`, entity.ConfigJson.WorkTableOut, strings.Join(pIds, ","), strings.Join(pIds, ","))
+			if entity.ConfigJson.WorkTableInside != entity.ConfigJson.WorkTableOut || !in.IntranetBool {
+				menuSql = fmt.Sprintf(`SELECT * from %s WHERE id IN (%s)  OR (parentid IN (%s)  AND status = 0)) %s`, entity.ConfigJson.WorkTableOut, strings.Join(pIds, ","), strings.Join(pIds, ","), positionType)
 			}
 			menuData := entity.BaseMysql.SelectBySql(menuSql)
 			if menuData != nil && len(*menuData) > 0 {
@@ -256,7 +264,7 @@ func GetWordDesktopMenuTree(in *WorkDesktopMenuInfoReq) ([]*pb.MenuList, error)
 		IntranetBool: in.IntranetBool,
 		WorkStatus:   in.WorkStatus,
 		AccountId:    accountId,
-		PositionType: positionType,
+		PositionType: positionType, //职位类型 0:个人 1:企业
 		PositionId:   positionId,
 	}
 	//获取菜单树的数据