部门模块的 controller层
先要分析 企业的部门结构
分清企业部门的层级结构
董事会—》一级部门—》二级部门—》基层
部门模块 属于系统功能,要在system包 就是系统包的意思
进行开发
部门对象
private String id;
//部门名称
private String deptName;
//父类id
private String parentId;
//部门状况
private Integer state;
//父类
private Dept parent;
在一个部门中牵涉到的信息有
部门id、 String id
部门名称、String deptName
上级部门、String parentId
状态、Integer state 这主要用来做隐形的逻辑,显示部门的情况是:解散、合并、新建等。
Dept parent; 上级部门 在部门对象中存在自关联,用次对象做他的上级部门的成员变量名。
这里也要找到页面的代码看看部门对象的成员是否与页面的
数据列表中的数据 个数、名称 是否能对应得上
<!--数据列表-->
<table id="dataList" class="table table-bordered table-striped table-hover dataTable">
<thead>
<tr>
<th class="" style="padding-right:0px;">
<input type="checkbox" name="selid" onclick="checkAll('id',this)">
</th>
<th class="sorting">部门名称</th>
<th class="sorting">所属部门</th>
<th class="sorting">状态</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${page.list}" var="dept">
<tr>
<td><input type="checkbox" name="id" value="${dept.id }"/></td>
<td>${dept.deptName }</td>
<td>${dept.parent.deptName }</td>
<td>${dept.state ==0?'未启用':'使用中'}</td>
<th class="text-center">
<button type="button" class="btn bg-olive btn-xs" onclick='location.href="${ctx}/system/dept?operation=toEdit&id=${dept.id}"'>编辑</button>
</th>
</tr>
</c:forEach>
</tbody>
</table>
接下来 配置这个部门对象的映射文件,就是建立起对象成员变量名称与数据库的数据表列中的字段名,的关联关系。