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
e1c86395
Commit
e1c86395
authored
Aug 16, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增方法
parent
76fef689
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
168 additions
and
5 deletions
+168
-5
ExamFolderTreeModel.cs
Edu.Model/ViewModel/Exam/ExamFolderTreeModel.cs
+32
-0
RB_Examination_Paper_ViewModel.cs
Edu.Model/ViewModel/Exam/RB_Examination_Paper_ViewModel.cs
+5
-0
PaperModule.cs
Edu.Module.Exam/PaperModule.cs
+60
-2
RB_Examination_PaperRepository.cs
Edu.Repository/Exam/RB_Examination_PaperRepository.cs
+50
-0
ExamController.cs
Edu.WebApi/Controllers/Exam/ExamController.cs
+21
-3
No files found.
Edu.Model/ViewModel/Exam/ExamFolderTreeModel.cs
0 → 100644
View file @
e1c86395
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.Model.ViewModel.Exam
{
/// <summary>
/// 试卷文件树形结构
/// </summary>
public
class
ExamFolderTreeModel
{
/// <summary>
/// 试卷编号
/// </summary>
public
int
PaperId
{
get
;
set
;
}
/// <summary>
/// 试卷名称
/// </summary>
public
string
PaperName
{
get
;
set
;
}
/// <summary>
/// 父节点编号
/// </summary>
public
int
ParentId
{
get
;
set
;
}
/// <summary>
/// 下级文件夹列表
/// </summary>
public
List
<
ExamFolderTreeModel
>
ChildList
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/Exam/RB_Examination_Paper_ViewModel.cs
View file @
e1c86395
...
@@ -26,5 +26,10 @@ namespace Edu.Model.ViewModel.Exam
...
@@ -26,5 +26,10 @@ namespace Edu.Model.ViewModel.Exam
/// 试卷编号
/// 试卷编号
/// </summary>
/// </summary>
public
string
QPaperIds
{
get
;
set
;
}
public
string
QPaperIds
{
get
;
set
;
}
/// <summary>
/// 是否查询文件夹
/// </summary>
public
int
IsQueryFolder
{
get
;
set
;
}
}
}
}
}
Edu.Module.Exam/PaperModule.cs
View file @
e1c86395
...
@@ -5,7 +5,6 @@ using System;
...
@@ -5,7 +5,6 @@ using System;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
VT.FW.DB
;
using
VT.FW.DB
;
using
System.Linq
;
using
System.Linq
;
using
System.Text.RegularExpressions
;
using
Edu.Cache.User
;
using
Edu.Cache.User
;
using
Edu.Common.Plugin
;
using
Edu.Common.Plugin
;
using
Edu.Module.Question
;
using
Edu.Module.Question
;
...
@@ -117,7 +116,7 @@ namespace Edu.Module.Exam
...
@@ -117,7 +116,7 @@ namespace Edu.Module.Exam
}
}
/// <summary>
/// <summary>
/// 递归遍历所有
章节
/// 递归遍历所有
下级文件夹或试卷
/// </summary>
/// </summary>
/// <param name="sourceList">源数据</param>
/// <param name="sourceList">源数据</param>
/// <param name="parentId">父节点编号</param>
/// <param name="parentId">父节点编号</param>
...
@@ -608,5 +607,64 @@ namespace Edu.Module.Exam
...
@@ -608,5 +607,64 @@ namespace Edu.Module.Exam
flag
=
examination_PaperRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
PaperId
));
flag
=
examination_PaperRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
PaperId
));
return
flag
;
return
flag
;
}
}
/// <summary>
/// 获取文件夹树形结构
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
object
GetFolderTreeModule
(
RB_Examination_Paper_ViewModel
query
)
{
List
<
ExamFolderTreeModel
>
list
=
new
List
<
ExamFolderTreeModel
>();
var
dataList
=
examination_PaperRepository
.
GetExaminationPaperListRepository
(
query
);
if
(
dataList
!=
null
&&
dataList
.
Count
>
0
)
{
var
rootList
=
dataList
?.
Where
(
qitem
=>
qitem
.
ParentId
==
0
)?.
ToList
();
foreach
(
var
rItem
in
rootList
)
{
ExamFolderTreeModel
fTreeModel
=
new
ExamFolderTreeModel
()
{
PaperId
=
rItem
.
PaperId
,
ParentId
=
rItem
.
ParentId
,
PaperName
=
rItem
.
PaperName
,
ChildList
=
new
List
<
ExamFolderTreeModel
>()
};
fTreeModel
.
ChildList
=
GetFolderChild
(
dataList
,
rItem
.
PaperId
);
list
.
Add
(
fTreeModel
);
}
}
return
list
;
}
/// <summary>
/// 递归遍历所有下级文件夹
/// </summary>
/// <param name="sourceList">源数据</param>
/// <param name="parentId">父节点编号</param>
/// <returns></returns>
public
List
<
ExamFolderTreeModel
>
GetFolderChild
(
List
<
RB_Examination_Paper_ViewModel
>
sourceList
,
int
parentId
)
{
List
<
ExamFolderTreeModel
>
resultList
=
new
List
<
ExamFolderTreeModel
>();
//获取下级节点
var
subList
=
sourceList
?.
Where
(
qItem
=>
qItem
.
ParentId
==
parentId
).
ToList
();
//如果存在下级节点
if
(
subList
!=
null
&&
subList
.
Count
>
0
)
{
foreach
(
var
childItem
in
subList
)
{
var
childModel
=
new
ExamFolderTreeModel
()
{
PaperId
=
childItem
.
PaperId
,
ParentId
=
childItem
.
ParentId
,
PaperName
=
childItem
.
PaperName
,
ChildList
=
new
List
<
ExamFolderTreeModel
>()
};
childModel
.
ChildList
.
AddRange
(
GetFolderChild
(
sourceList
,
childItem
.
PaperId
));
resultList
.
Add
(
childModel
);
}
}
return
resultList
;
}
}
}
}
}
Edu.Repository/Exam/RB_Examination_PaperRepository.cs
View file @
e1c86395
...
@@ -60,6 +60,56 @@ WHERE 1=1
...
@@ -60,6 +60,56 @@ WHERE 1=1
return
GetPage
<
RB_Examination_Paper_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
return
GetPage
<
RB_Examination_Paper_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
}
}
/// <summary>
/// 获取试卷列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Examination_Paper_ViewModel
>
GetExaminationPaperListRepository
(
RB_Examination_Paper_ViewModel
query
)
{
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_Examination_Paper AS A
WHERE 1=1
"
);
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Examination_Paper_ViewModel
.
ParentId
),
0
);
if
(
query
!=
null
)
{
if
(
query
.
Group_Id
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Examination_Paper_ViewModel
.
Group_Id
),
query
.
Group_Id
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
PaperName
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @PaperName "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperName
));
parameters
.
Add
(
"PaperName"
,
"%"
+
query
.
PaperName
.
Trim
()
+
"%"
);
}
if
(
query
.
ParentId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Examination_Paper_ViewModel
.
ParentId
),
query
.
ParentId
);
}
if
(
query
.
PaperId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
query
.
PaperId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QPaperIds
))
{
builder
.
AppendFormat
(
@" AND A.{0} IN({1}) "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
query
.
QPaperIds
);
}
//查询文件夹
if
(
query
.
IsQueryFolder
==
1
)
{
builder
.
AppendFormat
(
@" AND A.{0}=1 "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperType
));
}
}
builder
.
AppendFormat
(
" ORDER BY A.{0} DESC "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
));
return
Get
<
RB_Examination_Paper_ViewModel
>(
builder
.
ToString
(),
parameters
).
ToList
();
}
/// <summary>
/// <summary>
/// 获取试卷所有下级列表
/// 获取试卷所有下级列表
/// </summary>
/// </summary>
...
...
Edu.WebApi/Controllers/Exam/ExamController.cs
View file @
e1c86395
...
@@ -256,11 +256,11 @@ namespace Edu.WebApi.Controllers.Exam
...
@@ -256,11 +256,11 @@ namespace Edu.WebApi.Controllers.Exam
}
}
/// <summary>
/// <summary>
/// 新增修改文件夹
/// 新增修改文件夹
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetPaperFolder
()
public
ApiResult
SetPaperFolder
()
{
{
var
extModel
=
new
RB_Examination_Paper_ViewModel
()
var
extModel
=
new
RB_Examination_Paper_ViewModel
()
...
@@ -280,8 +280,7 @@ namespace Edu.WebApi.Controllers.Exam
...
@@ -280,8 +280,7 @@ namespace Edu.WebApi.Controllers.Exam
bool
flag
=
paperModule
.
SetExaminationPaperFolderModule
(
extModel
);
bool
flag
=
paperModule
.
SetExaminationPaperFolderModule
(
extModel
);
return
flag
?
ApiResult
.
Success
(
data
:
extModel
)
:
ApiResult
.
Failed
();
return
flag
?
ApiResult
.
Success
(
data
:
extModel
)
:
ApiResult
.
Failed
();
}
}
/// <summary>
/// <summary>
/// 根据编号获取试卷信息
/// 根据编号获取试卷信息
...
@@ -357,5 +356,24 @@ namespace Edu.WebApi.Controllers.Exam
...
@@ -357,5 +356,24 @@ namespace Edu.WebApi.Controllers.Exam
var
flag
=
paperModule
.
MoveExamnationPaperModule
(
PaperId
,
ParentId
);
var
flag
=
paperModule
.
MoveExamnationPaperModule
(
PaperId
,
ParentId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
}
/// <summary>
/// 获取文件夹树形结构
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetFolderTree
()
{
var
extModel
=
new
RB_Examination_Paper_ViewModel
()
{
CreateBy
=
UserInfo
.
Id
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
IsQueryFolder
=
1
,
};
var
obj
=
paperModule
.
GetFolderTreeModule
(
extModel
);
return
ApiResult
.
Success
(
data
:
obj
);
}
}
}
}
}
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