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
0a09ce7c
Commit
0a09ce7c
authored
Oct 11, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
a237975d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
250 additions
and
0 deletions
+250
-0
RB_Class.cs
Edu.Model/Entity/Course/RB_Class.cs
+69
-0
RB_Class_ViewModel.cs
Edu.Model/ViewModel/Course/RB_Class_ViewModel.cs
+13
-0
ClassModule.cs
Edu.Module.Course/ClassModule.cs
+110
-0
RB_ClassRepository.cs
Edu.Repository/Course/RB_ClassRepository.cs
+58
-0
No files found.
Edu.Model/Entity/Course/RB_Class.cs
0 → 100644
View file @
0a09ce7c
using
Edu.Common.Enum
;
using
System
;
using
VT.FW.DB
;
namespace
Edu.Model.Entity.Course
{
/// <summary>
/// 班级实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Class
{
/// <summary>
/// 主键(班级ID)
/// </summary>
public
int
ClassId
{
get
;
set
;
}
/// <summary>
/// 班级名称
/// </summary>
public
string
ClassName
{
get
;
set
;
}
/// <summary>
/// 课程Id
/// </summary>
public
int
CouseId
{
get
;
set
;
}
/// <summary>
/// 讲师Id
/// </summary>
public
int
Teacher_Id
{
get
;
set
;
}
/// <summary>
/// 助教Id
/// </summary>
public
int
Assist_Id
{
get
;
set
;
}
/// <summary>
/// 集团编号
/// </summary>
public
int
Group_Id
{
get
;
set
;
}
/// <summary>
/// 学校编号
/// </summary>
public
int
School_Id
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
CreateTime
{
get
;
set
;
}
/// <summary>
/// 修改人
/// </summary>
public
int
UpdateBy
{
get
;
set
;
}
/// <summary>
/// 更新时间
/// </summary>
public
DateTime
UpdateTime
{
get
;
set
;
}
/// <summary>
/// 删除状态(0-正常,1-禁用)
/// </summary>
public
DateStateEnum
Status
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/Course/RB_Class_ViewModel.cs
0 → 100644
View file @
0a09ce7c
using
System
;
namespace
Edu.Model.ViewModel.Course
{
/// <summary>
/// 班级实体类
/// </summary>
[
Serializable
]
public
class
RB_Class_ViewModel
:
Model
.
Entity
.
Course
.
RB_Class
{
}
}
\ No newline at end of file
Edu.Module.Course/ClassModule.cs
0 → 100644
View file @
0a09ce7c
using
Edu.Common.Enum
;
using
Edu.Model.ViewModel.Course
;
using
Edu.Repository.Course
;
using
System.Collections.Generic
;
using
VT.FW.DB
;
namespace
Edu.Module.Course
{
/// <summary>
/// 班级管理处理类
/// </summary>
public
class
ClassModule
{
/// <summary>
/// 班级仓储层对象
/// </summary>
private
readonly
RB_ClassRepository
classRepository
=
new
RB_ClassRepository
();
/// <summary>
/// 获取班级列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Class_ViewModel
>
GetClassListModule
(
RB_Class_ViewModel
query
)
{
return
classRepository
.
GetClassListRepository
(
query
);
}
/// <summary>
/// 获取班级分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Class_ViewModel
>
GetClassPageListModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Class_ViewModel
query
)
{
return
classRepository
.
GetClassPageListRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
}
/// <summary>
/// 检查班级是否存在
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
ExistsClassModule
(
RB_Class_ViewModel
model
)
{
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(
nameof
(
RB_Class_ViewModel
.
ClassName
),
model
.
ClassName
.
Trim
()),
};
if
(
model
.
ClassId
>
0
)
{
wheres
.
Add
(
new
WhereHelper
(
nameof
(
RB_Class_ViewModel
.
ClassId
),
model
.
ClassId
,
OperatorEnum
.
NotEqual
));
}
return
classRepository
.
Exists
(
wheres
);
}
/// <summary>
/// 新增修改班级
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetClassModule
(
RB_Class_ViewModel
model
)
{
if
(
model
.
ClassId
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Class_ViewModel
.
ClassName
),
model
.
ClassName
},
{
nameof
(
RB_Class_ViewModel
.
CouseId
),
model
.
CouseId
},
{
nameof
(
RB_Class_ViewModel
.
Teacher_Id
),
model
.
Teacher_Id
},
{
nameof
(
RB_Class_ViewModel
.
Assist_Id
),
model
.
Assist_Id
},
};
return
classRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Class_ViewModel
.
ClassId
),
model
.
ClassId
));
}
else
{
var
newId
=
classRepository
.
Insert
(
model
);
model
.
ClassId
=
newId
;
return
newId
>
0
;
}
}
/// <summary>
/// 根据班级编号获取班级详细信息
/// </summary>
/// <param name="ClassId"></param>
/// <returns></returns>
public
RB_Class_ViewModel
GetClassModule
(
object
ClassId
)
{
return
classRepository
.
GetEntity
<
RB_Class_ViewModel
>(
ClassId
);
}
/// <summary>
/// 删除班级
/// </summary>
/// <param name="ClassId"></param>
/// <returns></returns>
public
bool
RemoveClassModule
(
object
ClassId
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Class_ViewModel
.
Status
),(
int
)
DateStateEnum
.
Delete
},
};
return
classRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Class_ViewModel
.
ClassId
),
ClassId
));
}
}
}
Edu.Repository/Course/RB_ClassRepository.cs
0 → 100644
View file @
0a09ce7c
using
Edu.Common.Enum
;
using
Edu.Model.Entity.Course
;
using
Edu.Model.ViewModel.Course
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Edu.Repository.Course
{
/// <summary>
/// 班级仓储层
/// </summary>
public
class
RB_ClassRepository
:
BaseRepository
<
RB_Class
>
{
/// <summary>
/// 获取班级列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Class_ViewModel
>
GetClassListRepository
(
RB_Class_ViewModel
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM rb_class AS A
WHERE 1=1
"
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Class_ViewModel
.
Status
),
(
int
)
DateStateEnum
.
Normal
);
return
Get
<
RB_Class_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 获取班级分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Class_ViewModel
>
GetClassPageListRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Class_ViewModel
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM rb_class AS A
WHERE 1=1
"
);
if
(
query
!=
null
)
{
if
(
query
.
Status
>=
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Class_ViewModel
.
Status
),
(
int
)
query
.
Status
);
}
}
return
GetPage
<
RB_Class_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
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