Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
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
黄奎
Education
Commits
9f7b3a77
Commit
9f7b3a77
authored
Jan 06, 2022
by
liudong1993
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/education
parents
67dfedf6
88f0e029
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
318 additions
and
2 deletions
+318
-2
CourseWordsHelper.cs
Edu.Common/Data/CourseWordsHelper.cs
+49
-0
RB_Course_Words.cs
Edu.Model/Entity/Course/RB_Course_Words.cs
+83
-0
RB_Course_Words_Extend.cs
Edu.Model/ViewModel/Course/RB_Course_Words_Extend.cs
+15
-0
CourseWordsModule.cs
Edu.Module.Course/CourseWordsModule.cs
+90
-0
RB_Course_WordsRepository.cs
Edu.Repository/Course/RB_Course_WordsRepository.cs
+44
-0
CourseController.cs
Edu.WebApi/Controllers/Course/CourseController.cs
+0
-2
CourseWordsController.cs
Edu.WebApi/Controllers/Course/CourseWordsController.cs
+30
-0
UploadController.cs
Edu.WebApi/Controllers/Upload/UploadController.cs
+7
-0
No files found.
Edu.Common/Data/CourseWordsHelper.cs
0 → 100644
View file @
9f7b3a77
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Text
;
namespace
Edu.Common.Data
{
public
class
CourseWordsHelper
{
/// <summary>
/// 根据Excel文件获取问题列表
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public
static
List
<
WordsItem
>
GetXlsWordsData
(
string
filePath
)
{
List
<
WordsItem
>
xlsItems
=
new
List
<
WordsItem
>();
var
dt
=
Common
.
Plugin
.
NPOIHelper
.
ImportExcelToDatatable
(
filePath
,
0
,
0
,
true
);
if
(
dt
!=
null
&&
dt
.
Rows
.
Count
>
0
)
{
foreach
(
DataRow
item
in
dt
.
Rows
)
{
xlsItems
.
Add
(
DataRowToModel
(
item
));
}
}
return
xlsItems
;
}
/// <summary>
/// DataRow转实体
/// </summary>
/// <param name="dr"></param>
/// <returns></returns>
private
static
WordsItem
DataRowToModel
(
DataRow
dr
)
{
WordsItem
model
=
new
WordsItem
();
if
(
dr
!=
null
)
{
}
return
model
;
}
}
public
class
WordsItem
{
}
}
Edu.Model/Entity/Course/RB_Course_Words.cs
0 → 100644
View file @
9f7b3a77
using
Edu.Common.Enum
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.Model.Entity.Course
{
/// <summary>
/// 课程章节单词实体类
/// </summary>
public
class
RB_Course_Words
{
/// <summary>
/// 单词编号(主键Id)
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 课程编号
/// </summary>
public
int
CourseId
{
get
;
set
;
}
/// <summary>
/// 章节编号
/// </summary>
public
int
ChapterId
{
get
;
set
;
}
/// <summary>
/// 单词类型(名词、动词、形容词等)
/// </summary>
public
string
WordType
{
get
;
set
;
}
/// <summary>
/// 单词内容
/// </summary>
public
string
WordContent
{
get
;
set
;
}
/// <summary>
/// 单词声调
/// </summary>
public
string
WordTone
{
get
;
set
;
}
/// <summary>
/// 单词书写
/// </summary>
public
string
WordWrite
{
get
;
set
;
}
/// <summary>
/// 中文意思
/// </summary>
public
string
ChineseMean
{
get
;
set
;
}
/// <summary>
/// 状态
/// </summary>
public
DateStateEnum
Status
{
get
;
set
;
}
/// <summary>
/// 集团编号
/// </summary>
public
int
Group_Id
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
int
CreateBy
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
CreateTime
{
get
;
set
;
}
/// <summary>
/// 修改人
/// </summary>
public
int
UpdateBy
{
get
;
set
;
}
/// <summary>
/// 更新时间
/// </summary>
public
DateTime
UpdateTime
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Course/RB_Course_Words_Extend.cs
0 → 100644
View file @
9f7b3a77
using
Edu.Model.Entity.Course
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.Model.ViewModel.Course
{
/// <summary>
/// 课程章节单词扩展实体类
/// </summary>
public
class
RB_Course_Words_Extend
:
RB_Course_Words
{
}
}
Edu.Module.Course/CourseWordsModule.cs
0 → 100644
View file @
9f7b3a77
using
Edu.Common.Enum
;
using
Edu.Model.ViewModel.Course
;
using
Edu.Repository.Course
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
VT.FW.DB
;
namespace
Edu.Module.Course
{
/// <summary>
/// 课程章节单词处理类
/// </summary>
public
class
CourseWordsModule
{
/// <summary>
/// 课程章节单词仓储层对象
/// </summary>
private
readonly
RB_Course_WordsRepository
course_WordsRepository
=
new
RB_Course_WordsRepository
();
/// <summary>
/// 获取课程单词列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Course_Words_Extend
>
GetCourseWordsListModule
(
RB_Course_Words_Extend
query
)
{
var
list
=
course_WordsRepository
.
GetCourseWordsListRepository
(
query
);
return
list
;
}
/// <summary>
/// 新增修改课程单词
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetCourseWordsModule
(
RB_Course_Words_Extend
model
)
{
bool
flag
=
false
;
if
(
model
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Course_Words_Extend
.
ChapterId
),
model
.
ChapterId
},
{
nameof
(
RB_Course_Words_Extend
.
WordType
),
model
.
WordType
},
{
nameof
(
RB_Course_Words_Extend
.
WordContent
),
model
.
WordContent
},
{
nameof
(
RB_Course_Words_Extend
.
WordTone
),
model
.
WordTone
},
{
nameof
(
RB_Course_Words_Extend
.
WordWrite
),
model
.
WordWrite
},
{
nameof
(
RB_Course_Words_Extend
.
ChineseMean
),
model
.
ChineseMean
},
{
nameof
(
RB_Course_Words_Extend
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_Course_Words_Extend
.
UpdateTime
),
model
.
UpdateTime
},
};
flag
=
course_WordsRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Course_Words_Extend
.
Id
),
model
.
Id
));
}
else
{
var
newId
=
course_WordsRepository
.
Insert
(
model
);
model
.
Id
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
/// <summary>
/// 根据编号获取单词详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public
RB_Course_Words_Extend
GetCourseWordsModule
(
object
Id
)
{
var
extModel
=
course_WordsRepository
.
GetEntity
<
RB_Course_Words_Extend
>(
Id
);
return
extModel
;
}
/// <summary>
/// 根据编号删除单词
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public
bool
RemoveCourseWordsModule
(
object
Id
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Course_Words_Extend
.
Status
),(
int
)
DateStateEnum
.
Delete
},
};
bool
flag
=
course_WordsRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Course_Words_Extend
.
Id
),
Id
));
return
flag
;
}
}
}
Edu.Repository/Course/RB_Course_WordsRepository.cs
0 → 100644
View file @
9f7b3a77
using
Edu.Common.Enum
;
using
Edu.Model.Entity.Course
;
using
Edu.Model.ViewModel.Course
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Edu.Repository.Course
{
/// <summary>
/// 课程章节单词仓储层
/// </summary>
public
class
RB_Course_WordsRepository
:
BaseRepository
<
RB_Course_Words
>
{
/// <summary>
/// 获取课程单词列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Course_Words_Extend
>
GetCourseWordsListRepository
(
RB_Course_Words_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_Course_Words AS A
WHERE 1=1
"
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Course_Words_Extend
.
Status
),
(
int
)
DateStateEnum
.
Normal
);
if
(
query
!=
null
)
{
if
(
query
.
Group_Id
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Course_Words_Extend
.
Group_Id
),
query
.
Group_Id
);
}
if
(
query
.
CourseId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Course_Words_Extend
.
CourseId
),
query
.
CourseId
);
}
}
return
Get
<
RB_Course_Words_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
}
Edu.WebApi/Controllers/Course/CourseController.cs
View file @
9f7b3a77
...
...
@@ -1432,8 +1432,6 @@ namespace Edu.WebApi.Controllers.Course
#
endregion
#
region
试听课程关联
/// <summary>
...
...
Edu.WebApi/Controllers/Course/CourseWordsController.cs
0 → 100644
View file @
9f7b3a77
using
Edu.Common.API
;
using
Edu.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Edu.WebApi.Controllers.Course
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
CourseWordsController
:
BaseController
{
/// <summary>
/// 导入Excel单词
/// </summary>
/// <returns></returns>
public
ApiResult
ImportExcelWords
(
string
filePath
,
int
CourseId
,
int
Uid
)
{
var
userInfo
=
base
.
GetUserInfo
(
Uid
);
var
dataList
=
Common
.
Data
.
CourseWordsHelper
.
GetXlsWordsData
(
filePath
);
return
ApiResult
.
Success
(
data
:
dataList
);
}
}
}
Edu.WebApi/Controllers/Upload/UploadController.cs
View file @
9f7b3a77
...
...
@@ -53,6 +53,8 @@ namespace Edu.WebApi.Controllers.Upload
Int32
.
TryParse
((
json
[
"Word"
]
!=
null
?
json
[
"Word"
].
ToString
()
:
"0"
),
out
int
Word
);
Int32
.
TryParse
((
json
[
"CourseId"
]
!=
null
?
json
[
"CourseId"
].
ToString
()
:
"0"
),
out
int
CourseId
);
Int32
.
TryParse
((
json
[
"Uid"
]
!=
null
?
json
[
"Uid"
].
ToString
()
:
"0"
),
out
int
Uid
);
//上次课程单词
Int32
.
TryParse
((
json
[
"CourseWords"
]
!=
null
?
json
[
"CourseWords"
].
ToString
()
:
"0"
),
out
int
CourseWords
);
string
filename
=
files
[
0
].
FileName
;
string
fileExtention
=
System
.
IO
.
Path
.
GetExtension
(
files
[
0
].
FileName
);
...
...
@@ -90,6 +92,11 @@ namespace Edu.WebApi.Controllers.Upload
{
return
new
QuestionController
().
ImportWordQuestion
(
path_server
,
CourseId
,
Uid
,
isDelete
:
true
);
}
//上传课程单词
if
(
CourseWords
==
1
)
{
return
new
CourseWordsController
().
ImportExcelWords
(
path_server
,
CourseId
,
Uid
);
}
return
ApiResult
.
Success
(
""
,
new
{
Name
=
filename
,
Path
=
path_server
});
}
catch
(
Exception
ex
)
...
...
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