作业添加的大体接口完成,还剩添加中取消的逻辑没完成
This commit is contained in:
parent
4e7fa68ddf
commit
0299363867
|
|
@ -70,6 +70,11 @@ export default {
|
||||||
addClassAssistant: (data) => request.post('/assistantClass/addClassAssistant', data),
|
addClassAssistant: (data) => request.post('/assistantClass/addClassAssistant', data),
|
||||||
getAssistantNotBelongClass: (data) =>
|
getAssistantNotBelongClass: (data) =>
|
||||||
request.post('/adminusers/getAssistantNotBelongClass', data),
|
request.post('/adminusers/getAssistantNotBelongClass', data),
|
||||||
AddScoringRubric: (data) => request.post('/problem/addScoringRubric', data),
|
addScoringRubric: (data) => request.post('/problem/addScoringRubric', data),
|
||||||
findScoringRubricNoStandardId:(data)=>request.post('/problem/findScoringRubricNoStandardId',data)
|
findScoringRubricNoStandardId:(data)=>request.post('/problem/findScoringRubricNoStandardId',data),
|
||||||
|
addScoringStandard: (data) => request.post('/problem/addScoringStandard', data),
|
||||||
|
findScoringStandardNoProblemId: (data) => request.post('/problem/findScoringStandardNoProblemId', data),
|
||||||
|
addProblem:(data) => request.post('/problem/addProblem', data),
|
||||||
|
findClassById: (data) => request.post('/classes/findClassById', data),
|
||||||
|
editClassMessage: (data) => request.post('/classes/editClassMessage', data),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -272,8 +272,7 @@ const onAssistantClass = async (classid)=>{
|
||||||
await router.push({name: 'AdminClassAssistant', params: {clId: id}})
|
await router.push({name: 'AdminClassAssistant', params: {clId: id}})
|
||||||
}
|
}
|
||||||
const onEditClass = async (classid)=>{
|
const onEditClass = async (classid)=>{
|
||||||
// const {id} = classid
|
const {id} = classid
|
||||||
const id=1
|
|
||||||
await router.push({name: 'AdminClassEdit', params: {clId: id}})
|
await router.push({name: 'AdminClassEdit', params: {clId: id}})
|
||||||
}
|
}
|
||||||
const search=async ()=>{
|
const search=async ()=>{
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ const onAssistantClass = async (classId)=>{
|
||||||
|
|
||||||
const queryByPage1 = async (query) => {
|
const queryByPage1 = async (query) => {
|
||||||
const res = await api.findAllTeacher({
|
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,
|
||||||
|
|
|
||||||
|
|
@ -2,27 +2,24 @@
|
||||||
<n-scrollbar x-scrollable style="max-height: 100vh">
|
<n-scrollbar x-scrollable style="max-height: 100vh">
|
||||||
<CommonPage show-footer>
|
<CommonPage show-footer>
|
||||||
<div style="margin-top: 0px">
|
<div style="margin-top: 0px">
|
||||||
<n-form ref="ProblemInfoRef"
|
<!-- <n-form ref="ProblemInfoRef"-->
|
||||||
:model="ProblemInfoValue"
|
<!-- :model="ScoringStandardInfoValue"-->
|
||||||
:rules="rules"
|
<!-- :rules="rules"-->
|
||||||
label-placement="left"
|
<!-- label-placement="left"-->
|
||||||
size="small"
|
<!-- size="small"-->
|
||||||
:label-width="60" >
|
<!-- :label-width="60" >-->
|
||||||
</n-form>
|
<!-- </n-form>-->
|
||||||
</div>
|
</div>
|
||||||
<n-data-table
|
<n-data-table
|
||||||
remote
|
remote
|
||||||
:single-line="false"
|
:single-line="false"
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="ProblemList"
|
:data="ScoringStandardList"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:pagination="paginationReactive"
|
|
||||||
:row-key="rowKey"
|
:row-key="rowKey"
|
||||||
:scroll-x="900"
|
:scroll-x="900"
|
||||||
style="width: 1180px;--n-td-padding:0px 5px;"
|
style="width: 1180px;--n-td-padding:0px 5px;"
|
||||||
@update:page="onChangePage"
|
|
||||||
@update:page-size="onUpdatePageSize"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</CommonPage>
|
</CommonPage>
|
||||||
|
|
@ -56,12 +53,11 @@ const paginationReactive = reactive({
|
||||||
return `总共 ${itemCount} 条`
|
return `总共 ${itemCount} 条`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const ProblemInfoValue = ref({
|
const ScoringStandardInfoValue = ref({
|
||||||
pageNum:paginationReactive.page,
|
|
||||||
pageSize:paginationReactive.pageSize,
|
|
||||||
id:0,
|
})
|
||||||
teacherId:'',
|
const ScoringStandardList=ref([])
|
||||||
});
|
|
||||||
const queryByPage1=async (value)=>{
|
const queryByPage1=async (value)=>{
|
||||||
if (userStore.getRole().some((r) => r === 'admin')) {
|
if (userStore.getRole().some((r) => r === 'admin')) {
|
||||||
const res = await api.findAllAdminusersBySchoolId({
|
const res = await api.findAllAdminusersBySchoolId({
|
||||||
|
|
@ -75,19 +71,19 @@ const queryByPage1=async (value)=>{
|
||||||
label: '全部',
|
label: '全部',
|
||||||
value: 0,
|
value: 0,
|
||||||
})
|
})
|
||||||
ProblemInfoValue.value.teacherId = 0
|
ScoringStandardInfoValue.value.teacherId = 0
|
||||||
options1.value = transformedData
|
options1.value = transformedData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
watch(()=>ProblemInfoValue.value.id,
|
watch(()=>ScoringStandardInfoValue.value.id,
|
||||||
(newVal)=>{
|
(newVal)=>{
|
||||||
ProblemInfoValue.value.teacherId=''
|
ScoringStandardInfoValue.value.teacherId=''
|
||||||
options1.value=[]
|
options1.value=[]
|
||||||
queryByPage1(newVal)
|
queryByPage1(newVal)
|
||||||
})
|
})
|
||||||
let columns = [
|
let columns = [
|
||||||
{
|
{
|
||||||
key: 'demension',
|
key: 'dimension',
|
||||||
title: '维度',
|
title: '维度',
|
||||||
width: '50',
|
width: '50',
|
||||||
align:'center'
|
align:'center'
|
||||||
|
|
@ -99,7 +95,7 @@ let columns = [
|
||||||
align:'center'
|
align:'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'rubics',
|
key: 'rubrics',
|
||||||
title: '评分细则',
|
title: '评分细则',
|
||||||
width: '300',
|
width: '300',
|
||||||
}
|
}
|
||||||
|
|
@ -108,32 +104,8 @@ let columns = [
|
||||||
const queryByPage = async (currentPage)=>{
|
const queryByPage = async (currentPage)=>{
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
ProblemInfoValue.value.pageSize=paginationReactive.pageSize
|
const res = await api.findScoringStandardNoProblemId({})
|
||||||
const res = await api.findAllProblemPage(
|
ScoringStandardList.value=res.data
|
||||||
{
|
|
||||||
...ProblemInfoValue.value
|
|
||||||
}
|
|
||||||
);
|
|
||||||
console.log(res.data)
|
|
||||||
if (userStore.getRole().some((r) => r === 'admin')){
|
|
||||||
const res1=await api.findAllShoolsInAdminusers()
|
|
||||||
const list1=res1.data
|
|
||||||
const transformedDatas=list1.map(item => ({
|
|
||||||
label: item.name,
|
|
||||||
value: item.id,
|
|
||||||
}));
|
|
||||||
transformedDatas.unshift({
|
|
||||||
label: '全部',
|
|
||||||
value: 0,
|
|
||||||
});
|
|
||||||
options.value=transformedDatas;
|
|
||||||
}
|
|
||||||
const {pageNum, pageSize, total, list} = res.data
|
|
||||||
paginationReactive.page = pageNum
|
|
||||||
paginationReactive.pageSize = pageSize
|
|
||||||
paginationReactive.itemCount = total
|
|
||||||
ProblemList.value=list.map((item,i)=>{return item;})
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|
@ -165,7 +137,7 @@ const onUpdatePageSize = (pageSize) => {
|
||||||
}
|
}
|
||||||
const onChangePage = (page) => {
|
const onChangePage = (page) => {
|
||||||
paginationReactive.page = page;
|
paginationReactive.page = page;
|
||||||
ProblemInfoValue.value.pageNum=page
|
ScoringStandardInfoValue.value.pageNum=page
|
||||||
if (!loading.value) {
|
if (!loading.value) {
|
||||||
queryByPage(page)
|
queryByPage(page)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {useRouter} from "vue-router";
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
import api from "@/api/admin";
|
import api from "@/api/admin";
|
||||||
import { useTagsStore } from '@/store'
|
import { useTagsStore } from '@/store'
|
||||||
|
|
@ -62,8 +62,12 @@ const tagsStore = useTagsStore()
|
||||||
const path=ref('')
|
const path=ref('')
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const rules=ref(null)
|
const rules=ref(null)
|
||||||
|
const route = useRoute()
|
||||||
|
const { courseId, history } = route.query
|
||||||
const problemInfoValue = ref({
|
const problemInfoValue = ref({
|
||||||
name: ''
|
title: "",
|
||||||
|
description:"",
|
||||||
|
courseId:courseId
|
||||||
});
|
});
|
||||||
const problemInfoRef = ref(null)
|
const problemInfoRef = ref(null)
|
||||||
const descEditorHeight = ref('160px')
|
const descEditorHeight = ref('160px')
|
||||||
|
|
@ -75,21 +79,25 @@ const cancel = ()=>{
|
||||||
const onAdd = ()=>{
|
const onAdd = ()=>{
|
||||||
router.push({name: 'AdminProblemScoringStandard'})
|
router.push({name: 'AdminProblemScoringStandard'})
|
||||||
}
|
}
|
||||||
const submit =async ()=>{
|
const submit =async ()=> {
|
||||||
if(problemInfoValue.value.name!==''){
|
if (problemInfoValue.value.title !== '' && problemInfoValue.value.description !== '') {
|
||||||
try {
|
try {
|
||||||
await api.Addproblem({
|
|
||||||
...problemInfoValue.value
|
await api.addProblem({
|
||||||
|
...problemInfoValue.value,
|
||||||
|
courseId:courseId
|
||||||
})
|
})
|
||||||
$message.success("添加课程成功")
|
$message.success("添加作业成功")
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
await router.push({name: 'AdminProblemList'})
|
await router.push({ name: 'AdminProblemList' })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
await router.push({name: 'AdminProblemList'})
|
await router.push({ name: 'AdminProblemList' })
|
||||||
}
|
}
|
||||||
}else {
|
} else if (problemInfoValue.value.title == "") {
|
||||||
$message.error("作业名称不能为空")
|
$message.error("作业名称不能为空")
|
||||||
|
} else{
|
||||||
|
$message.error("题目描述不能为空")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ const onAdd = ()=>{
|
||||||
const submit =async ()=>{
|
const submit =async ()=>{
|
||||||
if(problemInfoValue.value.lowerLimit!==''&&problemInfoValue.value.upperLimit!==''&&problemInfoValue.value.description!==''){
|
if(problemInfoValue.value.lowerLimit!==''&&problemInfoValue.value.upperLimit!==''&&problemInfoValue.value.description!==''){
|
||||||
try {
|
try {
|
||||||
await api.AddScoringRubric({
|
await api.addScoringRubric({
|
||||||
...problemInfoValue.value
|
...problemInfoValue.value
|
||||||
})
|
})
|
||||||
$message.success("添加评分细则成功")
|
$message.success("添加评分细则成功")
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<n-form ref="problemInfoRef"
|
<n-form ref="problemInfoRef"
|
||||||
:model="problemInfoValue"
|
:model="ScoringStandardInfoValue"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
label-placement="left"style="margin-top: 15px;margin-left: 5%">
|
label-placement="left"style="margin-top: 15px;margin-left: 5%">
|
||||||
<div class="flex" style='align-items:
|
<div class="flex" style='align-items:
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
path="demension"
|
path="demension"
|
||||||
>
|
>
|
||||||
<n-input
|
<n-input
|
||||||
v-model:value="problemInfoValue.demension"
|
v-model:value="ScoringStandardInfoValue.dimension"
|
||||||
placeholder="输入维度"
|
placeholder="输入维度"
|
||||||
style='width: 800px'/>
|
style='width: 800px'/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
style="margin-left: 30px"
|
style="margin-left: 30px"
|
||||||
>
|
>
|
||||||
<n-input
|
<n-input
|
||||||
v-model:value="problemInfoValue.weight"
|
v-model:value="ScoringStandardInfoValue.weight"
|
||||||
placeholder="输入权重"
|
placeholder="输入权重"
|
||||||
style='width: 800px'/>
|
style='width: 800px'/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
@ -63,35 +63,34 @@ const tagsStore = useTagsStore()
|
||||||
const path=ref('')
|
const path=ref('')
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const rules=ref(null)
|
const rules=ref(null)
|
||||||
const problemInfoValue = ref({
|
const ScoringStandardInfoValue = ref({
|
||||||
demension:"",
|
dimension:'',
|
||||||
weight:"",
|
weight:'',
|
||||||
problemId:''
|
id:''
|
||||||
});
|
});
|
||||||
const problemInfoRef = ref(null)
|
const problemInfoRef = ref(null)
|
||||||
|
|
||||||
const cancel = ()=>{
|
const cancel = ()=>{
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
router.push({path: 'problem-add'})
|
|
||||||
}
|
}
|
||||||
const onAdd = ()=>{
|
const onAdd = ()=>{
|
||||||
router.push({name: 'AdminProblemScoringRubric'})
|
router.push({name: 'AdminProblemScoringRubric'})
|
||||||
}
|
}
|
||||||
const submit =async ()=>{
|
const submit =async ()=>{
|
||||||
if(problemInfoValue.value.name!==''){
|
if(ScoringStandardInfoValue.value.dimension!==''&&ScoringStandardInfoValue.value.weight!==''){
|
||||||
try {
|
try {
|
||||||
await api.Addproblem({
|
await api.addScoringStandard({
|
||||||
...problemInfoValue.value
|
...ScoringStandardInfoValue.value
|
||||||
})
|
})
|
||||||
$message.success("添加课程成功")
|
$message.success("添加评分标准成功")
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
await router.push({name: 'AdminProblemList'})
|
await router.push({name: 'AdminProblemAdd'})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
await router.push({name: 'AdminProblemList'})
|
await router.push({name: 'AdminProblemAdd'})
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
$message.error("作业名称不能为空")
|
$message.error("维度或权重不能为空")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,7 @@ package com.example.aes.problem.controller;
|
||||||
|
|
||||||
import com.example.aes.global.model.DecodeToken;
|
import com.example.aes.global.model.DecodeToken;
|
||||||
import com.example.aes.global.model.RespBean;
|
import com.example.aes.global.model.RespBean;
|
||||||
import com.example.aes.problem.model.PMProblem;
|
import com.example.aes.problem.model.*;
|
||||||
import com.example.aes.problem.model.PMScoringRubric;
|
|
||||||
import com.example.aes.problem.model.UScoringRubric;
|
|
||||||
import com.example.aes.problem.service.ProblemServiceI;
|
import com.example.aes.problem.service.ProblemServiceI;
|
||||||
import com.example.aes.user.model.*;
|
import com.example.aes.user.model.*;
|
||||||
import com.example.aes.user.service.ClassesServiceI;
|
import com.example.aes.user.service.ClassesServiceI;
|
||||||
|
|
@ -34,6 +32,46 @@ public class ProblemController {
|
||||||
problemServiceI.addScoringRubric(scoringRubric);
|
problemServiceI.addScoringRubric(scoringRubric);
|
||||||
return RespBean.ok("添加评分细则成功");
|
return RespBean.ok("添加评分细则成功");
|
||||||
}
|
}
|
||||||
|
@PostMapping("/addScoringStandard")
|
||||||
|
public RespBean addScoringStandard(@RequestBody PMScoringStandard pmScoringStandard) {
|
||||||
|
problemServiceI.addScoringStandard(pmScoringStandard);
|
||||||
|
List<ScoringStandard> scoringStandardList=problemServiceI.findStandardIdNoProblemId();
|
||||||
|
if(scoringStandardList.size()>1) {
|
||||||
|
problemServiceI.updateStandardId(scoringStandardList.get(0).getId());
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
for(ScoringStandard scoringStandard:scoringStandardList){
|
||||||
|
problemServiceI.updateStandardId(scoringStandard.getId());
|
||||||
|
}
|
||||||
|
} return RespBean.ok("添加评分标准成功");
|
||||||
|
|
||||||
|
}
|
||||||
|
@PostMapping("/addProblem")
|
||||||
|
public RespBean addProblem(@RequestBody Problem problem, HttpServletRequest request) {
|
||||||
|
String title= problem.getTitle();
|
||||||
|
//作业名称不能重复
|
||||||
|
String result=
|
||||||
|
problemServiceI.findProblemByTitle(title);
|
||||||
|
if(result.equals("true"))
|
||||||
|
return RespBean.error(
|
||||||
|
"不能重复添加相同标题的作业");
|
||||||
|
//添加作业
|
||||||
|
DecodeToken decodeToken = new DecodeToken(request);
|
||||||
|
String userId = decodeToken.getUserId();
|
||||||
|
problem.setAdminuserId(Integer.parseInt(userId));
|
||||||
|
problemServiceI.addProblem(problem);
|
||||||
|
//更新评分标准标中的problemId
|
||||||
|
List<Problem> problems=
|
||||||
|
problemServiceI.findProblemIdByTitle(title);
|
||||||
|
if(problems.size()>1){
|
||||||
|
problemServiceI.updateProblemId(problems.get(0).getId());
|
||||||
|
}else{
|
||||||
|
for(Problem problem1:problems){
|
||||||
|
problemServiceI.updateProblemId(problem1.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return RespBean.ok("添加作业成功");
|
||||||
|
}
|
||||||
@PostMapping("/findScoringRubricNoStandardId")
|
@PostMapping("/findScoringRubricNoStandardId")
|
||||||
public RespBean findScoringRubricNoStandardId() {
|
public RespBean findScoringRubricNoStandardId() {
|
||||||
List<UScoringRubric> uScoringRubricList=
|
List<UScoringRubric> uScoringRubricList=
|
||||||
|
|
@ -45,6 +83,18 @@ public class ProblemController {
|
||||||
return RespBean.error("获取评分细则列表失败!");
|
return RespBean.error("获取评分细则列表失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@PostMapping("/findScoringStandardNoProblemId")
|
||||||
|
public RespBean findScoringStandardNoProblemId() {
|
||||||
|
List<UScoringStandard> uScoringStandardList=
|
||||||
|
problemServiceI.findScoringStandardNoProblemId();
|
||||||
|
if (uScoringStandardList != null) {
|
||||||
|
return RespBean.ok("获取评分标准列表成功!",
|
||||||
|
uScoringStandardList);
|
||||||
|
} else {
|
||||||
|
return RespBean.error("获取评分标准列表失败!");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//获取作业列表
|
//获取作业列表
|
||||||
@GetMapping("/getExamList")
|
@GetMapping("/getExamList")
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.example.aes.problem.model.PMScoringRubric;
|
||||||
import com.example.aes.problem.model.Problem;
|
import com.example.aes.problem.model.Problem;
|
||||||
import com.example.aes.user.dao.BaseDaoI;
|
import com.example.aes.user.dao.BaseDaoI;
|
||||||
import com.example.aes.user.model.Classstudents;
|
import com.example.aes.user.model.Classstudents;
|
||||||
|
import com.example.aes.user.model.PMCourse;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -14,7 +15,9 @@ import java.util.List;
|
||||||
public interface ProblemDaoI extends BaseDaoI<Problem> {
|
public interface ProblemDaoI extends BaseDaoI<Problem> {
|
||||||
|
|
||||||
List<PMProblem> findProblemsByClassIds(List<Integer> classIds);
|
List<PMProblem> findProblemsByClassIds(List<Integer> classIds);
|
||||||
|
public String findProblemByTitle(String title);
|
||||||
|
public List<Problem> findProblemIdByTitle(String title);
|
||||||
|
public void addProblem(Problem problem);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,6 @@ import java.util.List;
|
||||||
public interface ScoringRubricDaoI extends BaseDaoI<ScoringRubric> {
|
public interface ScoringRubricDaoI extends BaseDaoI<ScoringRubric> {
|
||||||
public void addScoringRubric(PMScoringRubric pmScoringRubric);
|
public void addScoringRubric(PMScoringRubric pmScoringRubric);
|
||||||
public List<ScoringRubric> getScoringRubricNoStandardId();
|
public List<ScoringRubric> getScoringRubricNoStandardId();
|
||||||
|
public void updateStandardId(Integer standardId);
|
||||||
|
public List<ScoringRubric> getScoringRubricByStandardId(Integer standardId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.example.aes.problem.dao;
|
||||||
|
|
||||||
|
import com.example.aes.problem.model.PMScoringStandard;
|
||||||
|
import com.example.aes.problem.model.ScoringStandard;
|
||||||
|
import com.example.aes.user.dao.BaseDaoI;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ScoringStandardDaoI extends BaseDaoI<ScoringStandard> {
|
||||||
|
public void addScoringStandard(PMScoringStandard pmScoringStandard);
|
||||||
|
public List<ScoringStandard> getStandardIdNoProblemId();
|
||||||
|
public List<ScoringStandard> getStandardIdNoProblemIdDesc();
|
||||||
|
public void updateProblemId(int problemId);
|
||||||
|
}
|
||||||
|
|
@ -7,6 +7,8 @@ import com.example.aes.problem.model.Problem;
|
||||||
import com.example.aes.user.dao.BaseDaoI;
|
import com.example.aes.user.dao.BaseDaoI;
|
||||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||||
import com.example.aes.user.model.Classstudents;
|
import com.example.aes.user.model.Classstudents;
|
||||||
|
import com.example.aes.user.model.Course;
|
||||||
|
import com.example.aes.user.model.PMCourse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
@ -40,7 +42,33 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
||||||
|
|
||||||
return problems;
|
return problems;
|
||||||
}
|
}
|
||||||
public void addScoringRubric(PMScoringRubric pmScoringRubric){
|
@Override
|
||||||
|
public String findProblemByTitle(String title){
|
||||||
};
|
String hql =
|
||||||
|
"from Problem where title=" +
|
||||||
|
"'" + title + "'";
|
||||||
|
List<Problem> problemList = this.find(hql);
|
||||||
|
if(problemList.size()>0)
|
||||||
|
return "true";
|
||||||
|
else
|
||||||
|
return "false";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<Problem> findProblemIdByTitle(String title){
|
||||||
|
String hql =
|
||||||
|
"from Problem where title=" +
|
||||||
|
"'" + title + "'";
|
||||||
|
List<Problem> problemList = this.find(hql);
|
||||||
|
return problemList;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void addProblem(Problem problem) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
Problem problem1=new Problem();
|
||||||
|
problem1.setAdminuserId(problem.getAdminuserId());
|
||||||
|
problem1.setCourseId(problem.getCourseId());
|
||||||
|
problem1.setTitle(problem.getTitle());
|
||||||
|
problem1.setDescription(problem.getDescription());
|
||||||
|
this.save(problem1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,7 @@ package com.example.aes.problem.dao.impl;
|
||||||
import com.example.aes.problem.dao.ScoringRubricDaoI;
|
import com.example.aes.problem.dao.ScoringRubricDaoI;
|
||||||
import com.example.aes.problem.model.PMScoringRubric;
|
import com.example.aes.problem.model.PMScoringRubric;
|
||||||
import com.example.aes.problem.model.ScoringRubric;
|
import com.example.aes.problem.model.ScoringRubric;
|
||||||
import com.example.aes.user.dao.CourseDaoI;
|
|
||||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||||
import com.example.aes.user.model.Course;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -29,5 +27,20 @@ public class ScoringRubricDaoImpl extends BaseDaoImpl<ScoringRubric> implements
|
||||||
List<ScoringRubric> scoringRubricList =
|
List<ScoringRubric> scoringRubricList =
|
||||||
this.find(hql);
|
this.find(hql);
|
||||||
return scoringRubricList;
|
return scoringRubricList;
|
||||||
};
|
}
|
||||||
|
@Override
|
||||||
|
public void updateStandardId(Integer standardId){
|
||||||
|
String hql =
|
||||||
|
"update ScoringRubric set " +
|
||||||
|
"standardId=" + standardId + " where standardId is null";
|
||||||
|
this.executeHql(hql);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<ScoringRubric> getScoringRubricByStandardId(Integer standardId){
|
||||||
|
String hql ="from ScoringRubric where " +
|
||||||
|
"standardId="+standardId;
|
||||||
|
List<ScoringRubric> scoringRubricList =
|
||||||
|
this.find(hql);
|
||||||
|
return scoringRubricList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.example.aes.problem.dao.impl;
|
||||||
|
|
||||||
|
import com.example.aes.problem.dao.ScoringStandardDaoI;
|
||||||
|
import com.example.aes.problem.model.PMScoringStandard;
|
||||||
|
import com.example.aes.problem.model.ScoringStandard;
|
||||||
|
import com.example.aes.problem.model.UScoringStandard;
|
||||||
|
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Repository("ScoringStandardDao")
|
||||||
|
public class ScoringStandardDaoImpl extends BaseDaoImpl<ScoringStandard> implements ScoringStandardDaoI {
|
||||||
|
@Override
|
||||||
|
public void addScoringStandard(PMScoringStandard pmScoringStandard){
|
||||||
|
ScoringStandard scoringStandard=
|
||||||
|
new ScoringStandard();
|
||||||
|
scoringStandard.setDimension(pmScoringStandard.getDimension());
|
||||||
|
scoringStandard.setWeight(pmScoringStandard.getWeight());
|
||||||
|
this.save(scoringStandard);
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<ScoringStandard> getStandardIdNoProblemId(){
|
||||||
|
String sql="from " +
|
||||||
|
"ScoringStandard where " +
|
||||||
|
"problemId is null";
|
||||||
|
return this.find(sql);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<ScoringStandard> getStandardIdNoProblemIdDesc(){
|
||||||
|
String sql="from " +
|
||||||
|
"ScoringStandard where " +
|
||||||
|
"problemId is null order by id " +
|
||||||
|
"desc";
|
||||||
|
return this.find(sql);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void updateProblemId(int problemId){
|
||||||
|
String hql =
|
||||||
|
"update ScoringStandard set " +
|
||||||
|
"problemId=" + problemId +
|
||||||
|
" where problemId is " +
|
||||||
|
"null";
|
||||||
|
this.executeHql(hql);
|
||||||
|
}
|
||||||
|
// @Override
|
||||||
|
// public List<UScoringStandard> getScoringStandardNoProblemId(){
|
||||||
|
// List<UScoringStandard> uScoringStandardList;
|
||||||
|
// String sql="from " +
|
||||||
|
// "ScoringStandard where " +
|
||||||
|
// "problemId is null";
|
||||||
|
// List<ScoringStandard> scoringStandardList=this.find(sql);
|
||||||
|
// for(ScoringStandard scoringStandard:scoringStandardList){
|
||||||
|
// UScoringStandard uScoringStandard=
|
||||||
|
// new UScoringStandard();
|
||||||
|
// uScoringStandard.setDimension(scoringStandard.getDimension());
|
||||||
|
// uScoringStandard.setWeight(scoringStandard.getWeight());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.example.aes.problem.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PMScoringStandard {
|
||||||
|
private int id;
|
||||||
|
private String dimension;
|
||||||
|
private Float weight;
|
||||||
|
}
|
||||||
|
|
@ -4,24 +4,32 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Table(name = "Problem")
|
@Entity
|
||||||
|
@Table(name = "Problem",catalog = "aes")
|
||||||
public class Problem implements java.io.Serializable{ //Problem父类
|
public class Problem implements java.io.Serializable{ //Problem父类
|
||||||
|
|
||||||
//作业problem基本属性
|
//作业problem基本属性
|
||||||
|
@javax.persistence.Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id", unique = true, nullable = false)
|
||||||
private int Id;//此处为ProblemId
|
private int Id;//此处为ProblemId
|
||||||
|
@Column(name = "courseId")
|
||||||
private int courseId;
|
private int courseId;
|
||||||
|
@Column(name = "adminuserId")
|
||||||
private int adminuserId;
|
private int adminuserId;
|
||||||
|
@Column(name = "title",length = 30)
|
||||||
private String title;
|
private String title;
|
||||||
|
@Column(name = "description",length=1000)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
// 作业列表分页exam
|
// // 作业列表分页exam
|
||||||
private int pageNum;
|
// private int pageNum;
|
||||||
private int pageSize;
|
// private int pageSize;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.example.aes.problem.model;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "scoringstandard",catalog = "aes")
|
||||||
|
public class ScoringStandard {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id", unique = true, nullable = false)
|
||||||
|
private Integer id;
|
||||||
|
@Column(name = "problemId")
|
||||||
|
private Integer problemId;
|
||||||
|
@Column(name = "dimension",length = 100)
|
||||||
|
private String dimension;
|
||||||
|
@Column(name = "weight")
|
||||||
|
private Float weight;
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getProblemId() {
|
||||||
|
return problemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProblemId(Integer problemId) {
|
||||||
|
this.problemId = problemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDimension() {
|
||||||
|
return dimension;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDimension(String dimension) {
|
||||||
|
this.dimension = dimension;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getWeight() {
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeight(Float weight) {
|
||||||
|
this.weight = weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.example.aes.problem.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UProblem {
|
||||||
|
private String title;
|
||||||
|
private String description;
|
||||||
|
private int courseId;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.example.aes.problem.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UScoringStandard {
|
||||||
|
private String dimension;
|
||||||
|
private Float weight;
|
||||||
|
private String rubrics;
|
||||||
|
}
|
||||||
|
|
@ -2,10 +2,8 @@ package com.example.aes.problem.service.Impl;
|
||||||
|
|
||||||
import com.example.aes.problem.dao.ProblemDaoI;
|
import com.example.aes.problem.dao.ProblemDaoI;
|
||||||
import com.example.aes.problem.dao.ScoringRubricDaoI;
|
import com.example.aes.problem.dao.ScoringRubricDaoI;
|
||||||
import com.example.aes.problem.model.PMProblem;
|
import com.example.aes.problem.dao.ScoringStandardDaoI;
|
||||||
import com.example.aes.problem.model.PMScoringRubric;
|
import com.example.aes.problem.model.*;
|
||||||
import com.example.aes.problem.model.ScoringRubric;
|
|
||||||
import com.example.aes.problem.model.UScoringRubric;
|
|
||||||
import com.example.aes.problem.service.ProblemServiceI;
|
import com.example.aes.problem.service.ProblemServiceI;
|
||||||
import com.example.aes.user.model.Course;
|
import com.example.aes.user.model.Course;
|
||||||
import com.example.aes.user.model.DataGrid;
|
import com.example.aes.user.model.DataGrid;
|
||||||
|
|
@ -21,6 +19,12 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
|
|
||||||
private ProblemDaoI problemDao;
|
private ProblemDaoI problemDao;
|
||||||
private ScoringRubricDaoI scoringRubricDao;
|
private ScoringRubricDaoI scoringRubricDao;
|
||||||
|
private ScoringStandardDaoI scoringStandardDao;
|
||||||
|
@Autowired
|
||||||
|
public void setScoringStandardDao(ScoringStandardDaoI scoringStandardDao) {
|
||||||
|
this.scoringStandardDao = scoringStandardDao;
|
||||||
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setScoringRubricDao(ScoringRubricDaoI scoringRubricDao) {
|
public void setScoringRubricDao(ScoringRubricDaoI scoringRubricDao) {
|
||||||
this.scoringRubricDao = scoringRubricDao;
|
this.scoringRubricDao = scoringRubricDao;
|
||||||
|
|
@ -40,6 +44,10 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
scoringRubricDao.addScoringRubric(pmscoringRubric);
|
scoringRubricDao.addScoringRubric(pmscoringRubric);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public void addScoringStandard(PMScoringStandard pmScoringStandard){
|
||||||
|
scoringStandardDao.addScoringStandard(pmScoringStandard);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public List<UScoringRubric> findScoringRubricNoStandardId(){
|
public List<UScoringRubric> findScoringRubricNoStandardId(){
|
||||||
List<ScoringRubric> scoringRubricList;
|
List<ScoringRubric> scoringRubricList;
|
||||||
scoringRubricList=
|
scoringRubricList=
|
||||||
|
|
@ -48,23 +56,64 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
List<UScoringRubric> uScoringRubricList=new ArrayList<>();
|
List<UScoringRubric> uScoringRubricList=new ArrayList<>();
|
||||||
changeModel2(scoringRubricList,
|
changeModel(scoringRubricList,
|
||||||
uScoringRubricList);
|
uScoringRubricList);
|
||||||
return uScoringRubricList;
|
return uScoringRubricList;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
private void changeModel1(List<ScoringRubric> l,
|
@Override
|
||||||
List<PMScoringRubric> nl) {
|
public List<ScoringStandard> findStandardIdNoProblemId(){
|
||||||
if (l != null && l.size() > 0) {
|
List<ScoringStandard> scoringStandardList=scoringStandardDao.getStandardIdNoProblemIdDesc();
|
||||||
for (ScoringRubric t : l) {
|
|
||||||
PMScoringRubric u = new PMScoringRubric();
|
return scoringStandardList;
|
||||||
BeanUtils.copyProperties(t, u);
|
|
||||||
nl.add(u);
|
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<UScoringStandard> findScoringStandardNoProblemId(){
|
||||||
|
List<UScoringStandard> uScoringStandardList=new ArrayList<>();
|
||||||
|
|
||||||
|
List<ScoringStandard> scoringStandardList=scoringStandardDao.getStandardIdNoProblemId();
|
||||||
|
for(ScoringStandard scoringStandard:scoringStandardList){
|
||||||
|
List<ScoringRubric> scoringRubricList=
|
||||||
|
scoringRubricDao.getScoringRubricByStandardId(scoringStandard.getId());
|
||||||
|
UScoringStandard uScoringStandard=
|
||||||
|
new UScoringStandard();
|
||||||
|
uScoringStandard.setDimension(scoringStandard.getDimension());
|
||||||
|
uScoringStandard.setWeight(scoringStandard.getWeight());
|
||||||
|
StringBuffer strb=new StringBuffer();
|
||||||
|
for(ScoringRubric scoringRubric:scoringRubricList){
|
||||||
|
strb.append(scoringRubric.getLowerLimit()+"~"+scoringRubric.getUpperLimit()+":"+scoringRubric.getDescription().replaceAll("<\\/?.*?>", "").trim()+";");
|
||||||
|
}uScoringStandard.setRubrics(strb.toString());
|
||||||
|
uScoringStandardList.add(uScoringStandard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return uScoringStandardList;
|
||||||
}
|
}
|
||||||
private void changeModel2(List<ScoringRubric> l,
|
@Override
|
||||||
|
public void updateStandardId(Integer standardId){
|
||||||
|
scoringRubricDao.updateStandardId(standardId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void updateProblemId(int problemId){
|
||||||
|
scoringStandardDao.updateProblemId(problemId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String findProblemByTitle(String title){
|
||||||
|
return problemDao.findProblemByTitle(title);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<Problem> findProblemIdByTitle(String title){
|
||||||
|
|
||||||
|
return problemDao.findProblemIdByTitle(title);
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void addProblem(Problem problem) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
problemDao.addProblem(problem);
|
||||||
|
}
|
||||||
|
private void changeModel(List<ScoringRubric> l,
|
||||||
List<UScoringRubric> nl) {
|
List<UScoringRubric> nl) {
|
||||||
if (l != null && l.size() > 0) {
|
if (l != null && l.size() > 0) {
|
||||||
for (ScoringRubric t : l) {
|
for (ScoringRubric t : l) {
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@ package com.example.aes.problem.service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.example.aes.problem.model.PMProblem;
|
import com.example.aes.problem.model.*;
|
||||||
import com.example.aes.problem.model.PMScoringRubric;
|
|
||||||
import com.example.aes.problem.model.UScoringRubric;
|
|
||||||
import com.example.aes.user.model.*;
|
import com.example.aes.user.model.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -13,5 +11,13 @@ public interface ProblemServiceI {
|
||||||
public List<PMProblem> getProblemsByClassIds(List<Integer> classIds);
|
public List<PMProblem> getProblemsByClassIds(List<Integer> classIds);
|
||||||
public void addScoringRubric(PMScoringRubric pmscoringRubric);
|
public void addScoringRubric(PMScoringRubric pmscoringRubric);
|
||||||
public List<UScoringRubric> findScoringRubricNoStandardId();
|
public List<UScoringRubric> findScoringRubricNoStandardId();
|
||||||
|
public List<UScoringStandard> findScoringStandardNoProblemId();
|
||||||
|
public void addScoringStandard(PMScoringStandard pmScoringStandard);
|
||||||
|
public List<ScoringStandard> findStandardIdNoProblemId();
|
||||||
|
public void updateStandardId(Integer standardId);
|
||||||
|
public String findProblemByTitle(String title);
|
||||||
|
public List<Problem> findProblemIdByTitle(String title);
|
||||||
|
public void addProblem(Problem problem);
|
||||||
|
public void updateProblemId(int problemId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -112,6 +113,34 @@ public class ClassesController{
|
||||||
classesServiceI.addClassToCourse(uClass);
|
classesServiceI.addClassToCourse(uClass);
|
||||||
return RespBean.ok("添加班级成功");
|
return RespBean.ok("添加班级成功");
|
||||||
}
|
}
|
||||||
|
@PostMapping("/findClassById")
|
||||||
|
public RespBean findClassById(@RequestBody UClass uClass) {
|
||||||
|
Classes onclass = classesServiceI.findClassById(uClass.getClassId());
|
||||||
|
return RespBean.ok("查询班级成功", onclass);
|
||||||
|
}
|
||||||
|
@PostMapping("/editClassMessage")
|
||||||
|
public RespBean editClassMessage(@RequestBody PMClasses pmclasses, HttpServletRequest request) // int id, String className, int teacherId
|
||||||
|
{
|
||||||
|
DecodeToken decodeToken=new DecodeToken(request);
|
||||||
|
int teacherId= Integer.parseInt(decodeToken.getUserId());
|
||||||
|
String role = decodeToken.getRole();
|
||||||
|
|
||||||
|
// 修改班级信息
|
||||||
|
int id = pmclasses.getId();
|
||||||
|
String className = pmclasses.getName();
|
||||||
|
// int advance = pmclasses.getAdvance();
|
||||||
|
// int late = pmclasses.getLate();
|
||||||
|
// int reject = pmclasses.getReject();
|
||||||
|
// String weektime = pmclasses.getWeektime();
|
||||||
|
// Date first_week_monday = pmclasses.getFirst_week_monday();
|
||||||
|
|
||||||
|
boolean result = classesServiceI.editClassMessage(id, className,teacherId);
|
||||||
|
if (result == true) {
|
||||||
|
return RespBean.ok("修改班级信息成功", result);
|
||||||
|
} else {
|
||||||
|
return RespBean.error("修改班级信息失败", result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/addClass")
|
@PostMapping("/addClass")
|
||||||
public RespBean addClass(@RequestBody PMClasses pmclasses) // 添加班级
|
public RespBean addClass(@RequestBody PMClasses pmclasses) // 添加班级
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ public interface BaseDaoI<T> {
|
||||||
// 查询用户,并返回用户信息
|
// 查询用户,并返回用户信息
|
||||||
public T get(Class<T> c, Serializable id); // 用ID查询
|
public T get(Class<T> c, Serializable id); // 用ID查询
|
||||||
|
|
||||||
|
|
||||||
public T get(String hql);
|
public T get(String hql);
|
||||||
|
|
||||||
public T get(String hql, Object[] params);
|
public T get(String hql, Object[] params);
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ public interface ClassesDaoI extends BaseDaoI<Classes> {
|
||||||
public long findClassStudentsByIdNum(int classId);
|
public long findClassStudentsByIdNum(int classId);
|
||||||
public List<PMUser> findClassStudentsByIdPage(int classId, int pageNum, int pageSize);
|
public List<PMUser> findClassStudentsByIdPage(int classId, int pageNum, int pageSize);
|
||||||
public boolean deleteClassStudentsByUserId(int classId, int userId); // 通过userId删除班级学生
|
public boolean deleteClassStudentsByUserId(int classId, int userId); // 通过userId删除班级学生
|
||||||
|
public boolean editClassMessage(int id,
|
||||||
|
String className, int teacherId);
|
||||||
public List<Classstudents>findClassIdByStudentId(int studentId);//根据班级id查找学生id
|
public List<Classstudents>findClassIdByStudentId(int studentId);//根据班级id查找学生id
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ public class BaseDaoImpl<T> implements BaseDaoI<T> {
|
||||||
// this.getCurrentSession().getTransaction().commit();
|
// this.getCurrentSession().getTransaction().commit();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 检查登录信息
|
* 检查登录信息
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,27 @@ public class ClassesDaoImpl extends BaseDaoImpl<Classes> implements ClassesDaoI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean editClassMessage(int id, String className, int teacherId) { // 执行修改班级信息
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
StringBuilder hql = new StringBuilder();
|
||||||
|
hql.append("update Classes set name=:className");
|
||||||
|
hql.append(" where id=:id");
|
||||||
|
// String hql = "update Classes set name=:className,teacherId=:teacherId,advance=:advance,late=:late,reject=:reject,weektime=:weektime,first_week_monday=:first_week_monday where id=:id";
|
||||||
|
Query q = this.getCurrentSession().createQuery(hql.toString());
|
||||||
|
q.setParameter("className", className);
|
||||||
|
q.setParameter("id", id);
|
||||||
|
// q.setParameter("advance", advance);
|
||||||
|
// q.setParameter("late", late);
|
||||||
|
// q.setParameter("reject", reject);
|
||||||
|
// q.setParameter("weektime", weektime);
|
||||||
|
// q.setParameter("first_week_monday", first_week_monday);
|
||||||
|
int num = q.executeUpdate();
|
||||||
|
if (num != 0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long findAllClassNum(int teacherId, String role){
|
public long findAllClassNum(int teacherId, String role){
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ public interface ClassesServiceI {
|
||||||
|
|
||||||
public void addClass(PMClasses pclass); // 添加班级
|
public void addClass(PMClasses pclass); // 添加班级
|
||||||
public void addClassToCourse(UClass uClass);//添加班级到课程
|
public void addClassToCourse(UClass uClass);//添加班级到课程
|
||||||
|
public Classes findClassById(int classId);
|
||||||
|
public boolean editClassMessage(int id, String className, int teacherId); // 修改班级信息
|
||||||
public DataGrid findClassStudentsByIdPage(int classId,int pageNum, int pageSize);
|
public DataGrid findClassStudentsByIdPage(int classId,int pageNum, int pageSize);
|
||||||
public boolean deleteClassStudentsByUserId(int classId, int userId);
|
public boolean deleteClassStudentsByUserId(int classId, int userId);
|
||||||
public DataGrid findClassNotInCourse(UClass uClass, int pageNum, int pageSize); // 获取未参加课程的班级
|
public DataGrid findClassNotInCourse(UClass uClass, int pageNum, int pageSize); // 获取未参加课程的班级
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,12 @@ import com.example.aes.user.dao.ClassesDaoI;
|
||||||
import com.example.aes.user.dao.ClassstudentsDaoI;
|
import com.example.aes.user.dao.ClassstudentsDaoI;
|
||||||
import com.example.aes.user.model.*;
|
import com.example.aes.user.model.*;
|
||||||
import com.example.aes.user.service.ClassesServiceI;
|
import com.example.aes.user.service.ClassesServiceI;
|
||||||
|
import org.hibernate.Query;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
@ -184,9 +186,20 @@ public void setclassstudentsDao(ClassstudentsDaoI classstudentsDao) {
|
||||||
}
|
}
|
||||||
classesDao.addClass(pclass);
|
classesDao.addClass(pclass);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void addClassToCourse(UClass uClass){
|
public void addClassToCourse(UClass uClass){
|
||||||
classesDao.addClassToCourse(uClass);
|
classesDao.addClassToCourse(uClass);
|
||||||
};
|
};
|
||||||
|
@Override
|
||||||
|
public Classes findClassById(int classId) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return classesDao.get(Classes.class, classId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean editClassMessage(int id, String className, int teacherId) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return classesDao.editClassMessage(id, className, teacherId);
|
||||||
|
}
|
||||||
// addclass要用的方法
|
// addclass要用的方法
|
||||||
public String getInviteCode() {
|
public String getInviteCode() {
|
||||||
// 1.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>룬2.<EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>
|
// 1.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>룬2.<EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue