Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
attendance-performance-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
attendance-performance-platform
Commits
585a838a
Commit
585a838a
authored
Aug 03, 2023
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
确保每个员工只能有一条假期余额记录
parent
dc5a897c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
1 deletion
+42
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceVacationBalanceServiceImpl.java
...ce/service/impl/AttendanceVacationBalanceServiceImpl.java
+42
-1
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceVacationBalanceServiceImpl.java
View file @
585a838a
package
com.mortals.xhx.module.attendance.service.impl
;
import
com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceQuery
;
import
com.mortals.xhx.module.staff.model.StaffEntity
;
import
com.mortals.xhx.module.staff.service.StaffService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.exception.AppException
;
...
...
@@ -15,5 +19,42 @@ import com.mortals.xhx.module.attendance.service.AttendanceVacationBalanceServic
*/
@Service
(
"attendanceVacationBalanceService"
)
public
class
AttendanceVacationBalanceServiceImpl
extends
AbstractCRUDServiceImpl
<
AttendanceVacationBalanceDao
,
AttendanceVacationBalanceEntity
,
Long
>
implements
AttendanceVacationBalanceService
{
@Autowired
private
StaffService
staffService
;
@Override
protected
void
saveBefore
(
AttendanceVacationBalanceEntity
entity
,
Context
context
)
throws
AppException
{
super
.
saveBefore
(
entity
,
context
);
if
(
entity
.
getStaffId
()==
null
){
throw
new
AppException
(
"员工ID不能为空"
);
}
StaffEntity
staff
=
staffService
.
get
(
entity
.
getStaffId
());
if
(
staff
==
null
){
throw
new
AppException
(
"员工ID不正确"
);
}
entity
.
setStaffName
(
staff
.
getName
());
entity
.
setDeptId
(
staff
.
getDeptId
());
entity
.
setDeptName
(
staff
.
getDeptName
());
}
@Override
public
AttendanceVacationBalanceEntity
save
(
AttendanceVacationBalanceEntity
entity
,
Context
context
)
throws
AppException
{
this
.
saveBefore
(
entity
,
context
);
AttendanceVacationBalanceEntity
temp
=
this
.
selectOne
(
new
AttendanceVacationBalanceQuery
().
staffId
(
entity
.
getStaffId
()));
int
iRet
=
0
;
if
(
temp
!=
null
){
entity
.
setId
(
temp
.
getId
());
iRet
=
this
.
dao
.
update
(
entity
);
}
else
{
iRet
=
this
.
dao
.
insert
(
entity
);
}
if
(
iRet
==
0
)
{
throw
new
AppException
(-
1001
,
"写入数据库失败!"
);
}
else
{
this
.
saveAfter
(
entity
,
context
);
return
entity
;
}
}
}
\ No newline at end of file
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