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
76fef689
Commit
76fef689
authored
Aug 16, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增方法
parent
6e181ba5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
178 additions
and
24 deletions
+178
-24
RB_Examination_Paper_ViewModel.cs
Edu.Model/ViewModel/Exam/RB_Examination_Paper_ViewModel.cs
+5
-0
PaperModule.cs
Edu.Module.Exam/PaperModule.cs
+88
-4
RB_Examination_PaperRepository.cs
Edu.Repository/Exam/RB_Examination_PaperRepository.cs
+12
-0
ExamController.cs
Edu.WebApi/Controllers/Exam/ExamController.cs
+73
-20
No files found.
Edu.Model/ViewModel/Exam/RB_Examination_Paper_ViewModel.cs
View file @
76fef689
...
...
@@ -21,5 +21,10 @@ namespace Edu.Model.ViewModel.Exam
/// 问题数量
/// </summary>
public
int
QuestionCount
{
get
;
set
;
}
/// <summary>
/// 试卷编号
/// </summary>
public
string
QPaperIds
{
get
;
set
;
}
}
}
Edu.Module.Exam/PaperModule.cs
View file @
76fef689
...
...
@@ -515,14 +515,98 @@ namespace Edu.Module.Exam
/// 根据分组删除分组和题目
/// </summary>
/// <param name="GId"></param>
/// <param name="QuestionTypeId">问题类型编号</param>
/// <returns></returns>
public
bool
RemoveExamnationGroupModule
(
int
qu
,
int
GId
)
[
TransactionCallHandler
]
public
bool
RemoveExamnationGroupModule
(
int
GId
,
int
QuestionTypeId
)
{
IList
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>();
var
flag
=
true
;
if
(
GId
>
0
)
{
flag
=
examination_GroupRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Group_ViewModel
.
GId
),
GId
));
}
if
(
flag
&&
QuestionTypeId
>
0
)
{
flag
=
examination_DetailsRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Details_ViewModel
.
QuestionTypeId
),
QuestionTypeId
));
}
return
flag
;
}
//examination_GroupRepository.Delete()
return
false
;
/// <summary>
/// 根据试卷编号删除试卷
/// </summary>
/// <param name="PaperId"></param>
/// <returns></returns>
[
TransactionCallHandler
]
public
bool
RemoveExamnationPaperModule
(
int
PaperId
)
{
var
flag
=
true
;
if
(
PaperId
>
0
)
{
flag
=
examination_PaperRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
PaperId
));
}
if
(
flag
)
{
flag
=
examination_GroupRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Group_ViewModel
.
PaperId
),
PaperId
));
}
if
(
flag
)
{
flag
=
examination_DetailsRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Details_ViewModel
.
PaperId
),
PaperId
));
}
return
flag
;
}
/// <summary>
/// 根据试卷编号复制试卷
/// </summary>
/// <param name="PaperId"></param>
/// <returns></returns>
[
TransactionCallHandler
]
public
bool
CopyExamnationPaperModule
(
int
PaperId
)
{
var
flag
=
true
;
var
model
=
GetExaminationPaperModule
(
PaperId
);
if
(
model
==
null
)
{
flag
=
false
;
return
flag
;
}
model
.
PaperId
=
0
;
if
(
model
.
GroupList
!=
null
&&
model
.
GroupList
.
Count
>
0
)
{
foreach
(
var
gItem
in
model
.
GroupList
)
{
gItem
.
GId
=
0
;
gItem
.
PaperId
=
0
;
if
(
gItem
.
DetailsList
!=
null
&&
gItem
.
DetailsList
.
Count
>
0
)
{
foreach
(
var
sItem
in
gItem
.
DetailsList
)
{
sItem
.
Id
=
0
;
sItem
.
PaperId
=
0
;
}
}
}
}
flag
=
SetExaminationPaperModule
(
model
);
return
flag
;
}
/// <summary>
/// 移动试卷
/// </summary>
/// <param name="PaperId">试卷编号</param>
/// <param name="ParentId">父节点编号</param>
/// <returns></returns>
public
bool
MoveExamnationPaperModule
(
int
PaperId
,
int
ParentId
)
{
var
flag
=
true
;
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Examination_Paper_ViewModel
.
ParentId
),
ParentId
}
};
flag
=
examination_PaperRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
PaperId
));
return
flag
;
}
}
}
Edu.Repository/Exam/RB_Examination_PaperRepository.cs
View file @
76fef689
...
...
@@ -43,6 +43,18 @@ WHERE 1=1
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
);
}
}
builder
.
AppendFormat
(
" ORDER BY A.{0} DESC "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
));
return
GetPage
<
RB_Examination_Paper_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
...
...
Edu.WebApi/Controllers/Exam/ExamController.cs
View file @
76fef689
...
...
@@ -41,6 +41,9 @@ namespace Edu.WebApi.Controllers.Exam
var
query
=
new
RB_Examination_Paper_ViewModel
()
{
PaperName
=
base
.
ParmJObj
.
GetStringValue
(
"PaperName"
),
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
QPaperIds
=
base
.
ParmJObj
.
GetStringValue
(
"QPaperIds"
)
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
List
<
object
>
result
=
new
List
<
object
>();
...
...
@@ -78,14 +81,14 @@ namespace Edu.WebApi.Controllers.Exam
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
),
PaperName
=
base
.
ParmJObj
.
GetStringValue
(
"PaperName"
),
QuestionBandIds
=
base
.
ParmJObj
.
GetStringValue
(
"QuestionBandIds"
),
DifficultyType
=
(
DifficultyTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"DifficultyType"
),
DifficultyType
=
(
DifficultyTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"DifficultyType"
),
CreateBy
=
UserInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
GenerateType
=
base
.
ParmJObj
.
GetInt
(
"GenerateType"
),
CreateNum
=
base
.
ParmJObj
.
GetInt
(
"CreateNum"
),
PaperType
=
base
.
ParmJObj
.
GetInt
(
"PaperType"
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
GenerateType
=
base
.
ParmJObj
.
GetInt
(
"GenerateType"
),
CreateNum
=
base
.
ParmJObj
.
GetInt
(
"CreateNum"
),
PaperType
=
base
.
ParmJObj
.
GetInt
(
"PaperType"
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
};
extModel
.
GroupList
=
new
List
<
RB_Examination_Group_ViewModel
>();
string
groups
=
base
.
ParmJObj
.
GetStringValue
(
"GroupList"
);
...
...
@@ -105,7 +108,7 @@ namespace Edu.WebApi.Controllers.Exam
GroupName
=
jobj
.
GetStringValue
(
"GroupName"
),
QuestionTypeId
=
jobj
.
GetInt
(
"QuestionTypeId"
),
QuestionTypeKey
=
jobj
.
GetStringValue
(
"QuestionTypeKey"
),
GSortNum
=
gSortNum
,
GSortNum
=
gSortNum
,
DetailsList
=
new
List
<
RB_Examination_Details_ViewModel
>(),
};
gSortNum
++;
...
...
@@ -168,14 +171,14 @@ namespace Edu.WebApi.Controllers.Exam
TemplateName
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateName"
),
TemplateScore
=
base
.
ParmJObj
.
GetDecimal
(
"TemplateScore"
),
TemplateNum
=
base
.
ParmJObj
.
GetInt
(
"TemplateNum"
),
TemplateDifficultyType
=
(
DifficultyTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"DifficultyType"
),
TemplateBankIds
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateBankIds"
),
TemplateDifficultyType
=
(
DifficultyTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"DifficultyType"
),
TemplateBankIds
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateBankIds"
),
CreateBy
=
UserInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
School_Id
=
base
.
UserInfo
.
School_Id
,
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
,
IsSaveTemplate
=
base
.
ParmJObj
.
GetBoolValue
(
"IsSaveTemplate"
),
School_Id
=
base
.
UserInfo
.
School_Id
,
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
,
IsSaveTemplate
=
base
.
ParmJObj
.
GetBoolValue
(
"IsSaveTemplate"
),
};
string
TemplateData
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateData"
);
if
(!
string
.
IsNullOrEmpty
(
TemplateData
))
...
...
@@ -229,7 +232,7 @@ namespace Edu.WebApi.Controllers.Exam
{
tempStr
+=
"、"
+
string
.
Format
(
"{0}:{1}"
,
tItem
.
DifficultyType
.
ToName
(),
tItem
.
ChooseNum
);
}
QuestionStructure
+=
";"
+
string
.
Format
(
"{0}:{1}"
,
sItem
.
QuestionTypeName
,
tempStr
.
TrimStart
(
'、'
));
QuestionStructure
+=
";"
+
string
.
Format
(
"{0}:{1}"
,
sItem
.
QuestionTypeName
,
tempStr
.
TrimStart
(
'、'
));
}
}
}
...
...
@@ -241,10 +244,10 @@ namespace Edu.WebApi.Controllers.Exam
item
.
TemplateScore
,
item
.
TemplateNum
,
item
.
TemplateDifficultyType
,
TemplateDifficultyTypeName
=
item
.
TemplateDifficultyType
.
ToName
(),
TemplateData
=
templist
,
TemplateDifficultyTypeName
=
item
.
TemplateDifficultyType
.
ToName
(),
TemplateData
=
templist
,
item
.
TemplateBankIds
,
QuestionStructure
=
QuestionStructure
.
TrimStart
(
';'
)
QuestionStructure
=
QuestionStructure
.
TrimStart
(
';'
)
});
}
pageModel
.
Count
=
rowsCount
;
...
...
@@ -252,7 +255,7 @@ namespace Edu.WebApi.Controllers.Exam
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 新增修改文件夹
...
...
@@ -294,15 +297,65 @@ namespace Edu.WebApi.Controllers.Exam
/// <summary>
/// 根据编号删除试卷题目
/// 根据试卷详情编号删除
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DeletePaperDetails
()
{
var
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
);
var
flag
=
paperModule
.
RemoveExaminationDetailsModule
(
Id
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 根据试卷分组编号删除
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DeletePaperQuestion
()
public
ApiResult
DeletePaperGroup
()
{
var
GId
=
base
.
ParmJObj
.
GetInt
(
"GId"
);
var
QuestionTypeId
=
base
.
ParmJObj
.
GetInt
(
"QuestionTypeId"
);
var
flag
=
paperModule
.
RemoveExamnationGroupModule
(
GId
,
QuestionTypeId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 根据试卷编号删除试卷
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DeletePaper
()
{
var
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
);
var
model
=
paperModule
.
RemoveExaminationDetailsModule
(
PaperId
);
return
ApiResult
.
Success
(
data
:
model
);
var
flag
=
paperModule
.
RemoveExamnationPaperModule
(
PaperId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 根据试卷编号复制试卷
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
CopyPaper
()
{
var
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
);
var
flag
=
paperModule
.
CopyExamnationPaperModule
(
PaperId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 移动试卷或文件夹
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
MovePaper
()
{
var
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
);
var
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
);
var
flag
=
paperModule
.
MoveExamnationPaperModule
(
PaperId
,
ParentId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
}
}
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