Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sportsschoolserver
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
node_server
sportsschoolserver
Commits
94837f3e
Commit
94837f3e
authored
Nov 08, 2021
by
chenjinjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
808354bf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
9 deletions
+60
-9
ydyglData.ts
src/data/ydyglData.ts
+60
-9
No files found.
src/data/ydyglData.ts
View file @
94837f3e
import
{
Query
}
from
"mongoose"
;
import
{
selectData
,
selectOnceObjectData
}
from
"./orcaleInterface"
;
import
{
selectData
,
selectOnceObjectData
}
from
"./orcaleInterface"
;
import
pyfl
from
'pyfl'
;
const
percentStr
=
'&%'
;
const
percentStr
=
'&%'
;
const
sqlKeyValueConfig
=
{
const
sqlKeyValueConfig
=
{
...
@@ -39,7 +41,7 @@ const sqlKeyValueConfig = {
...
@@ -39,7 +41,7 @@ const sqlKeyValueConfig = {
sql
:
"select * from player_sex_ratio"
,
sql
:
"select * from player_sex_ratio"
,
analysis
:{
"男"
:
"male"
,
"女"
:
"female"
},
analysis
:{
"男"
:
"male"
,
"女"
:
"female"
},
haveUnit
:
"&%"
haveUnit
:
"&%"
}
,
}
};
};
...
@@ -98,21 +100,46 @@ function checkUnit(str, data, allUnit?) {
...
@@ -98,21 +100,46 @@ function checkUnit(str, data, allUnit?) {
export
async
function
get
积分赛淘汰赛数据
(
time
,
type
)
{
export
async
function
get
积分赛淘汰赛数据
(
time
,
type
)
{
//这里要单独做,切换时间的时候有个接口,直接调用这个就可以 根据时间和类型来拼sql
//这里要单独做,切换时间的时候有个接口,直接调用这个就可以 根据时间和类型来拼sql
//他们数据表少了时间字段,少了比赛类型字段(淘汰赛,积分赛)
//他们数据表少了时间字段,少了比赛类型字段(淘汰赛,积分赛)
let
sql
=
''
;
let
sql
=
'
select * from points_competition
'
;
let
selectResult
=
await
selectData
(
sql
);
let
selectResult
=
await
selectData
(
sql
);
return
selectResult
;
return
selectResult
;
}
}
//todo 少了一张表
//todo 少了一张表
async
function
男女训练成绩对比
()
{
async
function
男女训练成绩对比
()
{
let
sql
=
"select * from train_month_sex"
;
let
info
=
await
selectData
(
sql
);
let
result
=
{
"月份"
:
info
.
month_sex
,
"女"
:
info
.
female
,
"男"
:
info
.
male
}
return
result
;
}
}
//todo 同上
//todo 同上
async
function
月训练量趋势
()
{
async
function
月训练量趋势
()
{
let
sql
=
"select * from train_month_sex"
;
let
info
=
await
selectData
(
sql
);
let
result
=
{
"月份"
:
info
.
month_sex
,
"女"
:
info
.
female
,
"男"
:
info
.
male
}
return
result
;
}
}
// 比赛类型 他们给的文档字段有问题 需要核对
// 比赛类型 他们给的文档字段有问题 需要核对
export
async
function
学员库
()
{
let
sql
=
"select p_name from student"
;
let
info
=
await
selectOnceObjectData
(
sql
);
let
result
=
{
"运动员姓名"
:
info
.
p_name
};
let
resultData
=
pyfl
(
result
);
console
.
log
(
result
);
console
.
log
(
resultData
);
return
resultData
;
}
export
async
function
基础数据
()
{
export
async
function
基础数据
()
{
//需要确认 student 表的pid和 recent_match表的 self_pid 有没有关联 此处默认有关联 没有关联
//需要确认 student 表的pid和 recent_match表的 self_pid 有没有关联 此处默认有关联 没有关联
...
@@ -120,15 +147,38 @@ export async function 基础数据() {
...
@@ -120,15 +147,38 @@ export async function 基础数据() {
//需要确认 recent_match表中的状态字段是多余的
//需要确认 recent_match表中的状态字段是多余的
//需要确认 recent_match 表中的 日期单词拼错了 改成了m_date
//需要确认 recent_match 表中的 日期单词拼错了 改成了m_date
let
sql
=
`select * from(select m.m_id,m.self_name,
m.self_score,m.self_pic,m.opponent_name,m.opponent_pic,m.opponent_score,m.m_dat
e,row_number()
let
sql
=
`select * from(select m.m_id,m.self_name,
birth,habitual_hand,match_count,win_count,win_rate,self_score,opponent_score,opponent_nam
e,row_number()
over(partition by m.self_name order by m.self_name asc) rn
over(partition by m.self_name order by m.self_name asc) rn
from student s,recent_match m
from student s,recent_match m
where s.p_id=m.self_pid group by m.m_id,m.self_name,
m.self_score,m.self_pic,m.opponent_name,m.opponent_pic,m.opponent_score,m.m_dat
e
where s.p_id=m.self_pid group by m.m_id,m.self_name,
birth,habitual_hand,match_count,win_count,win_rate,self_score,opponent_score,opponent_nam
e
)t where rn <=5`
;
)t where rn <=5`
;
//todo 这里的sql需要优化
//todo 这里的sql需要优化
let
info
=
await
selectOnceObjectData
(
sql
);
let
result
=
{
"基本信息"
:
{
"出生日期"
:
info
.
birth
,
"惯用手"
:
info
.
habitual_hand
,
"比赛场次"
:
info
.
match_count
,
"胜场"
:
info
.
win_count
,
"胜率"
:
info
.
win_rate
},
"近期比赛"
:
{
"match"
:[
info
.
self_name
,
info
.
self_score
,
info
.
opponent_score
,
info
.
opponent_name
]
}
}
let
resultData
=
""
;
for
(
let
i
in
result
)
{
resultData
=
result
[
i
];
}
resultData
=
resultData
.
sort
(
function
compareFunction
(
item1
,
item2
)
{
let
result
=
[];
return
item1
.
localeCompare
(
item2
);
return
result
;
}
)
return
resultData
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment