20200416-zlp-1
班级管理
This commit is contained in:
parent
b327803c09
commit
3cddf5586a
Binary file not shown.
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 2.8 KiB |
@ -26,7 +26,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '本一智慧平台管理系统',
|
||||
title: '本一智慧平台',
|
||||
logo: logoImg
|
||||
}
|
||||
}
|
||||
|
@ -96,24 +96,12 @@
|
||||
|
||||
<el-table v-loading="loading" :data="classList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="班级编号" align="center" prop="bjbh" />
|
||||
<el-table-column label="学校代码" align="center" prop="schoolid" />
|
||||
<el-table-column label="班级类型" align="center" :formatter="bjtypeFormat" prop="bjtype" />
|
||||
<el-table-column label="班级序号" align="center" prop="bhxh" />
|
||||
<el-table-column label="学年" align="center" prop="xn" />
|
||||
<el-table-column label="班级编号" align="center" prop="bjbh" v-if="false" />>
|
||||
<el-table-column label="班级类型" align="center" :formatter="bjtypeFormat" prop="bjtype" />
|
||||
<el-table-column label="班级名称" align="center" prop="bjmc" />
|
||||
<el-table-column label="班级荣誉称号" align="center" prop="bjrych" />
|
||||
<el-table-column label="建班年月" align="center" prop="jbny" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.jbny) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="主班教师" align="center" prop="zbjs" />
|
||||
<el-table-column label="配班教师" align="center" prop="pbjs" />
|
||||
<el-table-column label="助理教师" align="center" prop="zljs" />
|
||||
<el-table-column label="是否删除
|
||||
1:删除
|
||||
0:正常" align="center" prop="isdel" />
|
||||
<el-table-column label="创建时间" align="center" prop="createtime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createtime) }}</span>
|
||||
@ -217,17 +205,12 @@ export default {
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
schoolid: undefined,
|
||||
bjtype: undefined,
|
||||
bhxh: undefined,
|
||||
xn: undefined,
|
||||
bjmc: undefined,
|
||||
bjrych: undefined,
|
||||
jbny: undefined,
|
||||
deptId: undefined,
|
||||
bjtype: undefined,
|
||||
bjmc: undefined,
|
||||
zbjs: undefined,
|
||||
pbjs: undefined,
|
||||
zljs: undefined,
|
||||
isdel: undefined,
|
||||
createtime: undefined
|
||||
},
|
||||
// 表单参数
|
||||
@ -270,17 +253,12 @@ export default {
|
||||
reset() {
|
||||
this.form = {
|
||||
bjbh: undefined,
|
||||
schoolid: undefined,
|
||||
deptId: undefined,
|
||||
bjtype: undefined,
|
||||
bhxh: undefined,
|
||||
xn: undefined,
|
||||
bjmc: undefined,
|
||||
bjrych: undefined,
|
||||
jbny: undefined,
|
||||
zbjs: undefined,
|
||||
pbjs: undefined,
|
||||
zljs: undefined,
|
||||
isdel: undefined,
|
||||
zljs: undefined,
|
||||
createtime: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
@ -349,7 +327,7 @@ export default {
|
||||
handleDelete(row) {
|
||||
const bjbhs = row.bjbh || this.ids;
|
||||
this.$confirm(
|
||||
'是否确认删除班级信息编号为"' + bjbhs + '"的数据项?',
|
||||
'是否确认删除选中的班级信息?',
|
||||
"警告",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
|
104
ruoyi/src/main/java/com/ruoyi/project/common/SchoolCommon.java
Normal file
104
ruoyi/src/main/java/com/ruoyi/project/common/SchoolCommon.java
Normal file
@ -0,0 +1,104 @@
|
||||
package com.ruoyi.project.common;
|
||||
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.security.LoginUser;
|
||||
import com.ruoyi.project.system.domain.BySchool;
|
||||
import com.ruoyi.project.system.domain.SysDept;
|
||||
import com.ruoyi.project.system.service.IBySchoolService;
|
||||
import com.ruoyi.project.system.service.ISysDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class SchoolCommon {
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
@Autowired
|
||||
private IBySchoolService schoolService;
|
||||
|
||||
/**
|
||||
* 部门id转学校id
|
||||
**/
|
||||
public Long deptIdToSchoolId() {
|
||||
Long schoolId = (long) 0;//转换值
|
||||
try {
|
||||
SysDept sysDept = getDept();
|
||||
BySchool SchoolInfo = new BySchool();
|
||||
System.out.println("schoolId is Empty======:" + isStringEmpty(sysDept.getSchoolId()));
|
||||
if (sysDept != null && !isStringEmpty(sysDept.getSchoolId())) {
|
||||
SchoolInfo.setXxdm(sysDept.getSchoolId());
|
||||
List<BySchool> list = schoolService.selectBySchoolList(SchoolInfo);
|
||||
if (list != null && list.size() > 0) {
|
||||
schoolId = list.get(0).getId();
|
||||
System.out.println("部门id转换学校id为======:" + schoolId);
|
||||
return schoolId;
|
||||
}
|
||||
}
|
||||
return schoolId;
|
||||
} catch (Exception e) {
|
||||
//throw new CustomException("部门id转换学校id异常", HttpStatus.UNAUTHORIZED);
|
||||
return schoolId;
|
||||
}
|
||||
}
|
||||
|
||||
public SysDept getDept() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
Long deptId = loginUser.getUser().getDept().getDeptId();//当前用户部门id
|
||||
System.out.println("部门id======:" + deptId);
|
||||
System.out.println("sys_user.deptid======:" + loginUser.getUser().getDeptId());
|
||||
SysDept sysDept = deptService.selectDeptById(deptId);
|
||||
|
||||
return sysDept;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前用户是否为学校
|
||||
**/
|
||||
public boolean isSchool() {
|
||||
SysDept sysDept = getDept();
|
||||
//如果schoolid不为空 暂且认为是学校用户
|
||||
String strSchoolId = sysDept.getSchoolId();
|
||||
if (!isStringEmpty(strSchoolId)) {
|
||||
//去school表验证 是否真的是学校数据
|
||||
BySchool SchoolInfo = new BySchool();
|
||||
SchoolInfo.setXxdm(strSchoolId);
|
||||
List<BySchool> list = schoolService.selectBySchoolList(SchoolInfo);
|
||||
if (list != null && list.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getCurrentXnXq() {
|
||||
Calendar date = Calendar.getInstance();
|
||||
Integer iYear = date.get(Calendar.YEAR);
|
||||
System.out.println("当前年======:" + iYear);
|
||||
Integer iMonth = date.get(Calendar.MONTH) + 1;//Calendar.MONTH 少一个月
|
||||
System.out.println("当前月======:" + iMonth);
|
||||
String strNxNq = "";
|
||||
|
||||
if (iMonth < 9) {
|
||||
strNxNq = (iYear - 1) + "-" + iYear + "2";
|
||||
} else {
|
||||
strNxNq = iYear + "-" + (iYear + 1) + "1";
|
||||
}
|
||||
return strNxNq;
|
||||
|
||||
}
|
||||
|
||||
public String getCurrentXn() {
|
||||
return getCurrentXnXq().substring(0,9);
|
||||
}
|
||||
|
||||
public boolean isStringEmpty(String str) {
|
||||
if (str == null || "".equals(str)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.project.common.SchoolCommon;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -34,6 +36,8 @@ import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
public class ByClassController extends BaseController {
|
||||
@Autowired
|
||||
private IByClassService byClassService;
|
||||
@Autowired
|
||||
private SchoolCommon schoolCommon;
|
||||
|
||||
/**
|
||||
* 查询班级信息列表
|
||||
@ -74,11 +78,19 @@ public class ByClassController extends BaseController {
|
||||
@Log(title = "班级信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ByClass byClass) {
|
||||
|
||||
//首先判断 当前用户是否为学校
|
||||
if(schoolCommon.isSchool()){
|
||||
String strBjbh = UUID.randomUUID().toString().replace("-","");
|
||||
System.out.println("bjbh:==" + strBjbh);
|
||||
byClass.setBjbh(strBjbh);
|
||||
byClass.setDeptId(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
|
||||
byClass.setXn(schoolCommon.getCurrentXn());
|
||||
byClass.setCreatetime(new Date());
|
||||
return toAjax(byClassService.insertByClass(byClass));
|
||||
return toAjax(byClassService.insertByClass(byClass));}
|
||||
else {
|
||||
return AjaxResult.error("当前用户非幼儿园,无法创建班级");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,7 +100,11 @@ public class ByClassController extends BaseController {
|
||||
@Log(title = "班级信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ByClass byClass) {
|
||||
return toAjax(byClassService.updateByClass(byClass));
|
||||
//首先判断 当前用户是否为学校
|
||||
if(schoolCommon.isSchool()) {
|
||||
return toAjax(byClassService.updateByClass(byClass));
|
||||
}
|
||||
return AjaxResult.error("当前用户非幼儿园,无法编辑班级");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,6 +114,11 @@ public class ByClassController extends BaseController {
|
||||
@Log(title = "班级信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{bjbhs}")
|
||||
public AjaxResult remove(@PathVariable String[] bjbhs) {
|
||||
return toAjax(byClassService.deleteByClassByIds(bjbhs));
|
||||
//首先判断 当前用户是否为学校
|
||||
if(schoolCommon.isSchool()) {
|
||||
return toAjax(byClassService.deleteByClassByIds(bjbhs));
|
||||
}
|
||||
return AjaxResult.error("当前用户非幼儿园,无法删除班级");
|
||||
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.project.system.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
||||
@ -25,7 +26,7 @@ public class ByClass extends BaseEntity {
|
||||
* 学校代码
|
||||
*/
|
||||
@Excel(name = "学校代码")
|
||||
private String schoolid;
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 班级类型
|
||||
@ -91,7 +92,7 @@ public class ByClass extends BaseEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createtime;
|
||||
|
||||
public void setBjbh(String bjbh) {
|
||||
@ -102,12 +103,12 @@ public class ByClass extends BaseEntity {
|
||||
return bjbh;
|
||||
}
|
||||
|
||||
public void setSchoolid(String schoolid) {
|
||||
this.schoolid = schoolid;
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getSchoolid() {
|
||||
return schoolid;
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setBjtype(String bjtype) {
|
||||
@ -202,7 +203,7 @@ public class ByClass extends BaseEntity {
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("bjbh", getBjbh())
|
||||
.append("schoolid", getSchoolid())
|
||||
.append("deptId", getDeptId())
|
||||
.append("bjtype", getBjtype())
|
||||
.append("bhxh", getBhxh())
|
||||
.append("xn", getXn())
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.ruoyi.project.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.project.system.mapper.ByClassMapper;
|
||||
@ -38,6 +40,7 @@ public class ByClassServiceImpl implements IByClassService
|
||||
* @return 班级信息
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<ByClass> selectByClassList(ByClass byClass)
|
||||
{
|
||||
return byClassMapper.selectByClassList(byClass);
|
||||
|
@ -5,41 +5,44 @@
|
||||
<mapper namespace="com.ruoyi.project.system.mapper.ByClassMapper">
|
||||
|
||||
<resultMap type="ByClass" id="ByClassResult">
|
||||
<result property="bjbh" column="bjbh" />
|
||||
<result property="schoolid" column="schoolid" />
|
||||
<result property="bjtype" column="bjtype" />
|
||||
<result property="bhxh" column="bhxh" />
|
||||
<result property="xn" column="xn" />
|
||||
<result property="bjmc" column="bjmc" />
|
||||
<result property="bjrych" column="bjrych" />
|
||||
<result property="jbny" column="jbny" />
|
||||
<result property="zbjs" column="zbjs" />
|
||||
<result property="pbjs" column="pbjs" />
|
||||
<result property="zljs" column="zljs" />
|
||||
<result property="isdel" column="isdel" />
|
||||
<result property="createtime" column="createtime" />
|
||||
<result property="bjbh" column="bjbh"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="bjtype" column="bjtype"/>
|
||||
<result property="bhxh" column="bhxh"/>
|
||||
<result property="xn" column="xn"/>
|
||||
<result property="bjmc" column="bjmc"/>
|
||||
<result property="bjrych" column="bjrych"/>
|
||||
<result property="jbny" column="jbny"/>
|
||||
<result property="zbjs" column="zbjs"/>
|
||||
<result property="pbjs" column="pbjs"/>
|
||||
<result property="zljs" column="zljs"/>
|
||||
<result property="isdel" column="isdel"/>
|
||||
<result property="createtime" column="createtime"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectByClassVo">
|
||||
select bjbh, schoolid, bjtype, bhxh, xn, bjmc, bjrych, jbny, zbjs, pbjs, zljs, isdel, createtime from by_class
|
||||
select bjbh, dept_id, bjtype, bhxh, xn, bjmc, bjrych, jbny, zbjs, pbjs, zljs, isdel, createtime from by_class d
|
||||
</sql>
|
||||
|
||||
<select id="selectByClassList" parameterType="ByClass" resultMap="ByClassResult">
|
||||
<include refid="selectByClassVo"/>
|
||||
<where>
|
||||
<if test="schoolid != null and schoolid != ''"> and schoolid = #{schoolid}</if>
|
||||
<if test="bjtype != null and bjtype != ''"> and bjtype = #{bjtype}</if>
|
||||
<if test="bhxh != null "> and bhxh = #{bhxh}</if>
|
||||
<if test="xn != null and xn != ''"> and xn = #{xn}</if>
|
||||
<if test="bjmc != null and bjmc != ''"> and bjmc = #{bjmc}</if>
|
||||
<if test="bjrych != null and bjrych != ''"> and bjrych = #{bjrych}</if>
|
||||
<if test="jbny != null "> and jbny = #{jbny}</if>
|
||||
<if test="zbjs != null "> and zbjs = #{zbjs}</if>
|
||||
<if test="pbjs != null "> and pbjs = #{pbjs}</if>
|
||||
<if test="zljs != null "> and zljs = #{zljs}</if>
|
||||
<if test="isdel != null and isdel != ''"> and isdel = #{isdel}</if>
|
||||
<if test="createtime != null "> and createtime = #{createtime}</if>
|
||||
</where>
|
||||
where isdel='0'
|
||||
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||
<if test="bjtype != null and bjtype != ''">and bjtype = #{bjtype}</if>
|
||||
<if test="bhxh != null ">and bhxh = #{bhxh}</if>
|
||||
<if test="xn != null and xn != ''">and xn = #{xn}</if>
|
||||
<if test="bjmc != null and bjmc != ''">and bjmc like concat('%', #{bjmc}, '%')</if>
|
||||
<if test="bjrych != null and bjrych != ''">and bjrych = #{bjrych}</if>
|
||||
<if test="jbny != null ">and jbny = #{jbny}</if>
|
||||
<if test="zbjs != null ">and zbjs = #{zbjs}</if>
|
||||
<if test="pbjs != null ">and pbjs = #{pbjs}</if>
|
||||
<if test="zljs != null ">and zljs = #{zljs}</if>
|
||||
<if test="isdel != null and isdel != ''">and isdel = #{isdel}</if>
|
||||
<if test="createtime != null ">and createtime = #{createtime}</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${dataScope}
|
||||
|
||||
order by createtime desc
|
||||
</select>
|
||||
|
||||
<select id="selectByClassById" parameterType="String" resultMap="ByClassResult">
|
||||
@ -51,7 +54,7 @@
|
||||
insert into by_class
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="bjbh != null and bjbh != ''">bjbh,</if>
|
||||
<if test="schoolid != null and schoolid != ''">schoolid,</if>
|
||||
<if test="deptId != null and deptId != ''">dept_id,</if>
|
||||
<if test="bjtype != null and bjtype != ''">bjtype,</if>
|
||||
<if test="bhxh != null ">bhxh,</if>
|
||||
<if test="xn != null and xn != ''">xn,</if>
|
||||
@ -66,7 +69,7 @@
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="bjbh != null and bjbh != ''">#{bjbh},</if>
|
||||
<if test="schoolid != null and schoolid != ''">#{schoolid},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="bjtype != null and bjtype != ''">#{bjtype},</if>
|
||||
<if test="bhxh != null ">#{bhxh},</if>
|
||||
<if test="xn != null and xn != ''">#{xn},</if>
|
||||
@ -84,7 +87,7 @@
|
||||
<update id="updateByClass" parameterType="ByClass">
|
||||
update by_class
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="schoolid != null and schoolid != ''">schoolid = #{schoolid},</if>
|
||||
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
|
||||
<if test="bjtype != null and bjtype != ''">bjtype = #{bjtype},</if>
|
||||
<if test="bhxh != null ">bhxh = #{bhxh},</if>
|
||||
<if test="xn != null and xn != ''">xn = #{xn},</if>
|
||||
@ -101,11 +104,11 @@
|
||||
</update>
|
||||
|
||||
<delete id="deleteByClassById" parameterType="String">
|
||||
delete from by_class where bjbh = #{bjbh}
|
||||
update by_class set isdel='1'where bjbh = #{bjbh}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByClassByIds" parameterType="String">
|
||||
delete from by_class where bjbh in
|
||||
update by_class set isdel='1' where bjbh in
|
||||
<foreach item="bjbh" collection="array" open="(" separator="," close=")">
|
||||
#{bjbh}
|
||||
</foreach>
|
||||
|
Loading…
x
Reference in New Issue
Block a user