feat(user): 添加根据用户名列表查询用户基础数据功能
- 在CuteUserSelectService中新增listMetadataByUsernames方法 - 为CuteUserSelectApi添加listMetadataByUsernames接口 - 在前端cute-user-select.js中新增listMetadataByUsernames请求方法 - 修改CuteSingleUserSelect组件支持初始化时根据用户名加载用户信息 - 修改CuteUserSelect组件移除dataSource属性并支持初始化加载 - 更新CuteBusinessDemo演示页面用户字段默认值为空数组
This commit is contained in:
+8
@@ -30,4 +30,12 @@ public class CuteUserSelectApi {
|
||||
List<CuteUserSelectVo> collect = cuteUserSelectService.listMetadata(args);
|
||||
return ResponseEntity.ok(collect);
|
||||
}
|
||||
|
||||
@ApiOperation("根据用户名称集合查询用户基础数据")
|
||||
@PostMapping(value = "/listMetadataByUsernames")
|
||||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<List<CuteUserSelectVo>> listMetadataByUsernames(@RequestBody List<String> usernameList) {
|
||||
List<CuteUserSelectVo> collect = cuteUserSelectService.listMetadataByUsernames(usernameList);
|
||||
return ResponseEntity.ok(collect);
|
||||
}
|
||||
}
|
||||
|
||||
+21
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.system.application.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.system.application.model.CuteUserSelectVo;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryUserArgs;
|
||||
@@ -8,7 +9,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CuteUserSelectService {
|
||||
@@ -44,4 +47,22 @@ public class CuteUserSelectService {
|
||||
return selectVo;
|
||||
}).getRecords();
|
||||
}
|
||||
|
||||
public List<CuteUserSelectVo> listMetadataByUsernames(List<String> usernameList) {
|
||||
if (CollUtil.isEmpty(usernameList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.select(SystemUserTb::getUsername, SystemUserTb::getNickName, SystemUserTb::getDeptId, SystemUserTb::getEmail, SystemUserTb::getPhone);
|
||||
wrapper.in(SystemUserTb::getUsername, usernameList);
|
||||
return systemUserMapper.selectList(wrapper).stream().map(m -> {
|
||||
CuteUserSelectVo selectVo = new CuteUserSelectVo();
|
||||
selectVo.setValue(m.getUsername());
|
||||
selectVo.setLabel(m.getNickName());
|
||||
selectVo.setDeptId(Long.toString(m.getDeptId()));
|
||||
selectVo.setEmail(m.getEmail());
|
||||
selectVo.setPhone(m.getPhone());
|
||||
return selectVo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user