Browse Source

Merge remote-tracking branch 'remotes/origin/dev_data_analyse_menu'

feature/teamB_zz_wgh
jianjun 3 years ago
parent
commit
f0570f68d8
  1. 42
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  2. 36
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java
  3. 16
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovMenuController.java
  4. 13
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovMenuDao.java
  5. 10
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java
  6. 9
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/GovMenuService.java
  7. 54
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java
  8. 19
      epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml

42
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -101,7 +101,7 @@ public class RedisKeys {
* epmet:sys:security:user:token字符串
*/
public static String getCpUserKey(String app, String client, String userId) {
return rootPrefix.concat("sys:security:user:").concat(app).concat(":").concat(client).concat(":").concat(userId);
return rootPrefix.concat("sys:security:user:").concat(app).concat(StrConstant.COLON).concat(client).concat(StrConstant.COLON).concat(userId);
}
/**
@ -200,7 +200,7 @@ public class RedisKeys {
* @return
*/
public static String getRoleOpeScopesKey(String roleId, String opeKey) {
return rootPrefix.concat("gov:access:role:opescopes:").concat(roleId).concat(":").concat(opeKey);
return rootPrefix.concat("gov:access:role:opescopes:").concat(roleId).concat(StrConstant.COLON).concat(opeKey);
}
/**
@ -338,7 +338,7 @@ public class RedisKeys {
* @return
*/
public static String getCustomerStatsCalFlag(String customerId) {
return getCustomerStatsCalKeyPrefix().concat(":").concat(customerId);
return getCustomerStatsCalKeyPrefix().concat(StrConstant.COLON).concat(customerId);
}
/**
@ -364,7 +364,7 @@ public class RedisKeys {
* @return
*/
public static String getCustomerFootbarKey(String customerId, String appType) {
return rootPrefix.concat("footbar").concat(":").concat(customerId).concat(":").concat(appType);
return rootPrefix.concat("footbar").concat(StrConstant.COLON).concat(customerId).concat(StrConstant.COLON).concat(appType);
}
@ -397,7 +397,7 @@ public class RedisKeys {
* @date 2020.11.05 13:34
*/
public static String getResiUserBadgeKey(String customerId, String userId) {
return rootPrefix.concat("badge:user:").concat(customerId).concat(":").concat(StringUtils.isBlank(userId) ? "*" : userId);
return rootPrefix.concat("badge:user:").concat(customerId).concat(StrConstant.COLON).concat(StringUtils.isBlank(userId) ? "*" : userId);
}
/**
@ -483,7 +483,7 @@ public class RedisKeys {
**/
public static String getGroupMsgReadKey(String source, String groupId, String sourceId) {
String currentMonth= DateUtils.getBeforeNMonth(NumConstant.ZERO);
return "groupread:".concat(currentMonth).concat(":").concat(source).concat(":").concat(groupId).concat(":").concat(sourceId);
return "groupread:".concat(currentMonth).concat(StrConstant.COLON).concat(source).concat(StrConstant.COLON).concat(groupId).concat(StrConstant.COLON).concat(sourceId);
}
/**
@ -497,7 +497,7 @@ public class RedisKeys {
**/
public static String getGroupMsgShouldReadUser(String source, String groupId, String sourceId) {
String currentMonth= DateUtils.getBeforeNMonth(NumConstant.ZERO);
return "groupread:user:".concat(currentMonth).concat(":").concat(source).concat(":").concat(groupId).concat(":").concat(sourceId);
return "groupread:user:".concat(currentMonth).concat(StrConstant.COLON).concat(source).concat(StrConstant.COLON).concat(groupId).concat(StrConstant.COLON).concat(sourceId);
}
/**
@ -560,7 +560,7 @@ public class RedisKeys {
* @date 2021.09.23 17:38:37
*/
public static String getQuestionnaireAccessKey(String userId, String qKey) {
return rootPrefix.concat("questionnaire:accesskey:").concat(userId).concat(":").concat(qKey);
return rootPrefix.concat("questionnaire:accesskey:").concat(userId).concat(StrConstant.COLON).concat(qKey);
}
/**
@ -594,7 +594,7 @@ public class RedisKeys {
* @date 2021.10.25 17:49:43
*/
public static String loginTicket(String app, String ticket) {
return rootPrefix.concat("sys:security:ticket:").concat(app).concat(":").concat(ticket);
return rootPrefix.concat("sys:security:ticket:").concat(app).concat(StrConstant.COLON).concat(ticket);
}
/**
@ -649,7 +649,7 @@ public class RedisKeys {
}
public static String getHouseInfoCacheKey(String houseId,String customerId){
return rootPrefix.concat("house:").concat(customerId).concat(":").concat(houseId);
return rootPrefix.concat("house:").concat(customerId).concat(StrConstant.COLON).concat(houseId);
}
/**
@ -671,7 +671,7 @@ public class RedisKeys {
* @return
*/
public static String icResiImportTypeKey(String importTag, String type) {
return icResiImportBaseKey(importTag).concat(":").concat(type);
return icResiImportBaseKey(importTag).concat(StrConstant.COLON).concat(type);
}
/**
@ -682,7 +682,7 @@ public class RedisKeys {
* @return
*/
public static String icResiImportResiCategoryKey(String importTag, String type, String resiId) {
return icResiImportTypeKey(importTag, type).concat(":").concat(resiId);
return icResiImportTypeKey(importTag, type).concat(StrConstant.COLON).concat(resiId);
}
/**
@ -693,7 +693,7 @@ public class RedisKeys {
* @date 2022/2/14 9:38 上午
*/
public static String getTemporaryHouseInfoCacheKey(String customerId,String userId){
return rootPrefix.concat("temporary:").concat("temporaryHouse:").concat(customerId).concat(":").concat(userId);
return rootPrefix.concat("temporary:").concat("temporaryHouse:").concat(customerId).concat(StrConstant.COLON).concat(userId);
}
/**
@ -704,7 +704,7 @@ public class RedisKeys {
* @date 2022/2/14 9:38 上午
*/
public static String getTemporaryGridInfoCacheKey(String customerId,String userId){
return rootPrefix.concat("temporary:").concat("temporaryGrid:").concat(customerId).concat(":").concat(userId);
return rootPrefix.concat("temporary:").concat("temporaryGrid:").concat(customerId).concat(StrConstant.COLON).concat(userId);
}
/**
@ -715,7 +715,7 @@ public class RedisKeys {
* @date 2022/2/14 9:39 上午
*/
public static String getTemporaryNeighborHoodInfoCacheKey(String customerId,String userId){
return rootPrefix.concat("temporary:").concat("temporaryNeighborHood:").concat(customerId).concat(":").concat(userId);
return rootPrefix.concat("temporary:").concat("temporaryNeighborHood:").concat(customerId).concat(StrConstant.COLON).concat(userId);
}
/**
@ -726,7 +726,7 @@ public class RedisKeys {
* @date 2022/2/14 9:39 上午
*/
public static String getTemporaryBuildingInfoCacheKey(String customerId,String userId){
return rootPrefix.concat("temporary:").concat("temporaryBuilding:").concat(customerId).concat(":").concat(userId);
return rootPrefix.concat("temporary:").concat("temporaryBuilding:").concat(customerId).concat(StrConstant.COLON).concat(userId);
}
/**
@ -737,15 +737,15 @@ public class RedisKeys {
* @date 2022/2/14 1:54 下午
*/
public static String getTemporaryBuildingUnitInfoCacheKey(String customerId,String userId){
return rootPrefix.concat("temporary:").concat("temporaryBuildingUnit:").concat(customerId).concat(":").concat(userId);
return rootPrefix.concat("temporary:").concat("temporaryBuildingUnit:").concat(customerId).concat(StrConstant.COLON).concat(userId);
}
public static String getTemporaryImportResultCacheKey(String customerId,String userId){
return rootPrefix.concat("temporary:").concat("temporaryResult:").concat(customerId).concat(":").concat(userId);
return rootPrefix.concat("temporary:").concat("temporaryResult:").concat(customerId).concat(StrConstant.COLON).concat(userId);
}
public static String getCustomerMenuList(String customerId, Integer type) {
return getCustomerMenuListPrefix().concat(customerId).concat(":type:")+type;
public static String getCustomerMenuList(String customerId, Integer type, String tableName) {
return getCustomerMenuListPrefix().concat("type:").concat(type.toString()).concat(":tableName:").concat(tableName).concat(StrConstant.COLON).concat(customerId);
}
/**
@ -753,7 +753,7 @@ public class RedisKeys {
* @return
*/
public static String getCustomerMenuListPrefix() {
return rootPrefix.concat("oper:access:nav:customerId:");
return rootPrefix.concat("gov:access:nav:");
}
/**

36
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java

@ -22,7 +22,6 @@ import com.epmet.dto.result.MenuResourceDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@ -77,36 +76,6 @@ public class GovMenuDTO extends TreeStringNode<GovMenuDTO> implements Serializab
*/
private Integer sort;
/**
* 删除标识0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 菜单资源
*/
@ -121,4 +90,9 @@ public class GovMenuDTO extends TreeStringNode<GovMenuDTO> implements Serializab
* 是否显示1显示 0不显示
*/
private Integer showFlag;
/**
* 用于区分哪个端的菜单 eg:管理平台(gov_menu)数据分析平台(data_menu)
*/
private String tableName;
}

16
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovMenuController.java

@ -11,7 +11,6 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.GovMenuDTO;
import com.epmet.dto.result.MenuResourceDTO;
import com.epmet.service.GovMenuService;
import com.epmet.service.GovResourceService;
import org.springframework.beans.factory.annotation.Autowired;
@ -45,11 +44,8 @@ public class GovMenuController {
}
@GetMapping("{id}")
public Result<GovMenuDTO> get(@PathVariable("id") String id){
GovMenuDTO data = govMenuService.get(id);
//菜单资源列表
List<MenuResourceDTO> resourceList = govResourceService.getMenuResourceList(id);
public Result<GovMenuDTO> get(@PathVariable("id") String id,String tableName){
GovMenuDTO data = govMenuService.get(id,tableName);
return new Result<GovMenuDTO>().ok(data);
}
@ -101,8 +97,8 @@ public class GovMenuController {
* @return Result<List<GovMenuDTO>>
*/
@GetMapping("list")
public Result<List<GovMenuDTO>> list(Integer type){
List<GovMenuDTO> list = govMenuService.getMenuList(type);
public Result<List<GovMenuDTO>> list(Integer type,String tableName){
List<GovMenuDTO> list = govMenuService.getMenuList(type,tableName);
return new Result<List<GovMenuDTO>>().ok(list);
}
@ -113,8 +109,8 @@ public class GovMenuController {
* @return List<GovMenuDTO>
*/
@GetMapping("nav")
public Result<List<GovMenuDTO>> nav(@LoginUser TokenDto tokenDto){
List<GovMenuDTO> list = govMenuService.getUserMenuNavList(tokenDto);
public Result<List<GovMenuDTO>> nav(@LoginUser TokenDto tokenDto, String tableName){
List<GovMenuDTO> list = govMenuService.getUserMenuNavList(tokenDto,tableName);
return new Result<List<GovMenuDTO>>().ok(list);
}

13
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovMenuDao.java

@ -1,8 +1,8 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* <p>
* https://www.renren.io
*
* <p>
* 版权所有侵权必究
*/
@ -24,15 +24,16 @@ import java.util.List;
@Mapper
public interface GovMenuDao extends BaseDao<GovMenuEntity> {
GovMenuEntity getById(@Param("id") String id, @Param("language") String language);
GovMenuEntity getById(@Param("id") String id, @Param("language") String language, @Param("tableName") String tableName);
/**
* 查询所有菜单列表
*
* @param type 菜单类型
* @param language 语言
* @param tableName
*/
List<GovMenuEntity> getMenuList(@Param("type") Integer type, @Param("language") String language);
List<GovMenuEntity> getMenuList(@Param("type") Integer type, @Param("language") String language, @Param("tableName") String tableName);
/**
* 查询用户菜单列表
@ -46,6 +47,7 @@ public interface GovMenuDao extends BaseDao<GovMenuEntity> {
/**
* 根据父菜单查询子菜单
*
* @param pid 父菜单ID
*/
List<GovMenuEntity> getListPid(String pid);
@ -56,6 +58,7 @@ public interface GovMenuDao extends BaseDao<GovMenuEntity> {
* @param customerId 客户id
* @param type 菜单类型
* @param language 语言
* @param tableName
*/
List<GovMenuEntity> getCustomerMenuList(@Param("customerId") String customerId, @Param("type") Integer type, @Param("language") String language);
List<GovMenuEntity> getCustomerMenuList(@Param("customerId") String customerId, @Param("type") Integer type, @Param("language") String language, @Param("tableName") String tableName);
}

10
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java

@ -45,11 +45,12 @@ public class GovCustomerMenuRedis {
* desc:保存客户菜单缓存
* @param customerId
* @param type
* @param tableName
* @see com.epmet.enums.MenuTypeEnum
*/
public void setCustomerMenuList(String customerId, Integer type, List<GovMenuDTO> govMenuDTOS) {
public void setCustomerMenuList(String customerId, Integer type, List<GovMenuDTO> govMenuDTOS, String tableName) {
if (checkParam(customerId, type) && !CollectionUtils.isEmpty(govMenuDTOS) && StringUtils.isNotBlank(govMenuDTOS.get(NumConstant.ZERO).getName())) {
String key = RedisKeys.getCustomerMenuList(customerId, type);
String key = RedisKeys.getCustomerMenuList(customerId, type, tableName);
redisUtils.set(key, govMenuDTOS, RedisUtils.DEFAULT_EXPIRE);
}
}
@ -57,11 +58,12 @@ public class GovCustomerMenuRedis {
* desc:获取客户菜单缓存
* @param customerId
* @param type
* @param tableName
* @see com.epmet.enums.MenuTypeEnum
*/
public List<GovMenuDTO> getCustomerMenuList(String customerId, Integer type) {
public List<GovMenuDTO> getCustomerMenuList(String customerId, Integer type, String tableName) {
if (checkParam(customerId, type)) {
String key = RedisKeys.getCustomerMenuList(customerId, type);
String key = RedisKeys.getCustomerMenuList(customerId, type, tableName);
return (List<GovMenuDTO>) redisUtils.get(key);
}
return null;

9
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/GovMenuService.java

@ -59,11 +59,12 @@ public interface GovMenuService extends BaseService<GovMenuEntity> {
* 单条查询
*
* @param id
* @param tableName
* @return GovMenuDTO
* @author generator
* @date 2020-03-18
*/
GovMenuDTO get(String id);
GovMenuDTO get(String id, String tableName);
/**
* 默认保存
@ -117,15 +118,17 @@ public interface GovMenuService extends BaseService<GovMenuEntity> {
* 菜单列表
*
* @param type 菜单类型
* @param tableName
*/
List<GovMenuDTO> getMenuList(Integer type);
List<GovMenuDTO> getMenuList(Integer type, String tableName);
/**
* 用户菜单导航
* @param tokenDto 用户信息
* @param tableName
* @return java.util.List<GovMenuDTO>
*/
List<GovMenuDTO> getUserMenuNavList(TokenDto tokenDto);
List<GovMenuDTO> getUserMenuNavList(TokenDto tokenDto, String tableName);
/**
* 获取用户权限标识

54
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java

@ -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);
}
@ -107,7 +108,9 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
//保存菜单
insert(entity);
saveLanguage(entity.getId(), "name", entity.getName());
String tableName = dto.getTableName();
tableName = getTableName(tableName);
saveLanguage(tableName, entity.getId(), "name", entity.getName());
//保存菜单资源
govResourceService.saveMenuResource(entity.getId(), entity.getName(), dto.getResourceList());
@ -117,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) {
@ -126,10 +141,12 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
if(entity.getId().equals(entity.getPid())){
throw new RenException(ErrorCode.SUPERIOR_MENU_ERROR);
}
String tableName = dto.getTableName();
tableName = getTableName(tableName);
//更新菜单
updateById(entity);
saveLanguage(entity.getId(), "name", entity.getName());
saveLanguage(tableName, entity.getId(), "name", entity.getName());
//更新菜单资源
govResourceService.saveMenuResource(entity.getId(), entity.getName(), dto.getResourceList());
@ -169,7 +186,8 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
// //系统管理员,拥有最高权限
// if(govUserDTOResult.getData().getSuperAdmin() == SuperAdminEnum.YES.value()){
menuList = baseDao.getMenuList(type, HttpContextUtils.getLanguage());
//目前不支持角色 菜单
menuList = baseDao.getMenuList(type, HttpContextUtils.getLanguage(), null);
// }else {
// menuList = baseDao.getUserMenuList(tokenDto.getUserId(), type, HttpContextUtils.getLanguage());
// }
@ -180,8 +198,9 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
}
@Override
public List<GovMenuDTO> getMenuList(Integer type) {
List<GovMenuEntity> menuList = baseDao.getMenuList(type, HttpContextUtils.getLanguage());
public List<GovMenuDTO> getMenuList(Integer type, String tableName) {
tableName = getTableName(tableName);
List<GovMenuEntity> menuList = baseDao.getMenuList(type, HttpContextUtils.getLanguage(), tableName);
List<GovMenuDTO> dtoList = ConvertUtils.sourceToTarget(menuList, GovMenuDTO.class);
@ -189,7 +208,7 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
}
@Override
public List<GovMenuDTO> getUserMenuNavList(TokenDto tokenDto) {
public List<GovMenuDTO> getUserMenuNavList(TokenDto tokenDto, String tableName) {
// List<GovMenuDTO> menuList = govMenuRedis.getUserMenuNavList(tokenDto.getCustomerId(), tokenDto.getApp(), tokenDto.getClient());
// if(menuList == null){
// menuList = getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value());
@ -198,7 +217,8 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
// }
// PC端 每个客户的菜单信息,不放入缓存,每次登陆重新查询。
// 或者 你可以选择,在给每个客户 配置可见菜单的时候, 在saveCustomerMenu方法中,增加更新缓存的逻辑
return getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value());
tableName = getTableName(tableName);
return getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value(),tableName);
}
/**
@ -206,19 +226,20 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
*
* @param customerId
* @param type
* @param tableName
* @return java.util.List<com.epmet.dto.GovMenuDTO>
* @Author zhangyong
* @Date 15:51 2021-03-16
**/
private List<GovMenuDTO> getCustomerMenuList(String customerId, Integer type) {
List<GovMenuDTO> govMenuDTOS = govCustomerMenuRedis.getCustomerMenuList(customerId,type);
private List<GovMenuDTO> getCustomerMenuList(String customerId, Integer type, String tableName) {
List<GovMenuDTO> govMenuDTOS = govCustomerMenuRedis.getCustomerMenuList(customerId,type,tableName);
if (!CollectionUtils.isEmpty(govMenuDTOS)){
return govMenuDTOS;
}
List<GovMenuEntity> menuList = baseDao.getCustomerMenuList(customerId, type, HttpContextUtils.getLanguage());
List<GovMenuEntity> menuList = baseDao.getCustomerMenuList(customerId, type, HttpContextUtils.getLanguage(),tableName);
List<GovMenuDTO> dtoList = ConvertUtils.sourceToTarget(menuList, GovMenuDTO.class);
govMenuDTOS = TreeUtils.buildTree(dtoList);
govCustomerMenuRedis.setCustomerMenuList(customerId,type,govMenuDTOS);
govCustomerMenuRedis.setCustomerMenuList(customerId,type,govMenuDTOS,tableName);
return govMenuDTOS;
}
@ -235,7 +256,8 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
//超级管理员,拥有最高权限
List<GovMenuEntity> menuList;
// if(govUserDTOResult.getData().getSuperAdmin() == SuperAdminEnum.YES.value()){
menuList = baseDao.getMenuList(MenuTypeEnum.BUTTON.value(), HttpContextUtils.getLanguage());
//目前不支持角色 菜单
menuList = baseDao.getMenuList(MenuTypeEnum.BUTTON.value(), HttpContextUtils.getLanguage(), null);
// }else{
// menuList = baseDao.getUserMenuList(tokenDto.getUserId(), MenuTypeEnum.BUTTON.value(), HttpContextUtils.getLanguage());
// }
@ -267,7 +289,7 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
logger.info(String.format("运营端用户退出系统%s,清空菜单、权限成功",userId));
}
private void saveLanguage(String tableId, String fieldName, String fieldValue){
govLanguageService.saveOrUpdate("gov_menu", tableId, fieldName, fieldValue, HttpContextUtils.getLanguage());
private void saveLanguage(String tableName, String tableId, String fieldName, String fieldValue){
govLanguageService.saveOrUpdate(tableName, tableId, fieldName, fieldValue, HttpContextUtils.getLanguage());
}
}

19
epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml

@ -5,18 +5,22 @@
<select id="getById" resultType="com.epmet.entity.GovMenuEntity">
select t1.*,
(select lang.field_value from gov_language lang where lang.table_name='gov_menu' and lang.field_name='name'
(select lang.field_value from gov_language lang where lang.table_name=#{tableName} and lang.field_name='name'
and lang.table_id=t1.pid and lang.language=#{language}) as parentName,
(select lang.field_value from gov_language lang where lang.table_name='gov_menu' and lang.field_name='name'
(select lang.field_value from gov_language lang where lang.table_name=#{tableName} and lang.field_name='name'
and lang.table_id=t1.id and lang.language=#{language}) as name
from gov_menu t1
where t1.id = #{id} and t1.del_flag = 0
</select>
<select id="getMenuList" resultType="com.epmet.entity.GovMenuEntity">
select t1.*, (select lang.field_value from gov_language lang where lang.table_name='gov_menu' and lang.field_name='name'
and lang.table_id=t1.id and lang.language=#{language}) as name
from gov_menu t1 where t1.del_flag = 0
select t1.*,
lang.field_value name
from gov_menu t1
inner join
gov_language lang on lang.table_name=#{tableName} and lang.field_name='name'
and lang.table_id=t1.id and lang.language=#{language}
where t1.del_flag = 0
<if test="type != null">
and t1.type = #{type}
</if>
@ -40,9 +44,10 @@
</select>
<select id="getCustomerMenuList" resultType="com.epmet.entity.GovMenuEntity">
select t1.*, (select lang.field_value from gov_language lang where lang.table_name='gov_menu' and lang.field_name='name'
and lang.table_id=t1.id and lang.language=#{language}) as name
select t1.*,
lang.field_value name
from gov_menu t1
INNER join gov_language lang on lang.table_name=#{tableName} and lang.field_name='name' and lang.table_id=t1.id and lang.language=#{language}
RIGHT JOIN gov_customer_menu m ON t1.id = m.TABLE_ID
where t1.del_flag = 0 AND m.del_flag = 0
<if test="type != null">

Loading…
Cancel
Save