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
3459afdb
Commit
3459afdb
authored
Jul 03, 2024
by
wdy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询检验人员列表
parent
6bcb4ed6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
148 additions
and
1 deletion
+148
-1
SysUserController.java
...va/com/ruoyi/web/controller/system/SysUserController.java
+22
-0
SysUserVO.java
...m/src/main/java/com/ruoyi/system/domain/vo/SysUserVO.java
+31
-0
SysUserMapper.java
.../src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
+15
-0
InspectionRequest.java
...main/java/com/ruoyi/system/request/InspectionRequest.java
+13
-0
ISysUserService.java
...c/main/java/com/ruoyi/system/service/ISysUserService.java
+14
-0
SysUserServiceImpl.java
...ava/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+36
-0
SysUserMapper.xml
...system/src/main/resources/mapper/system/SysUserMapper.xml
+17
-1
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
View file @
3459afdb
...
...
@@ -6,6 +6,8 @@ import javax.servlet.http.HttpServletResponse;
import
cn.hutool.core.collection.CollUtil
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.system.domain.vo.SysUserVO
;
import
com.ruoyi.system.request.InspectionRequest
;
import
com.ruoyi.system.service.*
;
import
com.ruoyi.web.request.UserByRoleRequest
;
import
io.swagger.annotations.Api
;
...
...
@@ -94,6 +96,26 @@ public class SysUserController extends BaseController
}
}
/**
* 获取主检验人员列表
* @return
*/
@ApiOperation
(
"获取主检验人员列表"
)
@PostMapping
(
"/getPrimaryInspection"
)
public
R
<
List
<
SysUserVO
>>
getPrimaryInspection
()
{
return
R
.
ok
(
userService
.
getPrimaryInspection
());
}
/**
* 获取检验人员列表
* @return
*/
@ApiOperation
(
"获取检验人员列表"
)
@PostMapping
(
"/getInspection"
)
public
R
<
List
<
SysUserVO
>>
getInspection
()
{
return
R
.
ok
(
userService
.
getInspection
());
}
@Trace
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"param1"
,
value
=
"arg[1]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
EXPORT
)
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserVO.java
0 → 100644
View file @
3459afdb
package
com
.
ruoyi
.
system
.
domain
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
@Data
@Accessors
(
chain
=
true
)
public
class
SysUserVO
{
@ApiModelProperty
(
"用户id"
)
private
Long
userId
;
@ApiModelProperty
(
"用户账号"
)
private
String
userName
;
@ApiModelProperty
(
"用户昵称"
)
private
String
nickname
;
@ApiModelProperty
(
"部门名称"
)
private
String
deptName
;
@ApiModelProperty
(
"角色id"
)
private
Long
roleId
;
@ApiModelProperty
(
"帐号状态(0正常 1停用)"
)
private
String
status
;
@ApiModelProperty
(
"删除标志(0代表存在 2代表删除)"
)
private
String
delFlag
;
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
View file @
3459afdb
package
com
.
ruoyi
.
system
.
mapper
;
import
java.util.List
;
import
com.ruoyi.system.domain.vo.SysUserVO
;
import
com.ruoyi.system.domain.vo.UserCountVo
;
import
com.ruoyi.system.request.InspectionRequest
;
import
org.apache.ibatis.annotations.Param
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
...
...
@@ -146,4 +149,16 @@ public interface SysUserMapper
* @return
*/
List
<
UserCountVo
>
countTaskByUserId
(
@Param
(
"userIds"
)
Long
[]
userIds
);
/**
* 获取主检验人员列表
* @return
*/
List
<
SysUserVO
>
getPrimaryInspection
();
/**
* 获取检验人员列表
* @return
*/
List
<
SysUserVO
>
getInspection
();
}
ruoyi-system/src/main/java/com/ruoyi/system/request/InspectionRequest.java
0 → 100644
View file @
3459afdb
package
com
.
ruoyi
.
system
.
request
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
public
class
InspectionRequest
{
@ApiModelProperty
(
"类型"
)
private
String
flag
;
}
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
View file @
3459afdb
...
...
@@ -2,6 +2,8 @@ package com.ruoyi.system.service;
import
java.util.List
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.system.domain.vo.SysUserVO
;
import
com.ruoyi.system.request.InspectionRequest
;
/**
* 用户 业务层
...
...
@@ -225,4 +227,16 @@ public interface ISysUserService
* @return
*/
List
<
SysUser
>
selectUserByRoleInDept
(
Long
roleId
);
/**
* 获取主检验人员列表
* @return
*/
List
<
SysUserVO
>
getPrimaryInspection
();
/**
* 获取检验人员列表
* @return
*/
List
<
SysUserVO
>
getInspection
();
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
View file @
3459afdb
...
...
@@ -6,8 +6,10 @@ import java.util.stream.Collectors;
import
javax.validation.Validator
;
import
com.ruoyi.common.core.domain.entity.SysDept
;
import
com.ruoyi.system.domain.vo.SysUserVO
;
import
com.ruoyi.system.domain.vo.UserCountVo
;
import
com.ruoyi.system.mapper.*
;
import
com.ruoyi.system.request.InspectionRequest
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -591,6 +593,40 @@ public class SysUserServiceImpl implements ISysUserService
return
list
;
}
/**
* 获取主检验人员列表
* @return
*/
@Override
public
List
<
SysUserVO
>
getPrimaryInspection
()
{
List
<
SysUserVO
>
userList
=
userMapper
.
getPrimaryInspection
();
// 使用Stream API进行去重,基于userId字段
List
<
SysUserVO
>
deduplicatedList
=
userList
.
stream
()
.
filter
(
distinctByKey
(
user
->
user
.
getUserId
()))
.
collect
(
Collectors
.
toList
());
return
deduplicatedList
;
}
/**
* 获取检验人员列表
* @return
*/
@Override
public
List
<
SysUserVO
>
getInspection
()
{
List
<
SysUserVO
>
userList
=
userMapper
.
getInspection
();
// 使用Stream API进行去重,基于userId字段
List
<
SysUserVO
>
deduplicatedList
=
userList
.
stream
()
.
filter
(
distinctByKey
(
user
->
user
.
getUserId
()))
.
collect
(
Collectors
.
toList
());
return
deduplicatedList
;
}
// 辅助方法,用于去重
private
static
<
T
>
java
.
util
.
function
.
Predicate
<
T
>
distinctByKey
(
java
.
util
.
function
.
Function
<?
super
T
,
?>
keyExtractor
)
{
java
.
util
.
Map
<
Object
,
Boolean
>
seen
=
new
java
.
util
.
concurrent
.
ConcurrentHashMap
<>();
return
t
->
seen
.
putIfAbsent
(
keyExtractor
.
apply
(
t
),
Boolean
.
TRUE
)
==
null
;
}
/**
* 递归
* 查询出当前用户所在部门以及所有子部门
...
...
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
View file @
3459afdb
...
...
@@ -244,5 +244,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
group by tr.user_id
</select>
<select
id=
"getPrimaryInspection"
resultType=
"com.ruoyi.system.domain.vo.SysUserVO"
>
select u.user_id,sr.role_id,u.user_name,u.nick_name,u.status,u.del_flag, sd.dept_name
from sys_user u
left join sys_user_role sr on u.user_id = sr.user_id
left join sys_dept sd on sd.dept_id = u.dept_id
where sr.role_id = 112
and u.del_flag = '0'
</select>
<select
id=
"getInspection"
resultType=
"com.ruoyi.system.domain.vo.SysUserVO"
>
select u.user_id,sr.role_id,u.user_name,u.nick_name,u.status,u.del_flag, sd.dept_name
from sys_user u
left join sys_user_role sr on u.user_id = sr.user_id
left join sys_dept sd on sd.dept_id = u.dept_id
where sr.role_id IN (106, 112)
and u.del_flag = '0'
</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