优化启动报错
This commit is contained in:
parent
a7761180c7
commit
5e19dfbbc5
|
|
@ -32,16 +32,16 @@ public class TrainCourseCategoryController extends BaseController {
|
|||
|
||||
@RequiresPermissions("train:course:category:view")
|
||||
@GetMapping()
|
||||
public String dept() {
|
||||
public String category() {
|
||||
return prefix + "/category";
|
||||
}
|
||||
|
||||
@RequiresPermissions("train:course:category:list")
|
||||
@GetMapping("/list")
|
||||
@ResponseBody
|
||||
public List<TrainCourseCategory> list(TrainCourseCategory dept) {
|
||||
List<TrainCourseCategory> deptList = trainCourseCategoryService.selectDeptList( dept );
|
||||
return deptList;
|
||||
public List<TrainCourseCategory> list(TrainCourseCategory category) {
|
||||
List<TrainCourseCategory> categoryList = trainCourseCategoryService.selectCategoryList( category );
|
||||
return categoryList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -49,7 +49,7 @@ public class TrainCourseCategoryController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/add/{parentId}")
|
||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) {
|
||||
mmap.put( "dept", trainCourseCategoryService.selectDeptById( parentId ) );
|
||||
mmap.put( "category", trainCourseCategoryService.selectCategoryById( parentId ) );
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
|
|
@ -60,9 +60,9 @@ 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 category) {
|
||||
category.setCreateBy( ShiroUtils.getLoginName() );
|
||||
return toAjax( trainCourseCategoryService.insertCategory( category ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -70,11 +70,11 @@ public class TrainCourseCategoryController extends BaseController {
|
|||
*/
|
||||
@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( "无" );
|
||||
TrainCourseCategory category = trainCourseCategoryService.selectCategoryById( id );
|
||||
if (StringUtils.isNotNull( category ) && 100L == id) {
|
||||
category.setParentName( "无" );
|
||||
}
|
||||
mmap.put( "dept", dept );
|
||||
mmap.put( "category", category );
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
|
|
@ -85,9 +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 category) {
|
||||
category.setUpdateBy( ShiroUtils.getLoginName() );
|
||||
return toAjax( trainCourseCategoryService.updateCategory( category ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -98,30 +98,30 @@ public class TrainCourseCategoryController extends BaseController {
|
|||
@PostMapping("/remove/{id}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(@PathVariable("id") Long id) {
|
||||
if (trainCourseCategoryService.selectDeptCount( id ) > 0) {
|
||||
if (trainCourseCategoryService.selectCategoryCount( id ) > 0) {
|
||||
return error( 1, "存在下级课程分类,不允许删除" );
|
||||
}
|
||||
if (trainCourseCategoryService.checkDeptExistUser( id )) {
|
||||
if (trainCourseCategoryService.checkCategoryExistCourse( id )) {
|
||||
return error( 1, "课程分类存在用户,不允许删除" );
|
||||
}
|
||||
return toAjax( trainCourseCategoryService.deleteDeptById( id ) );
|
||||
return toAjax( trainCourseCategoryService.deleteCategoryById( id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验课程分类名称
|
||||
*/
|
||||
@PostMapping("/checkDeptNameUnique")
|
||||
@PostMapping("/checkCategoryNameUnique")
|
||||
@ResponseBody
|
||||
public String checkDeptNameUnique(TrainCourseCategory dept) {
|
||||
return trainCourseCategoryService.checkDeptNameUnique( dept );
|
||||
public String checkCategoryNameUnique(TrainCourseCategory category) {
|
||||
return trainCourseCategoryService.checkCategoryNameUnique( category );
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择课程分类树
|
||||
*/
|
||||
@GetMapping("/selectDeptTree/{id}")
|
||||
public String selectDeptTree(@PathVariable("id") Long id, ModelMap mmap) {
|
||||
mmap.put( "dept", trainCourseCategoryService.selectDeptById( id ) );
|
||||
@GetMapping("/selectCategoryTree/{id}")
|
||||
public String selectCategoryTree(@PathVariable("id") Long id, ModelMap mmap) {
|
||||
mmap.put( "category", trainCourseCategoryService.selectCategoryById( id ) );
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ public class TrainCourseCategoryController extends BaseController {
|
|||
@GetMapping("/treeData")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> treeData() {
|
||||
List<Map<String, Object>> tree = trainCourseCategoryService.selectDeptTree();
|
||||
List<Map<String, Object>> tree = trainCourseCategoryService.selectCategoryTree();
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,72 +19,72 @@ public interface TrainCourseCategoryMapper extends MyMapper<TrainCourseCategory>
|
|||
* @param dept 课程分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int selectDeptCount(TrainCourseCategory dept);
|
||||
public int selectCategoryCount(TrainCourseCategory category);
|
||||
|
||||
/**
|
||||
* 查询课程分类是否存在用户
|
||||
*
|
||||
* @param deptId 课程分类ID
|
||||
* @param id 课程分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int checkDeptExistUser(Long deptId);
|
||||
public int checkCategoryExistCourse(Long id);
|
||||
|
||||
/**
|
||||
* 查询课程分类管理数据
|
||||
*
|
||||
* @param dept 课程分类信息
|
||||
* @param category 课程分类信息
|
||||
* @return 课程分类信息集合
|
||||
*/
|
||||
public List<TrainCourseCategory> selectDeptList(TrainCourseCategory dept);
|
||||
public List<TrainCourseCategory> selectCategoryList(TrainCourseCategory 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(TrainCourseCategory dept);
|
||||
public int insertCategory(TrainCourseCategory category);
|
||||
|
||||
/**
|
||||
* 修改课程分类信息
|
||||
*
|
||||
* @param dept 课程分类信息
|
||||
* @param category 课程分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDept(TrainCourseCategory dept);
|
||||
public int updateCategory(TrainCourseCategory category);
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
* @param depts 子元素
|
||||
* @param ids 子元素
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeptChildren(@Param("depts") List<TrainCourseCategory> depts);
|
||||
public int updateCategoryChildren(@Param("ids") List<TrainCourseCategory> ids);
|
||||
|
||||
/**
|
||||
* 根据课程分类ID查询信息
|
||||
*
|
||||
* @param deptId 课程分类ID
|
||||
* @param id 课程分类ID
|
||||
* @return 课程分类信息
|
||||
*/
|
||||
public TrainCourseCategory selectDeptById(Long deptId);
|
||||
public TrainCourseCategory selectCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 校验课程分类名称是否唯一
|
||||
*
|
||||
* @param deptName 课程分类名称
|
||||
* @param name 课程分类名称
|
||||
* @param parentId 父课程分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public TrainCourseCategory checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
|
||||
public TrainCourseCategory checkCategoryNameUnique(@Param("name") String name, @Param("parentId") Long parentId);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询课程分类
|
||||
|
|
@ -92,5 +92,5 @@ public interface TrainCourseCategoryMapper extends MyMapper<TrainCourseCategory>
|
|||
* @param roleId 角色ID
|
||||
* @return 课程分类列表
|
||||
*/
|
||||
public List<String> selectRoleDeptTree(Long roleId);
|
||||
public List<String> selectRoleCategoryTree(Long roleId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,81 +8,81 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* 课程分类管理 服务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ITrainCourseCategoryService extends AbstractBaseService<TrainCourseCategory>
|
||||
{
|
||||
/**
|
||||
* 查询课程分类管理数据
|
||||
*
|
||||
* @param dept 课程分类信息
|
||||
*
|
||||
* @param category 课程分类信息
|
||||
* @return 课程分类信息集合
|
||||
*/
|
||||
public List<TrainCourseCategory> selectDeptList(TrainCourseCategory dept);
|
||||
public List<TrainCourseCategory> selectCategoryList(TrainCourseCategory 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 checkCategoryExistCourse(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(TrainCourseCategory dept);
|
||||
public int insertCategory(TrainCourseCategory category);
|
||||
|
||||
/**
|
||||
* 修改保存课程分类信息
|
||||
*
|
||||
* @param dept 课程分类信息
|
||||
*
|
||||
* @param category 课程分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDept(TrainCourseCategory dept);
|
||||
public int updateCategory(TrainCourseCategory category);
|
||||
|
||||
/**
|
||||
* 根据课程分类ID查询信息
|
||||
*
|
||||
* @param deptId 课程分类ID
|
||||
*
|
||||
* @param id 课程分类ID
|
||||
* @return 课程分类信息
|
||||
*/
|
||||
public TrainCourseCategory selectDeptById(Long deptId);
|
||||
public TrainCourseCategory selectCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 校验课程分类名称是否唯一
|
||||
*
|
||||
* @param dept 课程分类信息
|
||||
*
|
||||
* @param category 课程分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkDeptNameUnique(TrainCourseCategory dept);
|
||||
public String checkCategoryNameUnique(TrainCourseCategory category);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
*/
|
||||
@Override
|
||||
@DataScope(tableAlias = "d")
|
||||
public List<TrainCourseCategory> selectDeptList(TrainCourseCategory dept) {
|
||||
return trainCourseCategoryMapper.selectDeptList( dept );
|
||||
public List<TrainCourseCategory> selectCategoryList(TrainCourseCategory dept) {
|
||||
return trainCourseCategoryMapper.selectCategoryList( dept );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -43,8 +43,8 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
* @return 所有课程分类信息
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectDeptTree() {
|
||||
List<TrainCourseCategory> deptList = selectDeptList( new TrainCourseCategory() );
|
||||
public List<Map<String, Object>> selectCategoryTree() {
|
||||
List<TrainCourseCategory> deptList = selectCategoryList( new TrainCourseCategory() );
|
||||
List<Map<String, Object>> trees = getTrees( deptList, false, null );
|
||||
return trees;
|
||||
}
|
||||
|
|
@ -55,10 +55,10 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
*
|
||||
* @param deptList 课程分类列表
|
||||
* @param isCheck 是否需要选中
|
||||
* @param roleDeptList 角色已存在菜单列表
|
||||
* @param roleCategoryList 角色已存在菜单列表
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getTrees(List<TrainCourseCategory> deptList, boolean isCheck, List<String> roleDeptList) {
|
||||
public List<Map<String, Object>> getTrees(List<TrainCourseCategory> deptList, boolean isCheck, List<String> roleCategoryList) {
|
||||
|
||||
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
||||
for (TrainCourseCategory dept : deptList) {
|
||||
|
|
@ -69,7 +69,7 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
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 );
|
||||
}
|
||||
|
|
@ -86,10 +86,10 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int selectDeptCount(Long parentId) {
|
||||
public int selectCategoryCount(Long parentId) {
|
||||
TrainCourseCategory dept = new TrainCourseCategory();
|
||||
dept.setParentId( parentId );
|
||||
return trainCourseCategoryMapper.selectDeptCount( dept );
|
||||
return trainCourseCategoryMapper.selectCategoryCount( dept );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -99,8 +99,8 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
@Override
|
||||
public boolean checkDeptExistUser(Long deptId) {
|
||||
int result = trainCourseCategoryMapper.checkDeptExistUser( deptId );
|
||||
public boolean checkCategoryExistCourse(Long deptId) {
|
||||
int result = trainCourseCategoryMapper.checkCategoryExistCourse( deptId );
|
||||
return result > 0 ? true : false;
|
||||
}
|
||||
|
||||
|
|
@ -111,8 +111,8 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeptById(Long deptId) {
|
||||
return trainCourseCategoryMapper.deleteDeptById( deptId );
|
||||
public int deleteCategoryById(Long deptId) {
|
||||
return trainCourseCategoryMapper.deleteCategoryById( deptId );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -122,10 +122,10 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDept(TrainCourseCategory dept) {
|
||||
TrainCourseCategory info = trainCourseCategoryMapper.selectDeptById( dept.getParentId() );
|
||||
public int insertCategory(TrainCourseCategory dept) {
|
||||
TrainCourseCategory info = trainCourseCategoryMapper.selectCategoryById( dept.getParentId() );
|
||||
dept.setParentIds( info.getParentIds() + "," + dept.getParentId() );
|
||||
return trainCourseCategoryMapper.insertDept( dept );
|
||||
return trainCourseCategoryMapper.insertCategory( dept );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -135,14 +135,14 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDept(TrainCourseCategory dept) {
|
||||
TrainCourseCategory info = trainCourseCategoryMapper.selectDeptById( dept.getParentId() );
|
||||
public int updateCategory(TrainCourseCategory dept) {
|
||||
TrainCourseCategory info = trainCourseCategoryMapper.selectCategoryById( dept.getParentId() );
|
||||
if (StringUtils.isNotNull( info )) {
|
||||
String ancestors = info.getParentIds() + "," + dept.getParentId();
|
||||
dept.setParentIds( ancestors );
|
||||
updateDeptChildren( dept.getDeptId(), ancestors );
|
||||
updateCategoryChildren( dept.getId(), ancestors );
|
||||
}
|
||||
return trainCourseCategoryMapper.updateDept( dept );
|
||||
return trainCourseCategoryMapper.updateCategory( dept );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -151,15 +151,15 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
* @param deptId 课程分类ID
|
||||
* @param ancestors 元素列表
|
||||
*/
|
||||
public void updateDeptChildren(Long deptId, String ancestors) {
|
||||
public void updateCategoryChildren(Long deptId, String ancestors) {
|
||||
TrainCourseCategory dept = new TrainCourseCategory();
|
||||
dept.setParentId( deptId );
|
||||
List<TrainCourseCategory> childrens = trainCourseCategoryMapper.selectDeptList( dept );
|
||||
List<TrainCourseCategory> childrens = trainCourseCategoryMapper.selectCategoryList( dept );
|
||||
for (TrainCourseCategory children : childrens) {
|
||||
children.setParentIds( ancestors + "," + dept.getParentId() );
|
||||
}
|
||||
if (childrens.size() > 0) {
|
||||
trainCourseCategoryMapper.updateDeptChildren( childrens );
|
||||
trainCourseCategoryMapper.updateCategoryChildren( childrens );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -170,8 +170,8 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
* @return 课程分类信息
|
||||
*/
|
||||
@Override
|
||||
public TrainCourseCategory selectDeptById(Long deptId) {
|
||||
return trainCourseCategoryMapper.selectDeptById( deptId );
|
||||
public TrainCourseCategory selectCategoryById(Long deptId) {
|
||||
return trainCourseCategoryMapper.selectCategoryById( deptId );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -181,10 +181,10 @@ public class TrainCourseCategoryServiceImpl extends AbstractBaseServiceImpl<Trai
|
|||
* @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()) {
|
||||
public String checkCategoryNameUnique(TrainCourseCategory dept) {
|
||||
Long deptId = StringUtils.isNull( dept.getId() ) ? -1L : dept.getId();
|
||||
TrainCourseCategory info = trainCourseCategoryMapper.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;
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ 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_course_category d
|
||||
</sql>
|
||||
<select id="selectRoleDeptTree" parameterType="Long" resultType="String">
|
||||
<select id="selectRoleCategoryTree" parameterType="Long" resultType="String">
|
||||
select concat(d.id, d.name) as name
|
||||
from train_course_category d
|
||||
left join sys_role_dept rd on d.id = rd.id
|
||||
|
|
@ -31,8 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
order by d.parent_id, d.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectDeptList" parameterType="TrainCourseCategory" resultMap="TrainCourseCategoryResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
<select id="selectCategoryList" parameterType="TrainCourseCategory" resultMap="TrainCourseCategoryResult">
|
||||
<include refid="selectCategoryVo"/>
|
||||
where d.del_flag = '0'
|
||||
<if test="parentId != null and parentId != 0">
|
||||
AND parent_id = #{parentId}
|
||||
|
|
@ -45,30 +45,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="checkDeptExistCourse" parameterType="Long" resultType="int">
|
||||
<select id="checkCategoryExistCourse" 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 id="selectCategoryCount" parameterType="TrainCourseCategory" resultType="int">
|
||||
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>
|
||||
</select>
|
||||
|
||||
<select id="checkDeptNameUnique" resultMap="TrainCourseCategoryResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
<select id="checkCategoryNameUnique" resultMap="TrainCourseCategoryResult">
|
||||
<include refid="selectCategoryVo"/>
|
||||
where name=#{name} and parent_id = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="selectDeptById" parameterType="Long" resultMap="TrainCourseCategoryResult">
|
||||
<select id="selectCategoryById" parameterType="Long" resultMap="TrainCourseCategoryResult">
|
||||
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 id="insertCategory" parameterType="TrainCourseCategory">
|
||||
insert into train_course_category(
|
||||
<if test="id != null and id != 0">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>
|
||||
|
||||
<update id="updateDept" parameterType="TrainCourseCategory">
|
||||
<update id="updateCategory" parameterType="TrainCourseCategory">
|
||||
update train_course_category
|
||||
<set>
|
||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||
|
|
@ -104,20 +104,20 @@ 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_course_category set parent_ids =
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
<foreach collection="ids" 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"
|
||||
<foreach collection="ids" item="item" index="index"
|
||||
separator="," open="(" close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeptById" parameterType="Long">
|
||||
<delete id="deleteCategoryById" parameterType="Long">
|
||||
update train_course_category set del_flag = '2' where id = #{id}
|
||||
</delete>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,18 +4,18 @@
|
|||
<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.deptName}"/>
|
||||
<input class="form-control" type="text" onclick="selectCategoryTree()" id="treeName" readonly="true" th:value="${category.name}"/>
|
||||
</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">
|
||||
<input class="form-control" type="text" name="name" id="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>
|
||||
|
|
@ -57,20 +39,20 @@
|
|||
<script type="text/javascript">
|
||||
var prefix = ctx + "course/category";
|
||||
|
||||
$("#form-dept-add").validate({
|
||||
$("#form-category-add").validate({
|
||||
rules:{
|
||||
deptName:{
|
||||
name:{
|
||||
required:true,
|
||||
remote: {
|
||||
url: prefix + "/checkDeptNameUnique",
|
||||
url: prefix + "/checkCategoryNameUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"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) {
|
||||
|
|
@ -90,24 +72,24 @@
|
|||
},
|
||||
},
|
||||
messages: {
|
||||
"deptName": {
|
||||
remote: "部门已经存在"
|
||||
"name": {
|
||||
remote: "分类已经存在"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="dept-form">
|
||||
<form id="category-form">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
部门名称:<input type="text" name="deptName"/>
|
||||
分类名称:<input type="text" name="name"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
<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}" />
|
||||
<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>
|
||||
<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">
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
<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="delFlag" 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>
|
||||
|
|
@ -40,17 +40,17 @@
|
|||
<script type="text/javascript">
|
||||
var prefix = ctx + "train/course/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: {
|
||||
"deptId": function() {
|
||||
return $("#deptId").val();
|
||||
"id": function() {
|
||||
return $("#id").val();
|
||||
},
|
||||
"parentId": function() {
|
||||
return $("input[name='parentId']").val();
|
||||
|
|
@ -84,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() {
|
||||
var deptId = $("#treeId").val();
|
||||
if(deptId > 0) {
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
部门名称:<input type="text" name="deptName"/>
|
||||
分类名称:<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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue