...
|
...
|
@@ -86,7 +86,7 @@ func GetRanksByUser(companyId int64, rankTypeId, rankRangeId, rankPeriodId int, |
|
|
(
|
|
|
select score,relation_id,user_id from(
|
|
|
select a.%v score,a.relation_id,user_id from rank a inner join user_company c on a.relation_id=c.id
|
|
|
where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v
|
|
|
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
|
|
|
order by a.%v desc,c.create_at asc
|
|
|
) a,(select @rowno:=%v) b
|
|
|
limit %v,%v
|
...
|
...
|
@@ -117,7 +117,7 @@ select a.*,b.nick_name name from |
|
|
(
|
|
|
select score,relation_id,user_id,(@rowno:=@rowno+1) as ranking from(
|
|
|
select a.%v score,a.relation_id,user_id from rank a inner join user_company c on a.relation_id=c.id
|
|
|
where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v
|
|
|
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
|
|
|
order by a.%v desc,c.create_at asc
|
|
|
) a,(select @rowno:=0 ) b
|
|
|
)a inner join user b on a.user_id = b.id
|
...
|
...
|
@@ -145,7 +145,7 @@ select a.*,(@rowno:=@rowno+1) as ranking from |
|
|
(
|
|
|
select a.%v score,a.relation_id,c.name
|
|
|
from rank a inner join department c on a.relation_id=c.id
|
|
|
where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v
|
|
|
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
|
|
|
order by a.%v desc,c.create_at asc
|
|
|
)a,(select (@rowno:=%v)) b
|
|
|
limit %v,%v
|
...
|
...
|
@@ -174,7 +174,7 @@ func GetRanksByDepartmentSelf(companyId int64, rankTypeId, rankRangeId, rankPeri |
|
|
sql := fmt.Sprintf(`select * from (
|
|
|
select a.*,(@rowno:=@rowno+1) as ranking from (
|
|
|
select a.%v score,a.relation_id,c.name from rank a inner join department c on a.relation_id=c.id
|
|
|
where a.company_id=%v and rank_type_id=%v and rank_range_id=%v and rank_period_id=%v
|
|
|
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
|
|
|
order by a.%v desc,c.create_at asc
|
|
|
) a,(select (@rowno:=0)) b
|
|
|
)a
|
...
|
...
|
@@ -184,6 +184,9 @@ where a.relation_id=%v |
|
|
|
|
|
if v != nil {
|
|
|
if err = utils.ExecuteQueryOne(v, sql); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
err = nil
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
}
|
...
|
...
|
|