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
43d7caad
Commit
43d7caad
authored
Jun 28, 2026
by
PC-20251223ZVQQ\Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取所有年级班级列表、政治面貌
parent
954c15b0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
0 deletions
+92
-0
public.ts
src/biz/admin/public.ts
+67
-0
enum.ts
src/config/enum.ts
+12
-0
public.ts
src/routers/public.ts
+13
-0
No files found.
src/biz/admin/public.ts
View file @
43d7caad
...
...
@@ -88,6 +88,73 @@ export async function getAllSubjects() {
}
/**
* 获取所有年级班级列表(级联下拉用)
* @param userInfo 当前用户信息 { userId, roles, permission }
* @returns { dataList: [{ classId: number, className: string, grade: number, gradeName: string }] }
*/
export
async
function
getAllGradeClasses
(
userInfo
?:
{
userId
:
string
;
roles
:
string
;
permission
:
number
})
{
// 判断是否为管理员
let
isAdmin
=
false
;
if
(
userInfo
)
{
const
roles
=
(
userInfo
.
roles
||
''
).
split
(
','
).
map
(
r
=>
parseInt
(
r
)).
filter
(
r
=>
!
isNaN
(
r
));
if
(
roles
.
includes
(
1
)
||
userInfo
.
permission
===
1
)
{
isAdmin
=
true
;
}
}
let
allowedClassIds
:
Set
<
number
>
|
null
=
null
;
if
(
!
isAdmin
&&
userInfo
)
{
allowedClassIds
=
new
Set
<
number
>
();
// 1. 查询该用户作为班主任管理的班级(head_teacher_id)
let
managedClasses
=
await
selectDataListByParam
(
TABLENAME
.
班级表
,
{
head_teacher_id
:
userInfo
.
userId
},
[
"id"
]
);
for
(
let
c
of
(
managedClasses
.
data
||
[]))
{
allowedClassIds
.
add
(
c
.
id
);
}
// 2. 查询该用户作为导师任教的班级(teacher_class)
let
taughtClasses
=
await
selectDataListByParam
(
TABLENAME
.
导师任教班级表
,
{
teacher_id
:
userInfo
.
userId
},
[
"class_id"
]
);
for
(
let
c
of
(
taughtClasses
.
data
||
[]))
{
allowedClassIds
.
add
(
c
.
class_id
);
}
// 如果没有任何关联班级,直接返回空
if
(
allowedClassIds
.
size
===
0
)
{
return
{
dataList
:
[]
};
}
}
let
classList
=
await
selectDataWithCustomOrder
(
TABLENAME
.
班级表
,
{},
[
"id"
,
"grade"
,
"class_name"
],
[[
"grade"
,
"DESC"
],
[
"id"
,
"ASC"
]]
);
let
dataList
=
(
classList
.
data
||
[])
.
filter
((
item
:
any
)
=>
isAdmin
||
!
allowedClassIds
||
allowedClassIds
.
has
(
item
.
id
))
.
map
((
item
:
any
)
=>
({
classId
:
item
.
id
,
className
:
item
.
class_name
,
grade
:
item
.
grade
,
gradeName
:
getGradeName
(
item
.
grade
),
}));
return
{
dataList
};
}
src/config/enum.ts
View file @
43d7caad
...
...
@@ -150,4 +150,16 @@ export enum COMPLETIONSTATUS {
};
/**
* 政治面貌
*/
export
enum
POLITICALSTATUS
{
中共党员
=
'中共党员'
,
中共预备党员
=
'中共预备党员'
,
共青团员
=
'共青团员'
,
群众
=
'群众'
,
民主党派
=
'民主党派'
,
无党派人士
=
'无党派人士'
,
};
src/routers/public.ts
View file @
43d7caad
...
...
@@ -5,9 +5,11 @@ import asyncHandler = require('express-async-handler');
import
*
as
enumConfig
from
'../config/enum'
;
import
*
as
classManagerBiz
from
'../biz/admin/public'
;
import
*
as
AIGrowthMessageBiz
from
'../biz/teacher/AIGrowthMessage'
;
import
{
checkUser
}
from
'../middleware/user'
;
const
config
=
{
"/api/public/maintype"
:
enumConfig
.
COMMUNICATIONTYPE
,
//交流记录子类型
"/api/public/politicalStatus"
:
enumConfig
.
POLITICALSTATUS
,
//政治面貌
}
export
function
setRouter
(
httpServer
)
{
...
...
@@ -19,6 +21,7 @@ export function setRouter(httpServer) {
httpServer
.
post
(
'/api/public/classes'
,
asyncHandler
(
getClassesByGrade
));
//根据年级获取班级列表
httpServer
.
post
(
'/api/public/subject'
,
asyncHandler
(
getAllSubjects
));
//根据年级获取任教科目列表
httpServer
.
post
(
'/api/public/labels'
,
asyncHandler
(
getAllLabels
));
//获取ai标签
httpServer
.
post
(
'/api/public/gradeClass'
,
checkUser
,
asyncHandler
(
getAllGradeClasses
));
//获取所有年级班级列表
}
...
...
@@ -41,6 +44,16 @@ async function getClassesByGrade(req, res) {
res
.
success
(
result
);
}
/**
* 获取所有年级班级列表
* 请求体参数:{ }
*/
async
function
getAllGradeClasses
(
req
,
res
)
{
const
userInfo
=
req
.
userInfo
;
const
result
=
await
classManagerBiz
.
getAllGradeClasses
(
userInfo
);
res
.
success
(
result
);
}
/**
* 获取所有任教科目列表
...
...
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