提交 cf7c0c0d 编写于 作者: doc_wei's avatar doc_wei

添加菜单上移下移操作

上级 b8a99057
......@@ -9,17 +9,17 @@ public interface SysEveMenuDao {
public List<Map<String, Object>> querySysMenuList(Map<String, Object> map, PageBounds pageBounds) throws Exception;
public void insertSysMenuMation(Map<String, Object> map) throws Exception;
public int insertSysMenuMation(Map<String, Object> map) throws Exception;
public Map<String, Object> querySysMenuMationToEditById(Map<String, Object> map) throws Exception;
public List<Map<String, Object>> querySysMenuMationBySimpleLevel(Map<String, Object> map) throws Exception;
public void editSysMenuMationById(Map<String, Object> map) throws Exception;
public int editSysMenuMationById(Map<String, Object> map) throws Exception;
public void deleteSysMenuChildMationById(Map<String, Object> map) throws Exception;
public int deleteSysMenuChildMationById(Map<String, Object> map) throws Exception;
public void deleteSysMenuMationById(Map<String, Object> map) throws Exception;
public int deleteSysMenuMationById(Map<String, Object> map) throws Exception;
public List<Map<String, Object>> queryTreeSysMenuMationBySimpleLevel(Map<String, Object> map) throws Exception;
......@@ -31,4 +31,12 @@ public interface SysEveMenuDao {
public Map<String, Object> queryOldParentIdById(Map<String, Object> map) throws Exception;
public Map<String, Object> querySysEveMenuISTopByThisId(Map<String, Object> map) throws Exception;
public int editSysEveMenuSortTopById(Map<String, Object> map) throws Exception;
public Map<String, Object> querySysEveMenuISLowerByThisId(Map<String, Object> map) throws Exception;
public int editSysEveMenuSortLowerById(Map<String, Object> map) throws Exception;
}
......@@ -21,4 +21,8 @@ public interface SysEveMenuService {
public void querySysMenuLevelList(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editSysEveMenuSortTopById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editSysEveMenuSortLowerById(InputObject inputObject, OutputObject outputObject) throws Exception;
}
......@@ -238,4 +238,52 @@ public class SysEveMenuServiceImpl implements SysEveMenuService{
}
}
/**
*
* @Title: editSysEveMenuSortTopById
* @Description: 菜单展示顺序上移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editSysEveMenuSortTopById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> topBean = sysEveMenuDao.querySysEveMenuISTopByThisId(map);//根据同一级排序获取这条数据的上一条数据
if(topBean == null){
outputObject.setreturnMessage("已经是最靠前菜单,无法移动。");
}else{
map.put("orderNum", topBean.get("orderNum"));
topBean.put("orderNum", topBean.get("thisOrderNum"));
sysEveMenuDao.editSysEveMenuSortTopById(map);
sysEveMenuDao.editSysEveMenuSortTopById(topBean);
}
}
/**
*
* @Title: editSysEveMenuSortLowerById
* @Description: 菜单展示顺序下移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editSysEveMenuSortLowerById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> topBean = sysEveMenuDao.querySysEveMenuISLowerByThisId(map);//根据同一级排序获取这条数据的下一条数据
if(topBean == null){
outputObject.setreturnMessage("已经是最靠后菜单,无法移动。");
}else{
map.put("orderNum", topBean.get("orderNum"));
topBean.put("orderNum", topBean.get("thisOrderNum"));
sysEveMenuDao.editSysEveMenuSortLowerById(map);
sysEveMenuDao.editSysEveMenuSortLowerById(topBean);
}
}
}
......@@ -143,4 +143,36 @@ public class SysEveMenuController {
sysEveMenuService.querySysMenuLevelList(inputObject, outputObject);
}
/**
*
* @Title: editSysEveMenuSortTopById
* @Description: 菜单展示顺序上移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveMenuController/editSysEveMenuSortTopById")
@ResponseBody
public void editSysEveMenuSortTopById(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveMenuService.editSysEveMenuSortTopById(inputObject, outputObject);
}
/**
*
* @Title: editSysEveMenuSortLowerById
* @Description: 菜单展示顺序下移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveMenuController/editSysEveMenuSortLowerById")
@ResponseBody
public void editSysEveMenuSortLowerById(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveMenuService.editSysEveMenuSortLowerById(inputObject, outputObject);
}
}
......@@ -15,6 +15,7 @@
a.menu_url menuUrl,
CONVERT(a.create_time, char) createTime,
b.user_name userName,
a.order_num orderNum,
IFNULL(GROUP_CONCAT(c.menu_name separator '->'), '创世菜单') menuParentName,
(SELECT COUNT(*) FROM sys_eve_role_menu d WHERE d.menu_id = a.id) roleNum
FROM
......@@ -188,4 +189,50 @@
a.id = #{id}
</select>
<select id="querySysEveMenuISTopByThisId" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
b.id,
b.order_num orderNum,
a.order_num thisOrderNum
FROM
sys_eve_menu a,
sys_eve_menu b
WHERE
a.id = #{id}
AND b.menu_parent_id = a.menu_parent_id
AND a.order_num > b.order_num
ORDER BY b.order_num DESC LIMIT 1
</select>
<update id="editSysEveMenuSortTopById" parameterType="java.util.Map">
UPDATE sys_eve_menu
<set>
order_num = #{orderNum},
</set>
WHERE id = #{id}
</update>
<select id="querySysEveMenuISLowerByThisId" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
b.id,
b.order_num orderNum,
a.order_num thisOrderNum
FROM
sys_eve_menu a,
sys_eve_menu b
WHERE
a.id = #{id}
AND b.menu_parent_id = a.menu_parent_id
AND b.order_num > a.order_num
ORDER BY b.order_num DESC LIMIT 1
</select>
<update id="editSysEveMenuSortLowerById" parameterType="java.util.Map">
UPDATE sys_eve_menu
<set>
order_num = #{orderNum},
</set>
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
......@@ -128,6 +128,12 @@
</url>
<url id="sys021" path="/post/SysEveMenuController/querySysMenuLevelList" val="获取菜单级别列表" allUse="1">
</url>
<url id="sys022" path="/post/SysEveMenuController/editSysEveMenuSortTopById" val="菜单展示顺序上移" allUse="1">
<property id="rowId" name="id" ref="required" var="菜单ID" />
</url>
<url id="sys023" path="/post/SysEveMenuController/editSysEveMenuSortLowerById" val="菜单展示顺序下移" allUse="1">
<property id="rowId" name="id" ref="required" var="菜单ID" />
</url>
<url id="icon001" path="/post/SysEveIconController/querySysIconList" val="获取ICON列表" allUse="1">
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册