|
@@ -86,7 +86,7 @@ func GetRanksByUser(companyId int64, rankTypeId, rankRangeId, rankPeriodId int, |
|
@@ -86,7 +86,7 @@ func GetRanksByUser(companyId int64, rankTypeId, rankRangeId, rankPeriodId int, |
86
|
(
|
86
|
(
|
87
|
select score,relation_id,user_id from(
|
87
|
select score,relation_id,user_id from(
|
88
|
select a.%v score,a.relation_id,user_id from rank a inner join user_company c on a.relation_id=c.id
|
88
|
select a.%v score,a.relation_id,user_id from rank a inner join user_company c on a.relation_id=c.id
|
89
|
-where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v
|
89
|
+where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v and a.enable_status=1
|
90
|
order by a.%v desc,c.create_at asc
|
90
|
order by a.%v desc,c.create_at asc
|
91
|
) a,(select @rowno:=%v) b
|
91
|
) a,(select @rowno:=%v) b
|
92
|
limit %v,%v
|
92
|
limit %v,%v
|
|
@@ -117,7 +117,7 @@ select a.*,b.nick_name name from |
|
@@ -117,7 +117,7 @@ select a.*,b.nick_name name from |
117
|
(
|
117
|
(
|
118
|
select score,relation_id,user_id,(@rowno:=@rowno+1) as ranking from(
|
118
|
select score,relation_id,user_id,(@rowno:=@rowno+1) as ranking from(
|
119
|
select a.%v score,a.relation_id,user_id from rank a inner join user_company c on a.relation_id=c.id
|
119
|
select a.%v score,a.relation_id,user_id from rank a inner join user_company c on a.relation_id=c.id
|
120
|
-where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v
|
120
|
+where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v and a.enable_status=1
|
121
|
order by a.%v desc,c.create_at asc
|
121
|
order by a.%v desc,c.create_at asc
|
122
|
) a,(select @rowno:=0 ) b
|
122
|
) a,(select @rowno:=0 ) b
|
123
|
)a inner join user b on a.user_id = b.id
|
123
|
)a inner join user b on a.user_id = b.id
|
|
@@ -145,7 +145,7 @@ select a.*,(@rowno:=@rowno+1) as ranking from |
|
@@ -145,7 +145,7 @@ select a.*,(@rowno:=@rowno+1) as ranking from |
145
|
(
|
145
|
(
|
146
|
select a.%v score,a.relation_id,c.name
|
146
|
select a.%v score,a.relation_id,c.name
|
147
|
from rank a inner join department c on a.relation_id=c.id
|
147
|
from rank a inner join department c on a.relation_id=c.id
|
148
|
-where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v
|
148
|
+where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v and a.enable_status=1
|
149
|
order by a.%v desc,c.create_at asc
|
149
|
order by a.%v desc,c.create_at asc
|
150
|
)a,(select (@rowno:=%v)) b
|
150
|
)a,(select (@rowno:=%v)) b
|
151
|
limit %v,%v
|
151
|
limit %v,%v
|
|
@@ -174,7 +174,7 @@ func GetRanksByDepartmentSelf(companyId int64, rankTypeId, rankRangeId, rankPeri |
|
@@ -174,7 +174,7 @@ func GetRanksByDepartmentSelf(companyId int64, rankTypeId, rankRangeId, rankPeri |
174
|
sql := fmt.Sprintf(`select * from (
|
174
|
sql := fmt.Sprintf(`select * from (
|
175
|
select a.*,(@rowno:=@rowno+1) as ranking from (
|
175
|
select a.*,(@rowno:=@rowno+1) as ranking from (
|
176
|
select a.%v score,a.relation_id,c.name from rank a inner join department c on a.relation_id=c.id
|
176
|
select a.%v score,a.relation_id,c.name from rank a inner join department c on a.relation_id=c.id
|
177
|
-where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v
|
177
|
+where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v and a.enable_status=1
|
178
|
order by a.%v desc,c.create_at asc
|
178
|
order by a.%v desc,c.create_at asc
|
179
|
) a,(select (@rowno:=0)) b
|
179
|
) a,(select (@rowno:=0)) b
|
180
|
)a
|
180
|
)a
|
|
@@ -184,6 +184,9 @@ where a.relation_id=%v |
|
@@ -184,6 +184,9 @@ where a.relation_id=%v |
184
|
|
184
|
|
185
|
if v != nil {
|
185
|
if v != nil {
|
186
|
if err = utils.ExecuteQueryOne(v, sql); err != nil {
|
186
|
if err = utils.ExecuteQueryOne(v, sql); err != nil {
|
|
|
187
|
+ if err == orm.ErrNoRows {
|
|
|
188
|
+ err = nil
|
|
|
189
|
+ }
|
187
|
return
|
190
|
return
|
188
|
}
|
191
|
}
|
189
|
}
|
192
|
}
|