培训课件

This commit is contained in:
zhujunjieit 2018-12-19 22:53:58 +08:00
parent ca3ea4a248
commit d4e84057dc
27 changed files with 212 additions and 1244 deletions

View File

@ -499,7 +499,7 @@
},
// 工具栏表格树修改
editTree: function() {
var row = $('#bootstrap-table').bootstrapTreeTable('getSelections')[0];
var row = $('#bootstrap-tree-table').bootstrapTreeTable('getSelections')[0];
if ($.common.isEmpty(row)) {
$.modal.alertWarning("请至少选择一条记录");
return;

View File

@ -43,7 +43,7 @@
手机号码:<input type="text" name="phonenumber"/>
</li>
<li>
用户状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
用户状态: <select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>

View File

@ -19,13 +19,12 @@ import java.util.Map;
/**
* 课程分类管理
*
*
* @author ruoyi
*/
@Controller
@RequestMapping("/train/course/category")
public class TrainCourseCategoryController extends BaseController
{
public class TrainCourseCategoryController extends BaseController {
private String prefix = "course/category";
@Autowired
@ -33,17 +32,15 @@ public class TrainCourseCategoryController extends BaseController
@RequiresPermissions("train:course:category:view")
@GetMapping()
public String dept()
{
return prefix + "/dept";
public String dept() {
return prefix + "/category";
}
@RequiresPermissions("train:course:category:list")
@GetMapping("/list")
@ResponseBody
public List<TrainCourseCategory> list(TrainCourseCategory dept)
{
List<TrainCourseCategory> deptList = trainCourseCategoryService.selectDeptList(dept);
public List<TrainCourseCategory> list(TrainCourseCategory dept) {
List<TrainCourseCategory> deptList = trainCourseCategoryService.selectDeptList( dept );
return deptList;
}
@ -51,9 +48,8 @@ public class TrainCourseCategoryController extends BaseController
* 新增课程分类
*/
@GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
{
mmap.put("dept", trainCourseCategoryService.selectDeptById(parentId));
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) {
mmap.put( "dept", trainCourseCategoryService.selectDeptById( parentId ) );
return prefix + "/add";
}
@ -64,24 +60,21 @@ public class TrainCourseCategoryController extends BaseController
@RequiresPermissions("train:course:category:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TrainCourseCategory dept)
{
dept.setCreateBy(ShiroUtils.getLoginName());
return toAjax(trainCourseCategoryService.insertDept(dept));
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("");
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap) {
TrainCourseCategory dept = trainCourseCategoryService.selectDeptById( id );
if (StringUtils.isNotNull( dept ) && 100L == id) {
dept.setParentName( "" );
}
mmap.put("dept", dept);
mmap.put( "dept", dept );
return prefix + "/edit";
}
@ -92,10 +85,9 @@ public class TrainCourseCategoryController extends BaseController
@RequiresPermissions("train:course:category:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TrainCourseCategory dept)
{
dept.setUpdateBy(ShiroUtils.getLoginName());
return toAjax(trainCourseCategoryService.updateDept(dept));
public AjaxResult editSave(TrainCourseCategory dept) {
dept.setUpdateBy( ShiroUtils.getLoginName() );
return toAjax( trainCourseCategoryService.updateDept( dept ) );
}
/**
@ -103,19 +95,16 @@ public class TrainCourseCategoryController extends BaseController
*/
@Log(title = "课程分类管理", businessType = BusinessType.DELETE)
@RequiresPermissions("train:course:category:remove")
@PostMapping("/remove/{deptId}")
@PostMapping("/remove/{id}")
@ResponseBody
public AjaxResult remove(@PathVariable("deptId") Long deptId)
{
if (trainCourseCategoryService.selectDeptCount(deptId) > 0)
{
return error(1, "存在下级课程分类,不允许删除");
public AjaxResult remove(@PathVariable("id") Long id) {
if (trainCourseCategoryService.selectDeptCount( id ) > 0) {
return error( 1, "存在下级课程分类,不允许删除" );
}
if (trainCourseCategoryService.checkDeptExistUser(deptId))
{
return error(1, "课程分类存在用户,不允许删除");
if (trainCourseCategoryService.checkDeptExistUser( id )) {
return error( 1, "课程分类存在用户,不允许删除" );
}
return toAjax(trainCourseCategoryService.deleteDeptById(deptId));
return toAjax( trainCourseCategoryService.deleteDeptById( id ) );
}
/**
@ -123,18 +112,16 @@ public class TrainCourseCategoryController extends BaseController
*/
@PostMapping("/checkDeptNameUnique")
@ResponseBody
public String checkDeptNameUnique(TrainCourseCategory dept)
{
return trainCourseCategoryService.checkDeptNameUnique(dept);
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));
@GetMapping("/selectDeptTree/{id}")
public String selectDeptTree(@PathVariable("id") Long id, ModelMap mmap) {
mmap.put( "dept", trainCourseCategoryService.selectDeptById( id ) );
return prefix + "/tree";
}
@ -143,8 +130,7 @@ public class TrainCourseCategoryController extends BaseController
*/
@GetMapping("/treeData")
@ResponseBody
public List<Map<String, Object>> treeData()
{
public List<Map<String, Object>> treeData() {
List<Map<String, Object>> tree = trainCourseCategoryService.selectDeptTree();
return tree;
}

View File

@ -19,13 +19,12 @@ import java.util.Map;
/**
* 课件分类信息
*
*
* @author ruoyi
*/
@Controller
@RequestMapping("/train/courseware/category")
public class TrainCoursewareCategoryController extends BaseController
{
public class TrainCoursewareCategoryController extends BaseController {
private String prefix = "courseware/category";
@Autowired
@ -33,27 +32,24 @@ public class TrainCoursewareCategoryController extends BaseController
@RequiresPermissions("train:courseware:category:view")
@GetMapping()
public String dept()
{
return prefix + "/dept";
public String category() {
return prefix + "/category";
}
@RequiresPermissions("train:courseware:category:list")
@GetMapping("/list")
@ResponseBody
public List<TrainCoursewareCategory> list(TrainCoursewareCategory dept)
{
List<TrainCoursewareCategory> deptList = trainCoursewareCategoryService.selectDeptList(dept);
return deptList;
public List<TrainCoursewareCategory> list(TrainCoursewareCategory category) {
List<TrainCoursewareCategory> categoryList = trainCoursewareCategoryService.selectCategoryList( category );
return categoryList;
}
/**
* 新增课件分类
*/
@GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
{
mmap.put("dept", trainCoursewareCategoryService.selectDeptById(parentId));
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) {
mmap.put( "category", trainCoursewareCategoryService.selectCategoryById( parentId ) );
return prefix + "/add";
}
@ -64,24 +60,21 @@ public class TrainCoursewareCategoryController extends BaseController
@RequiresPermissions("train:courseware:category:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TrainCoursewareCategory dept)
{
dept.setCreateBy(ShiroUtils.getLoginName());
return toAjax(trainCoursewareCategoryService.insertDept(dept));
public AjaxResult addSave(TrainCoursewareCategory category) {
category.setCreateBy( ShiroUtils.getLoginName() );
return toAjax( trainCoursewareCategoryService.insertCategory( category ) );
}
/**
* 修改
*/
@GetMapping("/edit/{deptId}")
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
{
TrainCoursewareCategory dept = trainCoursewareCategoryService.selectDeptById(deptId);
if (StringUtils.isNotNull(dept) && 100L == deptId)
{
dept.setParentName("");
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap) {
TrainCoursewareCategory category = trainCoursewareCategoryService.selectCategoryById( id );
if (StringUtils.isNotNull( category ) && 100L == id) {
category.setParentName( "" );
}
mmap.put("dept", dept);
mmap.put( "category", category );
return prefix + "/edit";
}
@ -92,10 +85,9 @@ public class TrainCoursewareCategoryController extends BaseController
@RequiresPermissions("train:courseware:category:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TrainCoursewareCategory dept)
{
dept.setUpdateBy(ShiroUtils.getLoginName());
return toAjax(trainCoursewareCategoryService.updateDept(dept));
public AjaxResult editSave(TrainCoursewareCategory category) {
category.setUpdateBy( ShiroUtils.getLoginName() );
return toAjax( trainCoursewareCategoryService.updateCategory( category ) );
}
/**
@ -103,38 +95,33 @@ public class TrainCoursewareCategoryController extends BaseController
*/
@Log(title = "课件分类管理", businessType = BusinessType.DELETE)
@RequiresPermissions("train:courseware:category:remove")
@PostMapping("/remove/{deptId}")
@PostMapping("/remove/{id}")
@ResponseBody
public AjaxResult remove(@PathVariable("deptId") Long deptId)
{
if (trainCoursewareCategoryService.selectDeptCount(deptId) > 0)
{
return error(1, "存在下级课件分类,不允许删除");
public AjaxResult remove(@PathVariable("id") Long id) {
if (trainCoursewareCategoryService.selectCategoryCount( id ) > 0) {
return error( 1, "存在下级课件分类,不允许删除" );
}
if (trainCoursewareCategoryService.checkDeptExistUser(deptId))
{
return error(1, "课件分类存在用户,不允许删除");
if (trainCoursewareCategoryService.checkCategoryExistCourseware( id )) {
return error( 1, "课件分类存在课件,不允许删除" );
}
return toAjax(trainCoursewareCategoryService.deleteDeptById(deptId));
return toAjax( trainCoursewareCategoryService.deleteCategoryById( id ) );
}
/**
* 校验课件分类名称
*/
@PostMapping("/checkDeptNameUnique")
@PostMapping("/checkCategoryNameUnique")
@ResponseBody
public String checkDeptNameUnique(TrainCoursewareCategory dept)
{
return trainCoursewareCategoryService.checkDeptNameUnique(dept);
public String checkCategoryNameUnique(TrainCoursewareCategory category) {
return trainCoursewareCategoryService.checkCategoryNameUnique( category );
}
/**
* 选择课件分类树
*/
@GetMapping("/selectDeptTree/{deptId}")
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
{
mmap.put("dept", trainCoursewareCategoryService.selectDeptById(deptId));
@GetMapping("/selectCategoryTree/{id}")
public String selectCategoryTree(@PathVariable("id") Long id, ModelMap mmap) {
mmap.put( "category", trainCoursewareCategoryService.selectCategoryById( id ) );
return prefix + "/tree";
}
@ -143,9 +130,8 @@ public class TrainCoursewareCategoryController extends BaseController
*/
@GetMapping("/treeData")
@ResponseBody
public List<Map<String, Object>> treeData()
{
List<Map<String, Object>> tree = trainCoursewareCategoryService.selectDeptTree();
public List<Map<String, Object>> treeData() {
List<Map<String, Object>> tree = trainCoursewareCategoryService.selectCategoryTree();
return tree;
}

View File

@ -11,86 +11,78 @@ import java.util.List;
*
* @author ruoyi
*/
public interface TrainCoursewareCategoryMapper extends MyMapper<TrainCoursewareCategory>
{
public interface TrainCoursewareCategoryMapper extends MyMapper<TrainCoursewareCategory> {
/**
* 查询课件分类人数
*
* @param dept 课件分类信息
* @param category 课件分类信息
* @return 结果
*/
public int selectDeptCount(TrainCoursewareCategory dept);
public int selectCategoryCount(TrainCoursewareCategory category);
/**
* 查询课件分类是否存在用户
*
* @param deptId 课件分类ID
* @param id 课件分类ID
* @return 结果
*/
public int checkDeptExistUser(Long deptId);
public int checkCategoryExistCourseware(Long id);
/**
* 查询课件分类管理数据
*
* @param dept 课件分类信息
* @param category 课件分类信息
* @return 课件分类信息集合
*/
public List<TrainCoursewareCategory> selectDeptList(TrainCoursewareCategory dept);
public List<TrainCoursewareCategory> selectCategoryList(TrainCoursewareCategory category);
/**
* 删除课件分类管理信息
*
* @param deptId 课件分类ID
* @param id 课件分类ID
* @return 结果
*/
public int deleteDeptById(Long deptId);
public int deleteCategoryById(Long id);
/**
* 新增课件分类信息
*
* @param dept 课件分类信息
* @param category 课件分类信息
* @return 结果
*/
public int insertDept(TrainCoursewareCategory dept);
public int insertCategory(TrainCoursewareCategory category);
/**
* 修改课件分类信息
*
* @param dept 课件分类信息
* @param category 课件分类信息
* @return 结果
*/
public int updateDept(TrainCoursewareCategory dept);
public int updateCategory(TrainCoursewareCategory category);
/**
* 修改子元素关系
*
* @param depts 子元素
* @param categorys 子元素
* @return 结果
*/
public int updateDeptChildren(@Param("depts") List<TrainCoursewareCategory> depts);
public int updateCategoryChildren(@Param("categorys") List<TrainCoursewareCategory> categorys);
/**
* 根据课件分类ID查询信息
*
* @param deptId 课件分类ID
* @param id 课件分类ID
* @return 课件分类信息
*/
public TrainCoursewareCategory selectDeptById(Long deptId);
public TrainCoursewareCategory selectCategoryById(Long id);
/**
* 校验课件分类名称是否唯一
*
* @param deptName 课件分类名称
* @param name 课件分类名称
* @param parentId 父课件分类ID
* @return 结果
*/
public TrainCoursewareCategory checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
public TrainCoursewareCategory checkCategoryNameUnique(@Param("name") String name, @Param("parentId") Long parentId);
/**
* 根据角色ID查询课件分类
*
* @param roleId 角色ID
* @return 课件分类列表
*/
public List<String> selectRoleDeptTree(Long roleId);
}

View File

@ -8,81 +8,81 @@ import java.util.Map;
/**
* 课件分类管理 服务层
*
*
* @author ruoyi
*/
public interface ITrainCoursewareCategoryService extends AbstractBaseService<TrainCoursewareCategory>
{
/**
* 查询课件分类管理数据
*
* @param dept 课件分类信息
*
* @param category 课件分类信息
* @return 课件分类信息集合
*/
public List<TrainCoursewareCategory> selectDeptList(TrainCoursewareCategory dept);
public List<TrainCoursewareCategory> selectCategoryList(TrainCoursewareCategory category);
/**
* 查询课件分类管理树
*
*
* @return 所有课件分类信息
*/
public List<Map<String, Object>> selectDeptTree();
public List<Map<String, Object>> selectCategoryTree();
/**
* 查询课件分类人数
*
*
* @param parentId 父课件分类ID
* @return 结果
*/
public int selectDeptCount(Long parentId);
public int selectCategoryCount(Long parentId);
/**
* 查询课件分类是否存在用户
*
* @param deptId 课件分类ID
*
* @param id 课件分类ID
* @return 结果 true 存在 false 不存在
*/
public boolean checkDeptExistUser(Long deptId);
public boolean checkCategoryExistCourseware(Long id);
/**
* 删除课件分类管理信息
*
* @param deptId 课件分类ID
*
* @param id 课件分类ID
* @return 结果
*/
public int deleteDeptById(Long deptId);
public int deleteCategoryById(Long id);
/**
* 新增保存课件分类信息
*
* @param dept 课件分类信息
*
* @param category 课件分类信息
* @return 结果
*/
public int insertDept(TrainCoursewareCategory dept);
public int insertCategory(TrainCoursewareCategory category);
/**
* 修改保存课件分类信息
*
* @param dept 课件分类信息
*
* @param category 课件分类信息
* @return 结果
*/
public int updateDept(TrainCoursewareCategory dept);
public int updateCategory(TrainCoursewareCategory category);
/**
* 根据课件分类ID查询信息
*
* @param deptId 课件分类ID
*
* @param id 课件分类ID
* @return 课件分类信息
*/
public TrainCoursewareCategory selectDeptById(Long deptId);
public TrainCoursewareCategory selectCategoryById(Long id);
/**
* 校验课件分类名称是否唯一
*
* @param dept 课件分类信息
*
* @param category 课件分类信息
* @return 结果
*/
public String checkDeptNameUnique(TrainCoursewareCategory dept);
public String checkCategoryNameUnique(TrainCoursewareCategory category);
}

View File

@ -31,8 +31,8 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
*/
@Override
@DataScope(tableAlias = "d")
public List<TrainCoursewareCategory> selectDeptList(TrainCoursewareCategory dept) {
return trainCoursewareCategoryMapper.selectDeptList( dept );
public List<TrainCoursewareCategory> selectCategoryList(TrainCoursewareCategory dept) {
return trainCoursewareCategoryMapper.selectCategoryList( dept );
}
/**
@ -41,9 +41,9 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
* @return 所有课件分类信息
*/
@Override
public List<Map<String, Object>> selectDeptTree() {
public List<Map<String, Object>> selectCategoryTree() {
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
List<TrainCoursewareCategory> deptList = selectDeptList( new TrainCoursewareCategory() );
List<TrainCoursewareCategory> deptList = selectCategoryList( new TrainCoursewareCategory() );
trees = getTrees( deptList, false, null );
return trees;
}
@ -54,10 +54,10 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
*
* @param deptList 课件分类列表
* @param isCheck 是否需要选中
* @param roleDeptList 角色已存在菜单列表
* @param roleCategoryList 角色已存在菜单列表
* @return
*/
public List<Map<String, Object>> getTrees(List<TrainCoursewareCategory> deptList, boolean isCheck, List<String> roleDeptList) {
public List<Map<String, Object>> getTrees(List<TrainCoursewareCategory> deptList, boolean isCheck, List<String> roleCategoryList) {
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
for (TrainCoursewareCategory dept : deptList) {
@ -68,7 +68,7 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
deptMap.put( "name", dept.getName() );
deptMap.put( "title", dept.getName() );
if (isCheck) {
deptMap.put( "checked", roleDeptList.contains( dept.getDeptId() + dept.getName() ) );
deptMap.put( "checked", roleCategoryList.contains( dept.getId() + dept.getName() ) );
} else {
deptMap.put( "checked", false );
}
@ -85,10 +85,10 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
* @return 结果
*/
@Override
public int selectDeptCount(Long parentId) {
public int selectCategoryCount(Long parentId) {
TrainCoursewareCategory dept = new TrainCoursewareCategory();
dept.setParentId( parentId );
return trainCoursewareCategoryMapper.selectDeptCount( dept );
return trainCoursewareCategoryMapper.selectCategoryCount( dept );
}
/**
@ -98,8 +98,8 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
* @return 结果 true 存在 false 不存在
*/
@Override
public boolean checkDeptExistUser(Long deptId) {
int result = trainCoursewareCategoryMapper.checkDeptExistUser( deptId );
public boolean checkCategoryExistCourseware(Long deptId) {
int result = trainCoursewareCategoryMapper.checkCategoryExistCourseware( deptId );
return result > 0 ? true : false;
}
@ -110,8 +110,8 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
* @return 结果
*/
@Override
public int deleteDeptById(Long deptId) {
return trainCoursewareCategoryMapper.deleteDeptById( deptId );
public int deleteCategoryById(Long deptId) {
return trainCoursewareCategoryMapper.deleteCategoryById( deptId );
}
/**
@ -121,27 +121,27 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
* @return 结果
*/
@Override
public int insertDept(TrainCoursewareCategory dept) {
TrainCoursewareCategory info = trainCoursewareCategoryMapper.selectDeptById( dept.getParentId() );
public int insertCategory(TrainCoursewareCategory dept) {
TrainCoursewareCategory info = trainCoursewareCategoryMapper.selectCategoryById( dept.getParentId() );
dept.setParentIds( info.getParentIds() + "," + dept.getParentId() );
return trainCoursewareCategoryMapper.insertDept( dept );
return trainCoursewareCategoryMapper.insertCategory( dept );
}
/**
* 修改保存课件分类信息
*
* @param dept 课件分类信息
* @param category 课件分类信息
* @return 结果
*/
@Override
public int updateDept(TrainCoursewareCategory dept) {
TrainCoursewareCategory info = trainCoursewareCategoryMapper.selectDeptById( dept.getParentId() );
public int updateCategory(TrainCoursewareCategory category) {
TrainCoursewareCategory info = trainCoursewareCategoryMapper.selectCategoryById( category.getParentId() );
if (StringUtils.isNotNull( info )) {
String ancestors = info.getParentIds() + "," + dept.getParentId();
dept.setParentIds( ancestors );
updateDeptChildren( dept.getDeptId(), ancestors );
String ancestors = info.getParentIds() + "," + category.getParentId();
category.setParentIds( ancestors );
updateCategoryChildren( category.getId(), ancestors );
}
return trainCoursewareCategoryMapper.updateDept( dept );
return trainCoursewareCategoryMapper.updateCategory( category );
}
/**
@ -150,15 +150,15 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
* @param deptId 课件分类ID
* @param ancestors 元素列表
*/
public void updateDeptChildren(Long deptId, String ancestors) {
public void updateCategoryChildren(Long deptId, String ancestors) {
TrainCoursewareCategory dept = new TrainCoursewareCategory();
dept.setParentId( deptId );
List<TrainCoursewareCategory> childrens = trainCoursewareCategoryMapper.selectDeptList( dept );
List<TrainCoursewareCategory> childrens = trainCoursewareCategoryMapper.selectCategoryList( dept );
for (TrainCoursewareCategory children : childrens) {
children.setParentIds( ancestors + "," + dept.getParentId() );
}
if (childrens.size() > 0) {
trainCoursewareCategoryMapper.updateDeptChildren( childrens );
trainCoursewareCategoryMapper.updateCategoryChildren( childrens );
}
}
@ -169,8 +169,8 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
* @return 课件分类信息
*/
@Override
public TrainCoursewareCategory selectDeptById(Long deptId) {
return trainCoursewareCategoryMapper.selectDeptById( deptId );
public TrainCoursewareCategory selectCategoryById(Long id) {
return trainCoursewareCategoryMapper.selectCategoryById( id );
}
/**
@ -180,10 +180,10 @@ public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<
* @return 结果
*/
@Override
public String checkDeptNameUnique(TrainCoursewareCategory dept) {
Long deptId = StringUtils.isNull( dept.getDeptId() ) ? -1L : dept.getDeptId();
TrainCoursewareCategory info = trainCoursewareCategoryMapper.checkDeptNameUnique( dept.getName(), dept.getParentId() );
if (StringUtils.isNotNull( info ) && info.getDeptId().longValue() != deptId.longValue()) {
public String checkCategoryNameUnique(TrainCoursewareCategory dept) {
Long deptId = StringUtils.isNull( dept.getId() ) ? -1L : dept.getId();
TrainCoursewareCategory info = trainCoursewareCategoryMapper.checkCategoryNameUnique( dept.getName(), dept.getParentId() );
if (StringUtils.isNotNull( info ) && info.getId().longValue() != deptId.longValue()) {
return UserConstants.DEPT_NAME_NOT_UNIQUE;
}
return UserConstants.DEPT_NAME_UNIQUE;

View File

@ -1,126 +0,0 @@
package com.ruoyi.web.controller.exam;
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.ModelMap;
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.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.exam.domain.TrainCourseCategory;
import com.ruoyi.exam.service.ITrainCourseCategoryService;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.ExcelUtil;
/**
* 课程分类 信息操作处理
*
* @author zhujj
* @date 2018-12-12
*/
@Controller
@RequestMapping("/exam/trainCourseCategory")
public class TrainCourseCategoryController extends BaseController
{
private String prefix = "exam/trainCourseCategory";
@Autowired
private ITrainCourseCategoryService trainCourseCategoryService;
@RequiresPermissions("exam:trainCourseCategory:view")
@GetMapping()
public String trainCourseCategory()
{
return prefix + "/trainCourseCategory";
}
/**
* 查询课程分类列表
*/
@RequiresPermissions("exam:trainCourseCategory:list")
@GetMapping("/list")
@ResponseBody
public List<TrainCourseCategory> list(TrainCourseCategory trainCourseCategory)
{
List<TrainCourseCategory> list = trainCourseCategoryService.selectTrainCourseCategoryPage(trainCourseCategory);
return list;
}
/**
* 导出课程分类列表
*/
@RequiresPermissions("exam:trainCourseCategory:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TrainCourseCategory trainCourseCategory)
{
List<TrainCourseCategory> list = trainCourseCategoryService.selectTrainCourseCategoryList(trainCourseCategory);
ExcelUtil<TrainCourseCategory> util = new ExcelUtil<TrainCourseCategory>(TrainCourseCategory.class);
return util.exportExcel(list, "trainCourseCategory");
}
/**
* 新增课程分类
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存课程分类
*/
@RequiresPermissions("exam:trainCourseCategory:add")
@Log(title = "课程分类", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TrainCourseCategory trainCourseCategory)
{
return toAjax(trainCourseCategoryService.insert(trainCourseCategory));
}
/**
* 修改课程分类
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
{
TrainCourseCategory trainCourseCategory = trainCourseCategoryService.selectById(id);
mmap.put("trainCourseCategory", trainCourseCategory);
return prefix + "/edit";
}
/**
* 修改保存课程分类
*/
@RequiresPermissions("exam:trainCourseCategory:edit")
@Log(title = "课程分类", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TrainCourseCategory trainCourseCategory)
{
return toAjax(trainCourseCategoryService.updateById(trainCourseCategory));
}
/**
* 删除课程分类
*/
@RequiresPermissions("exam:trainCourseCategory:remove")
@Log(title = "课程分类", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(trainCourseCategoryService.deleteByIds(ids));
}
}

View File

@ -1,126 +0,0 @@
package com.ruoyi.web.controller.exam;
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.ModelMap;
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.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.exam.domain.TrainCoursewareCategory;
import com.ruoyi.exam.service.ITrainCoursewareCategoryService;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.ExcelUtil;
/**
* 课件分类 信息操作处理
*
* @author zhujj
* @date 2018-12-12
*/
@Controller
@RequestMapping("/exam/trainCoursewareCategory")
public class TrainCoursewareCategoryController extends BaseController
{
private String prefix = "exam/trainCoursewareCategory";
@Autowired
private ITrainCoursewareCategoryService trainCoursewareCategoryService;
@RequiresPermissions("exam:trainCoursewareCategory:view")
@GetMapping()
public String trainCoursewareCategory()
{
return prefix + "/trainCoursewareCategory";
}
/**
* 查询课件分类列表
*/
@RequiresPermissions("exam:trainCoursewareCategory:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TrainCoursewareCategory trainCoursewareCategory)
{
List<TrainCoursewareCategory> list = trainCoursewareCategoryService.selectTrainCoursewareCategoryPage(trainCoursewareCategory);
return getDataTable(list);
}
/**
* 导出课件分类列表
*/
@RequiresPermissions("exam:trainCoursewareCategory:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TrainCoursewareCategory trainCoursewareCategory)
{
List<TrainCoursewareCategory> list = trainCoursewareCategoryService.selectTrainCoursewareCategoryList(trainCoursewareCategory);
ExcelUtil<TrainCoursewareCategory> util = new ExcelUtil<TrainCoursewareCategory>(TrainCoursewareCategory.class);
return util.exportExcel(list, "trainCoursewareCategory");
}
/**
* 新增课件分类
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存课件分类
*/
@RequiresPermissions("exam:trainCoursewareCategory:add")
@Log(title = "课件分类", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TrainCoursewareCategory trainCoursewareCategory)
{
return toAjax(trainCoursewareCategoryService.insert(trainCoursewareCategory));
}
/**
* 修改课件分类
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
{
TrainCoursewareCategory trainCoursewareCategory = trainCoursewareCategoryService.selectById(id);
mmap.put("trainCoursewareCategory", trainCoursewareCategory);
return prefix + "/edit";
}
/**
* 修改保存课件分类
*/
@RequiresPermissions("exam:trainCoursewareCategory:edit")
@Log(title = "课件分类", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TrainCoursewareCategory trainCoursewareCategory)
{
return toAjax(trainCoursewareCategoryService.updateById(trainCoursewareCategory));
}
/**
* 删除课件分类
*/
@RequiresPermissions("exam:trainCoursewareCategory:remove")
@Log(title = "课件分类", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(trainCoursewareCategoryService.deleteByIds(ids));
}
}

View File

@ -1,194 +0,0 @@
package com.ruoyi.exam.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.base.BaseEntity;
import javax.persistence.Id;
import java.util.Date;
/**
* 课程分类表 train_course_category
*
* @author zhujj
* @date 2018-12-12
*/
public class TrainCourseCategory
{
private static final long serialVersionUID = 1L;
/** 部门id */
@Id
private Integer id;
/** 部门ID */
private Integer deptId;
/** 父部门id */
private Integer parentId;
/** 祖级列表 */
private String parentIds;
/** 分类名称 */
private String name;
/** 显示顺序 */
private Integer orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 创建者 */
private String createBy;
/** 创建时间 */
private Date createTime;
/** 更新者 */
private String updateBy;
/** 更新时间 */
private Date updateTime;
/** 备注 */
private String remark;
/** 设置部门id */
public void setId(Integer id)
{
this.id = id;
}
/** 获取部门id */
public Integer getId()
{
return id;
}
/** 设置部门ID */
public void setDeptId(Integer deptId)
{
this.deptId = deptId;
}
/** 获取部门ID */
public Integer getDeptId()
{
return deptId;
}
/** 设置父部门id */
public void setParentId(Integer parentId)
{
this.parentId = parentId;
}
/** 获取父部门id */
public Integer getParentId()
{
return parentId;
}
/** 设置祖级列表 */
public void setParentIds(String parentIds)
{
this.parentIds = parentIds;
}
/** 获取祖级列表 */
public String getParentIds()
{
return parentIds;
}
/** 设置分类名称 */
public void setName(String name)
{
this.name = name;
}
/** 获取分类名称 */
public String getName()
{
return name;
}
/** 设置显示顺序 */
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
/** 获取显示顺序 */
public Integer getOrderNum()
{
return orderNum;
}
/** 设置删除标志0代表存在 2代表删除 */
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
/** 获取删除标志0代表存在 2代表删除 */
public String getDelFlag()
{
return delFlag;
}
/** 设置创建者 */
public void setCreateBy(String createBy)
{
this.createBy = createBy;
}
/** 获取创建者 */
public String getCreateBy()
{
return createBy;
}
/** 设置创建时间 */
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
/** 获取创建时间 */
public Date getCreateTime()
{
return createTime;
}
/** 设置更新者 */
public void setUpdateBy(String updateBy)
{
this.updateBy = updateBy;
}
/** 获取更新者 */
public String getUpdateBy()
{
return updateBy;
}
/** 设置更新时间 */
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
/** 获取更新时间 */
public Date getUpdateTime()
{
return updateTime;
}
/** 设置备注 */
public void setRemark(String remark)
{
this.remark = remark;
}
/** 获取备注 */
public String getRemark()
{
return remark;
}
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deptId", getDeptId())
.append("parentId", getParentId())
.append("parentIds", getParentIds())
.append("name", getName())
.append("orderNum", getOrderNum())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -1,194 +0,0 @@
package com.ruoyi.exam.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.base.BaseEntity;
import javax.persistence.Id;
import java.util.Date;
/**
* 课件分类表 train_courseware_category
*
* @author zhujj
* @date 2018-12-12
*/
public class TrainCoursewareCategory
{
private static final long serialVersionUID = 1L;
/** 部门id */
@Id
private Integer id;
/** 部门ID */
private Integer deptId;
/** 父部门id */
private Integer parentId;
/** 祖级列表 */
private String parentIds;
/** 部门名称 */
private String name;
/** 显示顺序 */
private Integer orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 创建者 */
private String createBy;
/** 创建时间 */
private Date createTime;
/** 更新者 */
private String updateBy;
/** 更新时间 */
private Date updateTime;
/** 备注 */
private String remark;
/** 设置部门id */
public void setId(Integer id)
{
this.id = id;
}
/** 获取部门id */
public Integer getId()
{
return id;
}
/** 设置部门ID */
public void setDeptId(Integer deptId)
{
this.deptId = deptId;
}
/** 获取部门ID */
public Integer getDeptId()
{
return deptId;
}
/** 设置父部门id */
public void setParentId(Integer parentId)
{
this.parentId = parentId;
}
/** 获取父部门id */
public Integer getParentId()
{
return parentId;
}
/** 设置祖级列表 */
public void setParentIds(String parentIds)
{
this.parentIds = parentIds;
}
/** 获取祖级列表 */
public String getParentIds()
{
return parentIds;
}
/** 设置部门名称 */
public void setName(String name)
{
this.name = name;
}
/** 获取部门名称 */
public String getName()
{
return name;
}
/** 设置显示顺序 */
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
/** 获取显示顺序 */
public Integer getOrderNum()
{
return orderNum;
}
/** 设置删除标志0代表存在 2代表删除 */
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
/** 获取删除标志0代表存在 2代表删除 */
public String getDelFlag()
{
return delFlag;
}
/** 设置创建者 */
public void setCreateBy(String createBy)
{
this.createBy = createBy;
}
/** 获取创建者 */
public String getCreateBy()
{
return createBy;
}
/** 设置创建时间 */
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
/** 获取创建时间 */
public Date getCreateTime()
{
return createTime;
}
/** 设置更新者 */
public void setUpdateBy(String updateBy)
{
this.updateBy = updateBy;
}
/** 获取更新者 */
public String getUpdateBy()
{
return updateBy;
}
/** 设置更新时间 */
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
/** 获取更新时间 */
public Date getUpdateTime()
{
return updateTime;
}
/** 设置备注 */
public void setRemark(String remark)
{
this.remark = remark;
}
/** 获取备注 */
public String getRemark()
{
return remark;
}
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deptId", getDeptId())
.append("parentId", getParentId())
.append("parentIds", getParentIds())
.append("name", getName())
.append("orderNum", getOrderNum())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -1,24 +0,0 @@
package com.ruoyi.exam.mapper;
import com.ruoyi.exam.domain.TrainCourseCategory;
import java.util.List;
import com.ruoyi.framework.web.base.MyMapper;
/**
* 课程分类 数据层
*
* @author zhujj
* @date 2018-12-12
*/
public interface TrainCourseCategoryMapper extends MyMapper<TrainCourseCategory>
{
/**
* 查询课程分类列表
*
* @param trainCourseCategory 课程分类信息
* @return 课程分类集合
*/
public List<TrainCourseCategory> selectTrainCourseCategoryList(TrainCourseCategory trainCourseCategory);
}

View File

@ -1,24 +0,0 @@
package com.ruoyi.exam.mapper;
import com.ruoyi.exam.domain.TrainCoursewareCategory;
import java.util.List;
import com.ruoyi.framework.web.base.MyMapper;
/**
* 课件分类 数据层
*
* @author zhujj
* @date 2018-12-12
*/
public interface TrainCoursewareCategoryMapper extends MyMapper<TrainCoursewareCategory>
{
/**
* 查询课件分类列表
*
* @param trainCoursewareCategory 课件分类信息
* @return 课件分类集合
*/
public List<TrainCoursewareCategory> selectTrainCoursewareCategoryList(TrainCoursewareCategory trainCoursewareCategory);
}

View File

@ -1,30 +0,0 @@
package com.ruoyi.exam.service;
import com.ruoyi.exam.domain.TrainCourseCategory;
import java.util.List;
import com.ruoyi.framework.web.base.AbstractBaseService;
/**
* 课程分类 服务层
*
* @author zhujj
* @date 2018-12-12
*/
public interface ITrainCourseCategoryService extends AbstractBaseService<TrainCourseCategory>
{
/**
* 查询课程分类分页列表
*
* @param trainCourseCategory 课程分类信息
* @return 课程分类集合
*/
public List<TrainCourseCategory> selectTrainCourseCategoryPage(TrainCourseCategory trainCourseCategory);
/**
* 查询课程分类列表
*
* @param trainCourseCategory 课程分类信息
* @return 课程分类集合
*/
public List<TrainCourseCategory> selectTrainCourseCategoryList(TrainCourseCategory trainCourseCategory);
}

View File

@ -1,30 +0,0 @@
package com.ruoyi.exam.service;
import com.ruoyi.exam.domain.TrainCoursewareCategory;
import java.util.List;
import com.ruoyi.framework.web.base.AbstractBaseService;
/**
* 课件分类 服务层
*
* @author zhujj
* @date 2018-12-12
*/
public interface ITrainCoursewareCategoryService extends AbstractBaseService<TrainCoursewareCategory>
{
/**
* 查询课件分类分页列表
*
* @param trainCoursewareCategory 课件分类信息
* @return 课件分类集合
*/
public List<TrainCoursewareCategory> selectTrainCoursewareCategoryPage(TrainCoursewareCategory trainCoursewareCategory);
/**
* 查询课件分类列表
*
* @param trainCoursewareCategory 课件分类信息
* @return 课件分类集合
*/
public List<TrainCoursewareCategory> selectTrainCoursewareCategoryList(TrainCoursewareCategory trainCoursewareCategory);
}

View File

@ -1,48 +0,0 @@
package com.ruoyi.exam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.exam.mapper.TrainCourseCategoryMapper;
import com.ruoyi.exam.domain.TrainCourseCategory;
import com.ruoyi.exam.service.ITrainCourseCategoryService;
import com.ruoyi.common.support.Convert;
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
/**
* 课程分类 服务层实现
*
* @author zhujj
* @date 2018-12-12
*/
@Service
public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<TrainCourseCategoryMapper,TrainCourseCategory> implements ITrainCourseCategoryService
{
@Autowired
private TrainCourseCategoryMapper trainCourseCategoryMapper;
/**
* 查询课程分类列表
*
* @param trainCourseCategory 课程分类信息
* @return 课程分类集合
*/
@Override
public List<TrainCourseCategory> selectTrainCourseCategoryList(TrainCourseCategory trainCourseCategory)
{
return trainCourseCategoryMapper.selectTrainCourseCategoryList(trainCourseCategory);
}
/**
* 查询课程分类分页列表
*
* @param trainCourseCategory 课程分类信息
* @return 课程分类集合
*/
@Override
public List<TrainCourseCategory> selectTrainCourseCategoryPage(TrainCourseCategory trainCourseCategory)
{
startPage();
return trainCourseCategoryMapper.selectTrainCourseCategoryList(trainCourseCategory);
}
}

View File

@ -1,48 +0,0 @@
package com.ruoyi.exam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.exam.mapper.TrainCoursewareCategoryMapper;
import com.ruoyi.exam.domain.TrainCoursewareCategory;
import com.ruoyi.exam.service.ITrainCoursewareCategoryService;
import com.ruoyi.common.support.Convert;
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
/**
* 课件分类 服务层实现
*
* @author zhujj
* @date 2018-12-12
*/
@Service
public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<TrainCoursewareCategoryMapper,TrainCoursewareCategory> implements ITrainCoursewareCategoryService
{
@Autowired
private TrainCoursewareCategoryMapper trainCoursewareCategoryMapper;
/**
* 查询课件分类列表
*
* @param trainCoursewareCategory 课件分类信息
* @return 课件分类集合
*/
@Override
public List<TrainCoursewareCategory> selectTrainCoursewareCategoryList(TrainCoursewareCategory trainCoursewareCategory)
{
return trainCoursewareCategoryMapper.selectTrainCoursewareCategoryList(trainCoursewareCategory);
}
/**
* 查询课件分类分页列表
*
* @param trainCoursewareCategory 课件分类信息
* @return 课件分类集合
*/
@Override
public List<TrainCoursewareCategory> selectTrainCoursewareCategoryPage(TrainCoursewareCategory trainCoursewareCategory)
{
startPage();
return trainCoursewareCategoryMapper.selectTrainCoursewareCategoryList(trainCoursewareCategory);
}
}

View File

@ -21,11 +21,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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
from train_course_category d
</sql>
<select id="selectRoleDeptTree" parameterType="Long" resultType="String">
select concat(d.id, d.name) as name
from train_courseware_category d
from train_course_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
@ -45,12 +45,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${params.dataScope}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where id = #{id} and del_flag = '0'
<select id="checkDeptExistCourse" parameterType="Long" resultType="int">
select count(1) from train_course where train_course_category_id = #{id} and del_flag = '0'
</select>
<select id="selectDeptCount" parameterType="TrainCourseCategory" resultType="int">
select count(1) from train_courseware_category
select count(1) from train_course_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>
@ -62,14 +62,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</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
select d.id, d.parent_id, d.parent_ids, d.name, d.order_num, d.del_flag,
(select name from train_course_category where id = d.parent_id) parent_name
from train_course_category d
where d.id = #{id}
</select>
<insert id="insertDept" parameterType="TrainCourseCategory">
insert into train_courseware_category(
insert into train_course_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>
@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateDept" parameterType="TrainCourseCategory">
update train_courseware_category
update train_course_category
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="name != null and name != ''">name = #{name},</if>
@ -105,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
update train_courseware_category set parent_ids =
update train_course_category set parent_ids =
<foreach collection="depts" item="item" index="index"
separator=" " open="case id" close="end">
when #{item.id} then #{item.parent_ids}
@ -118,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteDeptById" parameterType="Long">
update train_courseware_category set del_flag = '2' where id = #{id}
update train_course_category set del_flag = '2' where id = #{id}
</delete>
</mapper>

View File

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.courseware.mapper.TrainCoursewareCategoryMapper">
<resultMap type="TrainCourseCategory" id="TrainCoursewareCategoryResult">
<resultMap type="TrainCoursewareCategory" id="TrainCoursewareCategoryResult">
<id property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
@ -19,20 +19,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDeptVo">
<sql id="selectCategoryVo">
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="TrainCoursewareCategoryResult">
<include refid="selectDeptVo"/>
<select id="selectCategoryList" parameterType="TrainCourseCategory" resultMap="TrainCoursewareCategoryResult">
<include refid="selectCategoryVo"/>
where d.del_flag = '0'
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
@ -45,30 +38,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${params.dataScope}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where id = #{id} and del_flag = '0'
<select id="checkCategoryExistCourseware" parameterType="Long" resultType="int">
select count(1) from train_courseware where train_courseware_category_id = #{id} and del_flag = '0'
</select>
<select id="selectDeptCount" parameterType="TrainCourseCategory" resultType="int">
<select id="selectCategoryCount" 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="TrainCoursewareCategoryResult">
<include refid="selectDeptVo"/>
<select id="checkCategoryNameUnique" resultMap="TrainCoursewareCategoryResult">
<include refid="selectCategoryVo"/>
where name=#{name} and parent_id = #{parentId}
</select>
<select id="selectDeptById" parameterType="Long" resultMap="TrainCoursewareCategoryResult">
select d.id, d.parent_id, d.parent_ids, d.name, d.order_num,
<select id="selectCategoryById" parameterType="Long" resultMap="TrainCoursewareCategoryResult">
select d.id, d.parent_id, d.parent_ids, d.name, d.order_num, d.del_flag,
(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 id="insertCategory" 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>
@ -90,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</insert>
<update id="updateDept" parameterType="TrainCourseCategory">
<update id="updateCategory" parameterType="TrainCourseCategory">
update train_courseware_category
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
@ -104,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
<update id="updateCategoryChildren" parameterType="java.util.List">
update train_courseware_category set parent_ids =
<foreach collection="depts" item="item" index="index"
separator=" " open="case id" close="end">
@ -117,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</update>
<delete id="deleteDeptById" parameterType="Long">
<delete id="deleteCategoryById" parameterType="Long">
update train_courseware_category set del_flag = '2' where id = #{id}
</delete>

View File

@ -1,46 +0,0 @@
<?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.exam.mapper.TrainCourseCategoryMapper">
<resultMap type="TrainCourseCategory" id="TrainCourseCategoryResult">
<result 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="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectTrainCourseCategoryVo">
id, dept_id, parent_id, parent_ids, name, order_num, del_flag, create_by, create_time, update_by, update_time, remark </sql>
<select id="selectTrainCourseCategoryList" parameterType="TrainCourseCategory" resultMap="TrainCourseCategoryResult">
select
<include refid="selectTrainCourseCategoryVo"/>
from train_course_category
<where>
<if test="id != null "> and id = #{id}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="parentIds != null and parentIds != '' "> and parent_ids = #{parentIds}</if>
<if test="name != null and name != '' "> and name = #{name}</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="remark != null and remark != '' "> and remark = #{remark}</if>
</where>
</select>
</mapper>

View File

@ -1,46 +0,0 @@
<?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.exam.mapper.TrainCoursewareCategoryMapper">
<resultMap type="TrainCoursewareCategory" id="TrainCoursewareCategoryResult">
<result 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="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectTrainCoursewareCategoryVo">
id, dept_id, parent_id, parent_ids, name, order_num, del_flag, create_by, create_time, update_by, update_time, remark </sql>
<select id="selectTrainCoursewareCategoryList" parameterType="TrainCoursewareCategory" resultMap="TrainCoursewareCategoryResult">
select
<include refid="selectTrainCoursewareCategoryVo"/>
from train_courseware_category
<where>
<if test="id != null "> and id = #{id}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="parentIds != null and parentIds != '' "> and parent_ids = #{parentIds}</if>
<if test="name != null and name != '' "> and name = #{name}</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="remark != null and remark != '' "> and remark = #{remark}</if>
</where>
</select>
</mapper>

View File

@ -79,6 +79,7 @@
title: '操作',
align: 'left',
formatter: function(value, row, index) {
debugger
if (row.parentId != 0) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit">编辑</i></a> ');

View File

@ -16,7 +16,7 @@
<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">
<input class="form-control" type="text" name="name" th:field="*{name}" id="name">
</div>
</div>
<div class="form-group">
@ -26,28 +26,10 @@
</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>
<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}">
<input type="radio" th:id="${dict.dictCode}" name="delFlag" th:value="${dict.dictValue}" th:field="*{status}">
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
@ -56,11 +38,11 @@
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
var prefix = ctx + "course/category";
var prefix = ctx + "train/course/category";
$("#form-dept-edit").validate({
rules:{
deptName:{
name:{
required:true,
remote: {
url: prefix + "/checkDeptNameUnique",
@ -73,8 +55,8 @@
"parentId": function() {
return $("input[name='parentId']").val();
},
"deptName": function() {
return $.common.trim($("#deptName").val());
"name": function() {
return $.common.trim($("#name").val());
}
},
dataFilter: function(data, type) {
@ -94,7 +76,7 @@
},
},
messages: {
"deptName": {
"name": {
remote: "部门已经存在"
}
}

View File

@ -4,12 +4,12 @@
<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}" />
<form class="form-horizontal m" id="form-category-add">
<input id="treeId" name="parentId" type="hidden" th:value="${category.id}" />
<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.name}"/>
<input class="form-control" type="text" onclick="selectCategoryTree()" id="treeName" readonly="true" th:value="${category.name}"/>
</div>
</div>
<div class="form-group">
@ -24,29 +24,11 @@
<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}">
<input type="radio" th:id="${dict.dictCode}" name="delFlag" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
@ -55,14 +37,14 @@
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
var prefix = ctx + "courseware/category";
var prefix = ctx + "train/courseware/category";
$("#form-dept-add").validate({
$("#form-category-add").validate({
rules:{
name:{
required:true,
remote: {
url: prefix + "/checkDeptNameUnique",
url: prefix + "/checkCategoryNameUnique",
type: "post",
dataType: "json",
data: {
@ -98,16 +80,16 @@
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-dept-add').serialize());
$.operate.save(prefix + "/add", $('#form-category-add').serialize());
}
}
/*部门管理-新增-选择父部门树*/
function selectDeptTree() {
function selectCategoryTree() {
var options = {
title: '部门选择',
width: "380",
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
url: prefix + "/selectCategoryTree/" + $("#treeId").val(),
callBack: doSubmit
};
$.modal.openOptions(options);

View File

@ -81,9 +81,9 @@
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>');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit">编辑</i></a> ');
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.id + '\')"><i class="fa fa-plus">新增</i></a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-remove">删除</i></a>');
return actions.join('');
} else {
return "";

View File

@ -4,17 +4,17 @@
<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}">
<form class="form-horizontal m" id="form-category-edit" th:object="${category}">
<input name="id" type="hidden" th:field="*{id}" />
<input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
<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">
<input class="form-control" type="text" id="treeName" onclick="selectDeptTree()" readonly="true" th:field="*{parentName}"/>
<input class="form-control" type="text" id="treeName" onclick="selectCategoryTree()" readonly="true" th:field="*{parentName}"/>
</div>
</div>
<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">
<input class="form-control" type="text" name="name" th:field="*{name}" id="name">
</div>
@ -26,28 +26,10 @@
</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>
<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}">
<input type="radio" th:id="${dict.dictCode}" name="delFlag" th:value="${dict.dictValue}" th:field="*{delFlag}">
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
@ -56,14 +38,14 @@
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
var prefix = ctx + "courseware/category";
var prefix = ctx + "train/courseware/category";
$("#form-dept-edit").validate({
$("#form-category-edit").validate({
rules:{
name:{
required:true,
remote: {
url: prefix + "/checkDeptNameUnique",
url: prefix + "/checkCategoryNameUnique",
type: "post",
dataType: "json",
data: {
@ -102,18 +84,18 @@
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-dept-edit').serialize());
$.operate.save(prefix + "/edit", $('#form-category-edit').serialize());
}
}
/*部门管理-修改-选择部门树*/
function selectDeptTree() {
function selectCategoryTree() {
var id = $("#treeId").val();
if(id > 0) {
var options = {
title: '部门选择',
width: "380",
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
url: prefix + "/selectCategoryTree/" + $("#treeId").val(),
callBack: doSubmit
};
$.modal.openOptions(options);

View File

@ -8,8 +8,8 @@ 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}"/>
<input id="treeId" name="treeId" type="hidden" th:value="${category.id}"/>
<input id="treeName" name="treeName" type="hidden" th:value="${category.name}"/>
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
<label id="btnShow" title="显示搜索" style="display:none;"></label>
<label id="btnHide" title="隐藏搜索"></label>
@ -28,7 +28,7 @@ button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
<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 + "courseware/category/treeData";
var url = ctx + "train/courseware/category/treeData";
var options = {
url: url,
expandLevel: 2,