diff --git a/src/main/java/cn/com/tenlion/controller/api/teacher/TeacherController.java b/src/main/java/cn/com/tenlion/controller/api/teacher/TeacherController.java index f05983f..23efd35 100644 --- a/src/main/java/cn/com/tenlion/controller/api/teacher/TeacherController.java +++ b/src/main/java/cn/com/tenlion/controller/api/teacher/TeacherController.java @@ -1,5 +1,6 @@ package cn.com.tenlion.controller.api.teacher; +import cn.com.tenlion.institutionmanagement.pojo.dtos.institution.InstitutionDTO; import cn.com.tenlion.pojo.dtos.teacher.TeacherDTO; import cn.com.tenlion.pojo.vos.teacher.TeacherVO; import cn.com.tenlion.service.service.ITeacherService; @@ -106,5 +107,13 @@ public class TeacherController extends DefaultBaseController { public SuccessResult delete(@PathVariable("ids") String ids) throws RemoveException { return teacherService.delete(ids); } - + + @ApiOperation(value = "查询当前用户机构ID", notes = "查询当前用户机构ID接口") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("getorginfo") + public InstitutionDTO getOrgInfo() throws SearchException { + InstitutionDTO institutionDTO = teacherService.getOrgInfo(); + return institutionDTO; + } + } diff --git a/src/main/java/cn/com/tenlion/pojo/dtos/lessons/LessonsDTO.java b/src/main/java/cn/com/tenlion/pojo/dtos/lessons/LessonsDTO.java index c2f71d5..1d9eae6 100644 --- a/src/main/java/cn/com/tenlion/pojo/dtos/lessons/LessonsDTO.java +++ b/src/main/java/cn/com/tenlion/pojo/dtos/lessons/LessonsDTO.java @@ -16,6 +16,8 @@ public class LessonsDTO { @ApiModelProperty(name = "lessonId", value = "课程ID") private String lessonId; + @ApiModelProperty(name = "orgId", value = "组织机构ID") + private String orgId; @ApiModelProperty(name = "projectCatalogId", value = "培训项目类别ID") private String projectCatalogId; @ApiModelProperty(name = "lessonName", value = "课程名称") @@ -45,6 +47,14 @@ public class LessonsDTO { this.lessonId = lessonId; } + public String getOrgId() { + return orgId == null ? "" : orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + public String getProjectCatalogId() { return projectCatalogId == null ? "" : projectCatalogId.trim(); } diff --git a/src/main/java/cn/com/tenlion/pojo/vos/lessons/LessonsVO.java b/src/main/java/cn/com/tenlion/pojo/vos/lessons/LessonsVO.java index cb61a43..04a7d69 100644 --- a/src/main/java/cn/com/tenlion/pojo/vos/lessons/LessonsVO.java +++ b/src/main/java/cn/com/tenlion/pojo/vos/lessons/LessonsVO.java @@ -1,7 +1,5 @@ package cn.com.tenlion.pojo.vos.lessons; -import ink.wgink.annotation.CheckEmptyAnnotation; -import ink.wgink.annotation.CheckNumberAnnotation; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -18,6 +16,8 @@ public class LessonsVO { @ApiModelProperty(name = "lessonId", value = "课程ID") private String lessonId; + @ApiModelProperty(name = "orgId", value = "培训机构ID") + private String orgId; @ApiModelProperty(name = "projectCatalogId", value = "培训项目类别ID") private String projectCatalogId; @ApiModelProperty(name = "lessonName", value = "课程名称") @@ -35,6 +35,14 @@ public class LessonsVO { this.lessonId = lessonId; } + public String getOrgId() { + return orgId == null ? "" : orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + public String getProjectCatalogId() { return projectCatalogId == null ? "" : projectCatalogId.trim(); } diff --git a/src/main/java/cn/com/tenlion/service/service/ITeacherService.java b/src/main/java/cn/com/tenlion/service/service/ITeacherService.java index 6dd3b1b..fce05b3 100644 --- a/src/main/java/cn/com/tenlion/service/service/ITeacherService.java +++ b/src/main/java/cn/com/tenlion/service/service/ITeacherService.java @@ -1,5 +1,6 @@ package cn.com.tenlion.service.service; +import cn.com.tenlion.institutionmanagement.pojo.dtos.institution.InstitutionDTO; import cn.com.tenlion.pojo.dtos.teacher.TeacherDTO; import cn.com.tenlion.pojo.vos.teacher.TeacherVO; import ink.wgink.exceptions.RemoveException; @@ -76,4 +77,10 @@ public interface ITeacherService { * @return */ List list(Map params); + + /** + * 查询当前用户培训机构信息 + * @return + */ + InstitutionDTO getOrgInfo(); } diff --git a/src/main/java/cn/com/tenlion/service/service/impl/TeacherServiceImpl.java b/src/main/java/cn/com/tenlion/service/service/impl/TeacherServiceImpl.java index 302c885..2a4f05a 100644 --- a/src/main/java/cn/com/tenlion/service/service/impl/TeacherServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/service/impl/TeacherServiceImpl.java @@ -1,15 +1,18 @@ package cn.com.tenlion.service.service.impl; import cn.com.tenlion.dao.teacher.ITeacherDao; +import cn.com.tenlion.institutionmanagement.pojo.dtos.institution.InstitutionDTO; import cn.com.tenlion.pojo.dtos.teacher.TeacherDTO; import cn.com.tenlion.pojo.vos.teacher.TeacherVO; import cn.com.tenlion.service.service.ITeacherService; +import cn.com.tenlion.service.traininginstitutionuser.ITrainingInstitutionUserService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import ink.wgink.common.base.DefaultBaseService; import ink.wgink.exceptions.RemoveException; import ink.wgink.exceptions.SearchException; import ink.wgink.pojo.ListPage; +import ink.wgink.pojo.bos.UserInfoBO; import ink.wgink.pojo.result.SuccessResult; import ink.wgink.pojo.result.SuccessResultData; import ink.wgink.pojo.result.SuccessResultList; @@ -34,6 +37,8 @@ public class TeacherServiceImpl extends DefaultBaseService implements ITeacherSe @Autowired private ITeacherDao teacherDao; + @Autowired + private ITrainingInstitutionUserService trainingInstitutionUserService; @Override public SuccessResultList> listPage(ListPage page) throws SearchException { @@ -104,4 +109,11 @@ public class TeacherServiceImpl extends DefaultBaseService implements ITeacherSe teacherDao.delete(params); return new SuccessResult(); } + + @Override + public InstitutionDTO getOrgInfo() { + UserInfoBO currentUser = securityComponent.getCurrentUser(); + InstitutionDTO institutionDTO = trainingInstitutionUserService.getByUserId(currentUser.getUserId()); + return institutionDTO; + } } diff --git a/src/main/resources/mybatis/mapper/classplan/class-plan-mapper.xml b/src/main/resources/mybatis/mapper/classplan/class-plan-mapper.xml index 9021a1c..4a7cc41 100644 --- a/src/main/resources/mybatis/mapper/classplan/class-plan-mapper.xml +++ b/src/main/resources/mybatis/mapper/classplan/class-plan-mapper.xml @@ -289,6 +289,9 @@ AND t1.worker_catalog = #{workerCatalog} + + AND t1.org_id = #{orgId} + AND ( t1.id LIKE CONCAT('%', #{keywords}, '%') diff --git a/src/main/resources/mybatis/mapper/lessons/lessons-mapper.xml b/src/main/resources/mybatis/mapper/lessons/lessons-mapper.xml index c2b2fd1..204b71e 100644 --- a/src/main/resources/mybatis/mapper/lessons/lessons-mapper.xml +++ b/src/main/resources/mybatis/mapper/lessons/lessons-mapper.xml @@ -4,6 +4,7 @@ + @@ -45,6 +46,7 @@ INSERT INTO e_lessons( lesson_id, + org_id, project_catalog_id, lesson_name, lesson_type, @@ -56,6 +58,7 @@ is_delete ) VALUES( #{lessonId}, + #{orgId}, #{projectCatalogId}, #{lessonName}, #{lessonType}, @@ -182,19 +185,18 @@ @@ -235,9 +236,16 @@ var wangEditorObj = {}; var viewerObj = {}; var teacherList = []; + var orgId = top.restAjax.params(window.location.href).orgId; + var orgName = top.restAjax.params(window.location.href).orgName; // 初始化内容 function initData() { + var dataObj = {} + dataObj['orgId'] = orgId; + dataObj['orgName'] = orgName; + form.val('dataForm',dataObj); + form.render(); initPlanStartTimeDateTime(); initPlanEndTimeDateTime(); initSignUpStartTimeDateTime(); @@ -248,16 +256,18 @@ //查询课程列表 function initLessonsList(){ + var dataObj = {}; var projectCatalogId = $('#projectCatalogId').val(); if(projectCatalogId == ''){ - laytpl(document.getElementById('lessonTbodyTemplate').innerHTML).render([], function(html) { + dataObj['lesson'] = []; + dataObj['teacher'] = []; + laytpl(document.getElementById('lessonTbodyTemplate').innerHTML).render(dataObj, function(html) { document.getElementById('lessonTbodyBox').innerHTML = html; }); form.render(); return; } top.restAjax.get(top.restAjax.path('api/lessons/list',[]), {projectCatalogId : projectCatalogId}, null, function(code,data){ - var dataObj = {}; dataObj['lesson'] = data; dataObj['teacher'] = teacherList; laytpl(document.getElementById('lessonTbodyTemplate').innerHTML).render(dataObj, function(html) { diff --git a/src/main/resources/static/route/lessons/list.html b/src/main/resources/static/route/lessons/list.html index 2a963ba..9fd55a9 100644 --- a/src/main/resources/static/route/lessons/list.html +++ b/src/main/resources/static/route/lessons/list.html @@ -68,6 +68,22 @@ var tableUrl = 'api/lessons/listpage'; var projectCatalogId = top.restAjax.params(window.location.href).projectCatalogId; var projectCatalogName = top.restAjax.params(window.location.href).parentName; + var orgInfo = {}; + + function initData(){ + initDate(); + getOrgInfo() + } + initData(); + + function getOrgInfo(){ + top.restAjax.get(top.restAjax.path('api/teacher/getorginfo', []), {}, null, function (code, data) { + orgInfo = data; + initTable(); + }, function (code, data) { + top.dialog.msg(data.msg); + }); + } // 初始化表格 function initTable() { @@ -84,6 +100,9 @@ pageName: 'page', limitName: 'rows' }, + where : { + orgId : orgInfo.institutionId + }, cols: [ [ {type:'checkbox', fixed: 'left'}, @@ -140,6 +159,7 @@ } }); } + // 重载表格 function reloadTable(currentPage) { table.reload('dataTable', { @@ -148,7 +168,8 @@ keywords: $('#keywords').val(), startTime: $('#startTime').val(), endTime: $('#endTime').val(), - projectCatalogId : projectCatalogId + projectCatalogId : projectCatalogId, + orgId : orgInfo.institutionId }, page: { curr: currentPage @@ -190,8 +211,7 @@ } }); } - initTable(); - initDate(); + // 事件 - 页面变化 $win.on('resize', function() { clearTimeout(resizeTimeout); @@ -209,6 +229,11 @@ var checkStatus = table.checkStatus('dataTable'); var checkDatas = checkStatus.data; if(layEvent === 'saveEvent') { + if(typeof (orgInfo.institutionId) === 'undefined' + || orgInfo.institutionId == ''){ + layer.msg('当前用户未绑定机构信息'); + return; + } layer.open({ type: 2, title: false, @@ -216,8 +241,10 @@ area: ['100%', '100%'], shadeClose: true, anim: 2, - content: top.restAjax.path('route/lessons/save.html?projectCatalogId={projectCatalogId}&projectCatalogName={projectCatalogName}', - [projectCatalogId,projectCatalogName]), + content: top.restAjax.path('route/lessons/save.html' + + '?projectCatalogId={projectCatalogId}&projectCatalogName={projectCatalogName}' + + '&orgId={orgId}', + [projectCatalogId,projectCatalogName,orgInfo.institutionId]), end: function() { reloadTable(); } diff --git a/src/main/resources/static/route/lessons/save.html b/src/main/resources/static/route/lessons/save.html index b628647..9453c77 100644 --- a/src/main/resources/static/route/lessons/save.html +++ b/src/main/resources/static/route/lessons/save.html @@ -22,11 +22,12 @@
+
+ -
@@ -83,12 +84,14 @@ var viewerObj = {}; var projectCatalogId = top.restAjax.params(window.location.href).projectCatalogId; var projectCatalogName = top.restAjax.params(window.location.href).projectCatalogName; + var orgId = top.restAjax.params(window.location.href).orgId; // 初始化内容 function initData() { var dataObj = {}; dataObj['projectCatalogId'] = projectCatalogId; dataObj['projectCatalogName'] = projectCatalogName; + dataObj['orgId'] = orgId; form.val('dataForm', dataObj); form.render(null, 'dataForm'); } diff --git a/src/main/resources/static/route/teacher/list-teacher.html b/src/main/resources/static/route/teacher/list-teacher.html index 4b782d4..3f2e469 100644 --- a/src/main/resources/static/route/teacher/list-teacher.html +++ b/src/main/resources/static/route/teacher/list-teacher.html @@ -59,12 +59,22 @@ var laydate = layui.laydate; var resizeTimeout = null; var tableUrl = 'api/teacher/listpage'; + var orgInfo = {}; function initData(){ - initTable(); + getOrgInfo(); } initData(); + function getOrgInfo(){ + top.restAjax.get(top.restAjax.path('api/teacher/getorginfo', []), {}, null, function (code, data) { + orgInfo = data; + initTable(); + }, function (code, data) { + top.dialog.msg(data.msg); + }); + } + // 事件 - 页面变化 $win.on('resize', function() { clearTimeout(resizeTimeout); @@ -92,6 +102,9 @@ pageName: 'page', limitName: 'rows' }, + where : { + orgId : orgInfo.institutionId + }, cols: [ [ {type:'checkbox', fixed: 'left'}, @@ -211,6 +224,7 @@ url: top.restAjax.path(tableUrl, []), where: { keywords: $('#keywords').val(), + orgId : orgInfo.institutionId }, page: { curr: currentPage @@ -224,6 +238,11 @@ var checkStatus = table.checkStatus('dataTable'); var checkDatas = checkStatus.data; if(layEvent === 'saveEvent') { + if(typeof (orgInfo.institutionId) === 'undefined' + || orgInfo.institutionId == ''){ + layer.msg('当前用户未绑定机构信息'); + return; + } layer.open({ type: 2, title: false, @@ -231,7 +250,8 @@ area: ['100%', '100%'], shadeClose: true, anim: 2, - content: top.restAjax.path('route/teacher/save.html', []), + content: top.restAjax.path('route/teacher/save.html?orgId={orgId}&orgName={orgName}', + [orgInfo.institutionId,orgInfo.institutionName]), end: function() { reloadTable(); } diff --git a/src/main/resources/static/route/teacher/save.html b/src/main/resources/static/route/teacher/save.html index 78fc60e..a31d66b 100644 --- a/src/main/resources/static/route/teacher/save.html +++ b/src/main/resources/static/route/teacher/save.html @@ -27,7 +27,8 @@
- + +
@@ -189,9 +190,16 @@ var laytpl = layui.laytpl; var laydate = layui.laydate; var viewerObj = {}; + var orgId = top.restAjax.params(window.location.href).orgId; + var orgName = top.restAjax.params(window.location.href).orgName; // 初始化内容 function initData() { + var dataObj = {} + dataObj['orgId'] = orgId; + dataObj['orgName'] = orgName; + form.val('dataForm',dataObj); + form.render(); initGenderSelect(); initNationSelect(); initPoliticalStatusSelect();