Merge branch '0.8.X' of http://49.232.154.205:10100/DeXun/klp-oa into 0.8.X
This commit is contained in:
@@ -86,4 +86,10 @@ public class SysFileVo extends BaseEntity {
|
||||
@ExcelProperty(value = "浏览次数")
|
||||
private Long viewCount;
|
||||
|
||||
/**
|
||||
* 创建者昵称
|
||||
*/
|
||||
@ExcelProperty(value = "创建者昵称")
|
||||
private String createByName;
|
||||
|
||||
}
|
||||
|
||||
@@ -17,12 +17,15 @@ import com.klp.system.domain.SysFile;
|
||||
import com.klp.system.domain.SysFileVisibleUser;
|
||||
import com.klp.system.mapper.SysFileMapper;
|
||||
import com.klp.system.mapper.SysFileVisibleUserMapper;
|
||||
import com.klp.system.mapper.SysUserMapper;
|
||||
import com.klp.system.service.ISysFileService;
|
||||
import com.klp.common.core.domain.entity.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 文件主信息Service业务层处理
|
||||
@@ -36,6 +39,7 @@ public class SysFileServiceImpl implements ISysFileService {
|
||||
|
||||
private final SysFileMapper baseMapper;
|
||||
private final SysFileVisibleUserMapper visibleUserMapper;
|
||||
private final SysUserMapper userMapper;
|
||||
|
||||
/**
|
||||
* 查询文件主信息
|
||||
@@ -52,6 +56,7 @@ public class SysFileServiceImpl implements ISysFileService {
|
||||
public TableDataInfo<SysFileVo> queryPageList(SysFileBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysFile> lqw = buildQueryWrapper(bo);
|
||||
Page<SysFileVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
fillCreateByName(result.getRecords());
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -61,7 +66,9 @@ public class SysFileServiceImpl implements ISysFileService {
|
||||
@Override
|
||||
public List<SysFileVo> queryList(SysFileBo bo) {
|
||||
LambdaQueryWrapper<SysFile> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
List<SysFileVo> list = baseMapper.selectVoList(lqw);
|
||||
fillCreateByName(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysFile> buildQueryWrapper(SysFileBo bo) {
|
||||
@@ -122,6 +129,7 @@ public class SysFileServiceImpl implements ISysFileService {
|
||||
LambdaQueryWrapper<SysFile> lqw = buildQueryWrapper(bo);
|
||||
lqw.in(SysFile::getFileId, fileIds);
|
||||
Page<SysFileVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
fillCreateByName(result.getRecords());
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -135,6 +143,35 @@ public class SysFileServiceImpl implements ISysFileService {
|
||||
.eq(SysFile::getFileId, fileId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 createBy(登录名)批量填充 createByName(用户昵称)
|
||||
*/
|
||||
private void fillCreateByName(List<SysFileVo> list) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 收集所有不重复的 createBy
|
||||
List<String> userNames = list.stream()
|
||||
.map(SysFileVo::getCreateBy)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (userNames.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 批量查询用户
|
||||
List<SysUser> users = userMapper.selectUserList(
|
||||
Wrappers.<SysUser>lambdaQuery().in(SysUser::getUserName, userNames));
|
||||
Map<String, String> nickNameMap = users.stream()
|
||||
.collect(Collectors.toMap(SysUser::getUserName, SysUser::getNickName, (a, b) -> a));
|
||||
// 赋值
|
||||
for (SysFileVo vo : list) {
|
||||
if (StringUtils.isNotBlank(vo.getCreateBy())) {
|
||||
vo.setCreateByName(nickNameMap.get(vo.getCreateBy()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<template>
|
||||
<div class="user-select-wrapper" :class="{ 'has-value': selectedValue && (Array.isArray(selectedValue) ? selectedValue.length > 0 : true) }">
|
||||
<el-select
|
||||
v-model="selectedValue"
|
||||
:multiple="multiple"
|
||||
@@ -21,6 +22,7 @@
|
||||
<span style="color: #999; font-size: 12px; margin-left: 8px;">{{ user.dept && user.dept.deptName ? user.dept.deptName : '无部门' }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -109,4 +111,62 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-select-wrapper {
|
||||
position: relative;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
padding: 2px 8px;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
min-height: 32px;
|
||||
}
|
||||
|
||||
.user-select-wrapper:hover {
|
||||
border-color: #c0c4cc;
|
||||
}
|
||||
|
||||
.user-select-wrapper.has-value {
|
||||
border-color: #5F7BA0;
|
||||
box-shadow: 0 0 0 1px rgba(95, 123, 160, 0.1);
|
||||
}
|
||||
|
||||
.user-select-wrapper /deep/ .el-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.user-select-wrapper /deep/ .el-select__tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
position: relative !important;
|
||||
top: auto !important;
|
||||
left: auto !important;
|
||||
transform: none !important;
|
||||
overflow: visible;
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
.user-select-wrapper /deep/ .el-select__tags .el-tag {
|
||||
margin: 2px 0;
|
||||
}
|
||||
|
||||
.user-select-wrapper /deep/ .el-input {
|
||||
width: auto;
|
||||
min-width: 60px;
|
||||
}
|
||||
|
||||
.user-select-wrapper /deep/ .el-select .el-select__input {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.user-select-wrapper /deep/ .el-select__tags-text {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* Hide the original el-select border since wrapper provides it */
|
||||
.user-select-wrapper /deep/ .el-select .el-input__inner {
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
padding-left: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user