Commit 9cc14a33 authored by 李驰骋's avatar 李驰骋

菜单添加泰语菜单名字段

parent 736ef97b
......@@ -6,8 +6,10 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.ximai.common.utils.SecurityUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ximai.common.core.domain.BaseEntity;
......@@ -78,5 +80,19 @@ public class SysMenu extends BaseEntity
@ApiModelProperty("菜单泰文名称")
private String menuNameTh;
public String localMenuName(){
String locale = SecurityUtils.getLoginUser().getUser().getLocale();
if(locale.indexOf("th")!=-1){
if(StringUtils.isNoneBlank(this.getMenuNameTh())){
return this.getMenuNameTh();
}
}else if(locale.indexOf("en")!=-1){
if(StringUtils.isNoneBlank(this.getMenuNameEn())){
return this.getMenuNameEn();
}
}
return this.getMenuName();
}
}
......@@ -129,7 +129,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
router.setPath(getRouterPath(menu));
router.setComponent(getComponent(menu));
router.setQuery(menu.getQuery());
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
router.setMeta(new MetaVo(menu.localMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
List<SysMenu> cMenus = menu.getChildren();
if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType())) {
router.setAlwaysShow(true);
......@@ -142,12 +142,12 @@ public class SysMenuServiceImpl implements ISysMenuService {
children.setPath(menu.getPath());
children.setComponent(menu.getComponent());
children.setName(StringUtils.capitalize(menu.getPath()));
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
children.setMeta(new MetaVo(menu.localMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
children.setQuery(menu.getQuery());
childrenList.add(children);
router.setChildren(childrenList);
} else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) {
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon()));
router.setMeta(new MetaVo(menu.localMenuName(), menu.getIcon()));
router.setPath("/");
List<RouterVo> childrenList = new ArrayList<RouterVo>();
RouterVo children = new RouterVo();
......@@ -155,7 +155,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
children.setPath(routerPath);
children.setComponent(UserConstants.INNER_LINK);
children.setName(StringUtils.capitalize(routerPath));
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath()));
children.setMeta(new MetaVo(menu.localMenuName(), menu.getIcon(), menu.getPath()));
childrenList.add(children);
router.setChildren(childrenList);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment