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
cc604b4a
Commit
cc604b4a
authored
May 06, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增重复验证
parent
0af0c655
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
0 deletions
+49
-0
DutyPlanModule.cs
Edu.Module.Duty/DutyPlanModule.cs
+10
-0
RB_Duty_PlanRepository.cs
Edu.Repository/Duty/RB_Duty_PlanRepository.cs
+35
-0
DutyPlanController.cs
Edu.WebApi/Controllers/Duty/DutyPlanController.cs
+4
-0
No files found.
Edu.Module.Duty/DutyPlanModule.cs
View file @
cc604b4a
...
...
@@ -189,6 +189,16 @@ namespace Edu.Module.Duty
return
list
;
}
/// <summary>
/// 检查值班计划是否存在
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
bool
CheckExistsDutyPlanModule
(
RB_Duty_Plan_ViewModel
query
)
{
return
duty_PlanRepository
.
CheckExistsDutyPlanRepository
(
query
);
}
/// <summary>
/// 新增修改值班计划
/// </summary>
...
...
Edu.Repository/Duty/RB_Duty_PlanRepository.cs
View file @
cc604b4a
...
...
@@ -128,5 +128,40 @@ WHERE 1=1 AND A.`Status`=0
builder
.
AppendFormat
(
" ORDER BY A.Date ASC "
);
return
GetPage
<
RB_Duty_Plan_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 检查值班计划是否存在
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
bool
CheckExistsDutyPlanRepository
(
RB_Duty_Plan_ViewModel
query
)
{
int
result
=
0
;
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
@" SELECT COUNT(1) FROM RB_Duty_Plan AS A WHERE 1=1 AND A.Status=0 "
);
if
(
query
.
Group_Id
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Duty_Plan_ViewModel
.
Group_Id
),
query
.
Group_Id
);
}
if
(
query
.
School_Id
>=
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Duty_Plan_ViewModel
.
School_Id
),
query
.
School_Id
);
}
if
(
query
.
Date
!=
null
)
{
builder
.
AppendFormat
(
@" AND A.{0}='{1}' "
,
nameof
(
RB_Duty_Plan_ViewModel
.
Date
),
query
.
Date
);
}
if
(
query
.
Id
>=
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}<>{1} "
,
nameof
(
RB_Duty_Plan_ViewModel
.
Id
),
query
.
Id
);
}
var
obj
=
base
.
ExecuteScalar
(
builder
.
ToString
());
if
(
obj
!=
null
)
{
Int32
.
TryParse
(
obj
.
ToString
(),
out
result
);
}
return
result
>
0
;
}
}
}
Edu.WebApi/Controllers/Duty/DutyPlanController.cs
View file @
cc604b4a
...
...
@@ -199,6 +199,10 @@ namespace Edu.WebApi.Controllers.Duty
model
.
CreateTime
=
DateTime
.
Now
;
model
.
UpdateBy
=
base
.
UserInfo
.
Id
;
model
.
UpdateTime
=
DateTime
.
Now
;
if
(
dutyPlanModule
.
CheckExistsDutyPlanModule
(
model
))
{
return
ApiResult
.
Failed
(
string
.
Format
(
"已经存在【{0}】的值班计划!请直接修改!"
,
Common
.
ConvertHelper
.
FormatDate
(
model
.
Date
)));
}
bool
flag
=
dutyPlanModule
.
SetDutyPlanModule
(
model
,
base
.
UserInfo
);
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