diff --git a/doc/new_intall_20180303.sql b/doc/new_intall_20180303.sql index 872664aba..4b26e4ef0 100644 --- a/doc/new_intall_20180303.sql +++ b/doc/new_intall_20180303.sql @@ -3,29 +3,28 @@ -- ---------------------------- drop table if exists sys_dept; create table sys_dept ( - dept_id int(11) not null auto_increment comment '部门ID', - parent_id int(11) default 0 comment '父部门ID', - dept_name varchar(30) default '' comment '部门名称', - order_num int(4) default null comment '显示顺序', - status int(1) default 0 comment '部门状态:0正常,1停用', + dept_id int(11) not null auto_increment comment '部门ID', + parent_id int(11) default 0 comment '父部门ID', + dept_name varchar(30) default '' comment '部门名称', + order_num int(4) default null comment '显示顺序', + status int(1) default 0 comment '部门状态:0正常,1停用', + create_time timestamp default current_timestamp comment '创建时间', primary key (dept_id) ) engine=innodb auto_increment=100 default charset=utf8; -- ---------------------------- -- 初始化-部门表数据 -- ---------------------------- -insert into sys_dept values('1', '0', '研发部门', '1', '0'); -insert into sys_dept values('2', '0', '测试部门', '2', '0'); -insert into sys_dept values('3', '0', '市场部门', '3', '0'); - -insert into sys_dept values('4', '1', '研发一部', '1', '0'); -insert into sys_dept values('5', '1', '研发二部', '2', '0'); -insert into sys_dept values('6', '1', '研发三部', '3', '0'); -insert into sys_dept values('7', '2', '测试一部', '1', '0'); -insert into sys_dept values('8', '2', '测试二部', '2', '0'); -insert into sys_dept values('9', '3', '市场一部', '1', '0'); -insert into sys_dept values('10', '3', '市场二部', '2', '0'); - +insert into sys_dept values(1, 0, '若依集团', 1, 0, '2018-03-01'); +insert into sys_dept values(2, 1, '研发部门', 2, 0, '2018-03-01'); +insert into sys_dept values(3, 1, '市场部门', 4, 0, '2018-03-01'); +insert into sys_dept values(4, 1, '测试部门', 3, 0, '2018-03-01'); +insert into sys_dept values(5, 1, '财务部门', 5, 1, '2018-03-01'); +insert into sys_dept values(6, 1, '运维部门', 6, 1, '2018-03-01'); +insert into sys_dept values(7, 2, '研发一部', 1, 0, '2018-03-01'); +insert into sys_dept values(8, 2, '研发二部', 2, 1, '2018-03-01'); +insert into sys_dept values(9, 3, '市场一部', 1, 0, '2018-03-01'); +insert into sys_dept values(10, 3, '市场二部', 2, 1, '2018-03-01'); -- ---------------------------- -- 2、用户信息表 @@ -49,8 +48,8 @@ create table sys_user ( -- ---------------------------- -- 初始化-用户信息表数据 -- ---------------------------- -insert into sys_user values('1', '1', 'admin', '若依', 'yzz_ivy@163.com', '15088888888', '172eee54aa664e9dd0536b063796e54e', '', 0, '维护中', '2018-03-01'); -insert into sys_user values('2', '1', 'ry', '若依', 'ry@163.com', '15288888888', '2f59d63eddd54f3977d6fe25aec8b2bc', '', 1, '锁定中', '2018-03-01'); +insert into sys_user values('1', '4', 'admin', '若依', 'yzz_ivy@163.com', '15088888888', '172eee54aa664e9dd0536b063796e54e', '', 0, '维护中', '2018-03-01'); +insert into sys_user values('2', '4', 'ry', '若依', 'ry@163.com', '15288888888', '2f59d63eddd54f3977d6fe25aec8b2bc', '', 1, '锁定中', '2018-03-01'); @@ -106,22 +105,27 @@ create table sys_menu ( insert into sys_menu values('1', '系统管理', '0', '1', '#', 'M', '0', '#', 'fa fa-gear', '2018-03-01', '', 'admin', '系统管理目录'); insert into sys_menu values('2', '系统监控', '0', '2', '#', 'M', '0', '#', 'fa fa-video-camera', '2018-03-01', '', 'admin', '系统监控目录'); -- 二级菜单 -insert into sys_menu values('3', '用户管理', '1', '1', '/system/user/userList', 'C', '0', 'system:user:view', '#', '2018-03-01', '', 'admin', '用户管理菜单'); -insert into sys_menu values('4', '角色管理', '1', '2', '/system/role/roleList', 'C', '0', 'system:role:view', '#', '2018-03-01', '', 'admin', '角色管理菜单'); -insert into sys_menu values('5', '菜单管理', '1', '3', '/system/menu/menuList', 'C', '0', 'system:menu:view', '#', '2018-03-01', '', 'admin', '菜单管理菜单'); -insert into sys_menu values('6', '部门管理', '1', '3', '/system/dept/deptList', 'C', '0', 'system:dept:view', '#', '2018-03-01', '', 'admin', '部门管理菜单'); -insert into sys_menu values('7', '操作日志', '2', '1', '/monitor/operlog', 'C', '0', 'monitor:operlog:view', '#', '2018-03-01', '', 'admin', '操作日志菜单'); -insert into sys_menu values('8', '登录日志', '2', '2', '/monitor/logininfor', 'C', '0', 'monitor:logininfor:view', '#', '2018-03-01', '', 'admin', '登录日志菜单'); -insert into sys_menu values('9', '在线用户', '2', '3', '/monitor/online', 'C', '0', 'monitor:online:view', '#', '2018-03-01', '', 'admin', '在线用户菜单'); -insert into sys_menu values('10', '数据监控', '2', '4', '/monitor/data', 'C', '0', 'monitor:data:xxxx', '#', '2018-03-01', '', 'admin', '数据监控菜单'); +insert into sys_menu values('3', '用户管理', '1', '1', '/system/user', 'C', '0', 'system:user:view', '#', '2018-03-01', '', 'admin', '用户管理菜单'); +insert into sys_menu values('4', '角色管理', '1', '2', '/system/role', 'C', '0', 'system:role:view', '#', '2018-03-01', '', 'admin', '角色管理菜单'); +insert into sys_menu values('5', '菜单管理', '1', '3', '/system/menu', 'C', '0', 'system:menu:view', '#', '2018-03-01', '', 'admin', '菜单管理菜单'); +insert into sys_menu values('6', '部门管理', '1', '3', '/system/dept', 'C', '0', 'system:dept:view', '#', '2018-03-01', '', 'admin', '部门管理菜单'); +insert into sys_menu values('7', '操作日志', '2', '1', '/monitor/operlog', 'C', '0', 'monitor:operlog:view', '#', '2018-03-01', '', 'admin', '操作日志菜单'); +insert into sys_menu values('8', '登录日志', '2', '2', '/monitor/logininfor', 'C', '0', 'monitor:logininfor:view', '#', '2018-03-01', '', 'admin', '登录日志菜单'); +insert into sys_menu values('9', '在线用户', '2', '3', '/monitor/online', 'C', '0', 'monitor:online:view', '#', '2018-03-01', '', 'admin', '在线用户菜单'); +insert into sys_menu values('10', '数据监控', '2', '4', '/monitor/data', 'C', '0', 'monitor:data:xxxx', '#', '2018-03-01', '', 'admin', '数据监控菜单'); +-- 部门管理按钮 +insert into sys_menu values('11', '部门新增', '6', '1', '/system/dept/add', 'F', '0', 'system:dept:add', '#', '2018-03-01', '', 'admin', ''); +insert into sys_menu values('12', '部门修改', '6', '2', '/system/dept/edit', 'F', '0', 'system:dept:edit', '#', '2018-03-01', '', 'admin', ''); +insert into sys_menu values('13', '部门删除', '6', '3', '/system/dept/remove', 'F', '0', 'system:dept:remove', '#', '2018-03-01', '', 'admin', ''); +insert into sys_menu values('14', '部门保存', '6', '4', '/system/dept/save', 'F', '0', 'system:dept:save', '#', '2018-03-01', '', 'admin', ''); -- 操作日志按钮 -insert into sys_menu values('11', '批量删除', '7', '1', '/monitor/operlog/batchRemove', 'F', '0', 'monitor:operlog:batchRemove', '#', '2018-03-01', '', 'admin', ''); -insert into sys_menu values('12', '详细信息', '7', '2', '/monitor/operlog/detail', 'F', '0', 'monitor:operlog:detail', '#', '2018-03-01', '', 'admin', ''); +insert into sys_menu values('15', '批量删除', '7', '1', '/monitor/operlog/batchRemove', 'F', '0', 'monitor:operlog:batchRemove', '#', '2018-03-01', '', 'admin', ''); +insert into sys_menu values('16', '详细信息', '7', '2', '/monitor/operlog/detail', 'F', '0', 'monitor:operlog:detail', '#', '2018-03-01', '', 'admin', ''); -- 登录日志按钮 -insert into sys_menu values('13', '批量删除', '8', '1', '/monitor/logininfor/batchRemove', 'F', '0', 'monitor:logininfor:batchRemove', '#', '2018-03-01', '', 'admin', ''); +insert into sys_menu values('17', '批量删除', '8', '1', '/monitor/logininfor/batchRemove', 'F', '0', 'monitor:logininfor:batchRemove', '#', '2018-03-01', '', 'admin', ''); -- 在线用户按钮 -insert into sys_menu values('14', '批量强退', '9', '1', '/monitor/online/batchForceLogout', 'F', '0', 'monitor:online:batchForceLogout', '#', '2018-03-01', '', 'admin', ''); -insert into sys_menu values('15', '单条强退', '9', '2', '/monitor/online/forceLogout', 'F', '0', 'monitor:online:forceLogout', '#', '2018-03-01', '', 'admin', ''); +insert into sys_menu values('18', '批量强退', '9', '1', '/monitor/online/batchForceLogout', 'F', '0', 'monitor:online:batchForceLogout', '#', '2018-03-01', '', 'admin', ''); +insert into sys_menu values('19', '单条强退', '9', '2', '/monitor/online/forceLogout', 'F', '0', 'monitor:online:forceLogout', '#', '2018-03-01', '', 'admin', ''); -- ---------------------------- -- 5、用户和角色关联表 用户N-1角色 @@ -169,7 +173,10 @@ insert into sys_role_menu values ('1', '12'); insert into sys_role_menu values ('1', '13'); insert into sys_role_menu values ('1', '14'); insert into sys_role_menu values ('1', '15'); - +insert into sys_role_menu values ('1', '16'); +insert into sys_role_menu values ('1', '17'); +insert into sys_role_menu values ('1', '18'); +insert into sys_role_menu values ('1', '19'); -- ---------------------------- -- 7、操作日志记录 -- ---------------------------- diff --git a/pom.xml b/pom.xml index d19893c92..987bb1090 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.ruoyi RuoYi - 1.0.1 + 1.0.2 jar RuoYi diff --git a/src/main/java/com/ruoyi/framework/web/dao/DynamicObjectBaseDao.java b/src/main/java/com/ruoyi/framework/web/dao/DynamicObjectBaseDao.java index cc3a2bfd9..8a4f75914 100644 --- a/src/main/java/com/ruoyi/framework/web/dao/DynamicObjectBaseDao.java +++ b/src/main/java/com/ruoyi/framework/web/dao/DynamicObjectBaseDao.java @@ -100,7 +100,7 @@ public class DynamicObjectBaseDao { return sqlSessionTemplate.delete(str, objs); } - + /** * 批量删除 根据数组 * @@ -140,6 +140,19 @@ public class DynamicObjectBaseDao return sqlSessionTemplate.selectOne(str, obj); } + /** + * 查找总数 + * + * @param str mapper 节点 + * @param obj 对象 + * @return 结果 + * @throws Exception + */ + public int count(String str, Object obj) + { + return sqlSessionTemplate.selectOne(str, obj); + } + /** * 查找对象 - 无条件 * diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java b/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java index ed59303a0..fb97abbe1 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java @@ -73,6 +73,6 @@ public class OperlogController extends BaseController { OperLog operLog = operLogService.selectOperLogById(deptId); model.addAttribute("operLog", operLog); - return prefix + "/view"; + return prefix + "/detail"; } } diff --git a/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java b/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java new file mode 100644 index 000000000..2368625b6 --- /dev/null +++ b/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java @@ -0,0 +1,116 @@ +package com.ruoyi.project.system.dept.controller; + +import java.util.List; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.ruoyi.framework.aspectj.lang.annotation.Log; +import com.ruoyi.framework.web.domain.JSON; +import com.ruoyi.project.system.dept.domain.Dept; +import com.ruoyi.project.system.dept.service.IDeptService; + +/** + * 部门信息 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/system/dept") +public class DeptController +{ + private String prefix = "system/dept"; + + @Autowired + private IDeptService deptService; + + @RequiresPermissions("system:dept:view") + @GetMapping() + public String dept() + { + return prefix + "/dept"; + } + + @RequiresPermissions("system:dept:view") + @GetMapping("/list") + @ResponseBody + public List list() + { + List deptList = deptService.selectDeptAll(); + return deptList; + } + + /** + * 修改 + */ + @Log(title = "系统管理", action = "部门管理-修改部门") + @RequiresPermissions("system:dept:edit") + @GetMapping("/edit/{deptId}") + public String edit(@PathVariable("deptId") Long deptId, Model model) + { + Dept dept = deptService.selectDeptById(deptId); + model.addAttribute("dept", dept); + return prefix + "/edit"; + } + + /** + * 新增 + */ + @Log(title = "系统管理", action = "部门管理-新增部门") + @RequiresPermissions("system:dept:add") + @GetMapping("/add/{parentId}") + public String add(@PathVariable("parentId") Long parentId, Model model) + { + Dept dept = deptService.selectDeptById(parentId); + model.addAttribute("dept", dept); + return prefix + "/add"; + } + + /** + * 保存 + */ + @Log(title = "系统管理", action = "部门管理-保存部门") + @RequiresPermissions("system:dept:save") + @PostMapping("/save") + @ResponseBody + public JSON save(Dept sysDept) + { + if (deptService.saveDept(sysDept) > 0) + { + return JSON.ok(); + } + return JSON.error(); + } + + /** + * 删除 + */ + @Log(title = "系统管理", action = "部门管理-删除部门") + @RequiresPermissions("system:dept:remove") + @GetMapping("/remove/{deptId}") + @ResponseBody + public JSON remove(@PathVariable("deptId") Long deptId) + { + if (deptService.selectDeptCount(deptId) > 0) + { + return JSON.error(1, "存在下级部门,不允许删除"); + } + + if (deptService.checkDeptExistUser(deptId)) + { + return JSON.error(1, "部门存在用户,不允许删除"); + } + if (deptService.deleteDeptById(deptId) > 0) + { + return JSON.ok(); + } + return JSON.error(); + } +} diff --git a/src/main/java/com/ruoyi/project/system/dept/dao/DeptDaoImpl.java b/src/main/java/com/ruoyi/project/system/dept/dao/DeptDaoImpl.java new file mode 100644 index 000000000..6f8993e66 --- /dev/null +++ b/src/main/java/com/ruoyi/project/system/dept/dao/DeptDaoImpl.java @@ -0,0 +1,99 @@ +package com.ruoyi.project.system.dept.dao; + +import java.util.List; +import org.springframework.stereotype.Repository; +import com.ruoyi.framework.web.dao.DynamicObjectBaseDao; +import com.ruoyi.project.system.dept.domain.Dept; + +/** + * 部门管理 数据实现层 + * + * @author ruoyi + */ +@Repository("deptDao") +public class DeptDaoImpl extends DynamicObjectBaseDao implements IDeptDao +{ + /** + * 新增部门管理 + * + * @param dept 部门对象 + */ + public int insertDept(Dept dept) + { + return this.save("SystemDeptMapper.insertDept", dept); + } + + /** + * 查询部门管理集合 + * + * @return 所有部门信息 + */ + public List selectDeptAll() + { + List deptList = null; + try + { + deptList = this.findForList("SystemDeptMapper.selectDeptAll"); + } + catch (Exception e) + { + e.printStackTrace(); + } + return deptList; + } + + /** + * 查询部门人数 + * + * @param parentId 部门ID + * @return 结果 + */ + public int selectDeptCount(Dept dept) + { + return this.count("SystemDeptMapper.selectDeptCount", dept); + } + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 + */ + public int checkDeptExistUser(Long deptId) + { + return this.count("SystemDeptMapper.checkDeptExistUser", deptId); + } + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId) + { + return this.delete("SystemDeptMapper.deleteDeptById", deptId); + } + + /** + * 保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int saveDept(Dept dept) + { + return this.save("SystemDeptMapper.saveDept", dept); + } + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + public Dept selectDeptById(Long deptId) + { + return this.findForObject("SystemDeptMapper.selectDeptById", deptId); + } +} diff --git a/src/main/java/com/ruoyi/project/system/dept/dao/IDeptDao.java b/src/main/java/com/ruoyi/project/system/dept/dao/IDeptDao.java new file mode 100644 index 000000000..be3368e0c --- /dev/null +++ b/src/main/java/com/ruoyi/project/system/dept/dao/IDeptDao.java @@ -0,0 +1,66 @@ +package com.ruoyi.project.system.dept.dao; + +import java.util.List; +import com.ruoyi.project.system.dept.domain.Dept; + +/** + * 部门管理 数据层 + * + * @author ruoyi + */ +public interface IDeptDao +{ + /** + * 新增部门管理 + * + * @param dept 部门对象 + */ + public int insertDept(Dept dept); + + /** + * 查询部门人数 + * + * @param parentId 部门ID + * @return 结果 + */ + public int selectDeptCount(Dept dept); + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 + */ + public int checkDeptExistUser(Long deptId); + + /** + * 查询部门管理集合 + * + * @return 所有部门信息 + */ + public List selectDeptAll(); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId); + + /** + * 保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int saveDept(Dept dept); + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + public Dept selectDeptById(Long deptId); +} diff --git a/src/main/java/com/ruoyi/project/system/dept/domain/Dept.java b/src/main/java/com/ruoyi/project/system/dept/domain/Dept.java index f1e889f50..b52bfd8b2 100644 --- a/src/main/java/com/ruoyi/project/system/dept/domain/Dept.java +++ b/src/main/java/com/ruoyi/project/system/dept/domain/Dept.java @@ -19,6 +19,8 @@ public class Dept /** 显示顺序 */ private String orderNum; /** 部门状态:0正常,1停用 */ - private String status; + private int status; + /** 父部门名称 */ + private String parentName; } diff --git a/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java b/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java new file mode 100644 index 000000000..c06bfddb7 --- /dev/null +++ b/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java @@ -0,0 +1,99 @@ +package com.ruoyi.project.system.dept.service; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import com.ruoyi.project.system.dept.dao.IDeptDao; +import com.ruoyi.project.system.dept.domain.Dept; + +/** + * 部门管理 服务实现 + * + * @author ruoyi + */ +@Repository("deptService") +public class DeptServiceImpl implements IDeptService +{ + @Autowired + private IDeptDao deptDao; + + /** + * 新增部门管理 + * + * @param dept 部门对象 + */ + public int insertDept(Dept dept) + { + return deptDao.insertDept(dept); + } + + /** + * 查询部门管理集合 + * + * @return 所有部门信息 + */ + public List selectDeptAll() + { + return deptDao.selectDeptAll(); + } + + /** + * 查询部门人数 + * + * @param parentId 部门ID + * @return 结果 + */ + public int selectDeptCount(Long parentId) + { + Dept dept = new Dept(); + dept.setParentId(parentId); + return deptDao.selectDeptCount(dept); + } + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkDeptExistUser(Long deptId) + { + int result = deptDao.checkDeptExistUser(deptId); + return result > 0 ? true : false; + } + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId) + { + return deptDao.deleteDeptById(deptId); + } + + /** + * 保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int saveDept(Dept dept) + { + return deptDao.saveDept(dept); + } + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + public Dept selectDeptById(Long deptId) + { + return deptDao.selectDeptById(deptId); + } +} diff --git a/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java b/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java new file mode 100644 index 000000000..f4c521007 --- /dev/null +++ b/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java @@ -0,0 +1,66 @@ +package com.ruoyi.project.system.dept.service; + +import java.util.List; +import com.ruoyi.project.system.dept.domain.Dept; + +/** + * 部门管理 服务层 + * + * @author ruoyi + */ +public interface IDeptService +{ + /** + * 新增部门管理 + * + * @param dept 部门对象 + */ + public int insertDept(Dept dept); + + /** + * 查询部门管理集合 + * + * @return 所有部门信息 + */ + public List selectDeptAll(); + + /** + * 查询部门人数 + * + * @param parentId 父部门ID + * @return 结果 + */ + public int selectDeptCount(Long parentId); + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkDeptExistUser(Long deptId); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId); + + /** + * 保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int saveDept(Dept dept); + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + public Dept selectDeptById(Long deptId); +} diff --git a/src/main/resources/mybatis/system/SystemDeptMapper.xml b/src/main/resources/mybatis/system/SystemDeptMapper.xml new file mode 100644 index 000000000..b2db7b7b7 --- /dev/null +++ b/src/main/resources/mybatis/system/SystemDeptMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + replace into sys_dept(dept_id, parent_id, dept_name, order_num, status) + values (#{deptId}, #{parentId}, #{deptName}, #{orderNum}, #{status}) + + + + delete from sys_dept where dept_id = #{deptId} + + + \ No newline at end of file diff --git a/src/main/resources/static/ajax/libs/bootstrap-table/page/bootstrap-page.js b/src/main/resources/static/ajax/libs/bootstrap-table/page/bootstrap-page.js index 7c2e1fb6d..e7565a442 100644 --- a/src/main/resources/static/ajax/libs/bootstrap-table/page/bootstrap-page.js +++ b/src/main/resources/static/ajax/libs/bootstrap-table/page/bootstrap-page.js @@ -37,6 +37,23 @@ function initTable(_columns, _url) { }); } +//初始化表格树 +function initTreeTable(_id, _parentId, _columns, _url) { + $('.bootstrap-table').bootstrapTreeTable({ + code : _id, // 用于设置父子关系 + parentCode : _parentId, // 用于设置父子关系 + type: 'get', // 请求方式(*) + url: _url, // 请求后台的URL(*) + ajaxParams : {}, // 请求数据的ajax的data属性 + expandColumn : '1', // 在哪一列上面显示展开按钮 + striped : false, // 是否各行渐变色 + bordered : true, // 是否显示边框 + expandAll : false, // 是否全部展开 + showRefresh: true, // 是否显示刷新按钮 + columns: _columns + }); +} + // 刷新 function refresh() { $('.bootstrap-table').bootstrapTable('refresh'); diff --git a/src/main/resources/static/ruoyi/system/dept/add.js b/src/main/resources/static/ruoyi/system/dept/add.js new file mode 100644 index 000000000..4c8264ac5 --- /dev/null +++ b/src/main/resources/static/ruoyi/system/dept/add.js @@ -0,0 +1,45 @@ +$("#form-dept-add").validate({ + rules:{ + deptName:{ + required:true, + }, + orderNum:{ + required:true, + }, + }, + submitHandler:function(form){ + update(); + } +}); + +function update() { + var parentId = $("input[name='parentId']").val(); + var orderNum = $("input[name='orderNum']").val(); + var deptName = $("input[name='deptName']").val(); + var status = $("input[name='status']").is(':checked') == true ? 0 : 1; + $.ajax({ + cache : true, + type : "POST", + url : "/system/dept/save", + data : { + "parentId": parentId, + "deptName": deptName, + "orderNum": orderNum, + "status": status + }, + async : false, + error : function(request) { + parent.layer.alert("系统错误"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg('新增成功',{icon:1,time:1000}); + layer_close(); + parent.loading(); + } else { + parent.layer.alert(data.m , {icon: 2,title:"系统提示"}); + } + + } + }); +} \ No newline at end of file diff --git a/src/main/resources/static/ruoyi/system/dept/dept.js b/src/main/resources/static/ruoyi/system/dept/dept.js new file mode 100644 index 000000000..1410eebf7 --- /dev/null +++ b/src/main/resources/static/ruoyi/system/dept/dept.js @@ -0,0 +1,82 @@ +var prefix = "/system/dept" + +window.onload = function() { + loading(); +}; + +function loading() { + var columns = [{ + title : '部门编号', + field : 'deptId', + visible : false, + align : 'center', + valign : 'middle', + width : '10%' + }, + { + field : 'deptName', + title : '部门名称' + }, + { + field : 'orderNum', + title : '排序' + }, + { + field : 'status', + title : '状态', + align : 'center', + formatter : function(item, index) { + if (item.status == '0') { + return '正常'; + } else if (item.status == '1') { + return '禁用'; + } + } + }, + { + title : '操作', + align : 'center', + formatter : function(row, index) { + if(row.parentId != 0) { + var edit = ' '; + var add = ' '; + var del = ' '; + return edit + add + del; + } else { + return ""; + } + } + }]; + var url = prefix + "/list"; + initTreeTable('deptId', 'parentId', columns, url); +} + +/*部门管理-新增*/ +function add(deptId) { + var url = prefix + '/add/' + deptId; + layer_show("新增部门管理", url, '800', '500'); +} + +/*部门管理-修改*/ +function edit(deptId) { + var url = prefix + '/edit/' + deptId; + layer_show("修改部门管理", url, '800', '400'); +} + +/*部门管理-删除*/ +function remove(deptId) { + layer.confirm("确定要删除部门吗?",{icon: 3, title:'提示'},function(index){ + $.ajax({ + type : 'get', + url: prefix + "/remove/" + deptId, + success : function(r) { + if (r.code == 0) { + layer.msg(r.msg, { icon: 1, time: 1000 }); + loading(); + } else { + layer.alert(r.msg, { icon: 2, title: "系统提示" }); + } + } + }); + }); +} diff --git a/src/main/resources/static/ruoyi/system/dept/edit.js b/src/main/resources/static/ruoyi/system/dept/edit.js new file mode 100644 index 000000000..34d664d10 --- /dev/null +++ b/src/main/resources/static/ruoyi/system/dept/edit.js @@ -0,0 +1,47 @@ +$("#form-dept-edit").validate({ + rules:{ + deptName:{ + required:true, + }, + orderNum:{ + required:true, + }, + }, + submitHandler:function(form){ + update(); + } +}); + +function update() { + var deptId = $("input[name='deptId']").val(); + var parentId = $("input[name='parentId']").val(); + var orderNum = $("input[name='orderNum']").val(); + var deptName = $("input[name='deptName']").val(); + var status = $("input[name='status']").is(':checked') == true ? 0 : 1; + $.ajax({ + cache : true, + type : "POST", + url : "/system/dept/save", + data : { + "deptId": deptId, + "parentId": parentId, + "deptName": deptName, + "orderNum": orderNum, + "status": status + }, + async : false, + error : function(request) { + parent.layer.alert("系统错误"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg('修改成功',{icon:1,time:1000}); + layer_close(); + parent.loading(); + } else { + parent.layer.alert(data.m , {icon: 2,title:"系统提示"}); + } + + } + }); +} \ No newline at end of file diff --git a/src/main/resources/templates/main.html b/src/main/resources/templates/main.html index d687e4c57..5c2f5ae90 100644 --- a/src/main/resources/templates/main.html +++ b/src/main/resources/templates/main.html @@ -35,7 +35,7 @@

若依后台管理框架

一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了若依管理系统。,她可以用于所有的Web应用程序,如网站管理后台网站会员中心CMSCRMOA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错效率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。

- 当前版本:v1.0.1 + 当前版本:v1.0.2

¥免费开源 @@ -94,13 +94,27 @@

+
+
+
+ v1.0.22018.03.04 +
+
+
+
+
    +
  1. 新增部门管理 (新增、删除、修改、查询)
  2. +
+
+
+
- v1.0.12018.03.03 + v1.0.12018.03.03
-
+
  1. 新增在线用户 (批量强退、单条强退、查询)
  2. @@ -114,10 +128,10 @@

    - v1.0.02018.03.01 + v1.0.02018.03.01

    -
    +
    1. 若依管理系统正式发布。
    2. diff --git a/src/main/resources/templates/monitor/operlog/view.html b/src/main/resources/templates/monitor/operlog/detail.html similarity index 93% rename from src/main/resources/templates/monitor/operlog/view.html rename to src/main/resources/templates/monitor/operlog/detail.html index 992da7784..b1f08d0c6 100644 --- a/src/main/resources/templates/monitor/operlog/view.html +++ b/src/main/resources/templates/monitor/operlog/detail.html @@ -43,7 +43,7 @@
    - +
    diff --git a/src/main/resources/templates/system/dept/add.html b/src/main/resources/templates/system/dept/add.html new file mode 100644 index 000000000..8c6d5164a --- /dev/null +++ b/src/main/resources/templates/system/dept/add.html @@ -0,0 +1,51 @@ + + + + + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + + + diff --git a/src/main/resources/templates/system/dept/dept.html b/src/main/resources/templates/system/dept/dept.html new file mode 100644 index 000000000..b3a689ca6 --- /dev/null +++ b/src/main/resources/templates/system/dept/dept.html @@ -0,0 +1,13 @@ + + + + + +
    + +
    +
    +
    + + + \ No newline at end of file diff --git a/src/main/resources/templates/system/dept/edit.html b/src/main/resources/templates/system/dept/edit.html new file mode 100644 index 000000000..44924bf46 --- /dev/null +++ b/src/main/resources/templates/system/dept/edit.html @@ -0,0 +1,52 @@ + + + + + +
    +
    + + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + + +