一、新增部门接口开发
1.1、DeptParam.java
1.2、LevelUtils.java
1.4.1、导入 commons-lang3 依赖包
1.2.2、实现LevelUtils开发
1.3、在 com.yuluomoshang.model.SysDept 中添加相关注解
1.4、SysDeptController.java
1.5、SysDeptService.java
二、部门层级树开发
2.1、DeptLevelDto
2.2、修改SysDeptMapper.java
2.3、修改SysDeptMapper.xml
2.4、DeptLevelDto.java
2.5、SysTreeService.java
2.6、修改SysDeptContrller.java
三、更新部门接口开发
3.1、修改SysDeptController.java
3.2、修改SysDeptService.java
3.3、修改SysDeptMapper.java
3.4、 修改SysDeptMapper.xml
<select id="getChildDeptListByLevel" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_dept
where level like #{level} || '.%' -- level like '0.%'
select>
<update id="batchUpdateLevel" parameterType="map">
<foreach collection="sysDeptList" item="dept" separator=";">
update sys_dept
set level = #{dept.level}
where id = #{dept.id}
foreach>
update>
<select id="countByNameAndParentId" parameterType="map" resultType="int">
select count(1)
from sys_dept
where name = #{name}
<if test="parentId != null">
and parent_id = #{parentId}
if>
<if test="id != null">
and id != #{id}
if>
select>
四、部门列表界面基本开发
4.1、修改SysDeptController.java
@RequestMapping("/page.page")
public ModelAndView page() {
return new ModelAndView("dept");
}
4.2、修改spring-servlet.xml
<mvc:resources location="/js/" mapping="/js/**" />
<mvc:resources location="/css/" mapping="/css/**" />
<mvc:resources location="/bootstrap3.3.5/" mapping="/bootstrap3.3.5/**" />
<mvc:resources location="/assets/" mapping="/assets/**" />
4.3、复制前端文件到webapp目录下
总之呢,项目就是这个样子的噻,其中省了一些代码,嘿嘿。