update 优化 TreeEntity 树实体 去除未知泛型

2.X
疯狂的狮子li 3 years ago
parent eaf6fdc445
commit e908329cc0

@ -26,7 +26,7 @@ import javax.validation.constraints.Size;
@NoArgsConstructor @NoArgsConstructor
@TableName("sys_dept") @TableName("sys_dept")
@ApiModel("部门业务对象") @ApiModel("部门业务对象")
public class SysDept extends TreeEntity { public class SysDept extends TreeEntity<SysDept> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -17,7 +16,7 @@ import java.util.List;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class TreeEntity extends BaseEntity { public class TreeEntity<T> extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -39,6 +38,6 @@ public class TreeEntity extends BaseEntity {
*/ */
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "子部门") @ApiModelProperty(value = "子部门")
private List<?> children = new ArrayList<>(); private List<T> children = new ArrayList<>();
} }

@ -28,7 +28,7 @@ import com.ruoyi.common.core.web.domain.TreeEntity;
#if($table.crud || $table.sub) #if($table.crud || $table.sub)
#set($Entity="BaseEntity") #set($Entity="BaseEntity")
#elseif($table.tree) #elseif($table.tree)
#set($Entity="TreeEntity") #set($Entity="TreeEntity<${ClassName}Bo>")
#end #end
@Data @Data

@ -26,7 +26,7 @@ import com.ruoyi.common.core.web.domain.TreeEntity;
#if($table.crud || $table.sub) #if($table.crud || $table.sub)
#set($Entity="BaseEntity") #set($Entity="BaseEntity")
#elseif($table.tree) #elseif($table.tree)
#set($Entity="TreeEntity") #set($Entity="TreeEntity<${ClassName}>")
#end #end
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

@ -25,7 +25,7 @@ import javax.validation.constraints.Size;
@NoArgsConstructor @NoArgsConstructor
@TableName("sys_menu") @TableName("sys_menu")
@ApiModel("菜单权限业务对象") @ApiModel("菜单权限业务对象")
public class SysMenu extends TreeEntity { public class SysMenu extends TreeEntity<SysMenu> {
/** /**
* ID * ID

@ -143,8 +143,8 @@ public class SysMenuServiceImpl implements ISysMenuService {
router.setComponent(getComponent(menu)); router.setComponent(getComponent(menu));
router.setQuery(menu.getQueryParam()); router.setQuery(menu.getQueryParam());
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
List<SysMenu> cMenus = (List<SysMenu>) menu.getChildren(); List<SysMenu> cMenus = menu.getChildren();
if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType())) { if (!cMenus.isEmpty() && UserConstants.TYPE_DIR.equals(menu.getMenuType())) {
router.setAlwaysShow(true); router.setAlwaysShow(true);
router.setRedirect("noRedirect"); router.setRedirect("noRedirect");
router.setChildren(buildMenus(cMenus)); router.setChildren(buildMenus(cMenus));

Loading…
Cancel
Save