master
chen 2 years ago
parent fbfbbea7c1
commit 01f5d044b2
  1. 7
      src/main/java/com/huoran/iasf/controller/RoleController.java
  2. 4
      src/main/java/com/huoran/iasf/controller/UserController.java
  3. 2
      src/main/java/com/huoran/iasf/entity/SysDept.java
  4. 2
      src/main/java/com/huoran/iasf/service/RoleService.java
  5. 7
      src/main/java/com/huoran/iasf/service/impl/DeptServiceImpl.java
  6. 5
      src/main/java/com/huoran/iasf/service/impl/RoleServiceImpl.java

@ -13,6 +13,7 @@ import com.huoran.iasf.service.RoleService;
import com.huoran.iasf.vo.req.RolePermissionOperationReqVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@ -65,12 +66,12 @@ public class RoleController {
return R.success();
}
@DeleteMapping("/role/{id}")
@DeleteMapping("/role/deleted")
@ApiOperation(value = "删除角色接口")
@LogAnnotation(title = "角色管理", action = "删除角色")
@RequiresPermissions("sys:role:deleted")
public R deleted(@PathVariable("id") Integer id) {
roleService.deletedRole(id);
public R deleted(@RequestBody @ApiParam(value = "id集合") List<Integer> ids) {
roleService.deletedRole(ids);
return R.success();
}

@ -162,8 +162,8 @@ public class UserController {
if (StringUtils.isEmpty(vo.getOldPwd()) || StringUtils.isEmpty(vo.getNewPwd())) {
return R.fail("旧密码与新密码不能为空");
}
Integer userId = httpSessionService.getCurrentUserId();
vo.setId(userId);
// Integer userId = httpSessionService.getCurrentUserId();
// vo.setId(userId);
userService.updatePwd(vo);
return R.success();
}

@ -31,7 +31,7 @@ public class SysDept implements Serializable {
@ApiModelProperty(value = "部门名称")
private String name;
@NotBlank(message = "父级不能为空")
// @NotBlank(message = "父级不能为空")
@ApiModelProperty(value = "父级id")
private Integer pid;

@ -33,7 +33,7 @@ public interface RoleService extends IService<SysRole> {
*
* @param id id
*/
void deletedRole(Integer id);
void deletedRole(List<Integer> ids);
/**
* 根据userId获取绑定的角色

@ -48,7 +48,10 @@ public class DeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impleme
String relationCode;
String deptCode = this.getNewDeptCode();
SysDept parent = sysDeptMapper.selectById(vo.getPid());
if ("0".equals(vo.getPid())) {
if (vo.getPid()==null){
vo.setPid(0);
}
if (vo.getPid()==0) {
relationCode = deptCode;
} else if (null == parent) {
throw new BusinessException(BaseResponseCode.DATA_ERROR);
@ -160,7 +163,7 @@ public class DeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impleme
private List<DeptRespNodeVO> getTree(List<SysDept> all) {
List<DeptRespNodeVO> list = new ArrayList<>();
for (SysDept sysDept : all) {
if ("0".equals(sysDept.getPid())) {
if (sysDept.getPid()==0) {
DeptRespNodeVO deptTree = new DeptRespNodeVO();
BeanUtils.copyProperties(sysDept, deptTree);
deptTree.setName(sysDept.getName());

@ -104,7 +104,9 @@ public class RoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impleme
@Transactional(rollbackFor = Exception.class)
@Override
public void deletedRole(Integer id) {
public void deletedRole(List<Integer> ids) {
for (Integer id : ids) {
//获取关联userId
List<Integer> userIds = userRoleService.getUserIdsByRoleId(id);
//删除角色
@ -118,6 +120,7 @@ public class RoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impleme
userIds.parallelStream().forEach(httpSessionService::refreshUerId);
}
}
}
@Override
public List<SysRole> getRoleInfoByUserId(Integer userId) {

Loading…
Cancel
Save