feat:add multiple dept support
This commit is contained in:
parent
3edae0ce7e
commit
ffd55ab3ba
@ -60,6 +60,9 @@ public class AuthPermissionInfoRespVO {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "CRM职能", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
|
@Schema(description = "CRM职能", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048")
|
||||||
private String crmUserFunction;
|
private String crmUserFunction;
|
||||||
|
|
||||||
|
@Schema(description = "用户部门拼接", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
private String deptIdColl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 登录用户的菜单信息 Response VO")
|
@Schema(description = "管理后台 - 登录用户的菜单信息 Response VO")
|
||||||
|
@ -99,4 +99,8 @@ public class UserSaveReqVO {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "CRM职能", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "CRM职能", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
private Integer crmUserFunction;
|
private Integer crmUserFunction;
|
||||||
|
|
||||||
|
@Schema(description = "用户部门拼接", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
private String deptIdColl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,4 +32,8 @@ public class UserSimpleRespVO {
|
|||||||
* CRM职能
|
* CRM职能
|
||||||
* 枚举 {@link com.ensign.crm.framework.common.enums.CrmFunctionEnum}
|
* 枚举 {@link com.ensign.crm.framework.common.enums.CrmFunctionEnum}
|
||||||
*/
|
*/
|
||||||
private Integer crmUserFunction;}
|
private Integer crmUserFunction;
|
||||||
|
|
||||||
|
@Schema(description = "多个部门ID拼接")
|
||||||
|
private String deptIdColl;
|
||||||
|
}
|
||||||
|
@ -14,6 +14,7 @@ import com.ensign.crm.module.system.dal.dataobject.dept.PostDO;
|
|||||||
import com.ensign.crm.module.system.dal.dataobject.permission.RoleDO;
|
import com.ensign.crm.module.system.dal.dataobject.permission.RoleDO;
|
||||||
import com.ensign.crm.module.system.dal.dataobject.social.SocialUserDO;
|
import com.ensign.crm.module.system.dal.dataobject.social.SocialUserDO;
|
||||||
import com.ensign.crm.module.system.dal.dataobject.user.AdminUserDO;
|
import com.ensign.crm.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
@ -40,7 +41,27 @@ public interface UserConvert {
|
|||||||
default List<UserSimpleRespVO> convertSimpleList(List<AdminUserDO> list, Map<Long, DeptDO> deptMap) {
|
default List<UserSimpleRespVO> convertSimpleList(List<AdminUserDO> list, Map<Long, DeptDO> deptMap) {
|
||||||
return CollectionUtils.convertList(list, user -> {
|
return CollectionUtils.convertList(list, user -> {
|
||||||
UserSimpleRespVO userVO = BeanUtils.toBean(user, UserSimpleRespVO.class);
|
UserSimpleRespVO userVO = BeanUtils.toBean(user, UserSimpleRespVO.class);
|
||||||
MapUtils.findAndThen(deptMap, user.getDeptId(), dept -> userVO.setDeptName(dept.getName()));
|
String deptIdColl = userVO.getDeptIdColl();
|
||||||
|
if (StringUtils.isBlank(deptIdColl)) {
|
||||||
|
MapUtils.findAndThen(deptMap, user.getDeptId(), dept -> userVO.setDeptName(dept.getName()));
|
||||||
|
return userVO;
|
||||||
|
}
|
||||||
|
String[] split = deptIdColl.split(",");
|
||||||
|
StringBuilder deptName = new StringBuilder();
|
||||||
|
StringBuilder deptColl = new StringBuilder();
|
||||||
|
for (String s : split) {
|
||||||
|
Long deptId = Long.valueOf(s);
|
||||||
|
if (deptMap.containsKey(deptId)) {
|
||||||
|
deptName.append(deptMap.get(deptId).getName()).append(",");
|
||||||
|
deptColl.append(deptMap.get(deptId).getId()).append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (deptName.length() > 0) {
|
||||||
|
userVO.setDeptName(deptName.substring(0, deptName.length() - 1));
|
||||||
|
}
|
||||||
|
if (deptColl.length() > 0) {
|
||||||
|
userVO.setDeptIdColl(deptColl.substring(0, deptColl.length() - 1));
|
||||||
|
}
|
||||||
return userVO;
|
return userVO;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user