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
b63c7b0c
Commit
b63c7b0c
authored
Sep 28, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增字段
parent
dc3fc191
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
113 deletions
+35
-113
RB_Question.cs
Edu.Model/Entity/Question/RB_Question.cs
+10
-0
RB_Question_Answer.cs
Edu.Model/Entity/Question/RB_Question_Answer.cs
+0
-33
RB_Question_Answer_ViewModel.cs
Edu.Model/ViewModel/Question/RB_Question_Answer_ViewModel.cs
+13
-3
RB_Question_ViewModel.cs
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
+2
-2
QuestionModule.cs
Edu.Module.Question/QuestionModule.cs
+10
-31
RB_Question_AnswerRepository.cs
Edu.Repository/Question/RB_Question_AnswerRepository.cs
+0
-44
No files found.
Edu.Model/Entity/Question/RB_Question.cs
View file @
b63c7b0c
...
...
@@ -81,5 +81,15 @@ namespace Edu.Model.Entity.Question
/// 排序
/// </summary>
public
int
SortNum
{
get
;
set
;
}
/// <summary>
/// 问题答案【JSON字符串】
/// </summary>
public
string
Answer
{
get
;
set
;
}
/// <summary>
/// 问题分数
/// </summary>
public
decimal
Score
{
get
;
set
;
}
}
}
Edu.Model/Entity/Question/RB_Question_Answer.cs
deleted
100644 → 0
View file @
dc3fc191
using
System
;
using
VT.FW.DB
;
namespace
Edu.Model.Entity.Question
{
/// <summary>
/// 问题答案实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Question_Answer
{
/// <summary>
/// 主键(答案编号)
/// </summary>
public
int
AnswerId
{
get
;
set
;
}
/// <summary>
/// 问题编号
/// </summary>
public
int
QuestionId
{
get
;
set
;
}
/// <summary>
/// 答案内容
/// </summary>
public
string
AnswerContent
{
get
;
set
;
}
/// <summary>
/// 是否是正确选项(1-是)
/// </summary>
public
int
IsRight
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Question/RB_Question_Answer_ViewModel.cs
View file @
b63c7b0c
...
...
@@ -4,11 +4,21 @@ namespace Edu.Model.ViewModel.Question
/// <summary>
/// 问题答案视图实体类
/// </summary>
public
class
RB_Question_Answer_ViewModel
:
Model
.
Entity
.
Question
.
RB_Question_Answer
public
class
Answer_ViewModel
{
/// <summary>
///
问题编号【逗号分隔】
///
答案选项(A、B、C、D、E)
/// </summary>
public
string
QuestionIds
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 答案内容
/// </summary>
public
string
Content
{
get
;
set
;
}
/// <summary>
/// 是否是正确答案
/// </summary>
public
bool
Isanswer
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
View file @
b63c7b0c
...
...
@@ -28,8 +28,8 @@ namespace Edu.Model.ViewModel.Question
public
string
UpdateTimeStr
{
get
{
return
Common
.
ConvertHelper
.
FormatTime
(
this
.
UpdateTime
);
}
}
/// <summary>
///
问题
答案列表
/// 答案列表
/// </summary>
public
List
<
RB_Question_
Answer_ViewModel
>
AnswerList
{
get
;
set
;
}
public
List
<
Answer_ViewModel
>
AnswerList
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Module.Question/QuestionModule.cs
View file @
b63c7b0c
...
...
@@ -22,10 +22,6 @@ namespace Edu.Module.Question
/// </summary>
private
readonly
RB_QuestionRepository
questionRepository
=
new
RB_QuestionRepository
();
/// <summary>
/// 问题答案仓储层对象
/// </summary>
private
readonly
RB_Question_AnswerRepository
question_AnswerRepository
=
new
RB_Question_AnswerRepository
();
/// <summary>
/// 知识点仓储层对象
...
...
@@ -85,6 +81,8 @@ namespace Edu.Module.Question
{
nameof
(
RB_Question_ViewModel
.
IsUpdateJobExam
),
model
.
IsUpdateJobExam
},
{
nameof
(
RB_Question_ViewModel
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_Question_ViewModel
.
UpdateTime
),
model
.
UpdateTime
},
{
nameof
(
RB_Question_ViewModel
.
Answer
),
model
.
Answer
},
{
nameof
(
RB_Question_ViewModel
.
Score
),
model
.
Score
},
};
flag
=
questionRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Question_ViewModel
.
QuestionId
),
model
.
QuestionId
));
}
...
...
@@ -94,28 +92,6 @@ namespace Edu.Module.Question
model
.
QuestionId
=
newId
;
flag
=
newId
>
0
;
}
if
(
flag
&&
model
.
AnswerList
!=
null
)
{
foreach
(
var
item
in
model
.
AnswerList
)
{
item
.
QuestionId
=
model
.
QuestionId
;
if
(
item
.
AnswerId
>
0
)
{
Dictionary
<
string
,
object
>
subFileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Question_Answer_ViewModel
.
AnswerContent
)
,
item
.
AnswerContent
},
{
nameof
(
RB_Question_Answer_ViewModel
.
IsRight
)
,
item
.
IsRight
},
};
flag
=
question_AnswerRepository
.
Update
(
subFileds
,
new
WhereHelper
(
nameof
(
RB_Question_Answer_ViewModel
.
AnswerId
),
item
.
AnswerId
));
}
else
{
var
subNewId
=
question_AnswerRepository
.
Insert
(
item
);
item
.
AnswerId
=
subNewId
;
flag
=
subNewId
>
0
;
}
}
}
return
flag
;
}
...
...
@@ -146,12 +122,15 @@ namespace Edu.Module.Question
{
nameof
(
RB_Question_ViewModel
.
SortNum
),
targetQId
},
};
bool
flag
=
questionRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Question_ViewModel
.
QuestionId
),
curQId
));
//排序修改
Dictionary
<
string
,
object
>
fileds2
=
new
Dictionary
<
string
,
object
>()
if
(
flag
)
{
{
nameof
(
RB_Question_ViewModel
.
SortNum
),
curQId
},
};
flag
=
questionRepository
.
Update
(
fileds2
,
new
WhereHelper
(
nameof
(
RB_Question_ViewModel
.
QuestionId
),
targetQId
));
//排序修改
Dictionary
<
string
,
object
>
fileds2
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Question_ViewModel
.
SortNum
),
curQId
},
};
flag
=
questionRepository
.
Update
(
fileds2
,
new
WhereHelper
(
nameof
(
RB_Question_ViewModel
.
QuestionId
),
targetQId
));
}
return
flag
;
}
...
...
Edu.Repository/Question/RB_Question_AnswerRepository.cs
deleted
100644 → 0
View file @
dc3fc191
using
Edu.Model.ViewModel.Question
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Edu.Repository.Question
{
/// <summary>
/// 问题答案仓储层
/// </summary>
public
class
RB_Question_AnswerRepository
:
BaseRepository
<
Model
.
Entity
.
Question
.
RB_Question_Answer
>
{
/// <summary>
/// 获取问题答案列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Question_Answer_ViewModel
>
GetAnswerListRepository
(
RB_Question_Answer_ViewModel
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT *
FROM RB_Question_Answer
WHERE 1=1
"
);
if
(
query
==
null
)
{
return
new
List
<
RB_Question_Answer_ViewModel
>();
}
else
{
if
(
query
.
QuestionId
>
0
)
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Question_Answer_ViewModel
.
QuestionId
),
query
.
QuestionId
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
query
.
QuestionIds
))
{
builder
.
AppendFormat
(
" AND {0} IN({1}) "
,
nameof
(
RB_Question_Answer_ViewModel
.
QuestionId
),
query
.
QuestionIds
);
}
return
Get
<
RB_Question_Answer_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
}
}
}
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