mirror of https://github.com/halo-dev/halo
Merge branch 'dev' of https://github.com/halo-dev/halo into dev
commit
73d198505a
|
@ -50,6 +50,10 @@ public class MenuTagDirective implements TemplateDirectiveModel {
|
||||||
String team = params.get("team").toString();
|
String team = params.get("team").toString();
|
||||||
env.setVariable("menus", builder.build().wrap(menuService.listByTeam(team, Sort.by(DESC, "priority"))));
|
env.setVariable("menus", builder.build().wrap(menuService.listByTeam(team, Sort.by(DESC, "priority"))));
|
||||||
break;
|
break;
|
||||||
|
case "treeByTeam":
|
||||||
|
String treeTeam = params.get("team").toString();
|
||||||
|
env.setVariable("menus", builder.build().wrap(menuService.listByTeamAsTree(treeTeam, Sort.by(DESC, "priority"))));
|
||||||
|
break;
|
||||||
case "count":
|
case "count":
|
||||||
env.setVariable("count", builder.build().wrap(menuService.count()));
|
env.setVariable("count", builder.build().wrap(menuService.count()));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -47,6 +47,15 @@ public interface MenuService extends CrudService<Menu, Integer> {
|
||||||
*/
|
*/
|
||||||
List<MenuDTO> listByTeam(@NonNull String team, Sort sort);
|
List<MenuDTO> listByTeam(@NonNull String team, Sort sort);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List menus by team as tree.
|
||||||
|
*
|
||||||
|
* @param team team
|
||||||
|
* @param sort sort
|
||||||
|
* @return list of tree menus
|
||||||
|
*/
|
||||||
|
List<MenuVO> listByTeamAsTree(@NonNull String team, Sort sort);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a menu.
|
* Creates a menu.
|
||||||
*
|
*
|
||||||
|
@ -62,7 +71,7 @@ public interface MenuService extends CrudService<Menu, Integer> {
|
||||||
* @param sort sort info must not be null
|
* @param sort sort info must not be null
|
||||||
* @return a menu tree
|
* @return a menu tree
|
||||||
*/
|
*/
|
||||||
List<MenuVO> listAsTree(Sort sort);
|
List<MenuVO> listAsTree(@NonNull Sort sort);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists menu by parent id.
|
* Lists menu by parent id.
|
||||||
|
|
|
@ -77,6 +77,24 @@ public class MenuServiceImpl extends AbstractCrudService<Menu, Integer> implemen
|
||||||
return menus.stream().map(menu -> (MenuDTO) new MenuDTO().convertFrom(menu)).collect(Collectors.toList());
|
return menus.stream().map(menu -> (MenuDTO) new MenuDTO().convertFrom(menu)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MenuVO> listByTeamAsTree(String team, Sort sort) {
|
||||||
|
Assert.notNull(team, "Team must not be null");
|
||||||
|
|
||||||
|
List<Menu> menus = menuRepository.findByTeam(team, sort);
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(menus)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuVO topLevelMenu = createTopLevelMenu();
|
||||||
|
|
||||||
|
concreteTree(topLevelMenu, menus);
|
||||||
|
|
||||||
|
List<MenuVO> children = topLevelMenu.getChildren();
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Menu createBy(MenuParam menuParam) {
|
public Menu createBy(MenuParam menuParam) {
|
||||||
Assert.notNull(menuParam, "Menu param must not be null");
|
Assert.notNull(menuParam, "Menu param must not be null");
|
||||||
|
|
|
@ -30,17 +30,6 @@ public class HaloUtils {
|
||||||
|
|
||||||
public static final String URL_SEPARATOR = "/";
|
public static final String URL_SEPARATOR = "/";
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets current http servlet request.
|
|
||||||
*
|
|
||||||
* @return current http servlet request
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public static HttpServletRequest getHttpServletRequest() {
|
|
||||||
return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes()))
|
|
||||||
.getRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static String ensureBoth(@NonNull String string, @NonNull String bothfix) {
|
public static String ensureBoth(@NonNull String string, @NonNull String bothfix) {
|
||||||
return ensureBoth(string, bothfix, bothfix);
|
return ensureBoth(string, bothfix, bothfix);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
${author!}:${content!}
|
${author!}:${content!}
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<p style="color: #6e6e6e;font-size:13px;line-height:24px;">你可以点击<a href="${url!}">查看完整内容</a></p>
|
<p style="color: #6e6e6e;font-size:13px;line-height:24px;">您可以点击<a href="${url!}">查看完整内容</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
<p style="color: #6e6e6e;font-size:13px;line-height:24px;">您在《${page!}》的留言:
|
<p style="color: #6e6e6e;font-size:13px;line-height:24px;">您在《${page!}》的留言:
|
||||||
<br />
|
<br />
|
||||||
<p style="color: #6e6e6e;font-size:13px;line-height:24px;padding:10px 20px;background:#f8f8f8;margin:0">${baseContent!}</p>
|
<p style="color: #6e6e6e;font-size:13px;line-height:24px;padding:10px 20px;background:#f8f8f8;margin:0">${baseContent!}</p>
|
||||||
<p style="color: #6e6e6e;font-size:13px;line-height:24px;">${replyAuthor!} 给你的回复:
|
<p style="color: #6e6e6e;font-size:13px;line-height:24px;">${replyAuthor!} 给您的回复:
|
||||||
<br />
|
<br />
|
||||||
<p style="color: #6e6e6e;font-size:13px;line-height:24px;padding:10px 20px;background:#f8f8f8;margin:0">${replyContent!}</p>
|
<p style="color: #6e6e6e;font-size:13px;line-height:24px;padding:10px 20px;background:#f8f8f8;margin:0">${replyContent!}</p>
|
||||||
<p style="color: #6e6e6e;font-size:13px;line-height:24px;">你可以点击
|
<p style="color: #6e6e6e;font-size:13px;line-height:24px;">您可以点击
|
||||||
<a href="${url!}">查看完整内容</a>
|
<a href="${url!}">查看完整内容</a>
|
||||||
</p>
|
</p>
|
||||||
<p style="color: #6e6e6e;font-size:13px;line-height:24px;">欢迎再度光临
|
<p style="color: #6e6e6e;font-size:13px;line-height:24px;">欢迎再度光临
|
||||||
|
|
Loading…
Reference in New Issue