Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nanMoMentorPlatform
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
nanMoMentorPlatform
Commits
29cfa5d2
Commit
29cfa5d2
authored
Jun 28, 2026
by
PC-20251223ZVQQ\Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导师/班主任端-我的学生-获取学期
parent
346a9e74
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
5 deletions
+50
-5
growthMessageSummary.ts
src/biz/headteacher/growthMessageSummary.ts
+40
-0
myStudents.ts
src/biz/teacher/myStudents.ts
+2
-1
teacherInfo.ts
src/biz/teacher/teacherInfo.ts
+2
-0
mysqlTableConfig.ts
src/config/mysqlTableConfig.ts
+1
-0
teacher.ts
src/routers/teacher.ts
+5
-4
No files found.
src/biz/headteacher/growthMessageSummary.ts
View file @
29cfa5d2
...
@@ -41,6 +41,43 @@ export async function getClassStudents(
...
@@ -41,6 +41,43 @@ export async function getClassStudents(
if
(
studentAll
.
data
.
length
===
0
)
{
if
(
studentAll
.
data
.
length
===
0
)
{
return
{
count
:
0
,
dataList
:
[]
};
return
{
count
:
0
,
dataList
:
[]
};
}
}
// 批量查询所有学生的当前匹配学期(避免 N+1 循环查询)
let
allStudentIds
=
studentAll
.
data
.
map
((
s
:
any
)
=>
s
.
user_id
);
let
semesterMap
=
new
Map
<
string
,
{
semester_id
:
number
;
semester_name
:
string
}
>
();
if
(
allStudentIds
.
length
>
0
)
{
let
allMatches
=
await
selectDataListByParam
(
TABLENAME
.
师生匹配表
,
{
student_id
:
{
"%in%"
:
allStudentIds
},
is_active
:
true
,
});
let
studentSemesterMap
=
new
Map
<
string
,
number
>
();
let
semesterIdSet
=
new
Set
<
number
>
();
for
(
let
m
of
allMatches
.
data
)
{
if
(
m
.
semester_id
)
{
studentSemesterMap
.
set
(
m
.
student_id
,
m
.
semester_id
);
semesterIdSet
.
add
(
m
.
semester_id
);
}
}
if
(
semesterIdSet
.
size
>
0
)
{
let
allSemesters
=
await
selectDataListByParam
(
TABLENAME
.
学期表
,
{
id
:
{
"%in%"
:
[...
semesterIdSet
]
},
});
let
nameMap
=
new
Map
<
number
,
string
>
();
for
(
let
s
of
allSemesters
.
data
)
{
nameMap
.
set
(
s
.
id
,
s
.
name
);
}
for
(
let
[
studentId
,
semId
]
of
studentSemesterMap
)
{
semesterMap
.
set
(
studentId
,
{
semester_id
:
semId
,
semester_name
:
nameMap
.
get
(
semId
)
||
''
,
});
}
}
}
// 当前学期
let
currentSemester
=
await
getCurrentSemester
();
for
(
let
bean
of
studentAll
.
data
)
{
for
(
let
bean
of
studentAll
.
data
)
{
let
student_id
=
bean
.
user_id
;
let
student_id
=
bean
.
user_id
;
/**获取学生基本信息 */
/**获取学生基本信息 */
...
@@ -82,11 +119,14 @@ export async function getClassStudents(
...
@@ -82,11 +119,14 @@ export async function getClassStudents(
"%limit%"
:
1
"%limit%"
:
1
});
});
let
semInfo
=
semesterMap
.
get
(
student_id
);
students
.
push
({
students
.
push
({
student_id
:
student_id
,
student_id
:
student_id
,
student_name
:
student
.
data
?
student
.
data
.
user_name
:
''
,
student_name
:
student
.
data
?
student
.
data
.
user_name
:
''
,
gender
:
student
.
data
?
student
.
data
.
gender
:
''
,
gender
:
student
.
data
?
student
.
data
.
gender
:
''
,
class_name
:
classInfo
&&
classInfo
.
data
?
classInfo
.
data
.
full_name
:
''
,
class_name
:
classInfo
&&
classInfo
.
data
?
classInfo
.
data
.
full_name
:
''
,
semester_id
:
semInfo
?
semInfo
.
semester_id
:
currentSemester
,
semester_name
:
semInfo
?
semInfo
.
semester_name
:
''
,
communication_count
:
communications
.
data
||
0
,
communication_count
:
communications
.
data
||
0
,
last_communication
:
lastComm
.
data
&&
lastComm
.
data
.
length
>
0
?
{
last_communication
:
lastComm
.
data
&&
lastComm
.
data
.
length
>
0
?
{
date
:
lastComm
.
data
[
0
].
date
,
date
:
lastComm
.
data
[
0
].
date
,
...
...
src/biz/teacher/myStudents.ts
View file @
29cfa5d2
...
@@ -96,6 +96,7 @@ export async function getMyStudents(teacherId:string, studentName?:string, semes
...
@@ -96,6 +96,7 @@ export async function getMyStudents(teacherId:string, studentName?:string, semes
students
.
push
({
students
.
push
({
student_id
:
match
.
student_id
,
student_id
:
match
.
student_id
,
semester_id
:
semesterId
,
student_name
:
student
.
data
?
student
.
data
.
user_name
:
''
,
student_name
:
student
.
data
?
student
.
data
.
user_name
:
''
,
gender
:
student
.
data
?
student
.
data
.
gender
:
''
,
gender
:
student
.
data
?
student
.
data
.
gender
:
''
,
class_name
:
classInfo
&&
classInfo
.
data
?
classInfo
.
data
.
full_name
:
''
,
class_name
:
classInfo
&&
classInfo
.
data
?
classInfo
.
data
.
full_name
:
''
,
...
@@ -146,7 +147,7 @@ export async function getStudentDetail(teacherId: string, studentId: string, sem
...
@@ -146,7 +147,7 @@ export async function getStudentDetail(teacherId: string, studentId: string, sem
is_active
:
true
is_active
:
true
});
});
if
(
!
match
.
data
)
{
if
(
!
match
.
data
&&
!
match
.
data
.
id
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
'您与该学生无师生关系'
);
throw
new
BizError
(
ERRORENUM
.
权限不足
,
'您与该学生无师生关系'
);
}
}
...
...
src/biz/teacher/teacherInfo.ts
View file @
29cfa5d2
...
@@ -71,6 +71,7 @@ export async function teacherInfo(teacherId: string) {
...
@@ -71,6 +71,7 @@ export async function teacherInfo(teacherId: string) {
* @param param.class_ids 任教班级ID数组
* @param param.class_ids 任教班级ID数组
* @param param.subjects 任教科目数组
* @param param.subjects 任教科目数组
* @param param.semester_id 学期ID(可选,默认使用当前学期)
* @param param.semester_id 学期ID(可选,默认使用当前学期)
* @param param.avatar 头像
*/
*/
export
async
function
teacherUpdate
(
teacherId
:
string
,
param
:
any
)
{
export
async
function
teacherUpdate
(
teacherId
:
string
,
param
:
any
)
{
...
@@ -141,6 +142,7 @@ export async function teacherUpdate(teacherId: string, param: any) {
...
@@ -141,6 +142,7 @@ export async function teacherUpdate(teacherId: string, param: any) {
if
(
param
.
user_name
!==
undefined
)
userParams
.
user_name
=
param
.
user_name
;
if
(
param
.
user_name
!==
undefined
)
userParams
.
user_name
=
param
.
user_name
;
if
(
param
.
user_name
!==
undefined
)
userParams
.
nickname
=
param
.
user_name
;
if
(
param
.
user_name
!==
undefined
)
userParams
.
nickname
=
param
.
user_name
;
if
(
param
.
gender
!==
undefined
)
userParams
.
gender
=
param
.
gender
;
if
(
param
.
gender
!==
undefined
)
userParams
.
gender
=
param
.
gender
;
if
(
param
.
avatar
!==
undefined
)
userParams
.
avatar
=
param
.
avatar
;
if
(
Object
.
keys
(
updateData
).
length
>
0
)
{
if
(
Object
.
keys
(
updateData
).
length
>
0
)
{
await
updateManyData
(
TABLENAME
.
统一用户表
,
{
user_id
:
teacherId
},
userParams
);
await
updateManyData
(
TABLENAME
.
统一用户表
,
{
user_id
:
teacherId
},
userParams
);
...
...
src/config/mysqlTableConfig.ts
View file @
29cfa5d2
...
@@ -41,6 +41,7 @@ export const TablesConfig = [
...
@@ -41,6 +41,7 @@ export const TablesConfig = [
eduid
:
{
type
:
DataTypes
.
STRING
(
40
),
allowNull
:
true
,
comment
:
'EduID'
},
eduid
:
{
type
:
DataTypes
.
STRING
(
40
),
allowNull
:
true
,
comment
:
'EduID'
},
uoid
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
defaultValue
:
0
,
comment
:
'本组内排序号'
},
uoid
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
true
,
defaultValue
:
0
,
comment
:
'本组内排序号'
},
user_mark
:
{
type
:
DataTypes
.
STRING
(
20
),
allowNull
:
true
,
comment
:
'用户标识(政务,院务,校务)'
},
user_mark
:
{
type
:
DataTypes
.
STRING
(
20
),
allowNull
:
true
,
comment
:
'用户标识(政务,院务,校务)'
},
avatar
:
{
type
:
DataTypes
.
STRING
(
20
),
allowNull
:
true
,
comment
:
'用户头像'
},
},
},
association
:
[]
association
:
[]
},
},
...
...
src/routers/teacher.ts
View file @
29cfa5d2
...
@@ -924,16 +924,17 @@ async function teacherInfo(req, res) {
...
@@ -924,16 +924,17 @@ async function teacherInfo(req, res) {
async
function
teacherUpdate
(
req
,
res
)
{
async
function
teacherUpdate
(
req
,
res
)
{
const
userInfo
=
req
.
userInfo
;
const
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
user_name
:
'String'
,
political_status
:
'String'
,
gender
:
'String'
,
class_ids
:
'[Number]'
,
subjects
:
'[String]'
};
let
reqConf
=
{
user_name
:
'String'
,
political_status
:
'String'
,
gender
:
'String'
,
class_ids
:
'[Number]'
,
subjects
:
'[String]'
,
avatar
:
'String'
};
const
NotMustHaveKeys
=
[
'user_name'
,
'political_status'
,
'gender'
,
'class_ids'
,
'subjects'
];
const
NotMustHaveKeys
=
[
'user_name'
,
'political_status'
,
'gender'
,
'class_ids'
,
'subjects'
,
'avatar'
];
let
{
user_name
,
political_status
,
gender
,
class_ids
,
subjects
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
{
user_name
,
political_status
,
gender
,
class_ids
,
subjects
,
avatar
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
updateData
=
{
let
updateData
=
{
political_status
,
political_status
,
user_name
,
user_name
,
gender
,
gender
,
class_ids
,
class_ids
,
subjects
subjects
,
avatar
};
};
let
result
=
await
teacherInfoBiz
.
teacherUpdate
(
userInfo
.
userId
,
updateData
);
let
result
=
await
teacherInfoBiz
.
teacherUpdate
(
userInfo
.
userId
,
updateData
);
...
...
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