课程模块的增删改查完成,参与班级功能开发了两个接口
This commit is contained in:
parent
7b49d3b506
commit
8663ca199f
|
|
@ -34,4 +34,12 @@ export default {
|
||||||
findAllClassPage: (data) => request.post('/classes/findAllClassPage', data),
|
findAllClassPage: (data) => request.post('/classes/findAllClassPage', data),
|
||||||
findAllShoolsInAdminusers: () => request.post('/school/findAllShoolsInAdminusers'),
|
findAllShoolsInAdminusers: () => request.post('/school/findAllShoolsInAdminusers'),
|
||||||
deleteClass: (data) => request.post('/classes/deleteClass', data),
|
deleteClass: (data) => request.post('/classes/deleteClass', data),
|
||||||
|
findAllCoursesPage: (data) => request.post('/course/findAllCoursesPage', data),
|
||||||
|
Addcourse: (data) => request.post('/course/addCourse', data),
|
||||||
|
getCourseById: (data) => request.post('/course/findCourseById', data),
|
||||||
|
EditCourse: (data) => request.post('/course/editCourse', data),
|
||||||
|
deletecoursesInfo: (data) => request.post('/course/deleteCourse', data),
|
||||||
|
findAllTeacher: (data) =>
|
||||||
|
request.post('/adminusers/findAllTeacher', data),
|
||||||
|
findClassNotInCourse: (data) => request.post('/classes/findClassNotInCourse', data),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -226,19 +226,19 @@ const queryByPage = async (currentPage)=>{
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
console.log(res.data)
|
console.log(res.data)
|
||||||
if (userStore.getRole().some((r) => r === 'admin')){
|
// if (userStore.getRole().some((r) => r === 'admin')){
|
||||||
const res1=await api.findAllShoolsInAdminusers()
|
// const res1=await api.findAllShoolsInAdminusers()
|
||||||
const list1=res1.data
|
// const list1=res1.data
|
||||||
const transformedDatas=list1.map(item => ({
|
// const transformedDatas=list1.map(item => ({
|
||||||
label: item.name,
|
// label: item.name,
|
||||||
value: item.id,
|
// value: item.id,
|
||||||
}));
|
// }));
|
||||||
transformedDatas.unshift({
|
// transformedDatas.unshift({
|
||||||
label: '全部',
|
// label: '全部',
|
||||||
value: 0,
|
// value: 0,
|
||||||
});
|
// });
|
||||||
options.value=transformedDatas;
|
// options.value=transformedDatas;
|
||||||
}
|
// }
|
||||||
const {pageNum, pageSize, total, list} = res.data
|
const {pageNum, pageSize, total, list} = res.data
|
||||||
paginationReactive.page = pageNum
|
paginationReactive.page = pageNum
|
||||||
paginationReactive.pageSize = pageSize
|
paginationReactive.pageSize = pageSize
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@
|
||||||
<div>
|
<div>
|
||||||
<div style="display: flex;margin-bottom: 20px">
|
<div style="display: flex;margin-bottom: 20px">
|
||||||
<span style="width: 100px">课程名称:</span>
|
<span style="width: 100px">课程名称:</span>
|
||||||
<n-input v-model:value="courseInfoValue.name" :placeholder="name"></n-input>
|
<n-input
|
||||||
|
v-model:value="courseInfoValue.name" placeholder=""></n-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons-wrapper">
|
<div class="buttons-wrapper">
|
||||||
<n-button style="margin-bottom: 10px;margin-left: 100px" @click="submit">提交</n-button>
|
<n-button style="margin-bottom: 10px;margin-left: 100px" @click="submit">提交</n-button>
|
||||||
|
|
@ -65,12 +66,10 @@ const queryByPage = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
path.value = router.currentRoute.value.fullPath
|
path.value = router.currentRoute.value.fullPath
|
||||||
try {
|
try {
|
||||||
const res = await api.getChapterById({
|
const res = await api.getCourseById({
|
||||||
...courseInfoValue.value
|
...courseInfoValue.value
|
||||||
})
|
})
|
||||||
const list = res.data
|
courseInfoValue.value=res.data
|
||||||
courseInfoValue.value.code=list.code
|
|
||||||
name.value = list.name
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ const columns = [
|
||||||
onClickEdit: () => onEditCourses(row),
|
onClickEdit: () => onEditCourses(row),
|
||||||
onClickDelete: () =>
|
onClickDelete: () =>
|
||||||
onDeleteCourses(row),
|
onDeleteCourses(row),
|
||||||
onClickBanji: () => onBanjiExam(row),
|
onClickBanji: () => onBanjiCourse(row),
|
||||||
onClickAdd:()=>onAddProblem(row),
|
onClickAdd:()=>onAddProblem(row),
|
||||||
onClickProblem:()=>onProblem(row),
|
onClickProblem:()=>onProblem(row),
|
||||||
onClickStore:()=>onProblemStore(row)
|
onClickStore:()=>onProblemStore(row)
|
||||||
|
|
@ -125,8 +125,7 @@ const sub = async ()=>{
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const onDeleteCourses = async (courses)=>{
|
const onDeleteCourses = async (courses)=>{
|
||||||
// const {id} = courses
|
const {id} = courses
|
||||||
const id=1
|
|
||||||
try {
|
try {
|
||||||
await api.deletecoursesInfo({id})
|
await api.deletecoursesInfo({id})
|
||||||
$message.success("删除成功")
|
$message.success("删除成功")
|
||||||
|
|
@ -137,8 +136,7 @@ const onDeleteCourses = async (courses)=>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const onEditCourses=async (courses)=>{
|
const onEditCourses=async (courses)=>{
|
||||||
// const {id} = courses
|
const {id} = courses
|
||||||
const id=1
|
|
||||||
await router.push({name: 'AdminCourseEdit', params: {chId: id}})
|
await router.push({name: 'AdminCourseEdit', params: {chId: id}})
|
||||||
}
|
}
|
||||||
const onUpdatePageSize = (pageSize) => {
|
const onUpdatePageSize = (pageSize) => {
|
||||||
|
|
@ -146,9 +144,8 @@ const onUpdatePageSize = (pageSize) => {
|
||||||
paginationReactive.page = 1;
|
paginationReactive.page = 1;
|
||||||
queryByPage(1)
|
queryByPage(1)
|
||||||
}
|
}
|
||||||
const onBanjiExam= async (classId)=>{
|
const onBanjiCourse= async (classId)=>{
|
||||||
// const { id } = classId
|
const { id } = classId
|
||||||
const id=1
|
|
||||||
try {
|
try {
|
||||||
await router.push({ name:
|
await router.push({ name:
|
||||||
'AdminClassManage', query: { classId: id
|
'AdminClassManage', query: { classId: id
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ import {NButton} from 'naive-ui'
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { examId, history } = route.query
|
const { courseId, history } = route.query
|
||||||
const role = ref(userStore.getRole())
|
const role = ref(userStore.getRole())
|
||||||
const options1 =
|
const options1 =
|
||||||
ref([])
|
ref([])
|
||||||
|
|
@ -161,28 +161,28 @@ const onAssistantClass = async (classId)=>{
|
||||||
const {id} = classId
|
const {id} = classId
|
||||||
await router.push({name: 'AdminClassAssistant', params: {clId: id}})
|
await router.push({name: 'AdminClassAssistant', params: {clId: id}})
|
||||||
}
|
}
|
||||||
const getSchools = async () => {
|
// const getSchools = async () => {
|
||||||
try {
|
// try {
|
||||||
const res = await api.findAllSchools()
|
// const res = await api.findAllSchools()
|
||||||
const transformData = res.data.map((item) => ({
|
// const transformData = res.data.map((item) => ({
|
||||||
label: item.name,
|
// label: item.name,
|
||||||
value: item.id,
|
// value: item.id,
|
||||||
}))
|
// }))
|
||||||
transformData.unshift({
|
// transformData.unshift({
|
||||||
label: '全部',
|
// label: '全部',
|
||||||
value: 0,
|
// value: 0,
|
||||||
})
|
// })
|
||||||
teacherInfoValue.value.schoolId = parseInt(userStore.getSchoolId(), 10)
|
// teacherInfoValue.value.schoolId = parseInt(userStore.getSchoolId(), 10)
|
||||||
options1.value = transformData
|
// options1.value = transformData
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
console.log(error)
|
// console.log(error)
|
||||||
$message.error('获取学校的信息失败')
|
// $message.error('获取学校的信息失败')
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
const queryByPage1 = async (query) => {
|
const queryByPage1 = async (query) => {
|
||||||
const res = await api.findAllAdminusersBySchoolId({
|
const res = await api.findAllTeacher({
|
||||||
schoolId: query,
|
// schoolId: query,
|
||||||
})
|
})
|
||||||
const transformedData = res.data.map((item) => ({
|
const transformedData = res.data.map((item) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
|
|
@ -206,7 +206,7 @@ const queryByPage1 = async (query) => {
|
||||||
teacherInfoValue.value.teacherId = 0
|
teacherInfoValue.value.teacherId = 0
|
||||||
}
|
}
|
||||||
options2.value = transformedData
|
options2.value = transformedData
|
||||||
await getClassesNotInExam()
|
await getClassesNotInCourse()
|
||||||
}
|
}
|
||||||
watch(
|
watch(
|
||||||
() => teacherInfoValue.value.schoolId,
|
() => teacherInfoValue.value.schoolId,
|
||||||
|
|
@ -237,14 +237,15 @@ const addClassToExam = async (classId) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getClassesNotInExam = async () => {
|
const getClassesNotInCourse = async () => {
|
||||||
try {
|
try {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
||||||
const res = await api.findClassNotInExam({
|
const res = await api.findClassNotInCourse({
|
||||||
examId: examId,
|
// examId: examId,
|
||||||
|
courseId:courseId,
|
||||||
teacherId: teacherInfoValue.value.teacherId,
|
teacherId: teacherInfoValue.value.teacherId,
|
||||||
id: teacherInfoValue.value.schoolId,
|
// id: teacherInfoValue.value.schoolId,
|
||||||
pageNum: paginationReactive.page,
|
pageNum: paginationReactive.page,
|
||||||
pageSize: paginationReactive.pageSize,
|
pageSize: paginationReactive.pageSize,
|
||||||
history:history
|
history:history
|
||||||
|
|
@ -267,6 +268,6 @@ const handleCheckedChange = (checked) => {
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
queryByPage1()
|
queryByPage1()
|
||||||
getSchools()
|
// getSchools()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
<template>
|
||||||
|
<div flex-col gap-y-10 style="width: 30px">
|
||||||
|
<div style="display: flex">
|
||||||
|
<!-- <n-button type="primary" size="small"-->
|
||||||
|
<!-- @click="onReview"-->
|
||||||
|
<!-- style="--n-width: 50px;margin-left: 20px;">-->
|
||||||
|
<!-- 查看-->
|
||||||
|
<!-- </n-button>-->
|
||||||
|
<!-- <n-button type="primary" size="small"-->
|
||||||
|
<!-- @click="onBack" style="--n-width:-->
|
||||||
|
<!-- 70px;margin-left:15px ;padding: 0 0">-->
|
||||||
|
<!-- 打回-->
|
||||||
|
<!-- </n-button>-->
|
||||||
|
<n-button type="primary" size="small"
|
||||||
|
@click="addTime"
|
||||||
|
style="--n-width: 50px;margin-left:15px">
|
||||||
|
加时
|
||||||
|
</n-button>
|
||||||
|
<n-modal
|
||||||
|
v-model:show="showModal"
|
||||||
|
:mask-closable="false"
|
||||||
|
preset="dialog"
|
||||||
|
title="删除"
|
||||||
|
content="将删除该学生,确认?"
|
||||||
|
positive-text="确认"
|
||||||
|
negative-text="取消"
|
||||||
|
@positive-click="onDelete"
|
||||||
|
@negative-click="closes"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
const emit =
|
||||||
|
defineEmits(['clickReview','clickBack','clickAddTime'])
|
||||||
|
const showModal=ref(false)
|
||||||
|
|
||||||
|
const onBack = ()=>{
|
||||||
|
emit('clickBack')
|
||||||
|
}
|
||||||
|
const onReview = ()=>{
|
||||||
|
emit('clickReview')
|
||||||
|
}
|
||||||
|
const onAddTime = ()=>{
|
||||||
|
emit('clickAddTime')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -67,8 +67,8 @@
|
||||||
style='justify-content: flex-end'>
|
style='justify-content: flex-end'>
|
||||||
<n-form-item
|
<n-form-item
|
||||||
v-if="selectedStatus==='weijiao'" style='margin-left: 10px;margin-right: 20px'>
|
v-if="selectedStatus==='weijiao'" style='margin-left: 10px;margin-right: 20px'>
|
||||||
<n-button type="primary"
|
<!-- <n-button type="primary"-->
|
||||||
style="margin-right: 10px" @click="addTime">加时</n-button>
|
<!-- style="margin-right: 10px" @click="addTime">加时</n-button>-->
|
||||||
<n-button type="primary" style="margin-right: 10px" @click="exportUnsubmitted">导出未交名单</n-button>
|
<n-button type="primary" style="margin-right: 10px" @click="exportUnsubmitted">导出未交名单</n-button>
|
||||||
|
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
@ -160,20 +160,20 @@ const updateColumns=()=>{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
width: '300',
|
width: '300',
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// key: 'actions',
|
key: 'actions',
|
||||||
// title: '操作',
|
title: '操作',
|
||||||
// width: '250',
|
width: '250',
|
||||||
// render(row) {
|
render(row) {
|
||||||
// return h(
|
return h(
|
||||||
// ProblemStudentAction2,
|
ProblemStudentAction2,
|
||||||
// {
|
{
|
||||||
// onClickAddTime: () =>
|
onClickAddTime: () =>
|
||||||
// addTime(row)
|
addTime(row)
|
||||||
// }
|
}
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,7 @@ package com.example.aes.user.controller;
|
||||||
import com.example.aes.global.model.DecodeToken;
|
import com.example.aes.global.model.DecodeToken;
|
||||||
import com.example.aes.global.model.PageBean;
|
import com.example.aes.global.model.PageBean;
|
||||||
import com.example.aes.global.model.RespBean;
|
import com.example.aes.global.model.RespBean;
|
||||||
import com.example.aes.user.model.AssistantClass;
|
import com.example.aes.user.model.*;
|
||||||
import com.example.aes.user.model.DataGrid;
|
|
||||||
import com.example.aes.user.model.PMAdminusers;
|
|
||||||
import com.example.aes.user.model.UAdminusers;
|
|
||||||
import com.example.aes.user.service.AdminusersServiceI;
|
import com.example.aes.user.service.AdminusersServiceI;
|
||||||
import com.example.aes.user.service.AssistantClassServiceI;
|
import com.example.aes.user.service.AssistantClassServiceI;
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
|
|
@ -265,6 +262,17 @@ public class AdminusersController {
|
||||||
return RespBean.error("修改教师密码失败");
|
return RespBean.error("修改教师密码失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@PostMapping("/findAllTeacher")
|
||||||
|
public RespBean findAllTeacher(@RequestBody PMAdminusers pmadminusers) {
|
||||||
|
List<Adminusers> adminuser = adminusersServiceI
|
||||||
|
.getTeacher();
|
||||||
|
if (adminuser.size() != 0) {
|
||||||
|
return RespBean.ok("查询学校教师用户成功", adminuser);
|
||||||
|
} else {
|
||||||
|
return RespBean.ok("无该学校教师信息", adminuser);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.example.aes.global.model.RespBean;
|
||||||
import com.example.aes.user.model.DataGrid;
|
import com.example.aes.user.model.DataGrid;
|
||||||
import com.example.aes.user.model.Json;
|
import com.example.aes.user.model.Json;
|
||||||
import com.example.aes.user.model.PMClasses;
|
import com.example.aes.user.model.PMClasses;
|
||||||
|
import com.example.aes.user.model.UClass;
|
||||||
import com.example.aes.user.service.ClassesServiceI;
|
import com.example.aes.user.service.ClassesServiceI;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -105,6 +106,36 @@ public class ClassesController{
|
||||||
return RespBean.error("删除班级失败", result);
|
return RespBean.error("删除班级失败", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@PostMapping("/findClassNotInCourse")
|
||||||
|
public RespBean findClassNotInCourse(@RequestBody UClass uClass, HttpServletRequest request) // 查看参与课程的班级
|
||||||
|
{
|
||||||
|
if(uClass.getPageNum() < 1 || uClass.getPageSize() < 1)
|
||||||
|
return RespBean.error("参数错误");
|
||||||
|
DecodeToken decodeToken = new DecodeToken(request);
|
||||||
|
String role = decodeToken.getRole();
|
||||||
|
int teacherId = uClass.getTeacherId();
|
||||||
|
// int schoolId = uClass.getId();
|
||||||
|
if(role.equals("admin")){
|
||||||
|
if(uClass.getTeacherId()!=0)
|
||||||
|
teacherId = uClass.getTeacherId();
|
||||||
|
else
|
||||||
|
teacherId = 0;
|
||||||
|
}
|
||||||
|
DataGrid classList = new DataGrid();
|
||||||
|
if(teacherId != 0){
|
||||||
|
classList =
|
||||||
|
classesServiceI.findClassNotInCourse(uClass.getCourseId(), teacherId, uClass.getPageNum(), uClass.getPageSize(), uClass.isHistory());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uClass.setTeacherId(teacherId);
|
||||||
|
classList =
|
||||||
|
classesServiceI.findClassNotInCourse(uClass, uClass.getPageNum(), uClass.getPageSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
return RespBean.ok("查看未参与课程的班级成功",
|
||||||
|
classList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
package com.example.aes.user.controller;
|
||||||
|
|
||||||
|
import com.example.aes.global.model.DecodeToken;
|
||||||
|
import com.example.aes.global.model.RespBean;
|
||||||
|
import com.example.aes.user.model.Course;
|
||||||
|
import com.example.aes.user.model.DataGrid;
|
||||||
|
import com.example.aes.user.model.PMCourse;
|
||||||
|
import com.example.aes.user.service.CourseServiceI;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/course")
|
||||||
|
@Transactional
|
||||||
|
public class CourseCotroller {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CourseServiceI courseServiceI;
|
||||||
|
// 根据课程名称查询课程(分页)
|
||||||
|
@PostMapping("/findAllCoursesPage")
|
||||||
|
public RespBean findAllCoursesPage(@RequestBody PMCourse pmCourse, HttpServletRequest request) {
|
||||||
|
if (pmCourse.getPageNum() < 1 || pmCourse.getPageSize() < 1)
|
||||||
|
return RespBean.error("参数错误!");
|
||||||
|
DecodeToken decodeToken = new DecodeToken(request);
|
||||||
|
String userId = decodeToken.getUserId();
|
||||||
|
pmCourse.setTeacherId(Integer.parseInt(userId));
|
||||||
|
DataGrid dataGrid = courseServiceI.CoursePage(pmCourse);
|
||||||
|
if (dataGrid != null) {
|
||||||
|
return RespBean.ok("获取课程列表成功!",dataGrid);
|
||||||
|
} else {
|
||||||
|
return RespBean.error("获取课程列表失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 添加课程
|
||||||
|
@PostMapping("/addCourse")
|
||||||
|
public RespBean addCourse(@RequestBody PMCourse pmcourse, HttpServletRequest request) {
|
||||||
|
String name = pmcourse.getName();
|
||||||
|
// 课程名称不能重复
|
||||||
|
String result = courseServiceI.findCourseByName(name);
|
||||||
|
if(result.equals("true"))
|
||||||
|
return RespBean.error("不能重复添加相同名称课程");
|
||||||
|
|
||||||
|
List<PMCourse> pmcoursesList = courseServiceI.findAllCourses();
|
||||||
|
// String courseCode = new String();
|
||||||
|
// String strCode = new String();
|
||||||
|
// if (pmcoursesList.size() == 0) {
|
||||||
|
// courseCode = "001";
|
||||||
|
// }
|
||||||
|
if (pmcoursesList.size() < 999) {
|
||||||
|
//
|
||||||
|
// for (int i = 1; i <= pmcoursesList.size(); i++) {
|
||||||
|
// strCode = pmcoursesList.get(i - 1).getCode();
|
||||||
|
// int numCode = Integer.valueOf(strCode);
|
||||||
|
// if (i != numCode) {
|
||||||
|
// if (i < 10) {
|
||||||
|
// courseCode = "00" + String.valueOf(i);
|
||||||
|
// break;
|
||||||
|
// } else if (i >= 10 && i < 100) {
|
||||||
|
// courseCode = "0" + String.valueOf(i);
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (i == pmcoursesList.size()) {
|
||||||
|
// int flag = i + 1;
|
||||||
|
// if (flag < 10)
|
||||||
|
// courseCode = "00" + String.valueOf(flag);
|
||||||
|
// else if (flag >= 10 && flag < 100)
|
||||||
|
// courseCode = "0" + String.valueOf(flag);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// pmcourse.setCode(courseCode);
|
||||||
|
DecodeToken decodeToken = new DecodeToken(request);
|
||||||
|
String userId = decodeToken.getUserId();
|
||||||
|
pmcourse.setTeacherId(Integer.parseInt(userId));
|
||||||
|
pmcourse.setName(name);
|
||||||
|
courseServiceI.addCourse(pmcourse);
|
||||||
|
return RespBean.ok("添加课程成功");
|
||||||
|
} else {
|
||||||
|
return RespBean.error("课程已经满了不能再添加课程了!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据id查询章节
|
||||||
|
@PostMapping("/findCourseById")
|
||||||
|
public RespBean findCourseById(@RequestBody PMCourse pmcourse) {
|
||||||
|
int id = pmcourse.getId();
|
||||||
|
Course course =
|
||||||
|
courseServiceI.findCourseById(id);
|
||||||
|
return RespBean.ok("查询章节成功", course);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除章节
|
||||||
|
@PostMapping("/deleteCourse")
|
||||||
|
public RespBean deleteCourse(@RequestBody PMCourse pmcourse) {
|
||||||
|
int id = pmcourse.getId(); // id
|
||||||
|
Course course =
|
||||||
|
courseServiceI.findCourseById(id);
|
||||||
|
courseServiceI.deleteCourse(id); // 删除
|
||||||
|
return RespBean.ok("删除成功", id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改课程名称
|
||||||
|
@PostMapping("/editCourse")
|
||||||
|
public RespBean editCourse(@RequestBody PMCourse pmCourse){
|
||||||
|
// String code = pmCourse.getCode();
|
||||||
|
// 课程新名称
|
||||||
|
String name = pmCourse.getName();
|
||||||
|
if(courseServiceI.findCourseByName(name)=="true"){
|
||||||
|
return RespBean.ok("课程名称重复");
|
||||||
|
}
|
||||||
|
int num =
|
||||||
|
courseServiceI.editCourse(pmCourse.getId(),pmCourse.getName());
|
||||||
|
if(num == 1)
|
||||||
|
return RespBean.ok("修改课程名称成功");
|
||||||
|
else
|
||||||
|
return RespBean.error("修改课程名称失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -25,4 +25,5 @@ public interface AdminusersDaoI extends BaseDaoI<Adminusers> {
|
||||||
public boolean editAdminuser(PMAdminusers pmadminusers); // 编辑教师信息
|
public boolean editAdminuser(PMAdminusers pmadminusers); // 编辑教师信息
|
||||||
public boolean addAdminuser(PMAdminusers pmadminusers); // 添加教师
|
public boolean addAdminuser(PMAdminusers pmadminusers); // 添加教师
|
||||||
public Map<String, String> findTeachersByteacherIdList(String teacherIdList);
|
public Map<String, String> findTeachersByteacherIdList(String teacherIdList);
|
||||||
|
public List<Adminusers> getTeacher();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,6 @@ import java.util.Map;
|
||||||
|
|
||||||
public interface ClassesDaoI extends BaseDaoI<Classes> {
|
public interface ClassesDaoI extends BaseDaoI<Classes> {
|
||||||
|
|
||||||
public List<Classes> findAllClass(); // 查询所有班级
|
|
||||||
|
|
||||||
public List<PMClasses> findAllClassPage(int pageNum, int pageSize);
|
|
||||||
|
|
||||||
public long findAllClassNum(int teacherId, String role);
|
public long findAllClassNum(int teacherId, String role);
|
||||||
|
|
||||||
|
|
@ -25,58 +22,10 @@ public interface ClassesDaoI extends BaseDaoI<Classes> {
|
||||||
|
|
||||||
public List<PMClasses> findClassesByConditionPage(int teacherId,String role, int pageNum, int pageSize);
|
public List<PMClasses> findClassesByConditionPage(int teacherId,String role, int pageNum, int pageSize);
|
||||||
|
|
||||||
public boolean editClassMessage(int id, String className, int teacherId, int advance, int late, int reject, String weektime, Date first_week_monday); // 修改班级信息
|
|
||||||
|
|
||||||
public boolean deleteClass(int id); // 删除班级
|
public boolean deleteClass(int id); // 删除班级
|
||||||
|
|
||||||
public List<PMUser> findClassStudentsById(int classId); // 通过班级id,查询学生
|
|
||||||
|
|
||||||
public List<PMUser> findClassStudentsByIdNoName(List<Integer> classIdList, String studentNo, String chineseName, int pageNum, int pageSize);
|
|
||||||
|
|
||||||
public long findClassStudentsByIdNoNameNum(List<Integer> classIdList, String studentNo, String chineseName);
|
|
||||||
|
|
||||||
public List<PMUser> findClassStudentsByIdPage(int classId, int pageNum, int pageSize);
|
|
||||||
|
|
||||||
public long findClassStudentsByIdNum(int classId);
|
|
||||||
|
|
||||||
public boolean deleteClassStudentsByUserId(int classId, int userId); // 通过userId删除班级学生
|
|
||||||
|
|
||||||
public boolean updateClassStudentsNum(int classId, int num); // 更新班级学生人数
|
public boolean updateClassStudentsNum(int classId, int num); // 更新班级学生人数
|
||||||
|
|
||||||
public void addClass(PMClasses pclass); // 添加班级
|
|
||||||
|
|
||||||
public List<PMClasses> findClassInExam(int examId, boolean history); // 获取参与考试的班级
|
|
||||||
|
|
||||||
// public List<PMClasses> findClassInExam(int examId, int teacherId, String role, boolean history); // 获取参与考试的班级,并进行身份验证
|
|
||||||
|
|
||||||
public List<PMClasses> findClassInExamPage(int examId, int pageNum, int pageSize, boolean history); // 获取参与考试的班级
|
|
||||||
|
|
||||||
// public List<PMClasses> findClassInExamPage(int examId, int teacherId, String role, int pageNum, int pageSize); // 获取参与考试的班级,并进行身份验证
|
|
||||||
|
|
||||||
public long findClassInExamNum(int examId, boolean history);
|
|
||||||
|
|
||||||
// public long findClassInExamNum(int examId, int teacherId, String role);
|
|
||||||
|
|
||||||
public List<PMClasses> findClassInExamRole(int examId, String role, int teacherId); // 根据角色获取参与考试的班级
|
|
||||||
|
|
||||||
public List<PMClasses> findClassInExamNoRole(int examId, boolean history);
|
|
||||||
|
|
||||||
public List<PMClasses> findClassInExamRolePage(int examId, String role, int teacherId, int pageNum, int pageSize); // 根据角色获取参与考试的班级
|
|
||||||
|
|
||||||
public long findClassInExamRoleNum(int examId, String role, int teacherId);
|
|
||||||
|
|
||||||
public List<PMClasses> findClassInPaperExam(int paperexamId); // 获取参与考试的班级
|
|
||||||
|
|
||||||
public List<PMClasses> findClassNotInExam(int examId, int teacherId, int pageNum, int pageSize, boolean history); // 获取未参与考试的班级
|
|
||||||
|
|
||||||
public List<PMClasses> findClassNotInExam(UClass uClass, int pageNum, int pageSize); // 获取未参与考试的班级
|
|
||||||
public long findClassNotInExamNum(int examId, int teacherId, boolean history);
|
|
||||||
|
|
||||||
public long findClassNotInExamNum(UClass uClass);
|
|
||||||
|
|
||||||
public List<PMClasses> findClassNotInPaperExam(int paperexamId); // 获取未参与笔试考试的班级
|
|
||||||
|
|
||||||
public List<Classes> findNotEndClassByTeacherId(int teacherId); // 通过教师查找所属的没有结束的班级,时间为一年以内
|
|
||||||
|
|
||||||
public List<PMClasses> findClassesByCondition(PMClasses pmclasses);
|
public List<PMClasses> findClassesByCondition(PMClasses pmclasses);
|
||||||
|
|
||||||
|
|
@ -88,24 +37,10 @@ public interface ClassesDaoI extends BaseDaoI<Classes> {
|
||||||
|
|
||||||
public Classes getClassesByCode(String inviteCode);
|
public Classes getClassesByCode(String inviteCode);
|
||||||
|
|
||||||
//获取参与该场考试班级的数量和学生人数
|
|
||||||
public List<Map<String,Object>> getClassAndStudentNumByExamId(int examId);
|
|
||||||
|
|
||||||
public List<Map<String,Object>> getClassAndStudentNumByExamIdHis(int examId, boolean history);
|
public List<PMClasses> findClassNotInCourse(UClass uClass, int pageNum, int pageSize); // 获取未参与课程的班级
|
||||||
|
public List<PMClasses> findClassNotInCourse(int courseId, int teacherId, int pageNum, int pageSize, boolean history);
|
||||||
|
|
||||||
public List<Map<String,Object>> getClassAndStudentNumByExamIdHis(int examId);
|
public long findClassNotInCourseNum(UClass uClass);
|
||||||
|
public long findClassNotInCourseNum(int courseId, int teacherId, boolean history);
|
||||||
public Integer findOnlyClassIdByUserExam(int examId,int userId);//通过userId和examId查找在本场考试中学生所属的班级
|
|
||||||
|
|
||||||
public List<Classes> findClassesAfterCreateTime(String createTime);
|
|
||||||
|
|
||||||
public Classes getLastClasses();
|
|
||||||
|
|
||||||
public List<Classes> getAllClassesByExamId(int examId);
|
|
||||||
|
|
||||||
public Classes getClassByPrimaryKey(String name, Integer teacherId, Date createTime);
|
|
||||||
|
|
||||||
public int addClass(Classes classes);
|
|
||||||
|
|
||||||
public int updateClass(Classes classes);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.example.aes.user.dao;
|
||||||
|
|
||||||
|
import com.example.aes.user.model.Course;
|
||||||
|
import com.example.aes.user.model.PMCourse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CourseDaoI extends BaseDaoI<Course>{
|
||||||
|
public long getAllCoursesNum(String name);
|
||||||
|
List<Course> getCoursesByPage(String name,
|
||||||
|
int page, int rows);
|
||||||
|
public void addCourse(PMCourse pmcourse);
|
||||||
|
public String findCourseByName(String name);
|
||||||
|
public List<PMCourse> findAllCourses();
|
||||||
|
public Course findCourseById(int id);
|
||||||
|
public int editCourse(int id,String name);
|
||||||
|
public void deleteCourse(int id);
|
||||||
|
}
|
||||||
|
|
@ -360,4 +360,18 @@ public class AdminusersDaoImpl extends BaseDaoImpl<Adminusers> implements
|
||||||
}
|
}
|
||||||
return adminusersMap;
|
return adminusersMap;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<Adminusers> getTeacher() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
String hql;
|
||||||
|
// if(schoolId != 0){
|
||||||
|
// hql = "from Adminusers where role='teacher' and schoolId ='"
|
||||||
|
// + schoolId + "'";
|
||||||
|
// }else{
|
||||||
|
hql = "select distinct ad from Adminusers ad where ad.role='teacher'";
|
||||||
|
// }
|
||||||
|
List<Adminusers> adminusersList = this.find(hql);
|
||||||
|
return adminusersList;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,89 @@
|
||||||
|
package com.example.aes.user.dao.impl;
|
||||||
|
|
||||||
|
import com.example.aes.user.dao.CourseDaoI;
|
||||||
|
import com.example.aes.user.model.Course;
|
||||||
|
import com.example.aes.user.model.PMCourse;
|
||||||
|
import org.hibernate.Query;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Repository("CourseDao")
|
||||||
|
public class CourseDaoImpl extends BaseDaoImpl<Course> implements CourseDaoI {
|
||||||
|
@Override
|
||||||
|
public long getAllCoursesNum(String name) {
|
||||||
|
String hql = "select count(*) from " +
|
||||||
|
"Course where name like '%"+name+"%'";
|
||||||
|
long count=this.count(hql);
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<Course> getCoursesByPage(String name, int page, int rows) {
|
||||||
|
|
||||||
|
String hql ="from Course where name " +
|
||||||
|
"like '%"+name+"%'";
|
||||||
|
List<Course> courseList = this.find(hql,page,rows);
|
||||||
|
return courseList;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<PMCourse> findAllCourses() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
String hql = "from Course";
|
||||||
|
List<Course> courseList = this.find(hql);
|
||||||
|
List<PMCourse> pmcourseList =
|
||||||
|
new ArrayList<PMCourse>();
|
||||||
|
for (int i = 0; i < courseList.size(); i++) {
|
||||||
|
Course course = courseList.get(i);
|
||||||
|
PMCourse p = new PMCourse();
|
||||||
|
p.setId(course.getId());
|
||||||
|
p.setName(course.getName());
|
||||||
|
// p.setCode(course.getCode());
|
||||||
|
pmcourseList.add(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pmcourseList;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Course findCourseById(int id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return this.get(Course.class, id);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int editCourse(int id,String name){
|
||||||
|
String hql = "update Course set " +
|
||||||
|
"name='"+name+"' where id="+id;
|
||||||
|
Query q = this.getCurrentSession().createQuery(hql);
|
||||||
|
// q.setParameter("name", pmCourse.getName());
|
||||||
|
// q.setParameter("code", pmCourse.getCode());
|
||||||
|
int num = q.executeUpdate();
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void deleteCourse(int id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
String hql = "delete from Course where id=" + id;
|
||||||
|
this.executeHql(hql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCourse(PMCourse pmcourse) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
Course course = new Course();
|
||||||
|
// course.setCode(pmcourse.getCode());
|
||||||
|
// course.setLevel(1);
|
||||||
|
course.setName(pmcourse.getName());
|
||||||
|
course.setTeacherId(pmcourse.getTeacherId());
|
||||||
|
this.save(course);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String findCourseByName(String name){
|
||||||
|
String hql = "from Course where name=" + "'" + name + "'";
|
||||||
|
List<Course> courseList = this.find(hql);
|
||||||
|
if(courseList.size()>0)
|
||||||
|
return "true";
|
||||||
|
else
|
||||||
|
return "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.example.aes.user.model;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name="course",catalog = "aes")
|
||||||
|
public class Course implements java.io.Serializable {
|
||||||
|
private static final long serialVersionUID = -4577366061004245861L;
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id", unique = true, nullable = false)
|
||||||
|
private Integer id;
|
||||||
|
@Column(name = "adminuserId",nullable = false)
|
||||||
|
private Integer teacherId;
|
||||||
|
@Column(name = "name", length = 100)
|
||||||
|
private String name;
|
||||||
|
public Course() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/** full constructor */
|
||||||
|
public Course(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTeacherId() {
|
||||||
|
return teacherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTeacherId(Integer teacherId) {
|
||||||
|
this.teacherId = teacherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.example.aes.user.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PMCourse {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5643701670745565018L;
|
||||||
|
// private int page;
|
||||||
|
// private int rows;
|
||||||
|
private String ids;
|
||||||
|
private int id;
|
||||||
|
// private String code;
|
||||||
|
private String name;
|
||||||
|
// private int level;
|
||||||
|
private int teacherId;
|
||||||
|
// private String chapterName;
|
||||||
|
private int pageNum;
|
||||||
|
private int pageSize;
|
||||||
|
}
|
||||||
|
|
@ -7,7 +7,17 @@ public class UClass {
|
||||||
private int id;
|
private int id;
|
||||||
private int classId;
|
private int classId;
|
||||||
private int userId;
|
private int userId;
|
||||||
private int examId;
|
// private int examId;
|
||||||
|
private int courseId;
|
||||||
|
|
||||||
|
public int getCourseId() {
|
||||||
|
return courseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCourseId(int courseId) {
|
||||||
|
this.courseId = courseId;
|
||||||
|
}
|
||||||
|
|
||||||
private int paperexamId;
|
private int paperexamId;
|
||||||
private int ClassTimeId;
|
private int ClassTimeId;
|
||||||
private InputStream fileInput;
|
private InputStream fileInput;
|
||||||
|
|
@ -23,10 +33,13 @@ public class UClass {
|
||||||
|
|
||||||
public UClass(){}
|
public UClass(){}
|
||||||
|
|
||||||
public UClass(int classId, int userId, int examId, int paperexamId, int classTimeId, InputStream fileInput) {
|
public UClass(int classId, int userId,
|
||||||
|
int courseId, int paperexamId,
|
||||||
|
int classTimeId, InputStream fileInput) {
|
||||||
this.classId = classId;
|
this.classId = classId;
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.examId = examId;
|
this.courseId=courseId;
|
||||||
|
// this.examId = examId;
|
||||||
this.paperexamId = paperexamId;
|
this.paperexamId = paperexamId;
|
||||||
ClassTimeId = classTimeId;
|
ClassTimeId = classTimeId;
|
||||||
this.fileInput = fileInput;
|
this.fileInput = fileInput;
|
||||||
|
|
@ -48,13 +61,13 @@ public class UClass {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getExamId() {
|
// public int getExamId() {
|
||||||
return examId;
|
// return examId;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setExamId(int examId) {
|
// public void setExamId(int examId) {
|
||||||
this.examId = examId;
|
// this.examId = examId;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public int getPaperexamId() {
|
public int getPaperexamId() {
|
||||||
return paperexamId;
|
return paperexamId;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.example.aes.user.service;
|
package com.example.aes.user.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.aes.user.model.Adminusers;
|
||||||
import com.example.aes.user.model.DataGrid;
|
import com.example.aes.user.model.DataGrid;
|
||||||
import com.example.aes.user.model.PMAdminusers;
|
import com.example.aes.user.model.PMAdminusers;
|
||||||
|
|
||||||
|
|
@ -26,5 +27,6 @@ public interface AdminusersServiceI {
|
||||||
public boolean updateStatusByaccount(String account, String status);
|
public boolean updateStatusByaccount(String account, String status);
|
||||||
public boolean editAdminuser(PMAdminusers pmadminusers); // 编辑教师信息
|
public boolean editAdminuser(PMAdminusers pmadminusers); // 编辑教师信息
|
||||||
public boolean addAdminuser(PMAdminusers pmadminusers); // 添加教师
|
public boolean addAdminuser(PMAdminusers pmadminusers); // 添加教师
|
||||||
|
public List<Adminusers> getTeacher();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,73 +13,13 @@ public interface ClassesServiceI {
|
||||||
|
|
||||||
public Json takeOneClass(String inviteCode, int studentID);
|
public Json takeOneClass(String inviteCode, int studentID);
|
||||||
|
|
||||||
// public List<Classes> findAllClass();
|
|
||||||
//
|
|
||||||
|
|
||||||
public DataGrid findClassesByConditionPage(int teacherId, String role, int pageNum, int pageSize);
|
public DataGrid findClassesByConditionPage(int teacherId, String role, int pageNum, int pageSize);
|
||||||
|
|
||||||
public DataGrid findClassesByConditionPage(PMClasses pmclasses, int pageNum, int pageSize);
|
public DataGrid findClassesByConditionPage(PMClasses pmclasses, int pageNum, int pageSize);
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// //
|
|
||||||
//
|
|
||||||
// public boolean editClassMessage(int id, String className, int teacherId, int advance, int late, int reject, String weektime, Date first_week_monday); // 修改班级信息
|
|
||||||
//
|
|
||||||
public boolean deleteClass(int id); // 删除班级
|
public boolean deleteClass(int id); // 删除班级
|
||||||
//
|
public DataGrid findClassNotInCourse(UClass uClass, int pageNum, int pageSize); // 获取未参加课程的班级
|
||||||
// public List<PMUser> findClassStudentsById(int classId); // 通过id查询所有学生
|
public DataGrid findClassNotInCourse(int courseId, int teacherId, int pageNum, int pageSize, boolean history); // 获取未参加课程的班级
|
||||||
//
|
|
||||||
// public DataGrid findClassStudentsByIdNoName(List<Integer> classIdList, String studentNo, String chineseName, int pageNum, int pageSize); // 通过id查询所有学生
|
|
||||||
//
|
|
||||||
// public DataGrid findClassStudentsByIdPage(int classId,int pageNum, int pageSize);
|
|
||||||
//
|
|
||||||
// public boolean deleteClassStudentsByUserId(int classId, int userId);
|
|
||||||
//
|
|
||||||
// public void addClass(PMClasses pclass); // 添加班级
|
|
||||||
//
|
|
||||||
// public List<PMClasses> findClassInExam(int examId); // 获取参与考试的班级
|
|
||||||
//
|
|
||||||
// public List<PMClasses> findClassInExam(int examId, int teacherId, String role, boolean history); // 获取参与考试的班级(有身份验证)
|
|
||||||
//
|
|
||||||
// public DataGrid findClassInExamPage(int examId, int pageNum, int pageSize, boolean history); // 获取参与考试的班级
|
|
||||||
//
|
|
||||||
// public DataGrid findClassInExamPage(int examId, int teacherId, String role, int pageNum, int pageSize); // 获取参与考试的班级(有身份验证)
|
|
||||||
//
|
|
||||||
// public List<PMClasses> findClassInExamRole(int examId, String role, int teacherId); // 根据角色获取参与考试的班级
|
|
||||||
//
|
|
||||||
// public List<PMClasses> findClassInExamNoRole(int examId, boolean history); // 根据角色获取参与考试的班级
|
|
||||||
//
|
|
||||||
// public DataGrid findClassInExamRolePage(int examId, String role, int teacherId, int pageNum, int pageSize); // 根据角色获取参与考试的班级
|
|
||||||
//
|
|
||||||
// public List<PMClasses> findClassInPaperExam(int paperexamId); // 获取参与考试的班级
|
|
||||||
//
|
|
||||||
// public DataGrid findClassNotInExam(int examId, int teacherId, int pageNum, int pageSize, boolean history); // 获取未参加考试的班级
|
|
||||||
//
|
|
||||||
// public DataGrid findClassNotInExam(UClass uClass, int pageNum, int pageSize); // 获取未参加考试的班级
|
|
||||||
//
|
|
||||||
// public List<PMClasses> findClassNotInPaperExam(int paperexamId); // 获取未参加笔试考试的班级
|
|
||||||
//
|
|
||||||
// public Classes findClassById(int classId);
|
|
||||||
//
|
|
||||||
// public List<Classes> findNotEndClassByTeacherId(int teacherId); // 通过教师查找所属的班级,班级时间为一年以内
|
|
||||||
//
|
|
||||||
// public List<PMClasses> findClassesByCondition(PMClasses pmclasses); //查找教师没有参加该考试的班级
|
|
||||||
//
|
|
||||||
// public DataGrid findClassesByConditionPage(PMClasses pmclasses, int pageNum, int pageSize); //查找教师没有参加该考试的班级
|
|
||||||
//
|
|
||||||
// public Json takeOneClass(String inviteCode, int studentID);
|
|
||||||
//
|
|
||||||
// public List<ClassTimes> getAttendanceByClassId(int classId); // 通过班级id查询考勤情况
|
|
||||||
//
|
|
||||||
// // 根据studentId获取该学生考勤的相关信息
|
|
||||||
// public List<StudentAttendance> findStudentAttendanceById(int studentId, int classId, int ClassTimeId);
|
|
||||||
//
|
|
||||||
//// public List<ClassTimes> getClassStudentsByClassId(int classId); // 通过班级id查询班级所有学生
|
|
||||||
//// 根据学生id和考试id查询本场考试中该学生的所属班级
|
|
||||||
// public Integer findClassInExamByStudentId(int studentId,int examId);
|
|
||||||
//
|
|
||||||
// public List<Classes> findClassesAfterCreateTime(String createTime);
|
|
||||||
//
|
|
||||||
// public Classes getLastClasses();
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.example.aes.user.service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.example.aes.user.model.Course;
|
||||||
|
import com.example.aes.user.model.DataGrid;
|
||||||
|
import com.example.aes.user.model.PMCourse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CourseServiceI {
|
||||||
|
|
||||||
|
DataGrid CoursePage(PMCourse pmCourse);
|
||||||
|
// 通过课程名称查找课程
|
||||||
|
public String findCourseByName(String name);
|
||||||
|
List<PMCourse> findAllCourses();
|
||||||
|
public void addCourse(PMCourse pmcourse);
|
||||||
|
public Course findCourseById(int id);
|
||||||
|
// 编辑课程名称
|
||||||
|
public int editCourse(int id,String name);
|
||||||
|
void deleteCourse(int id);
|
||||||
|
}
|
||||||
|
|
@ -239,6 +239,12 @@ public class AdminusersServiceImpl implements AdminusersServiceI {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return adminusersDao.addAdminuser(pmadminusers);
|
return adminusersDao.addAdminuser(pmadminusers);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<Adminusers> getTeacher() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return adminusersDao.getTeacher();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PMAdminusers findAssistantByno(String no){
|
public PMAdminusers findAssistantByno(String no){
|
||||||
|
|
|
||||||
|
|
@ -120,5 +120,35 @@ public void setclassstudentsDao(ClassstudentsDaoI classstudentsDao) {
|
||||||
|
|
||||||
return classesDao.deleteClass(id);
|
return classesDao.deleteClass(id);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public DataGrid findClassNotInCourse(UClass uClass, int pageNum, int pageSize){
|
||||||
|
DataGrid dg = new DataGrid();
|
||||||
|
long totalLines;
|
||||||
|
totalLines = classesDao.findClassNotInCourseNum(uClass);
|
||||||
|
List<PMClasses> pmClassesList = classesDao.findClassNotInCourse(uClass, pageNum, pageSize);
|
||||||
|
dg.setTotal(totalLines);
|
||||||
|
dg.setPageSize(pageSize);
|
||||||
|
dg.setTotalPages((long) (Math.ceil((double) dg.getTotal() / (double) dg.getPageSize())));
|
||||||
|
dg.setPageNum(pageNum);
|
||||||
|
dg.setCurrentPageLineNum(pmClassesList.size());
|
||||||
|
dg.setList(pmClassesList);
|
||||||
|
return dg;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public DataGrid findClassNotInCourse(int courseId, int teacherId, int pageNum, int pageSize, boolean history) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
DataGrid dg = new DataGrid();
|
||||||
|
long totalLines;
|
||||||
|
totalLines =
|
||||||
|
classesDao.findClassNotInCourseNum(courseId, teacherId, history);
|
||||||
|
List<PMClasses> pmClassesList =
|
||||||
|
classesDao.findClassNotInCourse(courseId, teacherId, pageNum, pageSize, history);
|
||||||
|
dg.setTotal(totalLines);
|
||||||
|
dg.setPageSize(pageSize);
|
||||||
|
dg.setTotalPages((long) (Math.ceil((double) dg.getTotal() / (double) dg.getPageSize())));
|
||||||
|
dg.setPageNum(pageNum);
|
||||||
|
dg.setCurrentPageLineNum(pmClassesList.size());
|
||||||
|
dg.setList(pmClassesList);
|
||||||
|
return dg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
package com.example.aes.user.service.impl;
|
||||||
|
|
||||||
|
import com.example.aes.user.dao.CourseDaoI;
|
||||||
|
import com.example.aes.user.model.Course;
|
||||||
|
import com.example.aes.user.model.DataGrid;
|
||||||
|
import com.example.aes.user.model.PMCourse;
|
||||||
|
import com.example.aes.user.service.CourseServiceI;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CourseServiceImpl implements CourseServiceI {
|
||||||
|
private CourseDaoI courseDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setCourseDao(CourseDaoI courseDao) {
|
||||||
|
this.courseDao = courseDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataGrid CoursePage(PMCourse pmCourse) {
|
||||||
|
DataGrid dg = new DataGrid();
|
||||||
|
int totalLines;
|
||||||
|
List<Course> theCourseList;
|
||||||
|
String name=pmCourse.getName();
|
||||||
|
totalLines =
|
||||||
|
(int) courseDao.getAllCoursesNum(name);
|
||||||
|
int page= pmCourse.getPageNum();
|
||||||
|
if ((page-1)*pmCourse.getPageSize()<totalLines){
|
||||||
|
theCourseList = courseDao.getCoursesByPage(pmCourse.getName(),pmCourse.getPageNum(), pmCourse.getPageSize());
|
||||||
|
}else {
|
||||||
|
pmCourse.setPageNum(1);
|
||||||
|
theCourseList = courseDao.getCoursesByPage(pmCourse.getName(),pmCourse.getPageNum(), pmCourse.getPageSize());
|
||||||
|
}
|
||||||
|
if (theCourseList == null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
List<PMCourse> pmCourseList =
|
||||||
|
new ArrayList<PMCourse>();
|
||||||
|
changeModel(theCourseList, pmCourseList);
|
||||||
|
dg.setTotal(totalLines);
|
||||||
|
dg.setPageSize(pmCourse.getPageSize());
|
||||||
|
dg.setTotalPages((long) (Math.ceil((double) dg.getTotal() / (double) dg.getPageSize())));
|
||||||
|
// // 设置当前显示第几页
|
||||||
|
dg.setPageNum(pmCourse.getPageNum());
|
||||||
|
// // 设置当前页的数据行数量
|
||||||
|
dg.setCurrentPageLineNum(pmCourseList.size());
|
||||||
|
// // 设置当前页的所有数据行
|
||||||
|
dg.setList(pmCourseList);
|
||||||
|
return dg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void changeModel(List<Course> l, List<PMCourse> nl) {
|
||||||
|
if (l != null && l.size() > 0) {
|
||||||
|
for (Course t : l) {
|
||||||
|
PMCourse u = new PMCourse();
|
||||||
|
BeanUtils.copyProperties(t, u);
|
||||||
|
nl.add(u);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void addCourse(PMCourse pmcourse) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
courseDao.addCourse(pmcourse);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String findCourseByName(String name){
|
||||||
|
return courseDao.findCourseByName(name);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<PMCourse> findAllCourses() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return courseDao.findAllCourses();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Course findCourseById(int id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return courseDao.findCourseById(id);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int editCourse(int id,String name){
|
||||||
|
return courseDao.editCourse(id,name);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void deleteCourse(int id) {
|
||||||
|
courseDao.deleteCourse(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue