Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
isoft_psa
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
王飞
isoft_psa
Commits
e9364ca4
Commit
e9364ca4
authored
Mar 26, 2025
by
huanghaoting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
请假审批实现
parent
80de54e3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
114 additions
and
7 deletions
+114
-7
LeaveApplicationController.java
...java/com/ruoyi/controller/LeaveApplicationController.java
+7
-0
LeaveApplication.java
...-psa/src/main/java/com/ruoyi/domain/LeaveApplication.java
+12
-1
BatchUpdateDTO.java
...sa/src/main/java/com/ruoyi/domain/dto/BatchUpdateDTO.java
+14
-0
LeaveApplicationMapper.java
...rc/main/java/com/ruoyi/mapper/LeaveApplicationMapper.java
+7
-0
ILeaveApplicationService.java
...main/java/com/ruoyi/service/ILeaveApplicationService.java
+28
-4
LeaveApplicationServiceImpl.java
...a/com/ruoyi/service/impl/LeaveApplicationServiceImpl.java
+15
-0
LeaveApplicationMapper.xml
...n/resources/mapper/application/LeaveApplicationMapper.xml
+31
-2
No files found.
ruoyi-psa/src/main/java/com/ruoyi/controller/LeaveApplicationController.java
View file @
e9364ca4
...
@@ -4,6 +4,7 @@ import java.util.List;
...
@@ -4,6 +4,7 @@ import java.util.List;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
com.ruoyi.common.utils.spring.SpringUtils
;
import
com.ruoyi.common.utils.spring.SpringUtils
;
import
com.ruoyi.domain.dto.BatchUpdateDTO
;
import
com.ruoyi.domain.dto.EmployeeBalanceDTO
;
import
com.ruoyi.domain.dto.EmployeeBalanceDTO
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -138,4 +139,10 @@ public class LeaveApplicationController extends BaseController
...
@@ -138,4 +139,10 @@ public class LeaveApplicationController extends BaseController
return
AjaxResult
.
success
(
generalManagerNickName
);
return
AjaxResult
.
success
(
generalManagerNickName
);
}
}
@PutMapping
(
"/updateNodeAndApprovalStatus"
)
public
void
batchUpdateNodeAndApprovalStatus
(
@RequestBody
BatchUpdateDTO
dto
)
{
System
.
out
.
println
(
"前端传过来的数据:"
+
dto
);
leaveApplicationService
.
batchUpdateNodeIdAndApprovalStatus
(
dto
);
}
}
}
ruoyi-psa/src/main/java/com/ruoyi/domain/LeaveApplication.java
View file @
e9364ca4
...
@@ -36,6 +36,12 @@ public class LeaveApplication extends BaseEntity {
...
@@ -36,6 +36,12 @@ public class LeaveApplication extends BaseEntity {
*/
*/
private
Long
userId
;
private
Long
userId
;
/**
* 审批节点id
*/
private
Integer
nodeId
;
/**
/**
* 申请日期
* 申请日期
...
@@ -119,7 +125,7 @@ public class LeaveApplication extends BaseEntity {
...
@@ -119,7 +125,7 @@ public class LeaveApplication extends BaseEntity {
/**
/**
* 审批状态(0代表待审批,1代表审批中,2代表已通过,3代表已驳回)
* 审批状态(0代表待审批,1代表审批中,2代表已通过,3代表已驳回)
*/
*/
@Excel
(
name
=
"审批状态"
,
readConverterExp
=
"
0=待审批,
1=审批中,2=已通过,3=不通过"
)
@Excel
(
name
=
"审批状态"
,
readConverterExp
=
"1=审批中,2=已通过,3=不通过"
)
private
String
approvalStatus
;
private
String
approvalStatus
;
/**
/**
...
@@ -156,6 +162,10 @@ public class LeaveApplication extends BaseEntity {
...
@@ -156,6 +162,10 @@ public class LeaveApplication extends BaseEntity {
public
void
setUserId
(
Long
userId
)
{
this
.
userId
=
userId
;}
public
void
setUserId
(
Long
userId
)
{
this
.
userId
=
userId
;}
public
Integer
getNodeId
()
{
return
nodeId
;}
public
void
setNodeId
(
Integer
nodeId
)
{
this
.
nodeId
=
nodeId
;}
public
void
setRequestDate
(
Date
requestDate
)
{
public
void
setRequestDate
(
Date
requestDate
)
{
this
.
requestDate
=
requestDate
;
this
.
requestDate
=
requestDate
;
}
}
...
@@ -277,6 +287,7 @@ public class LeaveApplication extends BaseEntity {
...
@@ -277,6 +287,7 @@ public class LeaveApplication extends BaseEntity {
.
append
(
"id"
,
getId
())
.
append
(
"id"
,
getId
())
.
append
(
"leaveId"
,
getLeaveId
())
.
append
(
"leaveId"
,
getLeaveId
())
.
append
(
"userId"
,
getUserId
())
.
append
(
"userId"
,
getUserId
())
.
append
(
"nodeId"
,
getNodeId
())
.
append
(
"requestDate"
,
getRequestDate
())
.
append
(
"requestDate"
,
getRequestDate
())
.
append
(
"leaveType"
,
getLeaveType
())
.
append
(
"leaveType"
,
getLeaveType
())
.
append
(
"uname"
,
getUname
())
.
append
(
"uname"
,
getUname
())
...
...
ruoyi-psa/src/main/java/com/ruoyi/domain/dto/BatchUpdateDTO.java
0 → 100644
View file @
e9364ca4
package
com
.
ruoyi
.
domain
.
dto
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
BatchUpdateDTO
{
private
List
<
Long
>
ids
;
// 选中的 id 列表
private
Integer
nodeId
;
// 要更新的节点 ID
private
Integer
approvalStatus
;
// 要更新的审批状态
}
ruoyi-psa/src/main/java/com/ruoyi/mapper/LeaveApplicationMapper.java
View file @
e9364ca4
...
@@ -2,6 +2,7 @@ package com.ruoyi.mapper;
...
@@ -2,6 +2,7 @@ package com.ruoyi.mapper;
import
java.util.List
;
import
java.util.List
;
import
com.ruoyi.domain.LeaveApplication
;
import
com.ruoyi.domain.LeaveApplication
;
import
com.ruoyi.domain.dto.BatchUpdateDTO
;
import
com.ruoyi.domain.dto.EmployeeBalanceDTO
;
import
com.ruoyi.domain.dto.EmployeeBalanceDTO
;
import
io.lettuce.core.dynamic.annotation.Param
;
import
io.lettuce.core.dynamic.annotation.Param
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -90,4 +91,10 @@ public interface LeaveApplicationMapper
...
@@ -90,4 +91,10 @@ public interface LeaveApplicationMapper
String
selectGeneralManagerNickName
();
String
selectGeneralManagerNickName
();
/**
* 根据节点id和审批状态更新请假申请
* @param dto 包含节点id和审批状态的对象
*/
int
batchUpdateNodeIdAndApprovalStatus
(
BatchUpdateDTO
dto
);
}
}
ruoyi-psa/src/main/java/com/ruoyi/service/ILeaveApplicationService.java
View file @
e9364ca4
...
@@ -4,6 +4,7 @@ import java.util.List;
...
@@ -4,6 +4,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
com.ruoyi.domain.LeaveApplication
;
import
com.ruoyi.domain.LeaveApplication
;
import
com.ruoyi.domain.dto.BatchUpdateDTO
;
import
com.ruoyi.domain.dto.EmployeeBalanceDTO
;
import
com.ruoyi.domain.dto.EmployeeBalanceDTO
;
import
io.lettuce.core.dynamic.annotation.Param
;
import
io.lettuce.core.dynamic.annotation.Param
;
...
@@ -63,16 +64,39 @@ public interface ILeaveApplicationService
...
@@ -63,16 +64,39 @@ public interface ILeaveApplicationService
*/
*/
public
int
deleteLeaveApplicationById
(
Long
id
);
public
int
deleteLeaveApplicationById
(
Long
id
);
//根据用户id查询该用户已扣除的加班小时数
/**
* 根据用户id查询用户剩余加班时长
* @param userId 用户id
* @return 结果
*/
EmployeeBalanceDTO
selectDeductionOvertimeHoursByUserId
(
@Param
(
"userId"
)
Long
userId
);
EmployeeBalanceDTO
selectDeductionOvertimeHoursByUserId
(
@Param
(
"userId"
)
Long
userId
);
//更新用户加班总时长
/**
* 更新用户剩余加班时长
* @param dto 请假申请信息
* @return 结果
*/
int
updateOvertimeHoursBalance
(
EmployeeBalanceDTO
dto
);
int
updateOvertimeHoursBalance
(
EmployeeBalanceDTO
dto
);
//查询项目经理列表
/**
* 查询项目经理
*
*/
List
<
String
>
selectProjectManagers
();
List
<
String
>
selectProjectManagers
();
//查询总经理
/**
* 查询总经理
*
*/
String
selectGeneralManagerNickName
();
String
selectGeneralManagerNickName
();
/**
* 根据节点id和审批状态批量更新请假申请状态
* @param dto 请假申请信息
* @return 结果
*/
int
batchUpdateNodeIdAndApprovalStatus
(
BatchUpdateDTO
dto
);
}
}
ruoyi-psa/src/main/java/com/ruoyi/service/impl/LeaveApplicationServiceImpl.java
View file @
e9364ca4
...
@@ -3,6 +3,7 @@ package com.ruoyi.service.impl;
...
@@ -3,6 +3,7 @@ package com.ruoyi.service.impl;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
com.ruoyi.domain.dto.BatchUpdateDTO
;
import
com.ruoyi.domain.dto.EmployeeBalanceDTO
;
import
com.ruoyi.domain.dto.EmployeeBalanceDTO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -55,6 +56,7 @@ public class LeaveApplicationServiceImpl implements ILeaveApplicationService
...
@@ -55,6 +56,7 @@ public class LeaveApplicationServiceImpl implements ILeaveApplicationService
@Override
@Override
public
int
insertLeaveApplication
(
LeaveApplication
leaveApplication
)
public
int
insertLeaveApplication
(
LeaveApplication
leaveApplication
)
{
{
leaveApplication
.
setNodeId
(
111
);
// 生成请假单号
// 生成请假单号
leaveApplication
.
setLeaveId
(
generateLeaveId
());
leaveApplication
.
setLeaveId
(
generateLeaveId
());
// 生成请假日期
// 生成请假日期
...
@@ -137,9 +139,22 @@ public class LeaveApplicationServiceImpl implements ILeaveApplicationService
...
@@ -137,9 +139,22 @@ public class LeaveApplicationServiceImpl implements ILeaveApplicationService
return
leaveApplicationMapper
.
selectProjectManagers
();
return
leaveApplicationMapper
.
selectProjectManagers
();
}
}
/**
* 查询总经理的昵称
* @return
*/
@Override
@Override
public
String
selectGeneralManagerNickName
(){
public
String
selectGeneralManagerNickName
(){
return
leaveApplicationMapper
.
selectGeneralManagerNickName
();
return
leaveApplicationMapper
.
selectGeneralManagerNickName
();
}
}
/**
* 批量更新节点ID和审批状态
* @param dto 包含节点ID和审批状态的DTO对象
* @return 更新结果
*/
@Override
public
int
batchUpdateNodeIdAndApprovalStatus
(
BatchUpdateDTO
dto
)
{
return
leaveApplicationMapper
.
batchUpdateNodeIdAndApprovalStatus
(
dto
);
}
}
}
ruoyi-psa/src/main/resources/mapper/application/LeaveApplicationMapper.xml
View file @
e9364ca4
...
@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"leaveId"
column=
"leave_id"
/>
<result
property=
"leaveId"
column=
"leave_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"nodeId"
column=
"node_id"
/>
<result
property=
"requestDate"
column=
"request_date"
/>
<result
property=
"requestDate"
column=
"request_date"
/>
<result
property=
"leaveType"
column=
"leave_type"
/>
<result
property=
"leaveType"
column=
"leave_type"
/>
<result
property=
"uname"
column=
"uname"
/>
<result
property=
"uname"
column=
"uname"
/>
...
@@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
</resultMap>
<sql
id=
"selectLeaveApplicationVo"
>
<sql
id=
"selectLeaveApplicationVo"
>
select id, leave_id,user_id, request_date, leave_type, uname,first_approver, second_approver, start_time, end_time, leavetime_hours,deduction_overtime_hours, leave_days_subtotal, total_leave_days, reason, proof,approval_status, created_time, updated_time from leave_application
select id, leave_id,user_id,
node_id,
request_date, leave_type, uname,first_approver, second_approver, start_time, end_time, leavetime_hours,deduction_overtime_hours, leave_days_subtotal, total_leave_days, reason, proof,approval_status, created_time, updated_time from leave_application
</sql>
</sql>
<select
id=
"selectLeaveApplicationList"
parameterType=
"LeaveApplication"
resultMap=
"LeaveApplicationResult"
>
<select
id=
"selectLeaveApplicationList"
parameterType=
"LeaveApplication"
resultMap=
"LeaveApplicationResult"
>
...
@@ -37,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -37,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"id != null "
>
and id = #{id}
</if>
<if
test=
"id != null "
>
and id = #{id}
</if>
<if
test=
"leaveId != null and leaveId != ''"
>
and leave_id = #{leaveId}
</if>
<if
test=
"leaveId != null and leaveId != ''"
>
and leave_id = #{leaveId}
</if>
<if
test=
"userId != null "
>
and user_id = #{userId}
</if>
<if
test=
"userId != null "
>
and user_id = #{userId}
</if>
<if
test=
"nodeId != null "
>
and node_id = #{nodeId}
</if>
<if
test=
"requestDate != null "
>
and request_date = #{requestDate}
</if>
<if
test=
"requestDate != null "
>
and request_date = #{requestDate}
</if>
<if
test=
"leaveType != null and leaveType != ''"
>
and leave_type = #{leaveType}
</if>
<if
test=
"leaveType != null and leaveType != ''"
>
and leave_type = #{leaveType}
</if>
<if
test=
"uname != null and uname != ''"
>
and uname like concat('%', #{uname}, '%')
</if>
<if
test=
"uname != null and uname != ''"
>
and uname like concat('%', #{uname}, '%')
</if>
...
@@ -67,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -67,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"leaveId != null"
>
leave_id,
</if>
<if
test=
"leaveId != null"
>
leave_id,
</if>
<if
test=
"userId != null"
>
user_id,
</if>
<if
test=
"userId != null"
>
user_id,
</if>
<if
test=
"nodeId != null"
>
node_id,
</if>
<if
test=
"requestDate != null"
>
request_date,
</if>
<if
test=
"requestDate != null"
>
request_date,
</if>
<if
test=
"leaveType != null and leaveType != ''"
>
leave_type,
</if>
<if
test=
"leaveType != null and leaveType != ''"
>
leave_type,
</if>
<if
test=
"uname != null"
>
uname,
</if>
<if
test=
"uname != null"
>
uname,
</if>
...
@@ -87,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -87,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"leaveId != null"
>
#{leaveId},
</if>
<if
test=
"leaveId != null"
>
#{leaveId},
</if>
<if
test=
"userId != null"
>
#{userId},
</if>
<if
test=
"userId != null"
>
#{userId},
</if>
<if
test=
"nodeId != null"
>
#{nodeId},
</if>
<if
test=
"requestDate != null"
>
#{requestDate},
</if>
<if
test=
"requestDate != null"
>
#{requestDate},
</if>
<if
test=
"leaveType != null and leaveType != ''"
>
#{leaveType},
</if>
<if
test=
"leaveType != null and leaveType != ''"
>
#{leaveType},
</if>
<if
test=
"uname != null"
>
#{uname},
</if>
<if
test=
"uname != null"
>
#{uname},
</if>
...
@@ -111,6 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -111,6 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"SET"
suffixOverrides=
","
>
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"leaveId != null"
>
leave_id = #{leaveId},
</if>
<if
test=
"leaveId != null"
>
leave_id = #{leaveId},
</if>
<if
test=
"userId != null"
>
user_id = #{userId},
</if>
<if
test=
"userId != null"
>
user_id = #{userId},
</if>
<if
test=
"nodeId != null"
>
node_id = #{nodeId},
</if>
<if
test=
"requestDate != null"
>
request_date = #{requestDate},
</if>
<if
test=
"requestDate != null"
>
request_date = #{requestDate},
</if>
<if
test=
"leaveType != null and leaveType != ''"
>
leave_type = #{leaveType},
</if>
<if
test=
"leaveType != null and leaveType != ''"
>
leave_type = #{leaveType},
</if>
<if
test=
"uname != null"
>
uname = #{uname},
</if>
<if
test=
"uname != null"
>
uname = #{uname},
</if>
...
@@ -159,6 +164,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -159,6 +164,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"annualLeaveBalance != null"
>
<if
test=
"annualLeaveBalance != null"
>
annual_leave_balance = #{annualLeaveBalance},
annual_leave_balance = #{annualLeaveBalance},
</if>
</if>
<!-- 如果两者都为 null,则将 overtime_hours_balance 设置为 0 -->
<if
test=
"overtimeHoursBalance == null and annualLeaveBalance == null"
>
overtime_hours_balance = 0
</if>
</trim>
</trim>
WHERE employee_id = #{employeeId}
WHERE employee_id = #{employeeId}
</update>
</update>
...
@@ -174,7 +183,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -174,7 +183,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT su.nick_name
SELECT su.nick_name
FROM sys_user su
FROM sys_user su
JOIN sys_user_role sur ON su.user_id = sur.user_id
JOIN sys_user_role sur ON su.user_id = sur.user_id
WHERE sur.role_id = 102;
WHERE sur.role_id = 102
AND su.nick_name LIKE '张%';
</select>
</select>
<update
id=
"batchUpdateNodeIdAndApprovalStatus"
parameterType=
"BatchUpdateDTO"
>
UPDATE leave_application
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"nodeId != null"
>
node_id = #{nodeId},
</if>
<if
test=
"approvalStatus != null"
>
approval_status = #{approvalStatus},
</if>
</trim>
WHERE id IN
<foreach
collection=
"ids"
item=
"id"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</update>
</mapper>
</mapper>
\ 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