增加课程分类和课件分类
This commit is contained in:
parent
66d701c5cb
commit
841eab3436
2
pom.xml
2
pom.xml
|
|
@ -47,6 +47,8 @@
|
||||||
<module>ruoyi-generator</module>
|
<module>ruoyi-generator</module>
|
||||||
<module>ruoyi-common</module>
|
<module>ruoyi-common</module>
|
||||||
<module>ruoyi-exam</module>
|
<module>ruoyi-exam</module>
|
||||||
|
<module>ruoyi-vip</module>
|
||||||
|
<module>ruoyi-train</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- spring-boot-devtools -->
|
<!-- spring-boot-devtools -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- swagger2-->
|
<!-- swagger2-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
@ -57,6 +57,12 @@
|
||||||
<artifactId>ruoyi-vip</artifactId>
|
<artifactId>ruoyi-vip</artifactId>
|
||||||
<version>${ruoyi.version}</version>
|
<version>${ruoyi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 培训系统-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-train</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
<!-- 测试生成的代码-->
|
<!-- 测试生成的代码-->
|
||||||
<!--<dependency>-->
|
<!--<dependency>-->
|
||||||
<!--<groupId>com.ruoyi</groupId>-->
|
<!--<groupId>com.ruoyi</groupId>-->
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,152 @@
|
||||||
|
package com.ruoyi.course.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.course.domain.TrainCourseCategory;
|
||||||
|
import com.ruoyi.course.service.ITrainCourseCategoryService;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/train/course/category")
|
||||||
|
public class TrainCourseCategoryController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "course/category";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ITrainCourseCategoryService trainCourseCategoryService;
|
||||||
|
|
||||||
|
@RequiresPermissions("train:course:category:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String dept()
|
||||||
|
{
|
||||||
|
return prefix + "/dept";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("train:course:category:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public List<TrainCourseCategory> list(TrainCourseCategory dept)
|
||||||
|
{
|
||||||
|
List<TrainCourseCategory> deptList = trainCourseCategoryService.selectDeptList(dept);
|
||||||
|
return deptList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增部门
|
||||||
|
*/
|
||||||
|
@GetMapping("/add/{parentId}")
|
||||||
|
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dept", trainCourseCategoryService.selectDeptById(parentId));
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存部门
|
||||||
|
*/
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
|
@RequiresPermissions("train:course:category:add")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(TrainCourseCategory dept)
|
||||||
|
{
|
||||||
|
dept.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(trainCourseCategoryService.insertDept(dept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{deptId}")
|
||||||
|
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
TrainCourseCategory dept = trainCourseCategoryService.selectDeptById(deptId);
|
||||||
|
if (StringUtils.isNotNull(dept) && 100L == deptId)
|
||||||
|
{
|
||||||
|
dept.setParentName("无");
|
||||||
|
}
|
||||||
|
mmap.put("dept", dept);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*/
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
|
@RequiresPermissions("train:course:category:edit")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(TrainCourseCategory dept)
|
||||||
|
{
|
||||||
|
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
return toAjax(trainCourseCategoryService.updateDept(dept));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions("train:course:category:remove")
|
||||||
|
@PostMapping("/remove/{deptId}")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(@PathVariable("deptId") Long deptId)
|
||||||
|
{
|
||||||
|
if (trainCourseCategoryService.selectDeptCount(deptId) > 0)
|
||||||
|
{
|
||||||
|
return error(1, "存在下级部门,不允许删除");
|
||||||
|
}
|
||||||
|
if (trainCourseCategoryService.checkDeptExistUser(deptId))
|
||||||
|
{
|
||||||
|
return error(1, "部门存在用户,不允许删除");
|
||||||
|
}
|
||||||
|
return toAjax(trainCourseCategoryService.deleteDeptById(deptId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验部门名称
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkDeptNameUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkDeptNameUnique(TrainCourseCategory dept)
|
||||||
|
{
|
||||||
|
return trainCourseCategoryService.checkDeptNameUnique(dept);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择部门树
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectDeptTree/{deptId}")
|
||||||
|
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||||
|
{
|
||||||
|
mmap.put("dept", trainCourseCategoryService.selectDeptById(deptId));
|
||||||
|
return prefix + "/tree";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载部门列表树
|
||||||
|
*/
|
||||||
|
@GetMapping("/treeData")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Map<String, Object>> treeData()
|
||||||
|
{
|
||||||
|
List<Map<String, Object>> tree = trainCourseCategoryService.selectDeptTree();
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,132 @@
|
||||||
|
package com.ruoyi.course.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.base.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门表 sys_dept
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class TrainCourseCategory extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 分类ID */
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 部门
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
|
/** 父部门ID */
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/** 祖级列表 */
|
||||||
|
private String parentIds;
|
||||||
|
|
||||||
|
/** 部门名称 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 显示顺序 */
|
||||||
|
private String orderNum;
|
||||||
|
|
||||||
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
/** 父部门名称 */
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDeptId() {
|
||||||
|
return deptId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptId(Long deptId) {
|
||||||
|
this.deptId = deptId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getParentId()
|
||||||
|
{
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentId(Long parentId)
|
||||||
|
{
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentIds() {
|
||||||
|
return parentIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentIds(String parentIds) {
|
||||||
|
this.parentIds = parentIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderNum()
|
||||||
|
{
|
||||||
|
return orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderNum(String orderNum)
|
||||||
|
{
|
||||||
|
this.orderNum = orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getDelFlag()
|
||||||
|
{
|
||||||
|
return delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDelFlag(String delFlag)
|
||||||
|
{
|
||||||
|
this.delFlag = delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentName()
|
||||||
|
{
|
||||||
|
return parentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentName(String parentName)
|
||||||
|
{
|
||||||
|
this.parentName = parentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("deptId", getDeptId())
|
||||||
|
.append("parentId", getParentId())
|
||||||
|
.append("ancestors", getParentIds())
|
||||||
|
.append("deptName", getName())
|
||||||
|
.append("orderNum", getOrderNum())
|
||||||
|
.append("delFlag", getDelFlag())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
package com.ruoyi.course.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.course.domain.TrainCourseCategory;
|
||||||
|
import com.ruoyi.framework.web.base.MyMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门管理 数据层
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public interface TrainCourseCategoryMapper extends MyMapper<TrainCourseCategory>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询部门人数
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int selectDeptCount(TrainCourseCategory dept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门是否存在用户
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int checkDeptExistUser(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门管理数据
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 部门信息集合
|
||||||
|
*/
|
||||||
|
public List<TrainCourseCategory> selectDeptList(TrainCourseCategory dept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除部门管理信息
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDeptById(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增部门信息
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDept(TrainCourseCategory dept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改部门信息
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDept(TrainCourseCategory dept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改子元素关系
|
||||||
|
*
|
||||||
|
* @param depts 子元素
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDeptChildren(@Param("depts") List<TrainCourseCategory> depts);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门ID查询信息
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 部门信息
|
||||||
|
*/
|
||||||
|
public TrainCourseCategory selectDeptById(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验部门名称是否唯一
|
||||||
|
*
|
||||||
|
* @param deptName 部门名称
|
||||||
|
* @param parentId 父部门ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public TrainCourseCategory checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色ID查询部门
|
||||||
|
*
|
||||||
|
* @param roleId 角色ID
|
||||||
|
* @return 部门列表
|
||||||
|
*/
|
||||||
|
public List<String> selectRoleDeptTree(Long roleId);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.ruoyi.course.service;
|
||||||
|
|
||||||
|
import com.ruoyi.course.domain.TrainCourseCategory;
|
||||||
|
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门管理 服务层
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public interface ITrainCourseCategoryService extends AbstractBaseService<TrainCourseCategory>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询部门管理数据
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 部门信息集合
|
||||||
|
*/
|
||||||
|
public List<TrainCourseCategory> selectDeptList(TrainCourseCategory dept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门管理树
|
||||||
|
*
|
||||||
|
* @return 所有部门信息
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> selectDeptTree();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门人数
|
||||||
|
*
|
||||||
|
* @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 insertDept(TrainCourseCategory dept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存部门信息
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDept(TrainCourseCategory dept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门ID查询信息
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 部门信息
|
||||||
|
*/
|
||||||
|
public TrainCourseCategory selectDeptById(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验部门名称是否唯一
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public String checkDeptNameUnique(TrainCourseCategory dept);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,191 @@
|
||||||
|
package com.ruoyi.course.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.course.domain.TrainCourseCategory;
|
||||||
|
import com.ruoyi.course.mapper.TrainCourseCategoryMapper;
|
||||||
|
import com.ruoyi.course.service.ITrainCourseCategoryService;
|
||||||
|
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门管理 服务实现
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<TrainCourseCategoryMapper, TrainCourseCategory> implements ITrainCourseCategoryService {
|
||||||
|
@Autowired
|
||||||
|
private TrainCourseCategoryMapper trainCourseCategoryMapper;
|
||||||
|
/**
|
||||||
|
* 查询部门管理数据
|
||||||
|
*
|
||||||
|
* @return 部门信息集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@DataScope(tableAlias = "d")
|
||||||
|
public List<TrainCourseCategory> selectDeptList(TrainCourseCategory dept) {
|
||||||
|
return trainCourseCategoryMapper.selectDeptList( dept );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门管理树
|
||||||
|
*
|
||||||
|
* @return 所有部门信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> selectDeptTree() {
|
||||||
|
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
||||||
|
List<TrainCourseCategory> deptList = selectDeptList( new TrainCourseCategory() );
|
||||||
|
trees = getTrees( deptList, false, null );
|
||||||
|
return trees;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象转部门树
|
||||||
|
*
|
||||||
|
* @param deptList 部门列表
|
||||||
|
* @param isCheck 是否需要选中
|
||||||
|
* @param roleDeptList 角色已存在菜单列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getTrees(List<TrainCourseCategory> deptList, boolean isCheck, List<String> roleDeptList) {
|
||||||
|
|
||||||
|
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
||||||
|
for (TrainCourseCategory dept : deptList) {
|
||||||
|
if (UserConstants.DEPT_NORMAL.equals( dept.getDelFlag() )) {
|
||||||
|
Map<String, Object> deptMap = new HashMap<String, Object>();
|
||||||
|
deptMap.put( "id", dept.getId() );
|
||||||
|
deptMap.put( "pId", dept.getParentId() );
|
||||||
|
deptMap.put( "name", dept.getName() );
|
||||||
|
deptMap.put( "title", dept.getName() );
|
||||||
|
if (isCheck) {
|
||||||
|
deptMap.put( "checked", roleDeptList.contains( dept.getDeptId() + dept.getName() ) );
|
||||||
|
} else {
|
||||||
|
deptMap.put( "checked", false );
|
||||||
|
}
|
||||||
|
trees.add( deptMap );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return trees;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门人数
|
||||||
|
*
|
||||||
|
* @param parentId 部门ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int selectDeptCount(Long parentId) {
|
||||||
|
TrainCourseCategory dept = new TrainCourseCategory();
|
||||||
|
dept.setParentId( parentId );
|
||||||
|
return trainCourseCategoryMapper.selectDeptCount( dept );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门是否存在用户
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 结果 true 存在 false 不存在
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean checkDeptExistUser(Long deptId) {
|
||||||
|
int result = trainCourseCategoryMapper.checkDeptExistUser( deptId );
|
||||||
|
return result > 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除部门管理信息
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDeptById(Long deptId) {
|
||||||
|
return trainCourseCategoryMapper.deleteDeptById( deptId );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存部门信息
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertDept(TrainCourseCategory dept) {
|
||||||
|
TrainCourseCategory info = trainCourseCategoryMapper.selectDeptById( dept.getParentId() );
|
||||||
|
dept.setParentIds( info.getParentIds() + "," + dept.getParentId() );
|
||||||
|
return trainCourseCategoryMapper.insertDept( dept );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存部门信息
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateDept(TrainCourseCategory dept) {
|
||||||
|
TrainCourseCategory info = trainCourseCategoryMapper.selectDeptById( dept.getParentId() );
|
||||||
|
if (StringUtils.isNotNull( info )) {
|
||||||
|
String ancestors = info.getParentIds() + "," + dept.getParentId();
|
||||||
|
dept.setParentIds( ancestors );
|
||||||
|
updateDeptChildren( dept.getDeptId(), ancestors );
|
||||||
|
}
|
||||||
|
return trainCourseCategoryMapper.updateDept( dept );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改子元素关系
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @param ancestors 元素列表
|
||||||
|
*/
|
||||||
|
public void updateDeptChildren(Long deptId, String ancestors) {
|
||||||
|
TrainCourseCategory dept = new TrainCourseCategory();
|
||||||
|
dept.setParentId( deptId );
|
||||||
|
List<TrainCourseCategory> childrens = trainCourseCategoryMapper.selectDeptList( dept );
|
||||||
|
for (TrainCourseCategory children : childrens) {
|
||||||
|
children.setParentIds( ancestors + "," + dept.getParentId() );
|
||||||
|
}
|
||||||
|
if (childrens.size() > 0) {
|
||||||
|
trainCourseCategoryMapper.updateDeptChildren( childrens );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门ID查询信息
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 部门信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TrainCourseCategory selectDeptById(Long deptId) {
|
||||||
|
return trainCourseCategoryMapper.selectDeptById( deptId );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验部门名称是否唯一
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String checkDeptNameUnique(TrainCourseCategory dept) {
|
||||||
|
Long deptId = StringUtils.isNull( dept.getDeptId() ) ? -1L : dept.getDeptId();
|
||||||
|
TrainCourseCategory info = trainCourseCategoryMapper.checkDeptNameUnique( dept.getName(), dept.getParentId() );
|
||||||
|
if (StringUtils.isNotNull( info ) && info.getDeptId().longValue() != deptId.longValue()) {
|
||||||
|
return UserConstants.DEPT_NAME_NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.DEPT_NAME_UNIQUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -31,14 +31,14 @@ public class TrainCoursewareCategoryController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private ITrainCoursewareCategoryService trainCoursewareCategoryService;
|
private ITrainCoursewareCategoryService trainCoursewareCategoryService;
|
||||||
|
|
||||||
@RequiresPermissions("vip:dept:view")
|
@RequiresPermissions("train:courseware:category:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String dept()
|
public String dept()
|
||||||
{
|
{
|
||||||
return prefix + "/dept";
|
return prefix + "/dept";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("vip:dept:list")
|
@RequiresPermissions("train:courseware:category:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<TrainCoursewareCategory> list(TrainCoursewareCategory dept)
|
public List<TrainCoursewareCategory> list(TrainCoursewareCategory dept)
|
||||||
|
|
@ -61,7 +61,7 @@ public class TrainCoursewareCategoryController extends BaseController
|
||||||
* 新增保存部门
|
* 新增保存部门
|
||||||
*/
|
*/
|
||||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
@RequiresPermissions("vip:dept:add")
|
@RequiresPermissions("train:courseware:category:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(TrainCoursewareCategory dept)
|
public AjaxResult addSave(TrainCoursewareCategory dept)
|
||||||
|
|
@ -89,7 +89,7 @@ public class TrainCoursewareCategoryController extends BaseController
|
||||||
* 保存
|
* 保存
|
||||||
*/
|
*/
|
||||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
@RequiresPermissions("vip:dept:edit")
|
@RequiresPermissions("train:courseware:category:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(TrainCoursewareCategory dept)
|
public AjaxResult editSave(TrainCoursewareCategory dept)
|
||||||
|
|
@ -102,7 +102,7 @@ public class TrainCoursewareCategoryController extends BaseController
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
@RequiresPermissions("vip:dept:remove")
|
@RequiresPermissions("train:courseware:category:remove")
|
||||||
@PostMapping("/remove/{deptId}")
|
@PostMapping("/remove/{deptId}")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(@PathVariable("deptId") Long deptId)
|
public AjaxResult remove(@PathVariable("deptId") Long deptId)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ public class TrainCoursewareCategory extends BaseEntity
|
||||||
private String parentIds;
|
private String parentIds;
|
||||||
|
|
||||||
/** 部门名称 */
|
/** 部门名称 */
|
||||||
private String deptName;
|
private String name;
|
||||||
|
|
||||||
/** 显示顺序 */
|
/** 显示顺序 */
|
||||||
private String orderNum;
|
private String orderNum;
|
||||||
|
|
@ -74,14 +74,12 @@ public class TrainCoursewareCategory extends BaseEntity
|
||||||
this.parentIds = parentIds;
|
this.parentIds = parentIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeptName()
|
public String getName() {
|
||||||
{
|
return name;
|
||||||
return deptName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeptName(String deptName)
|
public void setName(String name) {
|
||||||
{
|
this.name = name;
|
||||||
this.deptName = deptName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOrderNum()
|
public String getOrderNum()
|
||||||
|
|
@ -122,7 +120,7 @@ public class TrainCoursewareCategory extends BaseEntity
|
||||||
.append("deptId", getDeptId())
|
.append("deptId", getDeptId())
|
||||||
.append("parentId", getParentId())
|
.append("parentId", getParentId())
|
||||||
.append("ancestors", getParentIds())
|
.append("ancestors", getParentIds())
|
||||||
.append("deptName", getDeptName())
|
.append("deptName", getName())
|
||||||
.append("orderNum", getOrderNum())
|
.append("orderNum", getOrderNum())
|
||||||
.append("delFlag", getDelFlag())
|
.append("delFlag", getDelFlag())
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,12 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
||||||
for (TrainCoursewareCategory dept : deptList) {
|
for (TrainCoursewareCategory dept : deptList) {
|
||||||
if (UserConstants.DEPT_NORMAL.equals( dept.getDelFlag() )) {
|
if (UserConstants.DEPT_NORMAL.equals( dept.getDelFlag() )) {
|
||||||
Map<String, Object> deptMap = new HashMap<String, Object>();
|
Map<String, Object> deptMap = new HashMap<String, Object>();
|
||||||
deptMap.put( "id", dept.getDeptId() );
|
deptMap.put( "id", dept.getId() );
|
||||||
deptMap.put( "pId", dept.getParentId() );
|
deptMap.put( "pId", dept.getParentId() );
|
||||||
deptMap.put( "name", dept.getDeptName() );
|
deptMap.put( "name", dept.getName() );
|
||||||
deptMap.put( "title", dept.getDeptName() );
|
deptMap.put( "title", dept.getName() );
|
||||||
if (isCheck) {
|
if (isCheck) {
|
||||||
deptMap.put( "checked", roleDeptList.contains( dept.getDeptId() + dept.getDeptName() ) );
|
deptMap.put( "checked", roleDeptList.contains( dept.getDeptId() + dept.getName() ) );
|
||||||
} else {
|
} else {
|
||||||
deptMap.put( "checked", false );
|
deptMap.put( "checked", false );
|
||||||
}
|
}
|
||||||
|
|
@ -182,7 +182,7 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
|
||||||
@Override
|
@Override
|
||||||
public String checkDeptNameUnique(TrainCoursewareCategory dept) {
|
public String checkDeptNameUnique(TrainCoursewareCategory dept) {
|
||||||
Long deptId = StringUtils.isNull( dept.getDeptId() ) ? -1L : dept.getDeptId();
|
Long deptId = StringUtils.isNull( dept.getDeptId() ) ? -1L : dept.getDeptId();
|
||||||
TrainCoursewareCategory info = trainCoursewareCategoryMapper.checkDeptNameUnique( dept.getDeptName(), dept.getParentId() );
|
TrainCoursewareCategory info = trainCoursewareCategoryMapper.checkDeptNameUnique( dept.getName(), dept.getParentId() );
|
||||||
if (StringUtils.isNotNull( info ) && info.getDeptId().longValue() != deptId.longValue()) {
|
if (StringUtils.isNotNull( info ) && info.getDeptId().longValue() != deptId.longValue()) {
|
||||||
return UserConstants.DEPT_NAME_NOT_UNIQUE;
|
return UserConstants.DEPT_NAME_NOT_UNIQUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.course.mapper.TrainCourseCategoryMapper">
|
||||||
|
|
||||||
|
<resultMap type="TrainCourseCategory" id="TrainCourseCategoryResult">
|
||||||
|
<id property="id" column="id" />
|
||||||
|
<result property="deptId" column="dept_id" />
|
||||||
|
<result property="parentId" column="parent_id" />
|
||||||
|
<result property="parentIds" column="parent_ids" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="orderNum" column="order_num" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
<result property="parentName" column="parent_name" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectDeptVo">
|
||||||
|
select d.id,d.dept_id, d.parent_id, d.parent_ids, d.name, d.order_num, d.del_flag, d.create_by, d.create_time
|
||||||
|
from train_courseware_category d
|
||||||
|
</sql>
|
||||||
|
<select id="selectRoleDeptTree" parameterType="Long" resultType="String">
|
||||||
|
select concat(d.id, d.name) as name
|
||||||
|
from train_courseware_category d
|
||||||
|
left join sys_role_dept rd on d.id = rd.id
|
||||||
|
where d.del_flag = '0' and rd.role_id = #{roleId}
|
||||||
|
order by d.parent_id, d.order_num
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDeptList" parameterType="TrainCourseCategory" resultMap="TrainCourseCategoryResult">
|
||||||
|
<include refid="selectDeptVo"/>
|
||||||
|
where d.del_flag = '0'
|
||||||
|
<if test="parentId != null and parentId != 0">
|
||||||
|
AND parent_id = #{parentId}
|
||||||
|
</if>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
AND name like concat('%', #{name}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 数据范围过滤 -->
|
||||||
|
${params.dataScope}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
||||||
|
select count(1) from sys_user where id = #{id} and del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDeptCount" parameterType="TrainCourseCategory" resultType="int">
|
||||||
|
select count(1) from train_courseware_category
|
||||||
|
where del_flag = '0'
|
||||||
|
<if test="id != null and id != 0"> and id = #{id} </if>
|
||||||
|
<if test="parentId != null and parentId != 0"> and parent_id = #{parentId} </if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkDeptNameUnique" resultMap="TrainCourseCategoryResult">
|
||||||
|
<include refid="selectDeptVo"/>
|
||||||
|
where name=#{name} and parent_id = #{parentId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDeptById" parameterType="Long" resultMap="TrainCourseCategoryResult">
|
||||||
|
select d.id, d.parent_id, d.parent_ids, d.name, d.order_num,
|
||||||
|
(select name from train_courseware_category where id = d.parent_id) parent_name
|
||||||
|
from train_courseware_category d
|
||||||
|
where d.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertDept" parameterType="TrainCourseCategory">
|
||||||
|
insert into train_courseware_category(
|
||||||
|
<if test="id != null and id != 0">id,</if>
|
||||||
|
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||||
|
<if test="name != null and name != ''">name,</if>
|
||||||
|
<if test="parentIds != null and parentIds != ''">parent_ids,</if>
|
||||||
|
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
||||||
|
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
create_time
|
||||||
|
)values(
|
||||||
|
<if test="id != null and id != 0">#{id},</if>
|
||||||
|
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||||
|
<if test="name != null and name != ''">#{name},</if>
|
||||||
|
<if test="parentIds != null and parentIds != ''">#{parentIds},</if>
|
||||||
|
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
||||||
|
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDept" parameterType="TrainCourseCategory">
|
||||||
|
update train_courseware_category
|
||||||
|
<set>
|
||||||
|
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||||
|
<if test="name != null and name != ''">name = #{name},</if>
|
||||||
|
<if test="parentIds != null and parentIds != ''">parent_ids = #{parentIds},</if>
|
||||||
|
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
||||||
|
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
update_time = sysdate()
|
||||||
|
</set>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateDeptChildren" parameterType="java.util.List">
|
||||||
|
update train_courseware_category set parent_ids =
|
||||||
|
<foreach collection="depts" item="item" index="index"
|
||||||
|
separator=" " open="case id" close="end">
|
||||||
|
when #{item.id} then #{item.parent_ids}
|
||||||
|
</foreach>
|
||||||
|
where id in
|
||||||
|
<foreach collection="depts" item="item" index="index"
|
||||||
|
separator="," open="(" close=")">
|
||||||
|
#{item.id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteDeptById" parameterType="Long">
|
||||||
|
update train_courseware_category set del_flag = '2' where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.courseware.mapper.TrainCoursewareCategoryMapper">
|
<mapper namespace="com.ruoyi.courseware.mapper.TrainCoursewareCategoryMapper">
|
||||||
|
|
||||||
<resultMap type="TrainCoursewareCategory" id="TrainCoursewareCategoryResult">
|
<resultMap type="TrainCourseCategory" id="TrainCoursewareCategoryResult">
|
||||||
<id property="id" column="id" />
|
<id property="id" column="id" />
|
||||||
<result property="deptId" column="dept_id" />
|
<result property="deptId" column="dept_id" />
|
||||||
<result property="parentId" column="parent_id" />
|
<result property="parentId" column="parent_id" />
|
||||||
|
|
@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
order by d.parent_id, d.order_num
|
order by d.parent_id, d.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptList" parameterType="TrainCoursewareCategory" resultMap="TrainCoursewareCategoryResult">
|
<select id="selectDeptList" parameterType="TrainCourseCategory" resultMap="TrainCoursewareCategoryResult">
|
||||||
<include refid="selectDeptVo"/>
|
<include refid="selectDeptVo"/>
|
||||||
where d.del_flag = '0'
|
where d.del_flag = '0'
|
||||||
<if test="parentId != null and parentId != 0">
|
<if test="parentId != null and parentId != 0">
|
||||||
|
|
@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select count(1) from sys_user where id = #{id} and del_flag = '0'
|
select count(1) from sys_user where id = #{id} and del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptCount" parameterType="TrainCoursewareCategory" resultType="int">
|
<select id="selectDeptCount" parameterType="TrainCourseCategory" resultType="int">
|
||||||
select count(1) from train_courseware_category
|
select count(1) from train_courseware_category
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
<if test="id != null and id != 0"> and id = #{id} </if>
|
<if test="id != null and id != 0"> and id = #{id} </if>
|
||||||
|
|
@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where d.id = #{id}
|
where d.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertDept" parameterType="TrainCoursewareCategory">
|
<insert id="insertDept" parameterType="TrainCourseCategory">
|
||||||
insert into train_courseware_category(
|
insert into train_courseware_category(
|
||||||
<if test="id != null and id != 0">id,</if>
|
<if test="id != null and id != 0">id,</if>
|
||||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||||
|
|
@ -90,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateDept" parameterType="TrainCoursewareCategory">
|
<update id="updateDept" parameterType="TrainCourseCategory">
|
||||||
update train_courseware_category
|
update train_courseware_category
|
||||||
<set>
|
<set>
|
||||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<head th:include="include :: header"></head>
|
||||||
|
<body class="white-bg">
|
||||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
<form class="form-horizontal m" id="form-dept-add">
|
||||||
|
<input id="treeId" name="parentId" type="hidden" th:value="${dept.deptId}" />
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label ">上级部门:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${dept.deptName}"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">部门名称:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="deptName" id="deptName">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">显示排序:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="orderNum">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">负责人:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="leader">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">联系电话:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="phone">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">邮箱:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="email">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">部门状态:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
|
||||||
|
<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
|
||||||
|
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div th:include="include::footer"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var prefix = ctx + "course/category";
|
||||||
|
|
||||||
|
$("#form-dept-add").validate({
|
||||||
|
rules:{
|
||||||
|
deptName:{
|
||||||
|
required:true,
|
||||||
|
remote: {
|
||||||
|
url: prefix + "/checkDeptNameUnique",
|
||||||
|
type: "post",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
"parentId": function() {
|
||||||
|
return $("input[name='parentId']").val();
|
||||||
|
},
|
||||||
|
"deptName" : function() {
|
||||||
|
return $.common.trim($("#deptName").val());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataFilter: function(data, type) {
|
||||||
|
return $.validate.unique(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
orderNum:{
|
||||||
|
required:true,
|
||||||
|
digits:true
|
||||||
|
},
|
||||||
|
email:{
|
||||||
|
email:true,
|
||||||
|
},
|
||||||
|
phone:{
|
||||||
|
isPhone:true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
"deptName": {
|
||||||
|
remote: "部门已经存在"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if ($.validate.form()) {
|
||||||
|
$.operate.save(prefix + "/add", $('#form-dept-add').serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*部门管理-新增-选择父部门树*/
|
||||||
|
function selectDeptTree() {
|
||||||
|
var options = {
|
||||||
|
title: '部门选择',
|
||||||
|
width: "380",
|
||||||
|
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
|
||||||
|
callBack: doSubmit
|
||||||
|
};
|
||||||
|
$.modal.openOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doSubmit(index, layero){
|
||||||
|
var body = layer.getChildFrame('body', index);
|
||||||
|
$("#treeId").val(body.find('#treeId').val());
|
||||||
|
$("#treeName").val(body.find('#treeName').val());
|
||||||
|
layer.close(index);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<head th:include="include :: header"></head>
|
||||||
|
<body class="gray-bg">
|
||||||
|
<div class="container-div">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 search-collapse">
|
||||||
|
<form id="dept-form">
|
||||||
|
<div class="select-list">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
部门名称:<input type="text" name="deptName"/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||||
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
||||||
|
<a class="btn btn-success" onclick="$.operate.add(100)" shiro:hasPermission="train:course:category:add">
|
||||||
|
<i class="fa fa-plus"></i> 新增
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-primary" onclick="$.operate.editTree()" shiro:hasPermission="train:course:category:edit">
|
||||||
|
<i class="fa fa-edit"></i> 修改
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-info" id="expandAllBtn">
|
||||||
|
<i class="fa fa-exchange"></i> 展开/折叠
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-12 select-table table-striped">
|
||||||
|
<table id="bootstrap-tree-table" data-mobile-responsive="true"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div th:include="include :: footer"></div>
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var addFlag = [[${@permission.hasPermi('train:course:category:add')}]];
|
||||||
|
var editFlag = [[${@permission.hasPermi('train:course:category:edit')}]];
|
||||||
|
var removeFlag = [[${@permission.hasPermi('train:course:category:remove')}]];
|
||||||
|
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||||
|
var prefix = ctx + "train/course/category"
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var options = {
|
||||||
|
code: "id",
|
||||||
|
parentCode: "parentId",
|
||||||
|
uniqueId: "id",
|
||||||
|
url: prefix + "/list",
|
||||||
|
createUrl: prefix + "/add/{id}",
|
||||||
|
updateUrl: prefix + "/edit/{id}",
|
||||||
|
removeUrl: prefix + "/remove/{id}",
|
||||||
|
modalName: "部门",
|
||||||
|
columns: [{
|
||||||
|
field: 'selectItem',
|
||||||
|
radio: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
title: '分类名称',
|
||||||
|
align: "left"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'orderNum',
|
||||||
|
title: '排序',
|
||||||
|
align: "left"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createTime',
|
||||||
|
title: '创建时间',
|
||||||
|
align: "left"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
align: 'left',
|
||||||
|
formatter: function(value, row, index) {
|
||||||
|
if (row.parentId != 0) {
|
||||||
|
var actions = [];
|
||||||
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.deptId + '\')"><i class="fa fa-edit">编辑</i></a> ');
|
||||||
|
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.deptId + '\')"><i class="fa fa-plus">新增</i></a> ');
|
||||||
|
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.deptId + '\')"><i class="fa fa-remove">删除</i></a>');
|
||||||
|
return actions.join('');
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
$.treeTable.init(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
function remove(id) {
|
||||||
|
$.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
|
||||||
|
$.ajax({
|
||||||
|
type : 'post',
|
||||||
|
url: prefix + "/remove/" + id,
|
||||||
|
success : function(result) {
|
||||||
|
if (result.code == web_status.SUCCESS) {
|
||||||
|
$.modal.msgSuccess(result.msg);
|
||||||
|
$.treeTable.refresh();
|
||||||
|
} else {
|
||||||
|
$.modal.msgError(result.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,133 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<head th:include="include :: header"></head>
|
||||||
|
<body class="white-bg">
|
||||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
<form class="form-horizontal m" id="form-dept-edit" th:object="${dept}">
|
||||||
|
<input name="deptId" type="hidden" th:field="*{deptId}" />
|
||||||
|
<input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label ">上级部门:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" id="treeName" onclick="selectDeptTree()" readonly="true" th:field="*{parentName}"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">部门名称:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="deptName" th:field="*{deptName}" id="deptName">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">显示排序:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="orderNum" th:field="*{orderNum}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">负责人:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="leader" th:field="*{leader}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">联系电话:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="phone" th:field="*{phone}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">邮箱:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="email" th:field="*{email}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">部门状态:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
|
||||||
|
<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
|
||||||
|
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div th:include="include::footer"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var prefix = ctx + "course/category";
|
||||||
|
|
||||||
|
$("#form-dept-edit").validate({
|
||||||
|
rules:{
|
||||||
|
deptName:{
|
||||||
|
required:true,
|
||||||
|
remote: {
|
||||||
|
url: prefix + "/checkDeptNameUnique",
|
||||||
|
type: "post",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
"deptId": function() {
|
||||||
|
return $("#deptId").val();
|
||||||
|
},
|
||||||
|
"parentId": function() {
|
||||||
|
return $("input[name='parentId']").val();
|
||||||
|
},
|
||||||
|
"deptName": function() {
|
||||||
|
return $.common.trim($("#deptName").val());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataFilter: function(data, type) {
|
||||||
|
return $.validate.unique(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
orderNum:{
|
||||||
|
required:true,
|
||||||
|
digits:true
|
||||||
|
},
|
||||||
|
email:{
|
||||||
|
email:true,
|
||||||
|
},
|
||||||
|
phone:{
|
||||||
|
isPhone:true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
"deptName": {
|
||||||
|
remote: "部门已经存在"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if ($.validate.form()) {
|
||||||
|
$.operate.save(prefix + "/edit", $('#form-dept-edit').serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*部门管理-修改-选择部门树*/
|
||||||
|
function selectDeptTree() {
|
||||||
|
var deptId = $("#treeId").val();
|
||||||
|
if(deptId > 0) {
|
||||||
|
var options = {
|
||||||
|
title: '部门选择',
|
||||||
|
width: "380",
|
||||||
|
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
|
||||||
|
callBack: doSubmit
|
||||||
|
};
|
||||||
|
$.modal.openOptions(options);
|
||||||
|
} else {
|
||||||
|
$.modal.alertError("父部门不能选择");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doSubmit(index, layero){
|
||||||
|
var body = layer.getChildFrame('body', index);
|
||||||
|
$("#treeId").val(body.find('#treeId').val());
|
||||||
|
$("#treeName").val(body.find('#treeName').val());
|
||||||
|
layer.close(index);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<head th:include="include :: header"></head>
|
||||||
|
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||||
|
<style>
|
||||||
|
body{height:auto;font-family: "Microsoft YaHei";}
|
||||||
|
button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
|
||||||
|
</style>
|
||||||
|
<body class="hold-transition box box-main">
|
||||||
|
<input id="treeId" name="treeId" type="hidden" th:value="${dept.deptId}"/>
|
||||||
|
<input id="treeName" name="treeName" type="hidden" th:value="${dept.deptName}"/>
|
||||||
|
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
|
||||||
|
<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
|
||||||
|
<label id="btnHide" title="隐藏搜索">︽</label>
|
||||||
|
</div>
|
||||||
|
<div class="treeSearchInput" id="search">
|
||||||
|
<label for="keyword">关键字:</label><input type="text" class="empty" id="keyword" maxlength="50">
|
||||||
|
<button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
|
||||||
|
</div>
|
||||||
|
<div class="treeExpandCollapse">
|
||||||
|
<a href="#" onclick="$.tree.expand()">展开</a> /
|
||||||
|
<a href="#" onclick="$.tree.collapse()">折叠</a>
|
||||||
|
</div>
|
||||||
|
<div id="tree" class="ztree treeselect"></div>
|
||||||
|
</div>
|
||||||
|
<div th:include="include::footer"></div>
|
||||||
|
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||||
|
<script th:inline="javascript">
|
||||||
|
$(function() {
|
||||||
|
var url = ctx + "course/category/treeData";
|
||||||
|
var options = {
|
||||||
|
url: url,
|
||||||
|
expandLevel: 2,
|
||||||
|
onClick : zOnClick
|
||||||
|
};
|
||||||
|
$.tree.init(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
function zOnClick(event, treeId, treeNode) {
|
||||||
|
var treeId = treeNode.id;
|
||||||
|
var treeName = treeNode.name;
|
||||||
|
$("#treeId").val(treeId);
|
||||||
|
$("#treeName").val(treeName);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -23,10 +23,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
||||||
<a class="btn btn-success" onclick="$.operate.add(100)" shiro:hasPermission="vip:dept:add">
|
<a class="btn btn-success" onclick="$.operate.add(100)" shiro:hasPermission="train:courseware:category:add">
|
||||||
<i class="fa fa-plus"></i> 新增
|
<i class="fa fa-plus"></i> 新增
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-primary" onclick="$.operate.editTree()" shiro:hasPermission="vip:dept:edit">
|
<a class="btn btn-primary" onclick="$.operate.editTree()" shiro:hasPermission="train:courseware:category:edit">
|
||||||
<i class="fa fa-edit"></i> 修改
|
<i class="fa fa-edit"></i> 修改
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-info" id="expandAllBtn">
|
<a class="btn btn-info" id="expandAllBtn">
|
||||||
|
|
@ -40,17 +40,17 @@
|
||||||
</div>
|
</div>
|
||||||
<div th:include="include :: footer"></div>
|
<div th:include="include :: footer"></div>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
var addFlag = [[${@permission.hasPermi('vip:dept:add')}]];
|
var addFlag = [[${@permission.hasPermi('train:courseware:category:add')}]];
|
||||||
var editFlag = [[${@permission.hasPermi('vip:dept:edit')}]];
|
var editFlag = [[${@permission.hasPermi('train:courseware:category:edit')}]];
|
||||||
var removeFlag = [[${@permission.hasPermi('vip:dept:remove')}]];
|
var removeFlag = [[${@permission.hasPermi('train:courseware:category:remove')}]];
|
||||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||||
var prefix = ctx + "train/courseware/category"
|
var prefix = ctx + "train/courseware/category"
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var options = {
|
var options = {
|
||||||
code: "deptId",
|
code: "id",
|
||||||
parentCode: "parentId",
|
parentCode: "parentId",
|
||||||
uniqueId: "deptId",
|
uniqueId: "id",
|
||||||
url: prefix + "/list",
|
url: prefix + "/list",
|
||||||
createUrl: prefix + "/add/{id}",
|
createUrl: prefix + "/add/{id}",
|
||||||
updateUrl: prefix + "/edit/{id}",
|
updateUrl: prefix + "/edit/{id}",
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-dept-edit" th:object="${dept}">
|
<form class="form-horizontal m" id="form-dept-edit" th:object="${dept}">
|
||||||
<input name="deptId" type="hidden" th:field="*{deptId}" />
|
<input name="id" type="hidden" th:field="*{id}" />
|
||||||
<input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
|
<input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label ">上级部门:</label>
|
<label class="col-sm-3 control-label ">上级部门:</label>
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">部门名称:</label>
|
<label class="col-sm-3 control-label">部门名称:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input class="form-control" type="text" name="deptName" th:field="*{deptName}" id="deptName">
|
<input class="form-control" type="text" name="name" th:field="*{name}" id="name">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
@ -60,21 +60,21 @@
|
||||||
|
|
||||||
$("#form-dept-edit").validate({
|
$("#form-dept-edit").validate({
|
||||||
rules:{
|
rules:{
|
||||||
deptName:{
|
name:{
|
||||||
required:true,
|
required:true,
|
||||||
remote: {
|
remote: {
|
||||||
url: prefix + "/checkDeptNameUnique",
|
url: prefix + "/checknameUnique",
|
||||||
type: "post",
|
type: "post",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: {
|
data: {
|
||||||
"deptId": function() {
|
"id": function() {
|
||||||
return $("#deptId").val();
|
return $("#id").val();
|
||||||
},
|
},
|
||||||
"parentId": function() {
|
"parentId": function() {
|
||||||
return $("input[name='parentId']").val();
|
return $("input[name='parentId']").val();
|
||||||
},
|
},
|
||||||
"deptName": function() {
|
"name": function() {
|
||||||
return $.common.trim($("#deptName").val());
|
return $.common.trim($("#name").val());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dataFilter: function(data, type) {
|
dataFilter: function(data, type) {
|
||||||
|
|
@ -94,7 +94,7 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
messages: {
|
messages: {
|
||||||
"deptName": {
|
"name": {
|
||||||
remote: "部门已经存在"
|
remote: "部门已经存在"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -108,8 +108,8 @@
|
||||||
|
|
||||||
/*部门管理-修改-选择部门树*/
|
/*部门管理-修改-选择部门树*/
|
||||||
function selectDeptTree() {
|
function selectDeptTree() {
|
||||||
var deptId = $("#treeId").val();
|
var id = $("#treeId").val();
|
||||||
if(deptId > 0) {
|
if(id > 0) {
|
||||||
var options = {
|
var options = {
|
||||||
title: '部门选择',
|
title: '部门选择',
|
||||||
width: "380",
|
width: "380",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue