作者 yangfu

部门长修改

@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 "bytes" 4 "bytes"
5 "fmt" 5 "fmt"
6 "github.com/astaxie/beego/orm" 6 "github.com/astaxie/beego/orm"
  7 + "gitlab.fjmaimaimai.com/mmm-go/gocomm/common"
7 "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" 8 "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
8 "opp/internal/utils" 9 "opp/internal/utils"
9 "opp/models" 10 "opp/models"
@@ -97,6 +98,7 @@ func GetTopDepartment(departments []*protocol.Department) *protocol.Department { @@ -97,6 +98,7 @@ func GetTopDepartment(departments []*protocol.Department) *protocol.Department {
97 if len(departments) == 0 { 98 if len(departments) == 0 {
98 return &protocol.Department{} 99 return &protocol.Department{}
99 } 100 }
  101 + log.Debug(common.AssertJson(departments))
100 var top *protocol.Department 102 var top *protocol.Department
101 var countTop, countTmp = 0, 0 103 var countTop, countTmp = 0, 0
102 for i := range departments { 104 for i := range departments {
@@ -126,6 +128,7 @@ func GetTopDepartment(departments []*protocol.Department) *protocol.Department { @@ -126,6 +128,7 @@ func GetTopDepartment(departments []*protocol.Department) *protocol.Department {
126 func GetTopPosition(positions []*protocol.Position) *protocol.Position { 128 func GetTopPosition(positions []*protocol.Position) *protocol.Position {
127 var top *protocol.Position 129 var top *protocol.Position
128 var countTop, countTmp = 0, 0 130 var countTop, countTmp = 0, 0
  131 + log.Debug(common.AssertJson(positions))
129 if len(positions) == 0 { 132 if len(positions) == 0 {
130 return &protocol.Position{} 133 return &protocol.Position{}
131 } 134 }
@@ -25,7 +25,7 @@ func Test_GetTopDepartment(t *testing.T) { @@ -25,7 +25,7 @@ func Test_GetTopDepartment(t *testing.T) {
25 }, 25 },
26 } 26 }
27 out := GetTopDepartment(input) 27 out := GetTopDepartment(input)
28 - if out.DepartmentId != 1 { 28 + if out.DepartmentId != 5 {
29 t.Fatal("top department error") 29 t.Fatal("top department error")
30 } 30 }
31 } 31 }