Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EduSpider
Project
Project
Details
Activity
Releases
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
viitto
EduSpider
Commits
7942b065
Commit
7942b065
authored
May 26, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增老师相关
parent
cac2db6d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
205 additions
and
1 deletion
+205
-1
ICourseTeacherRepository.cs
EduSpider.IRepository/ICourseTeacherRepository.cs
+9
-0
ICourseService.cs
EduSpider.IServices/ICourseService.cs
+8
-0
RB_Course_Teacher_Extend.cs
EduSpider.Model/Extend/RB_Course_Teacher_Extend.cs
+51
-0
CourseTeacherRepository.cs
EduSpider.Repository/CourseTeacherRepository.cs
+35
-0
CourseService.cs
EduSpider.Services/CourseService.cs
+18
-1
TeacherController.cs
EduSpider.WebApi/Controllers/Student/TeacherController.cs
+84
-0
No files found.
EduSpider.IRepository/ICourseTeacherRepository.cs
View file @
7942b065
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Extend
;
using
EduSpider.Model.Query
;
using
System.Collections.Generic
;
using
VTX.FW.Config
;
using
VTX.FW.DB
;
...
...
@@ -17,5 +19,12 @@ namespace EduSpider.Repository
/// <returns></returns>
public
bool
BatchSetCourseTeacherRepository
(
List
<
RB_Course_Teacher
>
courses
);
/// <summary>
/// 获取老师课程列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Course_Teacher_Extend
>
GetTeacherCourseListRepository
(
CourseQuery
query
);
}
}
EduSpider.IServices/ICourseService.cs
View file @
7942b065
...
...
@@ -22,11 +22,19 @@ namespace EduSpider.IServices
/// <returns></returns>
public
List
<
RB_Course_Student_Extend
>
GetStuCourseList
(
CourseQuery
query
);
/// <summary>
/// 获取学员考试和家庭作业列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
object
>
GetStuWorkAndExamList
(
CourseQuery
query
);
/// <summary>
/// 获取老师课程列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Course_Teacher_Extend
>
GetTeacherCourseList
(
CourseQuery
query
);
}
}
EduSpider.Model/Extend/RB_Course_Teacher_Extend.cs
0 → 100644
View file @
7942b065
using
EduSpider.Model.Entity
;
namespace
EduSpider.Model.Extend
{
/// <summary>
/// 课程老师管理扩展实体类
/// </summary>
public
class
RB_Course_Teacher_Extend
:
RB_Course_Teacher
{
/// <summary>
/// 课程名称
/// </summary>
public
string
courseName
{
get
;
set
;
}
/// <summary>
/// 教师编号
/// </summary>
public
int
teacherId
{
get
;
set
;
}
/// <summary>
/// 教师名称
/// </summary>
public
string
teacherName
{
get
;
set
;
}
/// <summary>
/// 教师头像
/// </summary>
public
string
teacherLogo
{
get
;
set
;
}
/// <summary>
/// 封面图
/// </summary>
public
string
CoverImg
{
get
;
set
;
}
/// <summary>
/// 课程状态
/// </summary>
public
int
courseStatus
{
get
;
set
;
}
/// <summary>
/// 完成次数
/// </summary>
public
int
completeNum
{
get
;
set
;
}
/// <summary>
/// 总次数
/// </summary>
public
int
totalClassNum
{
get
;
set
;
}
}
}
EduSpider.Repository/CourseTeacherRepository.cs
View file @
7942b065
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Extend
;
using
EduSpider.Model.Query
;
using
EduSpider.Repository.Base
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
VTX.FW.DB.Dapper
;
namespace
EduSpider.Repository
{
...
...
@@ -20,5 +25,35 @@ namespace EduSpider.Repository
flag
=
base
.
BatchInsert
(
courses
,
isReplace
:
true
);
return
flag
;
}
/// <summary>
/// 获取老师课程列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Course_Teacher_Extend
>
GetTeacherCourseListRepository
(
CourseQuery
query
)
{
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
();
builder
.
AppendFormat
(
@"
SELECT A.*,B.courseName,B.teacherId,B.teacherName,B.teacherLogo,B.CoverImg,B.courseStatus,B.completeNum,B.totalClassNum
FROM RB_Course_Teacher AS A INNER JOIN RB_Course AS B ON A.courseId=B.courseId
WHERE 1=1
"
);
if
(
query
!=
null
)
{
if
(
query
.
courseId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Course_Student
.
courseId
),
query
.
courseId
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
query
.
TeacherIds
))
{
builder
.
AppendFormat
(
" AND A.{0} IN({1}) "
,
nameof
(
RB_Course_Student
.
uid
),
query
.
TeacherIds
);
}
}
builder
.
AppendFormat
(
" ORDER BY A.courseId DESC "
);
return
Get
<
RB_Course_Teacher_Extend
>(
builder
.
ToString
(),
parameters
).
ToList
();
}
}
}
EduSpider.Services/CourseService.cs
View file @
7942b065
...
...
@@ -37,6 +37,12 @@ namespace EduSpider.Services
[
Autowired
]
public
ICommentRepository
CommentRepository
{
get
;
set
;
}
/// <summary>
/// 老师课程关联仓储接口
/// </summary>
[
Autowired
]
public
ICourseTeacherRepository
CourseTeacherRepository
{
get
;
set
;
}
/// <summary>
/// 获取学员课程列表
...
...
@@ -49,6 +55,17 @@ namespace EduSpider.Services
return
list
;
}
/// <summary>
/// 获取老师课程列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Course_Teacher_Extend
>
GetTeacherCourseList
(
CourseQuery
query
)
{
var
list
=
CourseTeacherRepository
.
GetTeacherCourseListRepository
(
query
);
return
list
;
}
/// <summary>
/// 获取学员考试和家庭作业列表
/// </summary>
...
...
@@ -72,7 +89,7 @@ namespace EduSpider.Services
item
.
ResultType
,
item
.
ResultTypeStr
,
item
.
Title
,
CreateTime
=
VTX
.
FW
.
Helper
.
ConvertHelper
.
FormatTime
(
item
.
CreateTime
,
2
),
CreateTime
=
VTX
.
FW
.
Helper
.
ConvertHelper
.
FormatTime
(
item
.
CreateTime
,
2
),
item
.
Score
,
item
.
Score_p
,
item
.
ScoreType
,
...
...
EduSpider.WebApi/Controllers/Student/TeacherController.cs
0 → 100644
View file @
7942b065
using
EduSpider.IServices
;
using
EduSpider.WebApi.Controllers.Base
;
using
Microsoft.AspNetCore.Mvc
;
using
System.Collections.Generic
;
using
VTX.FW.Api
;
using
VTX.FW.Attr
;
using
VTX.FW.Helper
;
namespace
EduSpider.WebApi.Controllers
{
/// <summary>
/// 老师相关控制器
/// </summary>
public
class
TeacherController
:
BaseController
{
/// <summary>
/// 课程仓储接口
/// </summary>
[
Autowired
]
public
ICourseService
CourseService
{
get
;
set
;
}
/// <summary>
/// 获取老师课程列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
HttpGet
]
public
ApiResult
GetTeacherCourse
()
{
var
query
=
new
Model
.
Query
.
CourseQuery
()
{
TeacherIds
=
base
.
BaseUserId
.
ToString
()
};
List
<
object
>
result
=
new
List
<
object
>();
var
list
=
CourseService
.
GetTeacherCourseList
(
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
foreach
(
var
item
in
list
)
{
result
.
Add
(
new
{
item
.
courseId
,
item
.
courseName
,
item
.
CoverImg
,
item
.
completeNum
,
item
.
totalClassNum
,
item
.
teacherName
,
});
}
}
return
ApiResult
.
Success
(
data
:
result
);
}
/// <summary>
/// 获取课程学员列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
HttpGet
]
public
ApiResult
GetCourseStu
()
{
var
query
=
new
Model
.
Query
.
CourseQuery
()
{
courseId
=
base
.
ReqParameters
.
GetInt
(
"courseId"
)
};
List
<
object
>
result
=
new
List
<
object
>();
var
list
=
CourseService
.
GetStuCourseList
(
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
foreach
(
var
item
in
list
)
{
result
.
Add
(
new
{
StuId
=
item
.
uid
,
StuName
=
item
.
name
,
StuAccount
=
item
.
account
});
}
}
return
ApiResult
.
Success
(
data
:
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