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
d062aefa
Commit
d062aefa
authored
Jun 06, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
1a397e90
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
288 additions
and
53 deletions
+288
-53
ICommentDetailsRepository.cs
EduSpider.IRepository/ICommentDetailsRepository.cs
+30
-0
ICommentRepository.cs
EduSpider.IRepository/ICommentRepository.cs
+10
-2
ICourseService.cs
EduSpider.IServices/ICourseService.cs
+1
-1
RB_Comment.cs
EduSpider.Model/Entity/RB_Comment.cs
+14
-19
RB_Comment_Details.cs
EduSpider.Model/Entity/RB_Comment_Details.cs
+42
-0
RB_Course_Comment.cs
EduSpider.Model/Entity/RB_Course_Comment.cs
+5
-0
RB_Comment_Extend.cs
EduSpider.Model/Extend/RB_Comment_Extend.cs
+18
-0
CommentDetailsRepository.cs
EduSpider.Repository/CommentDetailsRepository.cs
+50
-0
CommentRepository.cs
EduSpider.Repository/CommentRepository.cs
+84
-6
CourseCommentRepository.cs
EduSpider.Repository/CourseCommentRepository.cs
+4
-0
StuHomeWorkRepository.cs
EduSpider.Repository/StuHomeWorkRepository.cs
+17
-17
CourseService.cs
EduSpider.Services/CourseService.cs
+3
-3
TeacherController.cs
EduSpider.WebApi/Controllers/Student/TeacherController.cs
+10
-5
No files found.
EduSpider.IRepository/ICommentDetailsRepository.cs
0 → 100644
View file @
d062aefa
using
EduSpider.Model.Entity
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VTX.FW.Config
;
using
VTX.FW.DB
;
namespace
EduSpider.IRepository
{
public
interface
ICommentDetailsRepository
:
IDBRepository
<
RB_Comment_Details
>,
IDependency
{
/// <summary>
/// 批量新增默认规则详情
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public
bool
BatchSetCommentDetailsRepository
(
List
<
RB_Comment_Details
>
list
);
/// <summary>
/// 获取默认规则详情列表
/// </summary>
/// <param name="CommentIds"></param>
/// <returns></returns>
public
List
<
RB_Comment_Details
>
GetCommentDetailsListRepository
(
string
CommentIds
);
}
}
EduSpider.IRepository/ICommentRepository.cs
View file @
d062aefa
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Extend
;
using
System.Collections.Generic
;
using
VTX.FW.Config
;
using
VTX.FW.DB
;
...
...
@@ -10,17 +11,24 @@ namespace EduSpider.IRepository
/// </summary>
public
interface
ICommentRepository
:
IDBRepository
<
RB_Comment
>,
IDependency
{
/// <summary>
/// 新增修改默认配置
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetCommentRepository
(
RB_Comment_Extend
model
);
/// <summary>
/// 根据查询条件获取评语
/// </summary>
/// <param name="Score"></param>
/// <returns></returns>
public
RB_Comment
GetComment
(
decimal
Score
);
public
RB_Comment
_Extend
GetComment
(
decimal
Score
);
/// <summary>
/// 获取系统配置评价列表
/// </summary>
/// <returns></returns>
public
List
<
RB_Comment
>
GetCommentListRepository
(
);
public
RB_Comment_Extend
GetCommentListRepository
(
string
KeyWords
,
int
CommentTimes
);
}
}
EduSpider.IServices/ICourseService.cs
View file @
d062aefa
...
...
@@ -136,7 +136,7 @@ namespace EduSpider.IServices
/// 获取系统评价配置
/// </summary>
/// <returns></returns>
public
List
<
RB_Comment
>
GetSysComment
(
);
public
RB_Comment_Extend
GetSysComment
(
string
KeyWords
,
int
CommentTimes
);
/// <summary>
/// 创建课程作业评论
...
...
EduSpider.Model/Entity/RB_Comment.cs
View file @
d062aefa
...
...
@@ -8,30 +8,25 @@ using VTX.FW.Attr;
namespace
EduSpider.Model.Entity
{
/// <summary>
///
评语配置
///
默认评语配置
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Comment
{
/// <summary>
/// 评语
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 主键编号
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 开始值
/// </summary>
public
decimal
StartNum
{
get
;
set
;
}
/// <summary>
/// 次数
/// </summary>
public
int
?
Times
{
get
;
set
;
}
/// <summary>
/// 结束值
/// </summary>
public
decimal
EndNum
{
get
;
set
;
}
/// <summary>
/// 评语
/// </summary>
public
string
Info
{
get
;
set
;
}
}
/// <summary>
/// 关键词
/// </summary>
public
string
KeyWords
{
get
;
set
;
}
}
}
EduSpider.Model/Entity/RB_Comment_Details.cs
0 → 100644
View file @
d062aefa
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VTX.FW.Attr
;
namespace
EduSpider.Model.Entity
{
/// <summary>
/// 默认评语配置详情
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Comment_Details
{
/// <summary>
/// 评语详情编号
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 评语主表编号
/// </summary>
public
int
CommentId
{
get
;
set
;
}
/// <summary>
/// 开始值
/// </summary>
public
decimal
StartNum
{
get
;
set
;
}
/// <summary>
/// 结束值
/// </summary>
public
decimal
EndNum
{
get
;
set
;
}
/// <summary>
/// 评语
/// </summary>
public
string
Info
{
get
;
set
;
}
}
}
EduSpider.Model/Entity/RB_Course_Comment.cs
View file @
d062aefa
...
...
@@ -48,5 +48,10 @@ namespace EduSpider.Model.Entity
/// 删除状态(0-正常,1-删除)
/// </summary>
public
int
Status
{
get
;
set
;
}
/// <summary>
/// 次数
/// </summary>
public
int
Times
{
get
;
set
;
}
}
}
EduSpider.Model/Extend/RB_Comment_Extend.cs
0 → 100644
View file @
d062aefa
using
EduSpider.Model.Entity
;
using
System
;
using
System.Collections.Generic
;
namespace
EduSpider.Model.Extend
{
/// <summary>
/// 默认评语扩展实体类
/// </summary>
public
class
RB_Comment_Extend
:
RB_Comment
{
/// <summary>
/// 默认评语详情列表
/// </summary>
public
List
<
RB_Comment_Details
>
Details
{
get
;
set
;
}
}
}
EduSpider.Repository/CommentDetailsRepository.cs
0 → 100644
View file @
d062aefa
using
EduSpider.IRepository
;
using
EduSpider.Model.Entity
;
using
EduSpider.Repository.Base
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
EduSpider.Repository
{
/// <summary>
/// 默认评论详情接口
/// </summary>
public
class
CommentDetailsRepository
:
BaseRepository
<
RB_Comment_Details
>,
ICommentDetailsRepository
{
/// <summary>
/// 批量新增默认规则详情
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public
bool
BatchSetCommentDetailsRepository
(
List
<
RB_Comment_Details
>
list
)
{
bool
flag
=
false
;
flag
=
base
.
BatchInsert
(
list
);
return
flag
;
}
/// <summary>
/// 获取默认规则详情列表
/// </summary>
/// <param name="CommentIds"></param>
/// <returns></returns>
public
List
<
RB_Comment_Details
>
GetCommentDetailsListRepository
(
string
CommentIds
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
@"
SELECT A.*
FROM RB_Comment_Details AS A
WHERE 1=1
"
);
if
(!
string
.
IsNullOrEmpty
(
CommentIds
))
{
builder
.
AppendFormat
(
@" AND A.{0} IN ({1}) "
,
nameof
(
RB_Comment_Details
.
CommentId
),
CommentIds
);
}
return
Get
<
RB_Comment_Details
>(
builder
.
ToString
()).
ToList
();
}
}
}
EduSpider.Repository/CommentRepository.cs
View file @
d062aefa
using
EduSpider.IRepository
;
using
EduSpider.Model.Entity
;
using
EduSpider.Model.Extend
;
using
EduSpider.Repository.Base
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
VTX.FW.DB
;
using
VTX.FW.DB.Dapper
;
namespace
EduSpider.Repository
{
/// <summary>
///
课程仓储层
///
默认评论仓储接口实现
/// </summary>
public
class
CommentRepository
:
BaseRepository
<
RB_Comment
>,
ICommentRepository
{
/// <summary>
/// 默认评论详情接口
/// </summary>
ICommentDetailsRepository
commentDetailsRepository
=
new
CommentDetailsRepository
();
/// <summary>
/// 新增修改默认配置
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetCommentRepository
(
RB_Comment_Extend
model
)
{
bool
flag
=
false
;
if
(
model
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Comment_Extend
.
KeyWords
),
model
.
KeyWords
.
Trim
()
}
};
flag
=
base
.
UpdateOne
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Comment_Extend
.
Id
),
model
.
Id
));
}
else
{
var
newId
=
base
.
Insert
(
model
);
model
.
Id
=
newId
;
flag
=
newId
>
0
;
}
if
(
model
.
Details
!=
null
&&
model
.
Details
.
Count
>
0
)
{
foreach
(
var
item
in
model
.
Details
)
{
item
.
CommentId
=
model
.
Id
;
}
commentDetailsRepository
.
BatchSetCommentDetailsRepository
(
model
.
Details
);
}
return
flag
;
}
/// <summary>
/// 获取评语
/// </summary>
/// <param name="Score"></param>
/// <returns></returns>
public
RB_Comment
GetComment
(
decimal
Score
)
public
RB_Comment
_Extend
GetComment
(
decimal
Score
)
{
StringBuilder
builder
=
new
();
builder
.
AppendFormat
(
@"
...
...
@@ -35,23 +75,61 @@ WHERE 1=1
builder
.
AppendFormat
(
@" AND A.StartNum<={0} AND {0}<=A.EndNum "
,
Score
);
}
return
base
.
Get
<
RB_Comment
>(
builder
.
ToString
()).
ToList
().
FirstOrDefault
();
return
base
.
Get
<
RB_Comment
_Extend
>(
builder
.
ToString
()).
ToList
().
FirstOrDefault
();
}
/// <summary>
/// 获取系统配置评价列表
/// </summary>
/// <returns></returns>
public
List
<
RB_Comment
>
GetCommentListRepository
(
)
public
RB_Comment_Extend
GetCommentListRepository
(
string
KeyWords
,
int
CommentTimes
)
{
DynamicParameters
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_Comment AS A
WHERE 1=1
"
);
return
base
.
Get
<
RB_Comment
>(
builder
.
ToString
()).
ToList
();
if
(!
string
.
IsNullOrEmpty
(
KeyWords
))
{
if
(
KeyWords
.
Contains
(
"高中"
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @KeyWords1 "
,
nameof
(
RB_Comment_Extend
.
KeyWords
));
parameters
.
Add
(
"KeyWords1"
,
"高中"
);
}
if
(
KeyWords
.
Contains
(
"初中"
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @KeyWords2 "
,
nameof
(
RB_Comment_Extend
.
KeyWords
));
parameters
.
Add
(
"KeyWords2"
,
"初中"
);
}
if
(
KeyWords
.
Contains
(
"化学"
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @KeyWords3 "
,
nameof
(
RB_Comment_Extend
.
KeyWords
));
parameters
.
Add
(
"KeyWords3"
,
"化学"
);
}
if
(
KeyWords
.
Contains
(
"数学"
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @KeyWords4 "
,
nameof
(
RB_Comment_Extend
.
KeyWords
));
parameters
.
Add
(
"KeyWords4"
,
"数学"
);
}
}
if
(
CommentTimes
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Comment_Extend
.
Times
),
CommentTimes
);
}
var
model
=
base
.
Get
<
RB_Comment_Extend
>(
builder
.
ToString
()).
ToList
().
FirstOrDefault
();
if
(
model
!=
null
&&
model
.
Id
>
0
)
{
string
Ids
=
model
.
Id
.
ToString
();
List
<
RB_Comment_Details
>
subList
=
new
List
<
RB_Comment_Details
>();
if
(!
string
.
IsNullOrEmpty
(
Ids
))
{
subList
=
commentDetailsRepository
.
GetCommentDetailsListRepository
(
Ids
);
}
model
.
Details
=
subList
?.
Where
(
qitem
=>
qitem
.
CommentId
==
model
.
Id
)?.
OrderBy
(
qitem
=>
qitem
.
StartNum
)?.
ToList
();
}
return
model
;
}
}
}
EduSpider.Repository/CourseCommentRepository.cs
View file @
d062aefa
...
...
@@ -77,6 +77,10 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND A.{0} IN({1}) "
,
nameof
(
RB_Course_Comment_Extend
.
CourseId
),
query
.
QCourseIds
);
}
if
(
query
.
CommentTimes
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Course_Comment_Extend
.
Times
),
query
.
CommentTimes
);
}
}
var
list
=
Get
<
RB_Course_Comment_Extend
>(
builder
.
ToString
()).
ToList
();
if
(
list
!=
null
&&
list
.
Count
>
0
)
...
...
EduSpider.Repository/StuHomeWorkRepository.cs
View file @
d062aefa
...
...
@@ -443,23 +443,23 @@ WHERE 1=1
private
string
GetCommentInfo
(
RB_Course_Comment_Extend
courseCommentModel
,
decimal
Score
)
{
string
info
=
""
;
var
commentModel
=
commentRepository
.
GetComment
(
Score
);
if
(
courseCommentModel
!=
null
&&
courseCommentModel
.
CommentDetails
!=
null
&&
courseCommentModel
.
CommentDetails
.
Count
>
0
)
{
var
tempModel
=
courseCommentModel
.
CommentDetails
.
Where
(
qitem
=>
qitem
.
StartNum
<=
Score
&&
Score
<
qitem
.
EndNum
)?.
FirstOrDefault
();
if
(
tempModel
!=
null
)
{
info
=
tempModel
?.
Info
??
""
;
}
else
{
info
=
commentModel
?.
Info
??
""
;
}
}
else
{
info
=
commentModel
?.
Info
??
""
;
}
//
var commentModel = commentRepository.GetComment(Score);
//
if (courseCommentModel != null && courseCommentModel.CommentDetails != null && courseCommentModel.CommentDetails.Count > 0)
//
{
//
var tempModel = courseCommentModel.CommentDetails.Where(qitem => qitem.StartNum <= Score && Score < qitem.EndNum)?.FirstOrDefault();
//
if (tempModel != null)
//
{
//
info = tempModel?.Info ?? "";
//
}
//
else
//
{
//
info = commentModel?.Info ?? "";
//
}
//
}
//
else
//
{
//
info = commentModel?.Info ?? "";
//
}
return
info
;
}
}
...
...
EduSpider.Services/CourseService.cs
View file @
d062aefa
...
...
@@ -472,10 +472,10 @@ namespace EduSpider.Services
/// 获取系统评价配置
/// </summary>
/// <returns></returns>
public
List
<
RB_Comment
>
GetSysComment
(
)
public
RB_Comment_Extend
GetSysComment
(
string
KeyWords
,
int
CommentTimes
)
{
var
list
=
CommentRepository
.
GetCommentListRepository
(
);
return
list
;
var
model
=
CommentRepository
.
GetCommentListRepository
(
KeyWords
,
CommentTimes
);
return
model
;
}
/// <summary>
...
...
EduSpider.WebApi/Controllers/Student/TeacherController.cs
View file @
d062aefa
...
...
@@ -147,10 +147,12 @@ namespace EduSpider.WebApi.Controllers
{
var
query
=
new
Model
.
Query
.
CourseQuery
()
{
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
)
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
),
CourseName
=
base
.
ReqParameters
.
GetString
(
"CourseName"
),
CommentTimes
=
base
.
ReqParameters
.
GetInt
(
"Times"
),
};
var
courseRule
=
CourseService
.
GetCourseCommentList
(
query
).
FirstOrDefault
();
object
result
;
object
result
=
new
object
()
;
if
(
courseRule
!=
null
)
{
result
=
new
...
...
@@ -158,18 +160,20 @@ namespace EduSpider.WebApi.Controllers
courseRule
.
Id
,
courseRule
.
Title
,
courseRule
.
CourseId
,
CommentDetails
=
courseRule
.
CommentDetails
.
OrderBy
(
qitem
=>
qitem
.
StartNum
).
ToList
()
courseRule
.
Times
,
CommentDetails
=
courseRule
.
CommentDetails
.
OrderBy
(
qitem
=>
qitem
.
StartNum
).
ToList
()
};
}
else
{
var
sys
List
=
CourseService
.
GetSysComment
(
);
var
sys
Model
=
CourseService
.
GetSysComment
(
query
.
CourseName
,
query
.
CommentTimes
);
result
=
new
{
Id
=
0
,
Title
=
"系统默认配置"
,
query
.
CourseId
,
CommentDetails
=
sysList
.
OrderBy
(
qitem
=>
qitem
.
StartNum
).
ToList
()
Times
=
query
.
CommentTimes
,
CommentDetails
=
sysModel
.
Details
,
};
}
return
ApiResult
.
Success
(
data
:
result
);
...
...
@@ -189,6 +193,7 @@ namespace EduSpider.WebApi.Controllers
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
),
Title
=
base
.
ReqParameters
.
GetString
(
"Title"
),
ShowType
=
base
.
ReqParameters
.
GetInt
(
"ShowType"
),
Times
=
base
.
ReqParameters
.
GetInt
(
"Times"
),
};
model
.
CreateBy
=
base
.
BaseUserId
;
model
.
CreateTime
=
System
.
DateTime
.
Now
;
...
...
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