上下级系统菜单 部门

BootStrap

关键点::bootStrap框架不用转换 ,options有个parentcode 它会自动转换

一。后台用get方法查出集合
@GetMapping("/list")
@ResponseBody
public List<SysMenu> list(SysMenu menu)
{
    List<SysMenu> menuList = menuService.selectMenuList(menu);
    return menuList;
}
二。前台
  1. table id=“bootstrap-tree-table”
  2. options有个code, parentCode, uniqueId
  3. $.treeTable.init(options);
  4. columns {
    field: ‘selectItem’,
    radio: true
    },
//body
<div class="col-sm-12 select-table table-striped">
    <table id="bootstrap-tree-table" data-mobile-responsive="true"></table>
</div>
//js
$(function() {
   var options = {
   	code: "deptId",
	parentCode: "parentId",
	uniqueId: "deptId",
        code: "deptId",
        parentCode: "parentId",
        expandAll: false,
        expandFirst: false,
        showSearch: false,
        showRefresh: false,
        showToggle: false,
        showColumns: false,
        url: prefix + "/list",
        modalName: "项目主管部门",
        columns: [
           {
              field: 'selectItem',
              radio: true
           },
           {
              field : 'deptId',
              title : '部门代码',
              formatter: function(value, row, index) {}
           }
        ]
   }
   $.treeTable.init(options);

EASYUI

关键点:实体有父级,子级,在dao双层查询设置子级

//body
<table id="dg" style="width:96%;height:630px"></table>
//js
$('#dg').treegrid({
    url:'findMenuTreeGrid',
    striped : true,// 斑马线效果
    animate:true,
    idField:'menuId',
    treeField:'menuName',
    pagination: true,
    singleSelect : true,
    pagination : true, //底部显示分页工具栏。
    rownumbers : true, //显示一个行号列。
    pageNumber : 1, //第几页显示(默认第一页,可以省略)
    pageSize : 10, //分页大小
    pageList : [10,20,30,40,50],//设置分页属性的时候 初始化页面大小选择列表。
    columns : [ [ {
       field : 'menuId',
       title : 'ID',
       width : 60,
       halign:'center'
    }, {
       field : 'menuName',
       title : '菜单名称',
       align : 'left',
       width : '200'
   }
   } ] ]
}
//dao接口
 List<MenuTreeDto> findMenuTreeGrid(MenuTreeDto menuTreeDto);// 菜单
//mapper.xml
<resultMap id="MenuTreeGridMap" type="com.jwcyzhpt.modules.sys.entity.dto.MenuTreeDto">
 	 <result column="MENU_PERMISSION" jdbcType="VARCHAR" property="menuPermission" />
 	 <result column="USER_ID" jdbcType="VARCHAR" property="userId" />
  	<collection property="children" fetchType="eager" 
   		ofType="com.jwcyzhpt.modules.sys.entity.dto.MenuTreeDto" column="MENU_ID"
    		select="findMenuTreeChild">
  	</collection>  
</resultMap>


<select id="findMenuTreeGrid" resultMap="MenuTreeGridMap" parameterType="sys.entity.dto.MenuTreeDto">
    select * from  from sn_menu 
    <where>
    	menu_parentid is null
    	<if test="menuUrl != null" >nd MENU_URL = #{menuUrl}/if>
    </where>
    order by menu_seq asc
</select>

<select id="findMenuTreeChild" resultMap="MenuTreeGridMap">
  select * from sn_menu where menu_parentid = #{menuId} rder by menu_seq asc
</select>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

飘然生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值