作业库的接口大致完成,删除作业的逻辑还没完善
This commit is contained in:
parent
8781cf1f92
commit
01b56e4bf9
|
|
@ -27,7 +27,6 @@ Node 安装 18 及以上
|
|||
|
||||
```shell
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
### Build and Release
|
||||
|
||||
|
|
|
|||
|
|
@ -80,4 +80,10 @@ export default {
|
|||
deleteScoringRubric:(data)=>request.post('/problem/deleteScoringRubric',data),
|
||||
deleteScoringStandard:(data)=>request.post('/problem/deleteScoringStandard',data),
|
||||
findAllProblemByCourseId:(data)=>request.post('/problem/findAllProblemByCourseId',data),
|
||||
findClassByCourseId:(data)=>request.post('/classes/findClassByCourseId',data),
|
||||
findProblemById:(data)=>request.post('/problem/findProblemById',data),
|
||||
postProblem:(data)=>request.post('/problem/postProblem',data),
|
||||
findScoringStandardByProblemId: (data) => request.post('/problem/findScoringStandardByProblemId', data),
|
||||
editProblem:(data) => request.post('/problem/editProblem', data),
|
||||
deleteProblem:(data) => request.post('/problem/deleteProblem', data),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
<script setup>
|
||||
const emit =
|
||||
defineEmits(['clickDelete','clickPost','clickDelete'])
|
||||
defineEmits(['clickDelete','clickPost','clickEdit'])
|
||||
const onEdit = ()=>{
|
||||
emit('clickEdit')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<n-scrollbar x-scrollable style="max-height: 100vh">
|
||||
<CommonPage show-footer>
|
||||
|
||||
<div style="display: flex;
|
||||
justify-content: flex-end;margin-left: 30px">
|
||||
<n-data-table
|
||||
remote
|
||||
:single-line="false"
|
||||
|
|
@ -9,48 +8,51 @@
|
|||
:columns="columns"
|
||||
:data="classList"
|
||||
:loading="loading"
|
||||
:pagination="paginationReactive"
|
||||
:row-key="rowKey"
|
||||
:scroll-x="900"
|
||||
style="width: 1180px;--n-td-padding:0px 5px;"
|
||||
@update:page="onChangePage"
|
||||
@update:page-size="onUpdatePageSize"
|
||||
/>
|
||||
style="width: 700px;margin-top:5px"
|
||||
v-model:checked-row-keys="checkedRowKeys"
|
||||
/> </div>
|
||||
<div style="display: flex;
|
||||
justify-content: flex-end;margin-top: 30px">
|
||||
justify-content: flex-end;margin-top:
|
||||
5px;margin-left: 30px">
|
||||
<n-button type="primary"
|
||||
size="small"
|
||||
style="margin-bottom:
|
||||
10px" @click="confirm">确认
|
||||
10px;margin-left: 30px"
|
||||
@click="onAdd">确认
|
||||
</n-button>
|
||||
<n-button type="primary"
|
||||
size="small" @click="cancel" style="margin-left: 30px">取消</n-button>
|
||||
<!-- <n-button type="primary"-->
|
||||
<!-- size="small" @click="cancel" style="margin-left: 30px">取消</n-button>-->
|
||||
</div>
|
||||
</CommonPage>
|
||||
</n-scrollbar>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref, reactive, onMounted, watch} from 'vue'
|
||||
import api from '@/api/admin';
|
||||
import {formatDateTime} from '@/utils';
|
||||
|
||||
import {
|
||||
useTagsStore,
|
||||
useUserStore
|
||||
} from '@/store'
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
const rules=ref(null)
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
const classInfoRef = ref(null)
|
||||
const route = useRoute()
|
||||
const { courseId,problemId, history } = route.query
|
||||
const loading = ref(true)
|
||||
const classList =
|
||||
ref([{name:"班级1"},{name: "班级2"}])
|
||||
ref([])
|
||||
const options1=ref([])
|
||||
const role=userStore.getRole()
|
||||
const teacherId=ref()
|
||||
const tagsStore = useTagsStore()
|
||||
const path=ref('')
|
||||
const checkedRowKeys = ref([])
|
||||
const emit = defineEmits([ 'clickAdd']);
|
||||
const onAdd=()=>{
|
||||
emit('clickAdd',checkedRowKeys);
|
||||
}
|
||||
const paginationReactive = reactive({
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
|
|
@ -66,9 +68,9 @@ const classInfoValue = ref({
|
|||
id:0,
|
||||
teacherId:'',
|
||||
});
|
||||
const onAdd = ()=>{
|
||||
router.push({name: 'AdminClassAdd'})
|
||||
}
|
||||
// const onAdd = ()=>{
|
||||
// router.push({name: 'AdminClassAdd'})
|
||||
// }
|
||||
const cancel = ()=>{
|
||||
tagsStore.removeTag(path.value)
|
||||
router.push({path: 'problem-post'})}
|
||||
|
|
@ -95,45 +97,52 @@ watch(()=>classInfoValue.value.id,
|
|||
options1.value=[]
|
||||
queryByPage1(newVal)
|
||||
})
|
||||
let columns = [
|
||||
const columns = [
|
||||
{
|
||||
key: 'name',
|
||||
title: '班级名称',
|
||||
width: '260',
|
||||
width: '500px',
|
||||
align:"center"
|
||||
},
|
||||
{ type: 'selection', width: 60 },
|
||||
{ type: 'selection', width: "200px",align:
|
||||
"center" },
|
||||
|
||||
]
|
||||
const save = () => {
|
||||
// console.log('保存的 ID 列表:',checkedRowKeys.value);
|
||||
tagsStore.removeTag(path.value)
|
||||
router.push({name: 'AdminProblemPost',query:{courseId:courseId,problemId:problemId}})
|
||||
};
|
||||
|
||||
|
||||
const queryByPage = async (currentPage)=>{
|
||||
loading.value = true;
|
||||
try {
|
||||
classInfoValue.value.pageSize=paginationReactive.pageSize
|
||||
const res = await api.findAllClassPage(
|
||||
const res = await api.findClassByCourseId(
|
||||
{
|
||||
...classInfoValue.value
|
||||
courseId:courseId
|
||||
}
|
||||
);
|
||||
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
|
||||
classList.value=list.map((item,i)=>{return item;})
|
||||
// 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
|
||||
classList.value=res.data
|
||||
|
||||
} catch (err) {
|
||||
} finally {
|
||||
|
|
@ -145,7 +154,7 @@ const search=async ()=>{
|
|||
try {
|
||||
if (userStore.getRole().some((r)=>r==='admin')){
|
||||
const res=await api.findAllClassPage({
|
||||
...classInfoValue.value
|
||||
courseId:courseId
|
||||
})
|
||||
const { pageNum, pageSize, total, list } = res.data
|
||||
paginationReactive.page = pageNum
|
||||
|
|
@ -199,6 +208,7 @@ const onChangePage = (page) => {
|
|||
}
|
||||
onMounted(()=>{
|
||||
queryByPage()
|
||||
path.value=router.currentRoute.value.fullPath
|
||||
})
|
||||
watch(
|
||||
()=>router.currentRoute.value.fullPath,
|
||||
|
|
@ -40,9 +40,19 @@
|
|||
</n-form-item>
|
||||
<div class="mb-10 mt-4 flex items-center">
|
||||
<h3 class="text-18">评分标准</h3>
|
||||
<n-button type="primary" size="small" @click="onAdd" style="margin-left: 12px">添加</n-button>
|
||||
<!-- <n-button type="primary" size="small" @click="onAdd" style="margin-left: 12px">添加</n-button>-->
|
||||
</div>
|
||||
<StandardsList />
|
||||
<n-data-table
|
||||
remote
|
||||
:single-line="false"
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:data="ScoringStandardList"
|
||||
:loading="loading"
|
||||
:row-key="rowKey"
|
||||
:scroll-x="900"
|
||||
style="width: 1180px;--n-td-padding:0px 5px;"
|
||||
/>
|
||||
</div>
|
||||
</n-form>
|
||||
</div>
|
||||
|
|
@ -51,24 +61,46 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {useRouter} from "vue-router";
|
||||
import {ref} from "vue";
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import {ref,onMounted} from "vue";
|
||||
import api from "@/api/admin";
|
||||
import { useTagsStore } from '@/store'
|
||||
import StandardsList
|
||||
from '@/views/admin/problem/components/StandardList.vue'
|
||||
import RichTextEditor
|
||||
from '@/components/common/RichTextEditor.vue'
|
||||
const tagsStore = useTagsStore()
|
||||
const path=ref('')
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const loading = ref(true)
|
||||
const {problemId, history } = route.query
|
||||
const rules=ref(null)
|
||||
const problemInfoValue = ref({
|
||||
name: ''
|
||||
title: "",
|
||||
description:"",
|
||||
id:problemId
|
||||
});
|
||||
const ScoringStandardList=ref([])
|
||||
const problemInfoRef = ref(null)
|
||||
const descEditorHeight = ref('160px')
|
||||
|
||||
let columns = [
|
||||
{
|
||||
key: 'dimension',
|
||||
title: '维度',
|
||||
width: '50',
|
||||
align:'center'
|
||||
},
|
||||
{
|
||||
key: 'weight',
|
||||
title: '权重',
|
||||
width: '50',
|
||||
align:'center'
|
||||
},
|
||||
{
|
||||
key: 'rubrics',
|
||||
title: '评分细则',
|
||||
width: '300',
|
||||
}
|
||||
]
|
||||
const cancel = ()=>{
|
||||
tagsStore.removeTag(path.value)
|
||||
router.push({path: 'problem-list'})
|
||||
|
|
@ -77,23 +109,50 @@ const onAdd = ()=>{
|
|||
router.push({name: 'AdminProblemScoringStandard'})
|
||||
}
|
||||
const submit =async ()=>{
|
||||
if(problemInfoValue.value.name!==''){
|
||||
if(problemInfoValue.value.title!==''){
|
||||
try {
|
||||
await api.Addproblem({
|
||||
await api.editProblem({
|
||||
...problemInfoValue.value
|
||||
})
|
||||
$message.success("添加课程成功")
|
||||
$message.success("编辑作业成功")
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
// await router.push({name: 'AdminProblemList'})
|
||||
} catch (err) {
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
// await router.push({name: 'AdminProblemList'})
|
||||
}
|
||||
}else {
|
||||
$message.error("作业名称不能为空")
|
||||
}
|
||||
}
|
||||
const queryByPage = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await api.findProblemById({
|
||||
...problemInfoValue.value
|
||||
})
|
||||
problemInfoValue.value=res.data
|
||||
} catch (err) {
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
const queryByPage2 = async (currentPage)=>{
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await
|
||||
api.findScoringStandardByProblemId({
|
||||
...problemInfoValue.value
|
||||
})
|
||||
ScoringStandardList.value=res.data
|
||||
} catch (err) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
path.value = router.currentRoute.value.fullPath
|
||||
queryByPage()
|
||||
queryByPage2()
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ const queryByPage = async (currentPage)=>{
|
|||
}
|
||||
);
|
||||
console.log(res.data)
|
||||
if (userStore.getRole().some((r) => r === 'admin')){
|
||||
// if (userStore.getRole().some((r) => r === 'admin')){
|
||||
// const res1=await api.findAllShoolsInAdminusers()
|
||||
// const list1=res1.data
|
||||
// const transformedDatas=list1.map(item => ({
|
||||
|
|
@ -265,7 +265,7 @@ const queryByPage = async (currentPage)=>{
|
|||
// value: 0,
|
||||
// });
|
||||
// options.value=transformedDatas;
|
||||
}
|
||||
// }
|
||||
const {pageNum, pageSize, total, list} = res.data
|
||||
paginationReactive.page = pageNum
|
||||
paginationReactive.pageSize = pageSize
|
||||
|
|
|
|||
|
|
@ -11,65 +11,76 @@
|
|||
label-width="100px"
|
||||
:show-require-mark="false"
|
||||
>
|
||||
<div class="exam-name-div">
|
||||
<n-h2
|
||||
class="show-problem-name">
|
||||
{{ problemName }}
|
||||
</n-h2>
|
||||
<div class="grid md:grid-cols-2 md:gap-x-30">
|
||||
<n-form-item label="发放对象:" path="class">
|
||||
<n-button type="primary" size="small"
|
||||
@click="onAdd"
|
||||
style="margin-left: 5px">
|
||||
添加对象</n-button>
|
||||
</n-form-item>
|
||||
|
||||
</div>
|
||||
<div class="grid md:grid-cols-2 md:gap-x-30">
|
||||
<n-form-item
|
||||
style='margin-left: 30px;margin-bottom: -10px'><n-h2>
|
||||
{{problemInfoValue.title}}
|
||||
</n-h2></n-form-item></div>
|
||||
<div class="grid md:grid-cols-3 md:gap-x-30">
|
||||
<n-form-item label="有效时段:"
|
||||
path="timeFrom">
|
||||
<n-form-item label="有效时段:">
|
||||
<n-date-picker
|
||||
v-model:formatted-value="problemInfoValue.timeFrom"
|
||||
v-model:formatted-value="problemInfoValue.startTime"
|
||||
style="width: 350px"
|
||||
type="datetime"
|
||||
input-readonly
|
||||
placeholder="请选择开始时间"
|
||||
format="yyyy-MM-dd HH:mm"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
update-value-on-close
|
||||
:actions="['confirm']"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item label="到:" path="timeTo">
|
||||
<n-form-item label="到:">
|
||||
<n-date-picker
|
||||
v-model:formatted-value="problemInfoValue.timeTo"
|
||||
v-model:formatted-value="problemInfoValue.endTime"
|
||||
style="width: 300px"
|
||||
type="datetime"
|
||||
input-readonly
|
||||
placeholder="请选择结束时间"
|
||||
format="yyyy-MM-dd HH:mm"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
update-value-on-close
|
||||
:actions="['confirm']"
|
||||
/>
|
||||
</n-form-item>
|
||||
</div>
|
||||
<div class="grid md:grid-cols-4 md:gap-x-30">
|
||||
<div style="display: flex">
|
||||
<n-form-item label="发放对象:" path="class">
|
||||
<n-button type="primary" size="small"
|
||||
@click="onAddClass=!onAddClass"
|
||||
style="margin-left: 5px">
|
||||
添加对象 </n-button>
|
||||
</n-form-item>
|
||||
<n-form-item label="允许补交:"
|
||||
path="allow">
|
||||
path="allow"
|
||||
style='margin-left: 60px'>
|
||||
<n-checkbox
|
||||
v-model:checked="problemInfoValue.allow"
|
||||
@update="allow"
|
||||
></n-checkbox>
|
||||
</n-form-item>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div flex>
|
||||
<n-form-item style="margin-left: 30px">
|
||||
<n-button type="primary"
|
||||
size="small" @click="submit" style='margin-left:
|
||||
30px'>发布
|
||||
</n-button>
|
||||
size="small" @click="post"
|
||||
>发布
|
||||
</n-button></n-form-item>
|
||||
<n-form-item style="margin-left: 10px">
|
||||
<n-button type="primary"
|
||||
size="small" @click="cancel" style='margin-left:
|
||||
20px'>取消
|
||||
</n-button></div>
|
||||
</n-button></n-form-item>
|
||||
</div>
|
||||
<div flex>
|
||||
</div>
|
||||
<div class="grid md:grid-cols-2 md:gap-x-30">
|
||||
<n-form-item>
|
||||
<view-classes-post v-if='onAddClass'
|
||||
@clickAdd="handleAdd"
|
||||
></view-classes-post></n-form-item>
|
||||
</div>
|
||||
</n-form>
|
||||
</div>
|
||||
|
|
@ -78,52 +89,79 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {useRouter} from "vue-router";
|
||||
import {ref} from "vue";
|
||||
import {ref, reactive, onMounted, watch} from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import api from "@/api/admin";
|
||||
import { useTagsStore } from '@/store'
|
||||
import StandardsList
|
||||
from '@/views/admin/problem/components/StandardList.vue'
|
||||
import RichTextEditor
|
||||
from '@/components/common/RichTextEditor.vue'
|
||||
import ViewClassesPost
|
||||
from '@/views/admin/problem/components/view-classes-post.vue'
|
||||
|
||||
const tagsStore = useTagsStore()
|
||||
const path=ref('')
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const loading = ref(true)
|
||||
const { courseId,problemId, history } = route.query
|
||||
const problemPostRules=ref(null)
|
||||
const problemInfoValue = ref({
|
||||
name: '',
|
||||
timeFrom: [],
|
||||
timeTo: [],
|
||||
allow:true
|
||||
title: '',
|
||||
startTime: [],
|
||||
endTime: [],
|
||||
allow:false,
|
||||
classList:{}
|
||||
});
|
||||
const handleAdd=(list)=>{
|
||||
// console.log("选中的班级列表",list.value)
|
||||
problemInfoValue.value.classList=list.value
|
||||
console.log(problemInfoValue.value)
|
||||
onAddClass.value=false
|
||||
}
|
||||
const problemInfoRef = ref(null)
|
||||
const descEditorHeight = ref('160px')
|
||||
const problemName = ref('作业标题')
|
||||
const cancel = ()=>{
|
||||
tagsStore.removeTag(path.value)
|
||||
router.push({path: 'problem-list'})
|
||||
}
|
||||
const onAdd = ()=>{
|
||||
router.push({name: 'AdminProblemPostClass'})
|
||||
}
|
||||
const submit =async ()=>{
|
||||
if(problemInfoValue.value.name!==''){
|
||||
const queryByPage = async ()=>{
|
||||
loading.value = true;
|
||||
// ProblemInfoValue.value.pageNum=currentPage
|
||||
// ProblemInfoValue.value.pageSize=paginationReactive.pageSize
|
||||
try {
|
||||
await api.Addproblem({
|
||||
const res = await
|
||||
api.findProblemById(
|
||||
{
|
||||
id:problemId
|
||||
}
|
||||
);
|
||||
problemInfoValue.value=res.data
|
||||
} catch (err) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
const onAddClass =ref(false)
|
||||
const post =async ()=>{
|
||||
if(problemInfoValue.value.startTime!==''&&problemInfoValue.value.endTime!==''){
|
||||
try {
|
||||
await api.postProblem({
|
||||
...problemInfoValue.value
|
||||
})
|
||||
$message.success("添加课程成功")
|
||||
$message.success("发布作业成功")
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
// await router.push({name:
|
||||
// 'AdminProblemStore'})
|
||||
} catch (err) {
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemList'})
|
||||
// await router.push({name:
|
||||
// 'AdminProblemStore'})
|
||||
}
|
||||
}else {
|
||||
$message.error("作业名称不能为空")
|
||||
$message.error("时间范围不能为空")
|
||||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
path.value=router.currentRoute.value.fullPath
|
||||
queryByPage()
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ const handleDescEditorFocus = once(() => {
|
|||
})
|
||||
const cancel = ()=>{
|
||||
tagsStore.removeTag(path.value)
|
||||
router.push({path: 'problem-scoring-standard',query:{courseId:courseId}})
|
||||
// router.push({path: 'problem-scoring-standard',query:{courseId:courseId}})
|
||||
}
|
||||
const submit =async ()=>{
|
||||
if(problemInfoValue.value.lowerLimit!==''&&problemInfoValue.value.upperLimit!==''&&problemInfoValue.value.description!==''){
|
||||
|
|
@ -93,10 +93,10 @@ const submit =async ()=>{
|
|||
})
|
||||
$message.success("添加评分细则成功")
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemScoringStandard',query:{courseId:courseId}})
|
||||
// await router.push({name: 'AdminProblemScoringStandard',query:{courseId:courseId}})
|
||||
} catch (err) {
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemScoringStandard',query:{courseId:courseId}})
|
||||
// await router.push({name: 'AdminProblemScoringStandard',query:{courseId:courseId}})
|
||||
}
|
||||
}else {
|
||||
$message.error("评分细则不能为空")
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ const problemInfoRef = ref(null)
|
|||
const cancel = async () => {
|
||||
await api.deleteScoringRubric({})
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name:
|
||||
'AdminProblemAdd',query:{courseId:courseId}})
|
||||
// await router.push({name:
|
||||
// 'AdminProblemAdd',query:{courseId:courseId}})
|
||||
}
|
||||
const onAdd = ()=>{
|
||||
router.push({name:
|
||||
|
|
@ -88,15 +88,15 @@ const submit =async ()=>{
|
|||
})
|
||||
$message.success("添加评分标准成功")
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name:
|
||||
'AdminProblemAdd', query: {
|
||||
courseId: courseId
|
||||
}})
|
||||
// await router.push({name:
|
||||
// 'AdminProblemAdd', query: {
|
||||
// courseId: courseId
|
||||
// }})
|
||||
} catch (err) {
|
||||
tagsStore.removeTag(path.value)
|
||||
await router.push({name: 'AdminProblemAdd', query: {
|
||||
courseId: courseId
|
||||
}})
|
||||
// await router.push({name: 'AdminProblemAdd', query: {
|
||||
// courseId: courseId
|
||||
// }})
|
||||
}
|
||||
}else {
|
||||
$message.error("维度或权重不能为空")
|
||||
|
|
|
|||
|
|
@ -52,15 +52,10 @@
|
|||
<script setup>
|
||||
import {ref, reactive, onMounted, watch} from 'vue'
|
||||
import api from '@/api/admin';
|
||||
import ProblemActions from
|
||||
'./components/ProblemActions.vue';
|
||||
import {formatDateTime} from '@/utils';
|
||||
import { useUserStore } from '@/store';
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import ProblemActions2
|
||||
from '@/views/admin/problem/components/ProblemActions2.vue'
|
||||
import problem
|
||||
from '@/views/user/problem/index.vue'
|
||||
const rules=ref(null)
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
|
|
@ -90,7 +85,7 @@ const ProblemInfoValue = ref({
|
|||
title:""
|
||||
});
|
||||
const onAdd = ()=>{
|
||||
router.push({name: 'AdminProblemAdd'})
|
||||
router.push({name: 'AdminProblemAdd',query:{courseId:courseId}})
|
||||
}
|
||||
const queryByPage1=async (value)=>{
|
||||
if (userStore.getRole().some((r) => r === 'admin')) {
|
||||
|
|
@ -200,15 +195,15 @@ const onAssistantProblem = async (problemid)=>{
|
|||
await router.push({name: 'AdminProblemAssistant', params: {clId: id}})
|
||||
}
|
||||
const onEditProblem = async (problemid)=>{
|
||||
// const {id} = problemid
|
||||
const {id} =1
|
||||
await router.push({name: 'AdminProblemEdit', params: {clId: id}})
|
||||
const {id} = problemid
|
||||
await router.push({name: 'AdminProblemEdit',
|
||||
query: {problemId: id}})
|
||||
}
|
||||
const onPostProblem = async (problemid)=>{
|
||||
// const {id} = problemid
|
||||
const {id} =1
|
||||
const {id} = problemid
|
||||
await router.push({name: 'AdminProblemPost',
|
||||
params: {clId: id}})
|
||||
query:
|
||||
{courseId:courseId,problemId: id}})
|
||||
}
|
||||
|
||||
const handleSearchSchool = async (query) => {
|
||||
|
|
@ -257,7 +252,7 @@ watch(
|
|||
()=>router.currentRoute.value.fullPath,
|
||||
()=>{
|
||||
if
|
||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-list') {
|
||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-store') {
|
||||
queryByPage(paginationReactive.page)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,19 +156,6 @@ export default {
|
|||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'AdminProblemTest',
|
||||
path: 'problem-test',
|
||||
isHidden: true,
|
||||
component: () => import('@/views/admin/problem/test.vue'),
|
||||
meta: {
|
||||
title: '测试页',
|
||||
icon: 'ic:baseline-add',
|
||||
role: ['admin', 'teacher'],
|
||||
requireAuth: true,
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'AdminProblemStore',
|
||||
path: 'problem-store',
|
||||
|
|
@ -208,18 +195,6 @@ export default {
|
|||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'AdminProblemPostClass',
|
||||
path: 'view-classes-post',
|
||||
isHidden: true,
|
||||
component: () => import('./problem/view-classes-post.vue'),
|
||||
meta: {
|
||||
title: '添加对象',
|
||||
role: ['admin', 'teacher', 'assistant'],
|
||||
requireAuth: true,
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -97,6 +97,43 @@ public class ProblemController {
|
|||
}
|
||||
|
||||
}
|
||||
@PostMapping(
|
||||
"/findScoringStandardByProblemId")
|
||||
public RespBean findScoringStandardByProblemId(@RequestBody PMProblem pmProblem) {
|
||||
List<UScoringStandard> uScoringStandardList=
|
||||
problemServiceI.findScoringStandardByProblemId(pmProblem.getId());
|
||||
if (uScoringStandardList != null) {
|
||||
return RespBean.ok("获取评分标准列表成功!",
|
||||
uScoringStandardList);
|
||||
} else {
|
||||
return RespBean.error("获取评分标准列表失败!");
|
||||
}
|
||||
|
||||
}
|
||||
@PostMapping("/editProblem")
|
||||
public RespBean editProblem(@RequestBody PMProblem pmProblem) {
|
||||
Integer id= pmProblem.getId();
|
||||
String title= pmProblem.getTitle();
|
||||
String description= pmProblem.getDescription();
|
||||
if(problemServiceI.findProblemByTitle(title,id)=="true"){
|
||||
return RespBean.ok("作业名称重复");
|
||||
}
|
||||
boolean result =
|
||||
problemServiceI.editProblem(title,
|
||||
description,id);
|
||||
if (result == true) {
|
||||
return RespBean.ok("编辑作业成功", result);
|
||||
} else {
|
||||
return RespBean.error("编辑作业失败",
|
||||
result);
|
||||
}
|
||||
|
||||
}
|
||||
@PostMapping("/deleteProblem")
|
||||
public RespBean deleteCourse(@RequestBody PMProblem pmProblem) {
|
||||
problemServiceI.deleteProblem(pmProblem.getId());
|
||||
return RespBean.ok("删除成功");
|
||||
}
|
||||
@PostMapping("/deleteScoringRubric")
|
||||
public RespBean deleteScoringRubric(){
|
||||
problemServiceI.deleteScoringRubric();
|
||||
|
|
@ -115,6 +152,24 @@ public class ProblemController {
|
|||
problemServiceI.findProblemByCourseId(pmProblem);
|
||||
return RespBean.ok("查询作业库成功",dataGrid);
|
||||
|
||||
}
|
||||
@PostMapping("/findProblemById")
|
||||
public RespBean findProblemById(@RequestBody PMProblem pmProblem){
|
||||
List<Problem> problems=
|
||||
problemServiceI.findProblemById(pmProblem.getId());
|
||||
return RespBean.ok("查询作业标题成功",
|
||||
problems.get(0));
|
||||
|
||||
}
|
||||
@PostMapping("/postProblem")
|
||||
public RespBean postProblem(@RequestBody PMPostProblem pmPostProblem){
|
||||
List<Integer> classList=
|
||||
pmPostProblem.getClassList();
|
||||
for(Integer classId:classList){
|
||||
problemServiceI.postProblem(pmPostProblem,classId);
|
||||
}
|
||||
return RespBean.ok("发布作业成功");
|
||||
|
||||
}
|
||||
//获取作业列表
|
||||
@GetMapping("/getExamList")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
package com.example.aes.problem.dao;
|
||||
|
||||
import com.example.aes.problem.model.PMPostProblem;
|
||||
import com.example.aes.problem.model.PostProblem;
|
||||
import com.example.aes.user.dao.BaseDaoI;
|
||||
|
||||
public interface PostProblemDaoI extends BaseDaoI<PostProblem> {
|
||||
public void postProblem(PMPostProblem pmPostProblem, Integer classId);
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import com.example.aes.problem.model.Problem;
|
|||
import com.example.aes.user.dao.BaseDaoI;
|
||||
import com.example.aes.user.model.Classstudents;
|
||||
import com.example.aes.user.model.Course;
|
||||
import com.example.aes.user.model.DataGrid;
|
||||
import com.example.aes.user.model.PMCourse;
|
||||
|
||||
|
||||
|
|
@ -18,10 +19,14 @@ public interface ProblemDaoI extends BaseDaoI<Problem> {
|
|||
|
||||
List<PMProblem> findProblemsByClassIds(List<Integer> classIds);
|
||||
public String findProblemByTitle(String title);
|
||||
public String findProblemByTitle(String title,Integer id);
|
||||
public List<Problem> findProblemIdByTitle(String title);
|
||||
public void addProblem(Problem problem);
|
||||
public long getAllProblemsNum(int courseId);
|
||||
List<Problem> getProblemsByPage(Integer courseId,String title,
|
||||
int page, int rows);
|
||||
|
||||
public List<Problem> findProblemById(int id);
|
||||
public boolean editProblem(String title,
|
||||
String description,Integer id);
|
||||
public void deleteProblem(Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ public interface ScoringStandardDaoI extends BaseDaoI<ScoringStandard> {
|
|||
public List<ScoringStandard> getStandardIdNoProblemId();
|
||||
public List<ScoringStandard> getStandardIdNoProblemIdDesc();
|
||||
public void updateProblemId(int problemId);
|
||||
public List<ScoringStandard> getStandardByProblemId(Integer problemId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.example.aes.problem.dao.impl;
|
||||
|
||||
import com.example.aes.problem.dao.PostProblemDaoI;
|
||||
import com.example.aes.problem.model.PMPostProblem;
|
||||
import com.example.aes.problem.model.PostProblem;
|
||||
import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository("PostProblemDao")
|
||||
public class PostProblemDaoImpl extends BaseDaoImpl<PostProblem> implements PostProblemDaoI {
|
||||
@Override
|
||||
public void postProblem(PMPostProblem pmPostProblem, Integer classId){
|
||||
PostProblem postProblem=new PostProblem();
|
||||
postProblem.setProblemId(pmPostProblem.getId());
|
||||
postProblem.setClassId(classId);
|
||||
postProblem.setTeacherId(pmPostProblem.getAdminuserId());
|
||||
postProblem.setStartTime(pmPostProblem.getStartTime());
|
||||
postProblem.setEndTime(pmPostProblem.getEndTime());
|
||||
if(pmPostProblem.getAllow()==true)
|
||||
postProblem.setAllow(1);
|
||||
else postProblem.setAllow(0);
|
||||
this.save(postProblem);
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import com.example.aes.user.dao.impl.BaseDaoImpl;
|
|||
import com.example.aes.user.model.Classstudents;
|
||||
import com.example.aes.user.model.Course;
|
||||
import com.example.aes.user.model.PMCourse;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
|
@ -57,6 +58,18 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
return "false";
|
||||
}
|
||||
@Override
|
||||
public String findProblemByTitle(String title,Integer id){
|
||||
String hql =
|
||||
"from Problem where title=" +
|
||||
"'" + title + "' and " +
|
||||
"id!="+id;
|
||||
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=" +
|
||||
|
|
@ -75,7 +88,17 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
this.find(hql,page,rows);
|
||||
return problemList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Problem> findProblemById(int id){
|
||||
String hql="from Problem where id="+id;
|
||||
return this.find(hql);
|
||||
}
|
||||
@Override
|
||||
public void deleteProblem(Integer id){
|
||||
String hql =
|
||||
"delete from Problem where id=" + id;
|
||||
this.executeHql(hql);
|
||||
}
|
||||
@Override
|
||||
public void addProblem(Problem problem) {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
@ -93,4 +116,21 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
|||
long count=this.count(hql);
|
||||
return count;
|
||||
}
|
||||
@Override
|
||||
public boolean editProblem(String title,
|
||||
String description,Integer id){
|
||||
StringBuilder hql = new StringBuilder();
|
||||
hql.append("update Problem set " +
|
||||
"title=:title," +
|
||||
"description=:description where id=:id");
|
||||
Query q = this.getCurrentSession().createQuery(hql.toString());
|
||||
q.setParameter("title", title);
|
||||
q.setParameter("description",description);
|
||||
q.setParameter("id", id);
|
||||
int num = q.executeUpdate();
|
||||
if (num != 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,13 @@ public class ScoringStandardDaoImpl extends BaseDaoImpl<ScoringStandard> impleme
|
|||
return this.find(sql);
|
||||
}
|
||||
@Override
|
||||
public List<ScoringStandard> getStandardByProblemId(Integer problemId){
|
||||
String sql="from " +
|
||||
"ScoringStandard where " +
|
||||
"problemId="+problemId;
|
||||
return this.find(sql);
|
||||
}
|
||||
@Override
|
||||
public List<ScoringStandard> getStandardIdNoProblemIdDesc(){
|
||||
String sql="from " +
|
||||
"ScoringStandard where " +
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.example.aes.problem.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PMPostProblem{
|
||||
private int id;
|
||||
private int adminuserId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endTime;
|
||||
private List<Integer> classList;
|
||||
private Boolean allow;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.example.aes.problem.model;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "postproblem",catalog = "aes")
|
||||
public class PostProblem {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", unique = true, nullable = false)
|
||||
private Integer id;
|
||||
@Column(name = "problemId")
|
||||
private Integer problemId;
|
||||
@Column(name = "classId")
|
||||
private Integer classId;
|
||||
@Column(name = "adminuserId")
|
||||
private Integer teacherId;
|
||||
@Column(name = "startTime")
|
||||
private LocalDateTime startTime;
|
||||
@Column(name = "endTime")
|
||||
private LocalDateTime endTime;
|
||||
@Column(name = "allow")
|
||||
private Integer allow;
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.example.aes.problem.service.Impl;
|
||||
|
||||
import com.example.aes.problem.dao.PostProblemDaoI;
|
||||
import com.example.aes.problem.dao.ProblemDaoI;
|
||||
import com.example.aes.problem.dao.ScoringRubricDaoI;
|
||||
import com.example.aes.problem.dao.ScoringStandardDaoI;
|
||||
|
|
@ -19,6 +20,12 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
private ScoringRubricDaoI scoringRubricDao;
|
||||
private ScoringStandardDaoI scoringStandardDao;
|
||||
private AdminusersDaoI adminusersDao;
|
||||
private PostProblemDaoI postProblemDao;
|
||||
@Autowired
|
||||
public void setPostProblemDao(PostProblemDaoI postProblemDao) {
|
||||
this.postProblemDao = postProblemDao;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setAdminusersDao(AdminusersDaoI adminusersDao) {
|
||||
this.adminusersDao = adminusersDao;
|
||||
|
|
@ -95,6 +102,27 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
return uScoringStandardList;
|
||||
}
|
||||
@Override
|
||||
public List<UScoringStandard> findScoringStandardByProblemId(Integer problemId){
|
||||
List<UScoringStandard> uScoringStandardList=new ArrayList<>();
|
||||
|
||||
List<ScoringStandard> scoringStandardList=scoringStandardDao.getStandardByProblemId(problemId);
|
||||
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;
|
||||
}
|
||||
@Override
|
||||
public void updateStandardId(Integer standardId){
|
||||
scoringRubricDao.updateStandardId(standardId);
|
||||
}
|
||||
|
|
@ -122,12 +150,22 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
|||
return problemDao.findProblemByTitle(title);
|
||||
}
|
||||
@Override
|
||||
public String findProblemByTitle(String title,Integer id){
|
||||
return problemDao.findProblemByTitle(title,id);
|
||||
}
|
||||
@Override
|
||||
public List<Problem> findProblemIdByTitle(String title){
|
||||
|
||||
return problemDao.findProblemIdByTitle(title);
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean editProblem(String title,
|
||||
String description,Integer id){
|
||||
return problemDao.editProblem(title,
|
||||
description,id);
|
||||
}
|
||||
@Override
|
||||
public DataGrid findProblemByCourseId(PMProblem pmProblem){
|
||||
DataGrid dg = new DataGrid();
|
||||
int totalLines;
|
||||
|
|
@ -157,6 +195,20 @@ changeModel2(pmProblems,theProblemList);
|
|||
}
|
||||
}
|
||||
@Override
|
||||
public List<Problem> findProblemById(int id){
|
||||
List<Problem> problems=
|
||||
problemDao.findProblemById(id);
|
||||
return problems;
|
||||
}
|
||||
@Override
|
||||
public void postProblem(PMPostProblem pmPostProblem, Integer classId){
|
||||
postProblemDao.postProblem(pmPostProblem,classId);
|
||||
}
|
||||
@Override
|
||||
public void deleteProblem(Integer id){
|
||||
problemDao.deleteProblem(id);
|
||||
}
|
||||
@Override
|
||||
public void addProblem(Problem problem) {
|
||||
// TODO Auto-generated method stub
|
||||
problemDao.addProblem(problem);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package com.example.aes.problem.service;
|
|||
import com.example.aes.problem.model.*;
|
||||
import com.example.aes.user.model.*;
|
||||
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import java.util.List;
|
||||
|
||||
public interface ProblemServiceI {
|
||||
|
|
@ -12,15 +13,24 @@ public interface ProblemServiceI {
|
|||
public void addScoringRubric(PMScoringRubric pmscoringRubric);
|
||||
public List<UScoringRubric> findScoringRubricNoStandardId();
|
||||
public List<UScoringStandard> findScoringStandardNoProblemId();
|
||||
public List<UScoringStandard> findScoringStandardByProblemId(Integer problemId);
|
||||
|
||||
public void addScoringStandard(PMScoringStandard pmScoringStandard);
|
||||
public List<ScoringStandard> findStandardIdNoProblemId();
|
||||
public void updateStandardId(Integer standardId);
|
||||
public String findProblemByTitle(String title);
|
||||
public String findProblemByTitle(String title, Integer id);
|
||||
public boolean editProblem(String title,
|
||||
String description,
|
||||
Integer id);
|
||||
public List<Problem> findProblemIdByTitle(String title);
|
||||
public void addProblem(Problem problem);
|
||||
public void updateProblemId(int problemId);
|
||||
public void deleteScoringRubric();
|
||||
public void deleteScoringStandard();
|
||||
public DataGrid findProblemByCourseId(PMProblem pmProblem);
|
||||
public List<Problem> findProblemById(int id);
|
||||
public void postProblem(PMPostProblem pmPostProblem, Integer classId);
|
||||
public void deleteProblem(Integer id);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,6 +95,12 @@ public class ClassesController{
|
|||
return RespBean.ok("查询所有班级信息成功", dataGrid);
|
||||
}
|
||||
}
|
||||
@PostMapping("findClassByCourseId")
|
||||
public RespBean findClassByCourseId(@RequestBody UClass uClass){
|
||||
List<Classes> classes=
|
||||
classesServiceI.findClassByCourseId(uClass.getCourseId());
|
||||
return RespBean.ok("查找该课程所有班级成功",classes);
|
||||
}
|
||||
@PostMapping("/deleteClass")
|
||||
public RespBean deleteClass(@RequestBody PMClasses pmclasses) {
|
||||
int id = pmclasses.getId();
|
||||
|
|
|
|||
|
|
@ -95,15 +95,13 @@ public class CourseCotroller {
|
|||
int id = pmcourse.getId();
|
||||
Course course =
|
||||
courseServiceI.findCourseById(id);
|
||||
return RespBean.ok("查询章节成功", course);
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,4 +47,5 @@ public interface ClassesDaoI extends BaseDaoI<Classes> {
|
|||
public boolean editClassMessage(int id,
|
||||
String className, int teacherId);
|
||||
public List<Classstudents>findClassIdByStudentId(int studentId);//根据班级id查找学生id
|
||||
public List<Classes> findClassByCourseId(int courseId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -564,6 +564,12 @@ public class ClassesDaoImpl extends BaseDaoImpl<Classes> implements ClassesDaoI
|
|||
Query q = this.getCurrentSession().createQuery(hql);
|
||||
return q.list();
|
||||
}
|
||||
@Override
|
||||
public List<Classes> findClassByCourseId(int courseId){
|
||||
String hql = "from Classes where " +
|
||||
"courseId="+courseId;
|
||||
return this.find(hql);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,4 +29,5 @@ public interface ClassesServiceI {
|
|||
public DataGrid findClassNotInCourse(int courseId, int teacherId, int pageNum, int pageSize, boolean history); // 获取未参加课程的班级
|
||||
|
||||
public List<Classstudents> findClassIdByStudentId(int studentId); // 根据学生id查找班级id
|
||||
public List<Classes> findClassByCourseId(int courseId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -250,6 +250,9 @@ public void setclassstudentsDao(ClassstudentsDaoI classstudentsDao) {
|
|||
public List<Classstudents> findClassIdByStudentId(int studentId){
|
||||
return classesDao.findClassIdByStudentId(studentId);
|
||||
};
|
||||
|
||||
@Override
|
||||
public List<Classes> findClassByCourseId(int courseId){
|
||||
return classesDao.findClassByCourseId(courseId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue