增加教师管理部分判断

This commit is contained in:
sk1551 2020-05-09 16:59:35 +08:00
parent 659f5e38d4
commit bf1836db64
3 changed files with 22 additions and 9 deletions

View File

@ -51,7 +51,7 @@ public class BySchoolcalendarClassController extends BaseController
String strClassId = schoolCommon.getClassId();
if(!schoolCommon.isStringEmpty(strClassId)){
startPage();
bySchoolcalendarClass.setClassid(schoolCommon.getClassId());
bySchoolcalendarClass.setClassid(strClassId);
List<BySchoolcalendarClass> list = bySchoolcalendarClassService.selectBySchoolcalendarClassList(bySchoolcalendarClass);
System.out.println("---------------------分页"+list);
return getDataTable(list);
@ -105,6 +105,7 @@ public class BySchoolcalendarClassController extends BaseController
public AjaxResult add(@RequestBody BySchoolcalendarClass bySchoolcalendarClass)
{
String strClassId = schoolCommon.getClassId();
//判断当前用户是否有班级
if(!schoolCommon.isStringEmpty(strClassId)) {
//设置创建时间为当前时间
bySchoolcalendarClass.setCreatetime(new Date());
@ -130,7 +131,11 @@ public class BySchoolcalendarClassController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody BySchoolcalendarClass bySchoolcalendarClass)
{
return toAjax(bySchoolcalendarClassService.updateBySchoolcalendarClass(bySchoolcalendarClass));
if(!schoolCommon.isStringEmpty(schoolCommon.getClassId())){
return toAjax(bySchoolcalendarClassService.updateBySchoolcalendarClass(bySchoolcalendarClass));
}else{
return AjaxResult.error("当前用户下没有班级,无法修改园历");
}
}
/**
@ -141,6 +146,12 @@ public class BySchoolcalendarClassController extends BaseController
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(bySchoolcalendarClassService.deleteBySchoolcalendarClassByIds(ids));
//判断当前用户下是否有班级
if(!schoolCommon.isStringEmpty(schoolCommon.getClassId())) {
return toAjax(bySchoolcalendarClassService.deleteBySchoolcalendarClassByIds(ids));
}else {
return AjaxResult.error("当前用户下没有班级,无法删除园历");
}
}
}

View File

@ -67,6 +67,7 @@ public class SchoolCommon {
return sysDept;
}
//获取用户信息
public SysUser getUser() {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUser().getUserId();
@ -101,14 +102,16 @@ public class SchoolCommon {
public String getClassId() {
SysUser sysUser = getUser();
ByClass byClass = new ByClass();
//根据用户id来设置主班教师,配班教师,助理教师的教师id
byClass.setZbjs(sysUser.getUserId());
byClass.setPbjs(sysUser.getUserId());
byClass.setZljs(sysUser.getUserId());
//新的返回byclass1返回整条数据
ByClass byClass1 = byClassService.selectByClassByUserId(byClass);
System.out.println("--------------------"+ byClass1);
if(byClass1 != null) {
return byClass1.getBjbh();
//新的返回byclassNew返回整条数据
ByClass byClassNew = byClassService.selectByClassByUserId(byClass);
System.out.println("--------------------"+ byClassNew);
if(byClassNew != null) {
//如果实体byclassnew不为空,那么取出它的班级编号
return byClassNew.getBjbh();
} else {
return "";
}

View File

@ -46,7 +46,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.bjbh, c.bjmc
from by_schoolcalendar_class sc, by_class c
<where>
<if test="name != null and name != ''"> and sc.name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and sc.type = #{type}</if>
<if test="classid != null and classid != ''"> and sc.classid = #{classid}</if>