新增园历管理(班级)部分功能

This commit is contained in:
sk1551 2020-05-07 18:32:25 +08:00
parent 07ff862089
commit 2ec48f4e51
15 changed files with 1046 additions and 2 deletions

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询园历管理(班级)列表
export function listSchoolcalendarclass(query) {
return request({
url: '/benyi/schoolcalendarclass/list',
method: 'get',
params: query
})
}
// 查询园历管理(班级)详细
export function getSchoolcalendarclass(id) {
return request({
url: '/benyi/schoolcalendarclass/' + id,
method: 'get'
})
}
// 新增园历管理(班级)
export function addSchoolcalendarclass(data) {
return request({
url: '/benyi/schoolcalendarclass',
method: 'post',
data: data
})
}
// 修改园历管理(班级)
export function updateSchoolcalendarclass(data) {
return request({
url: '/benyi/schoolcalendarclass',
method: 'put',
data: data
})
}
// 删除园历管理(班级)
export function delSchoolcalendarclass(id) {
return request({
url: '/benyi/schoolcalendarclass/' + id,
method: 'delete'
})
}
// 导出园历管理(班级)
export function exportSchoolcalendarclass(query) {
return request({
url: '/benyi/schoolcalendarclass/export',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,345 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
<el-form-item label="活动类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择活动类型" clearable size="small">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="所属班级" prop="classid">
<el-input
v-model="queryParams.classid"
placeholder="请输入所属班级"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="学年学期" prop="xnxq">
<el-select v-model="queryParams.xnxq" placeholder="请选择学年学期" clearable size="small">
<el-option
v-for="dict in xnxqOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="活动时间" prop="activitytime">
<el-date-picker clearable size="small" style="width: 200px"
v-model="queryParams.activitytime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择活动时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['benyi:schoolcalendarclass:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['benyi:schoolcalendarclass:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['benyi:schoolcalendarclass:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['benyi:schoolcalendarclass:export']"
>导出</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="schoolcalendarclassList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="活动类型" align="center" prop="type" :formatter="typeFormat" />
<el-table-column label="所属班级" align="center" prop="classid" />
<el-table-column label="学年学期" align="center" prop="xnxq" :formatter="xnxqFormat" />
<el-table-column label="活动时间" align="center" prop="activitytime" width="180"/>
<el-table-column label="创建时间" align="center" prop="createtime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createtime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['benyi:schoolcalendarclass:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['benyi:schoolcalendarclass:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改园历管理(班级)对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="活动类型">
<el-select v-model="form.type" placeholder="请选择活动类型">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="活动时间" prop="activitytime">
<el-date-picker clearable size="small" style="width: 200px"
v-model="form.activitytime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择活动时间">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listSchoolcalendarclass, getSchoolcalendarclass, delSchoolcalendarclass, addSchoolcalendarclass, updateSchoolcalendarclass, exportSchoolcalendarclass } from "@/api/benyi/schoolcalendarclass";
export default {
name: "Schoolcalendarclass",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
total: 0,
// ()
schoolcalendarclassList: [],
//
title: "",
//
open: false,
//
typeOptions: [],
//
xnxqOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: undefined,
type: undefined,
classid: undefined,
xnxq: undefined,
deptid: undefined,
activitytime: undefined,
createuserid: undefined,
createtime: undefined
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
this.getDicts("sys_schoolcalendartype").then(response => {
this.typeOptions = response.data;
});
this.getDicts("sys_xnxq").then(response => {
this.xnxqOptions = response.data;
});
},
methods: {
/** 查询园历管理(班级)列表 */
getList() {
this.loading = true;
listSchoolcalendarclass(this.queryParams).then(response => {
this.schoolcalendarclassList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
typeFormat(row, column) {
return this.selectDictLabel(this.typeOptions, row.type);
},
// --
xnxqFormat(row, column) {
return this.selectDictLabel(this.xnxqOptions, row.xnxq);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: undefined,
name: undefined,
type: undefined,
classid: undefined,
xnxq: undefined,
deptid: undefined,
activitytime: undefined,
createuserid: undefined,
createtime: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!=1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加园历管理(班级)";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getSchoolcalendarclass(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改园历管理(班级)";
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
updateSchoolcalendarclass(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
} else {
this.msgError(response.msg);
}
});
} else {
addSchoolcalendarclass(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
} else {
this.msgError(response.msg);
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除园历管理(班级)编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delSchoolcalendarclass(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有园历管理(班级)数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportSchoolcalendarclass(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
}
}
};
</script>

View File

@ -0,0 +1,126 @@
package com.ruoyi.project.benyi.controller;
import java.util.Date;
import java.util.List;
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;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.benyi.domain.BySchoolcalendarClass;
import com.ruoyi.project.benyi.service.IBySchoolcalendarClassService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
/**
* 园历管理(班级)Controller
*
* @author tsbz
* @date 2020-05-06
*/
@RestController
@RequestMapping("/benyi/schoolcalendarclass")
public class BySchoolcalendarClassController extends BaseController
{
@Autowired
private IBySchoolcalendarClassService bySchoolcalendarClassService;
//导入学校公用类
@Autowired
private SchoolCommon schoolCommon;
/**
* 查询园历管理(班级)列表
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendarclass:list')")
@GetMapping("/list")
public TableDataInfo list(BySchoolcalendarClass bySchoolcalendarClass)
{
startPage();
List<BySchoolcalendarClass> list = bySchoolcalendarClassService.selectBySchoolcalendarClassList(bySchoolcalendarClass);
return getDataTable(list);
}
/**
* 导出园历管理(班级)列表
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendarclass:export')")
@Log(title = "园历管理(班级)", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(BySchoolcalendarClass bySchoolcalendarClass)
{
List<BySchoolcalendarClass> list = bySchoolcalendarClassService.selectBySchoolcalendarClassList(bySchoolcalendarClass);
ExcelUtil<BySchoolcalendarClass> util = new ExcelUtil<BySchoolcalendarClass>(BySchoolcalendarClass.class);
return util.exportExcel(list, "schoolcalendarclass");
}
/**
* 获取园历管理(班级)详细信息
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendarclass:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(bySchoolcalendarClassService.selectBySchoolcalendarClassById(id));
}
/**
* 新增园历管理(班级)
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendarclass:add')")
@Log(title = "园历管理(班级)", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BySchoolcalendarClass bySchoolcalendarClass)
{
String strClassId = schoolCommon.getClassId();
if(!schoolCommon.isStringEmpty(strClassId)) {
//设置创建时间为当前时间
bySchoolcalendarClass.setCreatetime(new Date());
//设置学年信息 从学校公共类调取方法 传入活动时间进行判断
bySchoolcalendarClass.setXnxq(schoolCommon.getCurrentXnXq(bySchoolcalendarClass.getActivitytime()));
//设置创建人id
bySchoolcalendarClass.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
//设置部门id
bySchoolcalendarClass.setDeptid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
bySchoolcalendarClass.setClassid(strClassId);
return toAjax(bySchoolcalendarClassService.insertBySchoolcalendarClass(bySchoolcalendarClass));
}else {
return AjaxResult.error("当前用户下没有班级,无法创建园历");
}
}
/**
* 修改园历管理(班级)
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendarclass:edit')")
@Log(title = "园历管理(班级)", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BySchoolcalendarClass bySchoolcalendarClass)
{
return toAjax(bySchoolcalendarClassService.updateBySchoolcalendarClass(bySchoolcalendarClass));
}
/**
* 删除园历管理(班级)
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendarclass:remove')")
@Log(title = "园历管理(班级)", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(bySchoolcalendarClassService.deleteBySchoolcalendarClassByIds(ids));
}
}

View File

@ -172,6 +172,7 @@ public class BySchoolcalendarController extends BaseController {
bySchoolcalendar.setXnxq(strXnxq);
bySchoolcalendar.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
bySchoolcalendar.setDeptid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
return toAjax(bySchoolcalendarService.insertBySchoolcalendar(bySchoolcalendar));
} else {
return AjaxResult.error("当前用户非幼儿园,无法创建园历");

View File

@ -0,0 +1,155 @@
package com.ruoyi.project.benyi.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;
import com.ruoyi.framework.web.domain.BaseEntity;
import java.util.Date;
/**
* 园历管理(班级)对象 by_schoolcalendar_class
*
* @author tsbz
* @date 2020-05-06
*/
public class BySchoolcalendarClass extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 标识 */
private Long id;
/** 名称 */
@Excel(name = "名称")
private String name;
/** 活动类型 */
@Excel(name = "活动类型")
private String type;
/** 所属班级 */
@Excel(name = "所属班级")
private String classid;
/** 学年学期 */
@Excel(name = "学年学期")
private String xnxq;
/** 所属学校 */
@Excel(name = "所属学校")
private Long deptid;
/** 活动时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date activitytime;
/** 创建人 */
@Excel(name = "创建人")
private Long createuserid;
/** 创建时间 */
@Excel(name = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createtime;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setClassid(String classid)
{
this.classid = classid;
}
public String getClassid()
{
return classid;
}
public void setXnxq(String xnxq)
{
this.xnxq = xnxq;
}
public String getXnxq()
{
return xnxq;
}
public void setDeptid(Long deptid)
{
this.deptid = deptid;
}
public Long getDeptid()
{
return deptid;
}
public void setActivitytime(Date activitytime)
{
this.activitytime = activitytime;
}
public Date getActivitytime()
{
return activitytime;
}
public void setCreateuserid(Long createuserid)
{
this.createuserid = createuserid;
}
public Long getCreateuserid()
{
return createuserid;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("type", getType())
.append("classid", getClassid())
.append("xnxq", getXnxq())
.append("deptid", getDeptid())
.append("activitytime", getActivitytime())
.append("createuserid", getCreateuserid())
.append("createtime", getCreatetime())
.toString();
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.benyi.mapper;
import java.util.List;
import com.ruoyi.project.benyi.domain.BySchoolcalendarClass;
/**
* 园历管理(班级)Mapper接口
*
* @author tsbz
* @date 2020-05-06
*/
public interface BySchoolcalendarClassMapper
{
/**
* 查询园历管理(班级)
*
* @param id 园历管理(班级)ID
* @return 园历管理(班级)
*/
public BySchoolcalendarClass selectBySchoolcalendarClassById(Long id);
/**
* 查询园历管理(班级)列表
*
* @param bySchoolcalendarClass 园历管理(班级)
* @return 园历管理(班级)集合
*/
public List<BySchoolcalendarClass> selectBySchoolcalendarClassList(BySchoolcalendarClass bySchoolcalendarClass);
/**
* 新增园历管理(班级)
*
* @param bySchoolcalendarClass 园历管理(班级)
* @return 结果
*/
public int insertBySchoolcalendarClass(BySchoolcalendarClass bySchoolcalendarClass);
/**
* 修改园历管理(班级)
*
* @param bySchoolcalendarClass 园历管理(班级)
* @return 结果
*/
public int updateBySchoolcalendarClass(BySchoolcalendarClass bySchoolcalendarClass);
/**
* 删除园历管理(班级)
*
* @param id 园历管理(班级)ID
* @return 结果
*/
public int deleteBySchoolcalendarClassById(Long id);
/**
* 批量删除园历管理(班级)
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteBySchoolcalendarClassByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.benyi.service;
import java.util.List;
import com.ruoyi.project.benyi.domain.BySchoolcalendarClass;
/**
* 园历管理(班级)Service接口
*
* @author tsbz
* @date 2020-05-06
*/
public interface IBySchoolcalendarClassService
{
/**
* 查询园历管理(班级)
*
* @param id 园历管理(班级)ID
* @return 园历管理(班级)
*/
public BySchoolcalendarClass selectBySchoolcalendarClassById(Long id);
/**
* 查询园历管理(班级)列表
*
* @param bySchoolcalendarClass 园历管理(班级)
* @return 园历管理(班级)集合
*/
public List<BySchoolcalendarClass> selectBySchoolcalendarClassList(BySchoolcalendarClass bySchoolcalendarClass);
/**
* 新增园历管理(班级)
*
* @param bySchoolcalendarClass 园历管理(班级)
* @return 结果
*/
public int insertBySchoolcalendarClass(BySchoolcalendarClass bySchoolcalendarClass);
/**
* 修改园历管理(班级)
*
* @param bySchoolcalendarClass 园历管理(班级)
* @return 结果
*/
public int updateBySchoolcalendarClass(BySchoolcalendarClass bySchoolcalendarClass);
/**
* 批量删除园历管理(班级)
*
* @param ids 需要删除的园历管理(班级)ID
* @return 结果
*/
public int deleteBySchoolcalendarClassByIds(Long[] ids);
/**
* 删除园历管理(班级)信息
*
* @param id 园历管理(班级)ID
* @return 结果
*/
public int deleteBySchoolcalendarClassById(Long id);
}

View File

@ -0,0 +1,93 @@
package com.ruoyi.project.benyi.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.benyi.mapper.BySchoolcalendarClassMapper;
import com.ruoyi.project.benyi.domain.BySchoolcalendarClass;
import com.ruoyi.project.benyi.service.IBySchoolcalendarClassService;
/**
* 园历管理(班级)Service业务层处理
*
* @author tsbz
* @date 2020-05-06
*/
@Service
public class BySchoolcalendarClassServiceImpl implements IBySchoolcalendarClassService
{
@Autowired
private BySchoolcalendarClassMapper bySchoolcalendarClassMapper;
/**
* 查询园历管理(班级)
*
* @param id 园历管理(班级)ID
* @return 园历管理(班级)
*/
@Override
public BySchoolcalendarClass selectBySchoolcalendarClassById(Long id)
{
return bySchoolcalendarClassMapper.selectBySchoolcalendarClassById(id);
}
/**
* 查询园历管理(班级)列表
*
* @param bySchoolcalendarClass 园历管理(班级)
* @return 园历管理(班级)
*/
@Override
public List<BySchoolcalendarClass> selectBySchoolcalendarClassList(BySchoolcalendarClass bySchoolcalendarClass)
{
return bySchoolcalendarClassMapper.selectBySchoolcalendarClassList(bySchoolcalendarClass);
}
/**
* 新增园历管理(班级)
*
* @param bySchoolcalendarClass 园历管理(班级)
* @return 结果
*/
@Override
public int insertBySchoolcalendarClass(BySchoolcalendarClass bySchoolcalendarClass)
{
return bySchoolcalendarClassMapper.insertBySchoolcalendarClass(bySchoolcalendarClass);
}
/**
* 修改园历管理(班级)
*
* @param bySchoolcalendarClass 园历管理(班级)
* @return 结果
*/
@Override
public int updateBySchoolcalendarClass(BySchoolcalendarClass bySchoolcalendarClass)
{
return bySchoolcalendarClassMapper.updateBySchoolcalendarClass(bySchoolcalendarClass);
}
/**
* 批量删除园历管理(班级)
*
* @param ids 需要删除的园历管理(班级)ID
* @return 结果
*/
@Override
public int deleteBySchoolcalendarClassByIds(Long[] ids)
{
return bySchoolcalendarClassMapper.deleteBySchoolcalendarClassByIds(ids);
}
/**
* 删除园历管理(班级)信息
*
* @param id 园历管理(班级)ID
* @return 结果
*/
@Override
public int deleteBySchoolcalendarClassById(Long id)
{
return bySchoolcalendarClassMapper.deleteBySchoolcalendarClassById(id);
}
}

View File

@ -2,10 +2,15 @@ package com.ruoyi.project.common;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.project.system.domain.ByClass;
import com.ruoyi.project.system.domain.BySchool;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.service.IByClassService;
import com.ruoyi.project.system.service.IBySchoolService;
import com.ruoyi.project.system.service.ISysDeptService;
import com.ruoyi.project.system.service.ISysUserService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
@ -20,7 +25,11 @@ public class SchoolCommon {
@Autowired
private ISysDeptService deptService;
@Autowired
private ISysUserService userService;
@Autowired
private IBySchoolService schoolService;
@Autowired
private IByClassService byClassService;
/**
* 部门id转学校id
@ -58,6 +67,15 @@ public class SchoolCommon {
return sysDept;
}
public SysUser getUser() {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUser().getUserId();
System.out.println("用户id======:" + userId);
System.out.println("sys_user.user_id======:" + loginUser.getUser().getUserId());
SysUser sysUser = userService.selectUserById(userId);
return sysUser;
}
/**
* 判断当前用户是否为学校
**/
@ -77,6 +95,20 @@ public class SchoolCommon {
return false;
}
public String getClassId() {
SysUser sysUser = getUser();
ByClass byClass = new ByClass();
byClass.setZbjs(sysUser.getUserId());
byClass.setPbjs(sysUser.getUserId());
byClass.setZljs(sysUser.getUserId());
ByClass byClass1 = byClassService.selectByClassByUserId(byClass);
if(byClass1 != null) {
return byClass1.getBjbh();
} else {
return "";
}
}
public String getCurrentXnXq() {
Calendar date = Calendar.getInstance();
Integer iYear = date.get(Calendar.YEAR);

View File

@ -27,6 +27,9 @@ public interface ByClassMapper
*/
public List<ByClass> selectByClassList(ByClass byClass);
//通过userID查询class
public ByClass selectByClassByUserId(ByClass byClass);
/**
* 新增班级信息
*

View File

@ -19,6 +19,9 @@ public interface IByClassService
*/
public ByClass selectByClassById(String bjbh);
//查询通过userid查询班级信息
public ByClass selectByClassByUserId(ByClass byClass);
/**
* 查询班级信息列表
*

View File

@ -33,6 +33,11 @@ public class ByClassServiceImpl implements IByClassService
return byClassMapper.selectByClassById(bjbh);
}
@Override
public ByClass selectByClassByUserId(ByClass byClass) {
return byClassMapper.selectByClassByUserId(byClass);
}
/**
* 查询班级信息列表
*

View File

@ -0,0 +1,94 @@
<?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.project.benyi.mapper.BySchoolcalendarClassMapper">
<resultMap type="BySchoolcalendarClass" id="BySchoolcalendarClassResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="classid" column="classid" />
<result property="xnxq" column="xnxq" />
<result property="deptid" column="deptId" />
<result property="activitytime" column="activitytime" />
<result property="createuserid" column="createuserid" />
<result property="createtime" column="createtime" />
</resultMap>
<sql id="selectBySchoolcalendarClassVo">
select id, name, type, classid, xnxq, deptId, activitytime, createuserid, createtime from by_schoolcalendar_class
</sql>
<select id="selectBySchoolcalendarClassList" parameterType="BySchoolcalendarClass" resultMap="BySchoolcalendarClassResult">
<include refid="selectBySchoolcalendarClassVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="classid != null and classid != ''"> and classid = #{classid}</if>
<if test="xnxq != null and xnxq != ''"> and xnxq = #{xnxq}</if>
<if test="deptid != null "> and deptId = #{deptid}</if>
<if test="activitytime != null "> and activitytime = #{activitytime}</if>
<if test="createuserid != null "> and createuserid = #{createuserid}</if>
<if test="createtime != null "> and createtime = #{createtime}</if>
</where>
</select>
<select id="selectBySchoolcalendarClassById" parameterType="Long" resultMap="BySchoolcalendarClassResult">
<include refid="selectBySchoolcalendarClassVo"/>
where id = #{id}
</select>
<insert id="insertBySchoolcalendarClass" parameterType="BySchoolcalendarClass">
insert into by_schoolcalendar_class
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null ">id,</if>
<if test="name != null and name != ''">name,</if>
<if test="type != null and type != ''">type,</if>
<if test="classid != null and classid != ''">classid,</if>
<if test="xnxq != null and xnxq != ''">xnxq,</if>
<if test="deptid != null ">deptId,</if>
<if test="activitytime != null ">activitytime,</if>
<if test="createuserid != null ">createuserid,</if>
<if test="createtime != null ">createtime,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null ">#{id},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="classid != null and classid != ''">#{classid},</if>
<if test="xnxq != null and xnxq != ''">#{xnxq},</if>
<if test="deptid != null ">#{deptid},</if>
<if test="activitytime != null ">#{activitytime},</if>
<if test="createuserid != null ">#{createuserid},</if>
<if test="createtime != null ">#{createtime},</if>
</trim>
</insert>
<update id="updateBySchoolcalendarClass" parameterType="BySchoolcalendarClass">
update by_schoolcalendar_class
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="classid != null and classid != ''">classid = #{classid},</if>
<if test="xnxq != null and xnxq != ''">xnxq = #{xnxq},</if>
<if test="deptid != null ">deptId = #{deptid},</if>
<if test="activitytime != null ">activitytime = #{activitytime},</if>
<if test="createuserid != null ">createuserid = #{createuserid},</if>
<if test="createtime != null ">createtime = #{createtime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBySchoolcalendarClassById" parameterType="Long">
delete from by_schoolcalendar_class where id = #{id}
</delete>
<delete id="deleteBySchoolcalendarClassByIds" parameterType="String">
delete from by_schoolcalendar_class where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -25,7 +25,7 @@
<sql id="selectByClassVo">
select bjbh, dept_id, bjtype, bhxh, xn, bjmc, bjrych, jbny,
zbjs,(select nick_name from sys_user where sys_user.user_id=zbjs) zbjsxm,
zbjs, (select nick_name from sys_user where sys_user.user_id=zbjs) zbjsxm,
pbjs, (select nick_name from sys_user where sys_user.user_id=pbjs) pbjsxm,
zljs, (select nick_name from sys_user where sys_user.user_id=zljs) zljsxm,
isdel, createtime from by_class d
@ -60,6 +60,17 @@
where bjbh = #{bjbh}
</select>
<select id="selectByClassByUserId" parameterType="ByClass" resultMap="ByClassResult">
<include refid="selectByClassVo"/>
<where>
<if test="zbjs != null ">and zbjs = #{zbjs}</if>
<if test="pbjs != null ">and pbjs = #{pbjs}</if>
<if test="zljs != null ">and zljs = #{zljs}</if>
</where>
<!-- 数据范围过滤 -->
${dataScope}
</select>
<insert id="insertByClass" parameterType="ByClass">
insert into by_class
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -35,7 +35,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="leader" column="leader" />
<result property="status" column="dept_status" />
</resultMap>
<resultMap id="RoleResult" type="SysRole">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />