| | |
| | | VciBaseUtil.alertNotNull( |
| | | smRoleDTO,"添加的角色对象", |
| | | smRoleDTO.getName(),"角色名"); |
| | | //查询数据库中的,根据角色名查 |
| | | //根据角色主键查询,确保修改的角色存在 |
| | | Map<String, String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("plname",smRoleDTO.getName()); |
| | | conditionMap.put("pluid",smRoleDTO.getOid()); |
| | | SmRoleVO dbSmRoleVO = getRoleByConditionMap(conditionMap); |
| | | //根据主键没查询到了用户 |
| | | if(Func.isEmpty(dbSmRoleVO) || Func.isBlank(dbSmRoleVO.getOid())){ |
| | | throw new PLException("500", new String[] { "当前修改的角色不存在!"}); |
| | | } |
| | | //角色名相等,但是主键不相等,说明修改为的角色名已存在,不能重复 |
| | | if(dbSmRoleVO.getName().equals(smRoleDTO.getName()) && !dbSmRoleVO.getOid().equals(smRoleDTO.getOid())){ |
| | | //查询数据库中的,根据角色名查重 |
| | | conditionMap.clear(); |
| | | conditionMap.put("plname",smRoleDTO.getName()); |
| | | //排除掉当前修改的用户 |
| | | conditionMap.put("pluid",QueryOptionConstant.NOTEQUAL + smRoleDTO.getName()); |
| | | SmRoleVO reapeatSmRoleVO = getRoleByConditionMap(conditionMap); |
| | | //说明修改为的角色名已存在,不能重复 |
| | | if(Func.isNotEmpty(reapeatSmRoleVO) && smRoleDTO.getName().equals(reapeatSmRoleVO)){ |
| | | throw new PLException("500", new String[] { "该角色名称已经存在,请修改!"}); |
| | | } |
| | | SmRoleDTO smRoleDTO1 = new SmRoleDTO(); |
| | |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public BaseResult importRole(File file) throws VciBaseException { |
| | | public BaseResult importRole(File file) throws Exception { |
| | | VciBaseUtil.alertNotNull(file,"excel文件"); |
| | | if(!file.exists()){ |
| | | throw new VciBaseException("导入的excel文件不存在,{0}",new String[]{file.getPath()}); |