Browse Source

是否收录处理

WH01243 1 year ago
parent
commit
0ba99ed710
1 changed files with 17 additions and 8 deletions
  1. 17 8
      api/internal/service/employService.go

+ 17 - 8
api/internal/service/employService.go

@@ -674,19 +674,19 @@ func employInfoPerson(table, employKey, findKey string, in *types.InfoEmployinfo
 		orderKey = "source"
 	}
 	if len(infoId1Arr) > 0 {
-		infoData1 = MC.CrmMysql.SelectBySql(fmt.Sprintf("select   %s, is_ignore,status,id,%s from  %s   where position_id =? and  %s in ('%s')    GROUP BY %s ,%s  order  by %s desc", employKey, orderKey, table, employKey, strings.Join(infoId1Arr, "','"), employKey, orderKey, orderKey), in.PositionId)
+		infoData1 = MC.CrmMysql.SelectBySql(fmt.Sprintf("select   %s, is_ignore,status,id,%s from  %s   where position_id =? and  %s in ('%s')    GROUP BY %s ,%s  order  by %s ", employKey, orderKey, table, employKey, strings.Join(infoId1Arr, "','"), employKey, orderKey, orderKey), in.PositionId)
 	}
 	if len(infoId2Arr) > 0 {
-		infoData2 = MC.CrmMysql.SelectBySql(fmt.Sprintf("select  %s,  is_ignore,status,id,%s from  %s   where position_id =? and  %s in ('%s')    GROUP BY %s ,%s order  by %s desc", employKey, orderKey, table, employKey, strings.Join(infoId2Arr, "','"), employKey, orderKey, orderKey), in.PositionId)
+		infoData2 = MC.CrmMysql.SelectBySql(fmt.Sprintf("select  %s,  is_ignore,status,id,%s from  %s   where position_id =? and  %s in ('%s')    GROUP BY %s ,%s order  by %s ", employKey, orderKey, table, employKey, strings.Join(infoId2Arr, "','"), employKey, orderKey, orderKey), in.PositionId)
 	}
 	if len(niJianIdArr) > 0 {
-		niJianData = MC.CrmMysql.SelectBySql(fmt.Sprintf("select %s,   is_ignore,status,id,%s from  %s   where position_id =? and  %s in ('%s')    GROUP BY %s  ,%s order  by %s desc", employKey, orderKey, table, employKey, strings.Join(niJianIdArr, "','"), employKey, orderKey, orderKey), in.PositionId)
+		niJianData = MC.CrmMysql.SelectBySql(fmt.Sprintf("select %s,   is_ignore,status,id,%s from  %s   where position_id =? and  %s in ('%s')    GROUP BY %s  ,%s order  by %s ", employKey, orderKey, table, employKey, strings.Join(niJianIdArr, "','"), employKey, orderKey, orderKey), in.PositionId)
 	}
 	if len(wuye1Arr) > 0 {
-		wuyeData1 = MC.CrmMysql.SelectBySql(fmt.Sprintf("select  %s,  is_ignore,status,id,%s from  %s   where position_id =? and  %s in ('%s')  GROUP BY %s  ,%s order  by %s desc", employKey, orderKey, table, employKey, strings.Join(wuye1Arr, "','"), employKey, orderKey, orderKey), in.PositionId)
+		wuyeData1 = MC.CrmMysql.SelectBySql(fmt.Sprintf("select  %s,  is_ignore,status,id,%s from  %s   where position_id =? and  %s in ('%s')  GROUP BY %s  ,%s order  by %s ", employKey, orderKey, table, employKey, strings.Join(wuye1Arr, "','"), employKey, orderKey, orderKey), in.PositionId)
 	}
 	if len(wuye2Arr) > 0 {
-		wuyeData2 = MC.CrmMysql.SelectBySql(fmt.Sprintf("select   %s, is_ignore,status,id,%s from  %s   where position_id =? and  %s in ('%s')    GROUP BY %s ,%s order  by %s desc", employKey, orderKey, table, employKey, strings.Join(wuye2Arr, "','"), employKey, orderKey, orderKey), in.PositionId)
+		wuyeData2 = MC.CrmMysql.SelectBySql(fmt.Sprintf("select   %s, is_ignore,status,id,%s from  %s   where position_id =? and  %s in ('%s')    GROUP BY %s ,%s order  by %s ", employKey, orderKey, table, employKey, strings.Join(wuye2Arr, "','"), employKey, orderKey, orderKey), in.PositionId)
 	}
 	for _, v := range *infoData1 {
 		valueMap := map[string]interface{}{
@@ -918,6 +918,16 @@ func EmployHandle(valueMap map[string]interface{}, employData map[string]interfa
 	employId := int64(0)
 	is_ignore := int64(0)
 	employArrStr := ""
+	//收录标识处理
+	if common.Int64All(employData["id"]) == 0 {
+		if len(gconv.String(employData["employIdArr"])) > 0 {
+			employArrStr = gconv.String(employData["employIdArr"])
+			employId = gconv.Int64(strings.Split(employArrStr, ",")[0])
+		}
+
+	} else {
+		employId = common.Int64All(employData["id"])
+	}
 	if version == 1 {
 		is_ignore = common.Int64All(employData["is_ignore"])
 		switch employType {
@@ -940,7 +950,7 @@ func EmployHandle(valueMap map[string]interface{}, employData map[string]interfa
 			employIgnore = true
 		}
 		employType = common.Int64All(employData["type"])
-		employId = common.Int64All(employData["id"])
+
 		valueMap["isIgnore"] = employIgnore
 		if originate == "jhfp" {
 			valueMap["isEmploy"] = employ3
@@ -955,8 +965,7 @@ func EmployHandle(valueMap map[string]interface{}, employData map[string]interfa
 		valueMap["isIgnore"] = common.If(common.Int64All(employData["is_ignore"]) == 1, true, false)
 		valueMap["isEmploy"] = common.If(common.Int64All(employData["status"]) == 1, true, false)
 		valueMap["type"] = common.Int64All(employData["type"])
-		employArrStr := common.InterfaceToStr(employData["employIdArr"])
-		valueMap["employId"] = strings.Split(employArrStr, ",")[0]
+		valueMap["employId"] = employId
 	}
 	if single && employArrStr != "" {
 		//列表查询