| | |
| | | package com.stylefeng.guns.modular.code.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.common.annotion.BussinessLog; |
| | | import com.stylefeng.guns.core.common.constant.dictmap.DeptDict; |
| | | import com.stylefeng.guns.core.common.constant.factory.ConstantFactory; |
| | |
| | | import com.stylefeng.guns.core.node.ZTreeNode; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.Dept; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.service.IDeptService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.DeptWarpper; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | return deptService.selectList(null); |
| | | // return tree; |
| | | } |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | @DeleteMapping ("/delete") |
| | | @ResponseBody |
| | | @ApiOperation(value = "删除部门", tags = {"后台-部门管理"}) |
| | | public ResultUtil delete(Integer id) { |
| | | deptService.deleteById(id); |
| | | public ResultUtil delete(String ids) { |
| | | String[] split = ids.split(","); |
| | | for (String id : split) { |
| | | List<User> users = userService.selectList(new EntityWrapper<User>().eq("deptid",Integer.valueOf(id))); |
| | | if (!users.isEmpty()){ |
| | | return ResultUtil.error("当前部门已绑定用户,无法删除"); |
| | | } |
| | | deptService.deleteById(Integer.valueOf(id)); |
| | | |
| | | } |
| | | return ResultUtil.success("删除成功"); |
| | | } |
| | | |