|
|
@ -94,8 +94,9 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public GovMenuDTO get(String id) { |
|
|
|
GovMenuEntity entity = baseDao.getById(id, HttpContextUtils.getLanguage()); |
|
|
|
public GovMenuDTO get(String id, String tableName) { |
|
|
|
tableName = getTableName(tableName); |
|
|
|
GovMenuEntity entity = baseDao.getById(id, HttpContextUtils.getLanguage(),tableName); |
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(entity, GovMenuDTO.class); |
|
|
|
} |
|
|
@ -108,9 +109,7 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit |
|
|
|
//保存菜单
|
|
|
|
insert(entity); |
|
|
|
String tableName = dto.getTableName(); |
|
|
|
if (StringUtils.isBlank(tableName)){ |
|
|
|
tableName = "gov_menu"; |
|
|
|
} |
|
|
|
tableName = getTableName(tableName); |
|
|
|
saveLanguage(tableName, entity.getId(), "name", entity.getName()); |
|
|
|
|
|
|
|
//保存菜单资源
|
|
|
@ -121,6 +120,18 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit |
|
|
|
//govMenuRedis.delete(tokenDto.getUserId(), tokenDto.getApp(), tokenDto.getClient());
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:获取tableName 默认 gov_menu |
|
|
|
* @param tableName |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private String getTableName(String tableName) { |
|
|
|
if (StringUtils.isBlank(tableName)) { |
|
|
|
tableName = "gov_menu"; |
|
|
|
} |
|
|
|
return tableName; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(GovMenuDTO dto, TokenDto tokenDto) { |
|
|
@ -131,9 +142,7 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit |
|
|
|
throw new RenException(ErrorCode.SUPERIOR_MENU_ERROR); |
|
|
|
} |
|
|
|
String tableName = dto.getTableName(); |
|
|
|
if (StringUtils.isBlank(tableName)){ |
|
|
|
tableName = "gov_menu"; |
|
|
|
} |
|
|
|
tableName = getTableName(tableName); |
|
|
|
|
|
|
|
//更新菜单
|
|
|
|
updateById(entity); |
|
|
@ -190,9 +199,7 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<GovMenuDTO> getMenuList(Integer type, String tableName) { |
|
|
|
if (StringUtils.isBlank(tableName)){ |
|
|
|
tableName = "gov_menu"; |
|
|
|
} |
|
|
|
tableName = getTableName(tableName); |
|
|
|
List<GovMenuEntity> menuList = baseDao.getMenuList(type, HttpContextUtils.getLanguage(), tableName); |
|
|
|
|
|
|
|
List<GovMenuDTO> dtoList = ConvertUtils.sourceToTarget(menuList, GovMenuDTO.class); |
|
|
@ -210,9 +217,7 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit |
|
|
|
// }
|
|
|
|
// PC端 每个客户的菜单信息,不放入缓存,每次登陆重新查询。
|
|
|
|
// 或者 你可以选择,在给每个客户 配置可见菜单的时候, 在saveCustomerMenu方法中,增加更新缓存的逻辑
|
|
|
|
if (StringUtils.isBlank(tableName)){ |
|
|
|
tableName = "gov_menu"; |
|
|
|
} |
|
|
|
tableName = getTableName(tableName); |
|
|
|
return getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value(),tableName); |
|
|
|
} |
|
|
|
|
|
|
|