修改ztree目录树为异步加载方式
This commit is contained in:
@ -63,6 +63,10 @@ public class SqMenu
|
||||
@Column(name = "bookmark_count")
|
||||
private Integer bookmarkCount;
|
||||
|
||||
/** 是否有下级 0无 1有*/
|
||||
@Column(name = "subordinate")
|
||||
private Integer subordinate;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Column(name = "create_time")
|
||||
@ -90,6 +94,14 @@ public class SqMenu
|
||||
this.bookmarkCount = bookmarkCount;
|
||||
}
|
||||
|
||||
public Integer getSubordinate() {
|
||||
return subordinate;
|
||||
}
|
||||
|
||||
public void setSubordinate(Integer subordinate) {
|
||||
this.subordinate = subordinate;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
@ -180,6 +192,7 @@ public class SqMenu
|
||||
.append("parentId", getParentId())
|
||||
.append("menuOrder", getMenuOrder())
|
||||
.append("bookmarkCount", getBookmarkCount())
|
||||
.append("subordinate", getSubordinate())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("menuUplinkSeries", getMenuUplinkSeries())
|
||||
@ -200,4 +213,12 @@ public class SqMenu
|
||||
this.menuId = menuId;
|
||||
this.menuUplinkSeries = menuUplinkSeries;
|
||||
}
|
||||
public SqMenu( Long parentId,Long userId) {
|
||||
this.parentId = parentId;
|
||||
this.userId = userId;
|
||||
}
|
||||
public SqMenu( Long menuId,Integer subordinate) {
|
||||
this.menuId = menuId;
|
||||
this.subordinate = subordinate;
|
||||
}
|
||||
}
|
||||
|
@ -126,4 +126,6 @@ public interface SqMenuMapper extends MyMapper<SqMenu>
|
||||
* @return
|
||||
*/
|
||||
public int countByMenuUplinkSeriesAndMenu(@Param("menuUplinkSeries")String menuUplinkSeries, @Param("menuId")Long menuId);
|
||||
|
||||
|
||||
}
|
||||
|
@ -165,4 +165,12 @@ public interface ISqMenuService
|
||||
* @return
|
||||
*/
|
||||
void reduceMenuByCountAndMenuUplinkSeries(SqMenu sqMenu);
|
||||
|
||||
/**
|
||||
* 查下级目录
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
List<SqMenu> listByMenuId(Long userId, Long menuId);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class SqBookmarkServiceImpl implements ISqBookmarkService
|
||||
sqBookmark.setMenuId(sqBookmark.getParentId());
|
||||
int i= sqBookmarkMapper.insertSqBookmark(sqBookmark);
|
||||
|
||||
//给对应目录 +1
|
||||
//给对应目录 +1 并且设置为目录
|
||||
sqMenuMapper.updateCountAdd(new Long[]{sqBookmark.getMenuId()},1);
|
||||
|
||||
|
||||
|
@ -294,4 +294,9 @@ public class SqMenuServiceImpl implements ISqMenuService
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SqMenu> listByMenuId(Long userId, Long parentId) {
|
||||
return sqMenuMapper.selectSqMenuList(new SqMenu(parentId,userId));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,11 +15,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="bookmarkCount" column="bookmark_count" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="subordinate" column="subordinate" />
|
||||
<result property="menuUplinkSeries" column="menu_uplink_series" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSqMenuVo">
|
||||
select menu_id, user_id, menu_name, menu_url, menu_icon, parent_id, menu_order,bookmark_count,create_time,update_time,menu_uplink_series from sq_menu
|
||||
select menu_id, user_id, menu_name, menu_url, menu_icon, parent_id, menu_order,bookmark_count,subordinate,create_time,update_time,menu_uplink_series from sq_menu
|
||||
</sql>
|
||||
|
||||
<select id="selectSqMenuList" parameterType="SqMenu" resultMap="SqMenuResult">
|
||||
@ -47,6 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="menuId != null "> and menu_id != #{menuId}</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectSqMenuById" parameterType="Long" resultMap="SqMenuResult">
|
||||
<include refid="selectSqMenuVo"/>
|
||||
where menu_id = #{menuId}
|
||||
@ -62,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
<if test="menuOrder != null">menu_order,</if>
|
||||
<if test="bookmarkCount != null">bookmark_count,</if>
|
||||
<if test="subordinate != null">subordinate,</if>
|
||||
create_time,update_time
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
@ -72,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="menuOrder != null">#{menuOrder},</if>
|
||||
<if test="bookmarkCount != null">#{bookmarkCount},</if>
|
||||
<if test="subordinate != null">#{subordinate},</if>
|
||||
now(),now()
|
||||
</trim>
|
||||
</insert>
|
||||
@ -86,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
<if test="menuOrder != null">menu_order = #{menuOrder},</if>
|
||||
<if test="bookmarkCount != null">bookmark_count = #{bookmarkCount},</if>
|
||||
<if test="subordinate != null">subordinate = #{subordinate},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="menuUplinkSeries != null">menu_uplink_series = #{menuUplinkSeries},</if>
|
||||
</trim>
|
||||
|
Reference in New Issue
Block a user