| | |
| | | import com.highdatas.mdm.service.*; |
| | | import com.highdatas.mdm.util.Constant; |
| | | import com.highdatas.mdm.util.DbUtils; |
| | | import com.highdatas.mdm.util.NoticeClient; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.util.*; |
| | | import java.util.Date; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | IMaintainFieldService maintainFieldService; |
| | | @Autowired |
| | | IMasterAuthorService masterAuthorService; |
| | | |
| | | @RequestMapping(value = "/all", method = RequestMethod.GET) |
| | | @Autowired |
| | | NoticeClient noticeClient; |
| | | @RequestMapping(value = "/all") |
| | | public Result<List<SysMenu>> getAll() { |
| | | EntityWrapper<SysMenu> sysMenuEntityWrapper = new EntityWrapper<>(); |
| | | sysMenuEntityWrapper.orderBy("parent_id, order_no"); |
| | |
| | | return result; |
| | | } |
| | | @RequestMapping(value = "/delete/{menuid}", method = RequestMethod.GET) |
| | | public Result<Object> delete(@PathVariable String menuid) throws Exception { |
| | | public Result<Object> delete(@PathVariable String menuid, HttpServletRequest request) throws Exception { |
| | | TUser user = DbUtils.getUser(request); |
| | | Result<List<SysMenu>> all = getAll(); |
| | | List<SysMenu> data = all.getData(); |
| | | SysMenu parentMenu = menuService.selectById(menuid); |
| | | |
| | | HashSet<SysMenu> sysMenus = deleteMenuByParentId(data, menuid); |
| | | |
| | | for (SysMenu sysMenu : sysMenus) { |
| | | List<MenuMapping> menuMappingList = menuMappingService.selectList(new EntityWrapper<MenuMapping>().eq("menu_id", sysMenu.getId())); |
| | | for (MenuMapping menuMapping : menuMappingList) { |
| | | //todo 添加待删除表的日志 |
| | | DeletedTableLog deletedTableLog = new DeletedTableLog(); |
| | | deletedTableLog.setId(DbUtils.getUUID()).setTableName(menuMapping.getTableName()).setCreateTime(new Date()); |
| | | deletedTableLog.insert(); |
| | | menuMapping.deleteById(); |
| | | |
| | | |
| | | } |
| | | |
| | | sysMenu.deleteById(); |
| | | } |
| | | boolean delete = menuService.deleteById(menuid); |
| | | if (parentMenu == null) { |
| | | return Result.success(null); |
| | | } |
| | | String menuType = parentMenu.getMenuType(); |
| | | |
| | | boolean delete = parentMenu.deleteById(); |
| | | if (delete) { |
| | | return Result.success(null); |
| | | } else { |