Commit 7c2fe347 by 李小龙

fixbug

parent f9882e1e
...@@ -86,17 +86,23 @@ implements SaasRoleService{ ...@@ -86,17 +86,23 @@ implements SaasRoleService{
} }
private void check(SaasRoleDTOVO dto) { private void check(SaasRoleDTOVO dto) {
SaasRole old = getOne(new QueryWrapper<SaasRole>().lambda() List<SaasRole> oldList = list(new QueryWrapper<SaasRole>().lambda()
.eq(SaasRole::getName, dto.getName())); .eq(SaasRole::getName, dto.getName()));
if (old != null && !old.getId().equals(dto.getId())) { for (SaasRole old : oldList) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_NAME_DUPLICATE); if (old != null && !old.getId().equals(dto.getId())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_NAME_DUPLICATE);
}
}
oldList = list(new QueryWrapper<SaasRole>().lambda()
.eq(SaasRole::getCode, dto.getCode()));
for (SaasRole old : oldList) {
if (old != null && !old.getId().equals(dto.getId())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_CODE_DUPLICATE);
}
} }
// old = getOne(new QueryWrapper<SaasRole>().lambda()
// .eq(SaasRole::getName, dto.getName()));
// if (old != null && !old.getId().equals(dto.getId())) {
// throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_CODE_DUPLICATE);
// }
} }
@Transactional @Transactional
......
...@@ -186,7 +186,7 @@ implements SaasUserService{ ...@@ -186,7 +186,7 @@ implements SaasUserService{
private void setRoleList(SaasUserDTOVO dto) { private void setRoleList(SaasUserDTOVO dto) {
saasUserRoleService.remove(new QueryWrapper<SaasUserRole>().lambda() saasUserRoleService.remove(new QueryWrapper<SaasUserRole>().lambda()
.eq(SaasUserRole::getUserId, dto.getId())); .eq(SaasUserRole::getUserId, dto.getId()));
if (CollectionUtils.isNotEmpty(dto.getRoleList())) { if (CollectionUtils.isNotEmpty(dto.getRoleIdList())) {
List<SaasUserRole> userRoleList = StreamUtil.map(dto.getRoleIdList(), e -> { List<SaasUserRole> userRoleList = StreamUtil.map(dto.getRoleIdList(), e -> {
SaasUserRole saasUserRole = new SaasUserRole(); SaasUserRole saasUserRole = new SaasUserRole();
saasUserRole.setUserId(dto.getId()); saasUserRole.setUserId(dto.getId());
......
...@@ -82,7 +82,7 @@ mybatis-plus: ...@@ -82,7 +82,7 @@ mybatis-plus:
global-config: global-config:
db-config: db-config:
id-type: ASSIGN_ID id-type: ASSIGN_ID
update-strategy: not_empty update-strategy: not_null
insert-strategy: not_empty insert-strategy: not_empty
where-strategy: not_empty where-strategy: not_empty
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment