| | |
| | | import com.highdatas.mdm.mapper.TableInfoMapper; |
| | | import com.highdatas.mdm.pojo.CodeMsg; |
| | | import com.highdatas.mdm.pojo.Result; |
| | | import com.highdatas.mdm.service.ActivitiService; |
| | | import com.highdatas.mdm.service.IMaintainService; |
| | | import com.highdatas.mdm.service.IMenuMappingService; |
| | | import com.highdatas.mdm.service.ISysMenuService; |
| | | import com.highdatas.mdm.service.*; |
| | | import com.highdatas.mdm.util.Constant; |
| | | import com.highdatas.mdm.util.DbUtils; |
| | | import com.highdatas.mdm.util.WorkflowUtils; |
| | |
| | | |
| | | @Autowired |
| | | ISysMenuService menuService; |
| | | @Autowired |
| | | IMaintainFieldService maintainFieldService; |
| | | @Autowired |
| | | IMasterAuthorService masterAuthorService; |
| | | |
| | | public static final String key = "process"; |
| | | |
| | |
| | | menuMapping = objectMapper.readValue(json, MenuMapping.class); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | String menuId = menuMapping.getMenuId(); |
| | | if (StringUtils.isEmpty(menuId)) { |
| | | return null; |
| | | } |
| | | int cnt = selectCount(new EntityWrapper<MenuMapping>().eq("menu_id", menuId)); |
| | | if (cnt != 0) { |
| | | return null; |
| | | } |
| | | //menuMapping.setMaintainFieldId(maintainId); |
| | |
| | | } else { |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | //only update no join |
| | | |
| | | //update menu name |
| | | String menuId = menuMapping.getMenuId(); |
| | | SysMenu sysMenu = menuService.selectById(menuId); |
| | | if (sysMenu == null) { |
| | | return false; |
| | | } |
| | | sysMenu.setName(menuMapping.getName()); |
| | | sysMenu.updateById(); |
| | | |
| | | return this.updateById(menuMapping); |
| | | } |
| | | |
| | | @Override |
| | | public Result getMapping(HttpSession session, String id) { |
| | | SysMenu sysMenu = menuService.selectById(id); |
| | | if (sysMenu == null) { |
| | | return Result.error(CodeMsg.SELECT_ERROR); |
| | | } |
| | | String menuType = sysMenu.getMenuType(); |
| | | if (StringUtils.isEmpty(menuType)) { |
| | | return Result.error(CodeMsg.SELECT_ERROR); |
| | |
| | | } |
| | | |
| | | String tableName = menuMapping.getTableName(); |
| | | Maintain resultMaintain = maintainService.getNowVersion(tableName); |
| | | TUser user = (TUser) session.getAttribute(Constant.USER); |
| | | |
| | | Maintain resultMaintain = masterAuthorService.getMaxVersionMaintain(user.getUserId(), tableName); |
| | | |
| | | |
| | | if (resultMaintain != null) { |
| | | Maintain nowVersion = maintainService.getNowVersion(tableName); |
| | | if (nowVersion.getOrderNo().equals(resultMaintain.getOrderNo())) { |
| | | mapping.put("maintainType", 0); |
| | | }else { |
| | | mapping.put("maintainType", 1); |
| | | } |
| | | mapping.put("version", resultMaintain.getVersion()); |
| | | mapping.put("maintainId", resultMaintain.getId()); |
| | | } |
| | | |
| | | return Result.success(mapping); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public SysMenu getMenuByTableName(String tableName) { |
| | | MenuMapping menuMapping = selectOne(new EntityWrapper<MenuMapping>().eq("table_name", tableName).orderBy("create_time desc")); |
| | | if (menuMapping == null) { |
| | | return null; |
| | | } |
| | | String menuId = menuMapping.getMenuId(); |
| | | SysMenu sysMenu = menuService.selectById(menuId); |
| | | return sysMenu; |
| | | } |
| | | |
| | | @Override |
| | | public String getTableNameByMenu(String menuId) { |
| | | MenuMapping menuMapping = selectOne(new EntityWrapper<MenuMapping>().eq("menu_id", menuId).orderBy("create_time desc")); |
| | | if (menuMapping == null) { |
| | | return null; |
| | | } |
| | | return menuMapping.getTableName(); |
| | | |
| | | } |
| | | } |