mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-19 19:50:06 +08:00
【修改】修改部门负责人,从 String 字符串,调整成和后台用户的用户编号绑定
This commit is contained in:
parent
2809254a07
commit
33ab2e9633
@ -1,5 +1,7 @@
|
|||||||
package cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept;
|
package cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -28,8 +30,8 @@ public class SysDeptBaseVO {
|
|||||||
@NotNull(message = "显示顺序不能为空")
|
@NotNull(message = "显示顺序不能为空")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
@ApiModelProperty(value = "负责人", example = "芋道")
|
@ApiModelProperty(value = "负责人的用户编号", example = "2048")
|
||||||
private String leader;
|
private Long leaderUserId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "联系电话", example = "15601691000")
|
@ApiModelProperty(value = "联系电话", example = "15601691000")
|
||||||
@Size(max = 11, message = "联系电话长度不能超过11个字符")
|
@Size(max = 11, message = "联系电话长度不能超过11个字符")
|
||||||
@ -42,7 +44,7 @@ public class SysDeptBaseVO {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 SysCommonStatusEnum 枚举")
|
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 SysCommonStatusEnum 枚举")
|
||||||
@NotNull(message = "状态不能为空")
|
@NotNull(message = "状态不能为空")
|
||||||
// @InEnum(value = SysCommonStatusEnum.class, message = "修改状态必须是 {value}")
|
// @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package cn.iocoder.yudao.adminserver.modules.system.controller.user;
|
package cn.iocoder.yudao.adminserver.modules.system.controller.user;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept.SysDeptListReqVO;
|
||||||
|
import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept.SysDeptSimpleRespVO;
|
||||||
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.*;
|
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.*;
|
||||||
|
import cn.iocoder.yudao.adminserver.modules.system.convert.dept.SysDeptConvert;
|
||||||
import cn.iocoder.yudao.adminserver.modules.system.convert.user.SysUserConvert;
|
import cn.iocoder.yudao.adminserver.modules.system.convert.user.SysUserConvert;
|
||||||
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysDeptDO;
|
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysDeptDO;
|
||||||
import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysDeptService;
|
import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysDeptService;
|
||||||
@ -32,6 +35,8 @@ import java.io.IOException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
|
||||||
@Api(tags = "用户")
|
@Api(tags = "用户")
|
||||||
@ -99,7 +104,7 @@ public class SysUserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获得拼接需要的数据
|
// 获得拼接需要的数据
|
||||||
Collection<Long> deptIds = CollectionUtils.convertList(pageResult.getList(), SysUserDO::getDeptId);
|
Collection<Long> deptIds = convertList(pageResult.getList(), SysUserDO::getDeptId);
|
||||||
Map<Long, SysDeptDO> deptMap = deptService.getDeptMap(deptIds);
|
Map<Long, SysDeptDO> deptMap = deptService.getDeptMap(deptIds);
|
||||||
// 拼接结果返回
|
// 拼接结果返回
|
||||||
List<SysUserPageItemRespVO> userList = new ArrayList<>(pageResult.getList().size());
|
List<SysUserPageItemRespVO> userList = new ArrayList<>(pageResult.getList().size());
|
||||||
@ -111,6 +116,15 @@ public class SysUserController {
|
|||||||
return success(new PageResult<>(userList, pageResult.getTotal()));
|
return success(new PageResult<>(userList, pageResult.getTotal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-all-simple")
|
||||||
|
@ApiOperation(value = "获取用户精简信息列表", notes = "只包含被开启的用户,主要用于前端的下拉选项")
|
||||||
|
public CommonResult<List<SysUserSimpleRespVO>> getSimpleUsers() {
|
||||||
|
// 获用户门列表,只要开启状态的
|
||||||
|
List<SysUserDO> list = userService.getUsersByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
// 排序后,返回给前端
|
||||||
|
return success(SysUserConvert.INSTANCE.convertList04(list));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@ApiOperation("获得用户详情")
|
@ApiOperation("获得用户详情")
|
||||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||||
@ -129,15 +143,19 @@ public class SysUserController {
|
|||||||
List<SysUserDO> users = userService.getUsers(reqVO);
|
List<SysUserDO> users = userService.getUsers(reqVO);
|
||||||
|
|
||||||
// 获得拼接需要的数据
|
// 获得拼接需要的数据
|
||||||
Collection<Long> deptIds = CollectionUtils.convertList(users, SysUserDO::getDeptId);
|
Collection<Long> deptIds = convertList(users, SysUserDO::getDeptId);
|
||||||
Map<Long, SysDeptDO> deptMap = deptService.getDeptMap(deptIds);
|
Map<Long, SysDeptDO> deptMap = deptService.getDeptMap(deptIds);
|
||||||
|
Map<Long, SysUserDO> deptLeaderUserMap = userService.getUserMap(convertSet(deptMap.values(), SysDeptDO::getLeaderUserId));
|
||||||
// 拼接数据
|
// 拼接数据
|
||||||
List<SysUserExcelVO> excelUsers = new ArrayList<>(users.size());
|
List<SysUserExcelVO> excelUsers = new ArrayList<>(users.size());
|
||||||
users.forEach(user -> {
|
users.forEach(user -> {
|
||||||
SysUserExcelVO excelVO = SysUserConvert.INSTANCE.convert02(user);
|
SysUserExcelVO excelVO = SysUserConvert.INSTANCE.convert02(user);
|
||||||
|
// 设置部门
|
||||||
MapUtils.findAndThen(deptMap, user.getDeptId(), dept -> {
|
MapUtils.findAndThen(deptMap, user.getDeptId(), dept -> {
|
||||||
excelVO.setDeptName(dept.getName());
|
excelVO.setDeptName(dept.getName());
|
||||||
excelVO.setDeptLeader(dept.getLeader());
|
// 设置部门负责人的名字
|
||||||
|
MapUtils.findAndThen(deptLeaderUserMap, dept.getLeaderUserId(),
|
||||||
|
deptLeaderUser -> excelVO.setDeptLeaderNickname(deptLeaderUser.getNickname()));
|
||||||
});
|
});
|
||||||
excelUsers.add(excelVO);
|
excelUsers.add(excelVO);
|
||||||
});
|
});
|
||||||
|
@ -47,6 +47,6 @@ public class SysUserExcelVO {
|
|||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
@ExcelProperty("部门负责人")
|
@ExcelProperty("部门负责人")
|
||||||
private String deptLeader;
|
private String deptLeaderNickname;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@ApiModel("用户精简信息 Response VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SysUserSimpleRespVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户编号", required = true, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户昵称", required = true, example = "芋道")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
}
|
@ -45,4 +45,5 @@ public interface SysUserConvert {
|
|||||||
|
|
||||||
List<SysUserProfileRespVO.SocialUser> convertList03(List<SysSocialUserDO> list);
|
List<SysUserProfileRespVO.SocialUser> convertList03(List<SysSocialUserDO> list);
|
||||||
|
|
||||||
|
List<SysUserSimpleRespVO> convertList04(List<SysUserDO> list);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept;
|
package cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
@ -38,8 +39,10 @@ public class SysDeptDO extends TenantBaseDO {
|
|||||||
private Integer sort;
|
private Integer sort;
|
||||||
/**
|
/**
|
||||||
* 负责人
|
* 负责人
|
||||||
|
*
|
||||||
|
* 关联 {@link SysUserDO#getId()}
|
||||||
*/
|
*/
|
||||||
private String leader;
|
private Long leaderUserId;
|
||||||
/**
|
/**
|
||||||
* 联系电话
|
* 联系电话
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,7 @@ public interface SysUserMapper extends BaseMapperX<SysUserDO> {
|
|||||||
return selectList(new QueryWrapperX<SysUserDO>().like("username", username));
|
return selectList(new QueryWrapperX<SysUserDO>().like("username", username));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 芋艿:可废弃该方法
|
||||||
default List<SysUserDO> selectListByDepartIdAndPostId(Long departId, Long postId) {
|
default List<SysUserDO> selectListByDepartIdAndPostId(Long departId, Long postId) {
|
||||||
return selectList(new QueryWrapperX<SysUserDO>()
|
return selectList(new QueryWrapperX<SysUserDO>()
|
||||||
.eq("status", CommonStatusEnum.ENABLE.getStatus())
|
.eq("status", CommonStatusEnum.ENABLE.getStatus())
|
||||||
@ -64,5 +64,9 @@ public interface SysUserMapper extends BaseMapperX<SysUserDO> {
|
|||||||
.likeIfPresent("post_ids", Optional.ofNullable(postId).map(t -> String.valueOf(postId)).orElse("")));
|
.likeIfPresent("post_ids", Optional.ofNullable(postId).map(t -> String.valueOf(postId)).orElse("")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<SysUserDO> selectListByStatus(Integer status) {
|
||||||
|
return selectList("status", status);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,4 +169,12 @@ public interface SysUserService {
|
|||||||
*/
|
*/
|
||||||
SysUserImportRespVO importUsers(List<SysUserImportExcelVO> importUsers, boolean isUpdateSupport);
|
SysUserImportRespVO importUsers(List<SysUserImportExcelVO> importUsers, boolean isUpdateSupport);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得指定状态的用户们
|
||||||
|
*
|
||||||
|
* @param status 状态
|
||||||
|
* @return 用户们
|
||||||
|
*/
|
||||||
|
List<SysUserDO> getUsersByStatus(Integer status);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -379,4 +379,9 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysUserDO> getUsersByStatus(Integer status) {
|
||||||
|
return userMapper.selectListByStatus(status);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,14 @@ export function listUser(query) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取用户精简信息列表
|
||||||
|
export function listSimpleUsers() {
|
||||||
|
return request({
|
||||||
|
url: '/system/user/list-all-simple',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 查询用户详细
|
// 查询用户详细
|
||||||
export function getUser(userId) {
|
export function getUser(userId) {
|
||||||
return request({
|
return request({
|
||||||
|
@ -25,8 +25,9 @@
|
|||||||
<el-table v-loading="loading" :data="deptList" row-key="id" default-expand-all
|
<el-table v-loading="loading" :data="deptList" row-key="id" default-expand-all
|
||||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
|
||||||
<el-table-column prop="name" label="部门名称" width="260"></el-table-column>
|
<el-table-column prop="name" label="部门名称" width="260"></el-table-column>
|
||||||
|
<el-table-column prop="status" label="负责人" :formatter="userNicknameFormat" width="120"/>
|
||||||
<el-table-column prop="sort" label="排序" width="200"></el-table-column>
|
<el-table-column prop="sort" label="排序" width="200"></el-table-column>
|
||||||
<el-table-column prop="status" label="状态" :formatter="statusFormat" width="100"></el-table-column>
|
<el-table-column prop="status" label="状态" :formatter="statusFormat" width="100"/>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
@ -64,8 +65,10 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="负责人" prop="leader">
|
<el-form-item label="负责人" prop="leaderUserId">
|
||||||
<el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />
|
<el-select v-model="form.leaderUserId" placeholder="请输入负责人" clearable style="width: 100%">
|
||||||
|
<el-option v-for="item in users" :key="parseInt(item.id)" :label="item.nickname" :value="parseInt(item.id)" />
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -103,6 +106,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|||||||
|
|
||||||
import {SysCommonStatusEnum} from '@/utils/constants'
|
import {SysCommonStatusEnum} from '@/utils/constants'
|
||||||
import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
|
import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
|
||||||
|
import {listSimpleUsers} from "@/api/system/user";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Dept",
|
name: "Dept",
|
||||||
@ -117,6 +121,8 @@ export default {
|
|||||||
deptList: [],
|
deptList: [],
|
||||||
// 部门树选项
|
// 部门树选项
|
||||||
deptOptions: [],
|
deptOptions: [],
|
||||||
|
// 用户下拉列表
|
||||||
|
users: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
@ -168,6 +174,10 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
|
// 获得用户列表
|
||||||
|
listSimpleUsers().then(response => {
|
||||||
|
this.users = response.data;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询部门列表 */
|
/** 查询部门列表 */
|
||||||
@ -193,6 +203,18 @@ export default {
|
|||||||
statusFormat(row, column) {
|
statusFormat(row, column) {
|
||||||
return getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, row.status)
|
return getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, row.status)
|
||||||
},
|
},
|
||||||
|
// 用户昵称展示
|
||||||
|
userNicknameFormat(row, column) {
|
||||||
|
if (!row.leaderUserId) {
|
||||||
|
return '未设置';
|
||||||
|
}
|
||||||
|
for (const user of this.users) {
|
||||||
|
if (row.leaderUserId === user.id) {
|
||||||
|
return user.nickname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '未知【' + row.leaderUserId + '】';
|
||||||
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -205,7 +227,7 @@ export default {
|
|||||||
parentId: undefined,
|
parentId: undefined,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
sort: undefined,
|
sort: undefined,
|
||||||
leader: undefined,
|
leaderUserId: undefined,
|
||||||
phone: undefined,
|
phone: undefined,
|
||||||
email: undefined,
|
email: undefined,
|
||||||
status: SysCommonStatusEnum.ENABLE,
|
status: SysCommonStatusEnum.ENABLE,
|
||||||
|
13
更新日志.md
13
更新日志.md
@ -20,6 +20,12 @@
|
|||||||
5. 流程结束
|
5. 流程结束
|
||||||
* 我的请假中,可以查询本人的请假申请, 和进度
|
* 我的请假中,可以查询本人的请假申请, 和进度
|
||||||
|
|
||||||
|
### 📝 TODO
|
||||||
|
|
||||||
|
* 支付
|
||||||
|
* 用户前台的社交登陆
|
||||||
|
* 用户前台的修改手机、修改密码、忘记密码
|
||||||
|
|
||||||
## [v1.3.0] 进行中
|
## [v1.3.0] 进行中
|
||||||
|
|
||||||
### ⚠️ Warning
|
### ⚠️ Warning
|
||||||
@ -33,6 +39,7 @@
|
|||||||
* 【新增】待办任务的管理,支持任务的审批通过与不通过
|
* 【新增】待办任务的管理,支持任务的审批通过与不通过
|
||||||
* 【新增】已办任务的管理,支持详情的查看
|
* 【新增】已办任务的管理,支持详情的查看
|
||||||
* 【新增】引入 bpmn-process-designer 0.0.1 版本,提供流程设计器的能力
|
* 【新增】引入 bpmn-process-designer 0.0.1 版本,提供流程设计器的能力
|
||||||
|
* 【修改】修改部门负责人,从 String 字符串,调整成和后台用户的用户编号绑定
|
||||||
|
|
||||||
### 🐞 Bug Fixes
|
### 🐞 Bug Fixes
|
||||||
|
|
||||||
@ -45,12 +52,6 @@
|
|||||||
* 【升级】druid from 1.2.4 to 1.2.8,提升数据库连接池的稳定性
|
* 【升级】druid from 1.2.4 to 1.2.8,提升数据库连接池的稳定性
|
||||||
* 【升级】dynamic-datasource from 3.3.2 to 3.5.0,修复动态数据源切换的问题
|
* 【升级】dynamic-datasource from 3.3.2 to 3.5.0,修复动态数据源切换的问题
|
||||||
|
|
||||||
### 📝 TODO
|
|
||||||
|
|
||||||
* 支付
|
|
||||||
* 用户前台的社交登陆
|
|
||||||
* 用户前台的修改手机、修改密码、忘记密码
|
|
||||||
|
|
||||||
## [v1.2.0]
|
## [v1.2.0]
|
||||||
|
|
||||||
### ⚠️ Warning
|
### ⚠️ Warning
|
||||||
|
Loading…
Reference in New Issue
Block a user