Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
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
王飞
vehicle-quality-review
Commits
09e54f0b
Commit
09e54f0b
authored
Apr 19, 2024
by
wdy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wangdingyi' into 'dev'
删除用户判断 See merge request
!304
parents
54d0c773
9dc3b557
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
0 deletions
+57
-0
pom.xml
ruoyi-system/pom.xml
+4
-0
UserCountVo.java
...src/main/java/com/ruoyi/system/domain/vo/UserCountVo.java
+22
-0
SysUserMapper.java
.../src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
+8
-0
SysUserServiceImpl.java
...ava/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+12
-0
SysUserMapper.xml
...system/src/main/resources/mapper/system/SysUserMapper.xml
+11
-0
No files found.
ruoyi-system/pom.xml
View file @
09e54f0b
...
...
@@ -22,6 +22,10 @@
<groupId>
com.ruoyi
</groupId>
<artifactId>
ruoyi-common
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
</dependencies>
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/UserCountVo.java
0 → 100644
View file @
09e54f0b
package
com
.
ruoyi
.
system
.
domain
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Builder
;
import
lombok.Data
;
@Data
@Builder
@ApiModel
(
"检验员VO"
)
public
class
UserCountVo
{
@ApiModelProperty
(
"检验员id"
)
private
Long
userId
;
@ApiModelProperty
(
"用户所进行任务数量"
)
private
Long
countNum
;
@ApiModelProperty
(
"用户名"
)
private
String
nikeName
;
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
View file @
09e54f0b
package
com
.
ruoyi
.
system
.
mapper
;
import
java.util.List
;
import
com.ruoyi.system.domain.vo.UserCountVo
;
import
org.apache.ibatis.annotations.Param
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
...
...
@@ -138,4 +139,11 @@ public interface SysUserMapper
* @return
*/
List
<
SysUser
>
selectUserListByRoleId
(
@Param
(
"roleId"
)
Long
roleId
);
/**
* 查询用户所含进行中任务数
* @param userIds
* @return
*/
List
<
UserCountVo
>
countTaskByUserId
(
@Param
(
"userIds"
)
Long
[]
userIds
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
View file @
09e54f0b
...
...
@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import
javax.validation.Validator
;
import
com.ruoyi.common.core.domain.entity.SysDept
;
import
com.ruoyi.system.domain.vo.UserCountVo
;
import
com.ruoyi.system.mapper.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -475,6 +476,17 @@ public class SysUserServiceImpl implements ISysUserService
checkUserAllowed
(
new
SysUser
(
userId
));
checkUserDataScope
(
userId
);
}
List
<
UserCountVo
>
list
=
userMapper
.
countTaskByUserId
(
userIds
);
StringBuilder
msg
=
new
StringBuilder
();
for
(
UserCountVo
countVo
:
list
)
{
if
(
countVo
.
getCountNum
()
>
0
)
{
msg
.
append
(
countVo
.
getNikeName
()).
append
(
"、"
);
}
}
if
(
StringUtils
.
isNotEmpty
(
msg
.
toString
()))
{
msg
=
new
StringBuilder
(
msg
.
substring
(
0
,
msg
.
length
()
-
1
));
throw
new
ServiceException
(
"用户:"
+
msg
+
"存在进行中的任务,不能删除"
);
}
// 删除用户与角色关联
userRoleMapper
.
deleteUserRole
(
userIds
);
// 删除用户与岗位关联
...
...
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
View file @
09e54f0b
...
...
@@ -229,5 +229,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{userId}
</foreach>
</delete>
<select
id=
"countTaskByUserId"
resultType=
"com.ruoyi.system.domain.vo.UserCountVo"
>
select count(*) countNum, tr.user_id userId, s.nick_name nikeName
from t_task t
left join t_task_user_relation tr on tr.task_id = t.id
left join sys_user s on s.user_id = tr.user_id
where t.task_status in ('NEW','PENDING') and tr.user_id in
<foreach
item=
"item"
collection=
"userIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
group by tr.user_id
</select>
</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