Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
an-plus-hr
Project
Project
Details
Activity
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
anjia-hr
an-plus-hr
Commits
b70f019d
Commit
b70f019d
authored
Dec 16, 2025
by
刘斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 编制计划记录,增加校验记录日期
parent
c274f9f9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
8 deletions
+37
-8
StaffingPlanRecordsCtrl.java
...ava/com/anplus/hr/controller/StaffingPlanRecordsCtrl.java
+4
-0
StaffingPlanRecordsServ.java
...n/java/com/anplus/hr/service/StaffingPlanRecordsServ.java
+10
-0
StaffingPlanRecordsServImpl.java
...m/anplus/hr/service/impl/StaffingPlanRecordsServImpl.java
+23
-8
No files found.
admin/src/main/java/com/anplus/hr/controller/StaffingPlanRecordsCtrl.java
View file @
b70f019d
...
...
@@ -12,6 +12,7 @@ import jakarta.validation.constraints.NotEmpty;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
top.binfast.common.core.constant.BusinessType
;
import
top.binfast.common.core.enums.ResultCode
;
import
top.binfast.common.core.validate.AddGroup
;
import
top.binfast.common.core.validate.EditGroup
;
import
top.binfast.common.core.util.ResponseUtils
;
...
...
@@ -75,6 +76,9 @@ public class StaffingPlanRecordsCtrl {
@PinSysLog
(
value
=
"编制规划记录"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
()
public
Response
add
(
@Validated
(
AddGroup
.
class
)
@RequestBody
StaffingPlanRecordsParam
param
)
{
if
(!
staffingPlanRecordsServ
.
checkRecordDateUnique
(
param
))
{
return
Response
.
buildFailure
(
ResultCode
.
FAIL
.
getCode
(),
"新增编制规划'"
+
param
.
getRecordDate
()
+
"'失败,记录时间已存在"
);
}
return
ResponseUtils
.
ofResult
(
staffingPlanRecordsServ
.
insertByParam
(
param
));
}
...
...
admin/src/main/java/com/anplus/hr/service/StaffingPlanRecordsServ.java
View file @
b70f019d
...
...
@@ -6,6 +6,8 @@ import com.anplus.hr.domain.params.StaffingPlanRecordsListParam;
import
com.anplus.hr.domain.params.StaffingPlanRecordsParam
;
import
com.alibaba.cola.dto.PageResponse
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
top.binfast.app.biz.sysapi.bean.params.sysUser.SysUserParam
;
import
java.util.List
;
/**
...
...
@@ -49,6 +51,14 @@ public interface StaffingPlanRecordsServ extends IService<StaffingPlanRecords> {
*/
Boolean
insertByParam
(
StaffingPlanRecordsParam
param
);
/**
* 校验当前记录日期是否唯一
*
* @param param 待校验参数
* @return 是否唯一
*/
boolean
checkRecordDateUnique
(
StaffingPlanRecordsParam
param
);
/**
* 修改编制规划记录
*
...
...
admin/src/main/java/com/anplus/hr/service/impl/StaffingPlanRecordsServImpl.java
View file @
b70f019d
package
com
.
anplus
.
hr
.
service
.
impl
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.cola.dto.PageResponse
;
import
com.anplus.hr.domain.StaffingPlanRecords
;
import
com.anplus.hr.domain.params.StaffingPlanRecordsListParam
;
import
com.anplus.hr.domain.params.StaffingPlanRecordsParam
;
import
com.anplus.hr.domain.vo.StaffingPlanRecordsVo
;
import
com.anplus.hr.mapper.StaffingPlanRecordsMapper
;
import
com.anplus.hr.service.StaffingPlanRecordsServ
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -11,12 +18,6 @@ import lombok.RequiredArgsConstructor;
import
org.springframework.stereotype.Service
;
import
top.binfast.common.core.util.MapstructUtils
;
import
top.binfast.common.mybatis.util.QueryUtil
;
import
com.anplus.hr.domain.StaffingPlanRecords
;
import
com.anplus.hr.domain.vo.StaffingPlanRecordsVo
;
import
com.anplus.hr.domain.params.StaffingPlanRecordsListParam
;
import
com.anplus.hr.domain.params.StaffingPlanRecordsParam
;
import
com.anplus.hr.mapper.StaffingPlanRecordsMapper
;
import
com.anplus.hr.service.StaffingPlanRecordsServ
;
import
java.util.List
;
...
...
@@ -77,7 +78,7 @@ public class StaffingPlanRecordsServImpl extends ServiceImpl<StaffingPlanRecords
* @return 编制规划记录
*/
@Override
public
StaffingPlanRecordsVo
queryById
(
Long
id
){
public
StaffingPlanRecordsVo
queryById
(
Long
id
)
{
StaffingPlanRecords
staffingPlanRecords
=
staffingPlanRecordsMapper
.
selectById
(
id
);
return
MapstructUtils
.
convert
(
staffingPlanRecords
,
StaffingPlanRecordsVo
.
class
);
}
...
...
@@ -111,10 +112,24 @@ public class StaffingPlanRecordsServImpl extends ServiceImpl<StaffingPlanRecords
return
this
.
updateById
(
staffingPlanRecords
);
}
/**
* 校验记录日期是否唯一
*
* @param param 待校验的参数
* @return 是否唯一
*/
@Override
public
boolean
checkRecordDateUnique
(
StaffingPlanRecordsParam
param
)
{
boolean
exist
=
staffingPlanRecordsMapper
.
exists
(
new
LambdaQueryWrapper
<
StaffingPlanRecords
>()
.
eq
(
StaffingPlanRecords:
:
getRecordDate
,
param
.
getRecordDate
())
.
ne
(
ObjectUtil
.
isNotNull
(
param
.
getId
()),
StaffingPlanRecords:
:
getId
,
param
.
getId
()));
return
!
exist
;
}
/**
* 保存前的数据校验
*/
private
void
validEntityBeforeSave
(
StaffingPlanRecords
entity
){
private
void
validEntityBeforeSave
(
StaffingPlanRecords
entity
)
{
// 做一些数据校验,如唯一约束
}
...
...
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