完成作业库列表显示和查找作业标题的接口
This commit is contained in:
parent
0299363867
commit
8781cf1f92
|
|
@ -77,4 +77,7 @@ export default {
|
||||||
addProblem:(data) => request.post('/problem/addProblem', data),
|
addProblem:(data) => request.post('/problem/addProblem', data),
|
||||||
findClassById: (data) => request.post('/classes/findClassById', data),
|
findClassById: (data) => request.post('/classes/findClassById', data),
|
||||||
editClassMessage: (data) => request.post('/classes/editClassMessage', data),
|
editClassMessage: (data) => request.post('/classes/editClassMessage', data),
|
||||||
|
deleteScoringRubric:(data)=>request.post('/problem/deleteScoringRubric',data),
|
||||||
|
deleteScoringStandard:(data)=>request.post('/problem/deleteScoringStandard',data),
|
||||||
|
findAllProblemByCourseId:(data)=>request.post('/problem/findAllProblemByCourseId',data),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,8 +175,10 @@ const onAddProblem= async (courseId)=>{
|
||||||
'AdminProblemAdd', query: { courseId: id
|
'AdminProblemAdd', query: { courseId: id
|
||||||
} })
|
} })
|
||||||
}
|
}
|
||||||
const onProblemStore= ()=>{
|
const onProblemStore=async (courseId)=>{
|
||||||
router.push({name: 'AdminProblemStore'})
|
const { id } = courseId
|
||||||
|
await router.push({name: 'AdminProblemStore',
|
||||||
|
query: { courseId: id}})
|
||||||
}
|
}
|
||||||
const rowKey = (rowData) => {
|
const rowKey = (rowData) => {
|
||||||
return rowData.id
|
return rowData.id
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,15 @@ const loading = ref(true)
|
||||||
const ScoringRubricList =
|
const ScoringRubricList =
|
||||||
ref([])
|
ref([])
|
||||||
const role=userStore.getRole()
|
const role=userStore.getRole()
|
||||||
|
const paginationReactive = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 50,
|
||||||
|
showSizePicker: true,
|
||||||
|
pageSizes: [50, 100,150],
|
||||||
|
prefix ({ itemCount }) {
|
||||||
|
return `总共 ${itemCount} 条`
|
||||||
|
}
|
||||||
|
})
|
||||||
let columns = [
|
let columns = [
|
||||||
{
|
{
|
||||||
key: 'range',
|
key: 'range',
|
||||||
|
|
@ -110,7 +119,7 @@ watch(
|
||||||
()=>{
|
()=>{
|
||||||
if
|
if
|
||||||
(router.currentRoute.value.fullPath==='/admin/problem/problem-scoring-standard') {
|
(router.currentRoute.value.fullPath==='/admin/problem/problem-scoring-standard') {
|
||||||
queryByPage()
|
queryByPage(paginationReactive.page)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
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'
|
||||||
|
|
@ -58,6 +57,7 @@ import StandardsList
|
||||||
from '@/views/admin/problem/components/StandardList.vue'
|
from '@/views/admin/problem/components/StandardList.vue'
|
||||||
import RichTextEditor
|
import RichTextEditor
|
||||||
from '@/components/common/RichTextEditor.vue'
|
from '@/components/common/RichTextEditor.vue'
|
||||||
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
const tagsStore = useTagsStore()
|
const tagsStore = useTagsStore()
|
||||||
const path=ref('')
|
const path=ref('')
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
@ -72,12 +72,13 @@ const problemInfoValue = ref({
|
||||||
const problemInfoRef = ref(null)
|
const problemInfoRef = ref(null)
|
||||||
const descEditorHeight = ref('160px')
|
const descEditorHeight = ref('160px')
|
||||||
|
|
||||||
const cancel = ()=>{
|
const cancel = async () => {
|
||||||
|
await api.deleteScoringStandard({})
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
router.push({path: 'problem-list'})
|
|
||||||
}
|
}
|
||||||
const onAdd = ()=>{
|
const onAdd = ()=>{
|
||||||
router.push({name: 'AdminProblemScoringStandard'})
|
router.push({name:
|
||||||
|
'AdminProblemScoringStandard',query:{courseId:courseId}})
|
||||||
}
|
}
|
||||||
const submit =async ()=> {
|
const submit =async ()=> {
|
||||||
if (problemInfoValue.value.title !== '' && problemInfoValue.value.description !== '') {
|
if (problemInfoValue.value.title !== '' && problemInfoValue.value.description !== '') {
|
||||||
|
|
@ -89,10 +90,10 @@ const submit =async ()=> {
|
||||||
})
|
})
|
||||||
$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 if (problemInfoValue.value.title == "") {
|
} else if (problemInfoValue.value.title == "") {
|
||||||
$message.error("作业名称不能为空")
|
$message.error("作业名称不能为空")
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,12 @@
|
||||||
</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'
|
||||||
|
const route = useRoute()
|
||||||
|
const { courseId, history } = route.query
|
||||||
import RichTextEditor
|
import RichTextEditor
|
||||||
from '@/components/common/RichTextEditor.vue'
|
from '@/components/common/RichTextEditor.vue'
|
||||||
import { once } from '@/utils'
|
import { once } from '@/utils'
|
||||||
|
|
@ -81,10 +83,7 @@ const handleDescEditorFocus = once(() => {
|
||||||
})
|
})
|
||||||
const cancel = ()=>{
|
const cancel = ()=>{
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
router.push({path: 'problem-scoring-standard'})
|
router.push({path: 'problem-scoring-standard',query:{courseId:courseId}})
|
||||||
}
|
|
||||||
const onAdd = ()=>{
|
|
||||||
router.push({name: 'AdminProblemScoringRubric'})
|
|
||||||
}
|
}
|
||||||
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!==''){
|
||||||
|
|
@ -94,10 +93,10 @@ const submit =async ()=>{
|
||||||
})
|
})
|
||||||
$message.success("添加评分细则成功")
|
$message.success("添加评分细则成功")
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
await router.push({name: 'AdminProblemScoringStandard'})
|
await router.push({name: 'AdminProblemScoringStandard',query:{courseId:courseId}})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
await router.push({name: 'AdminProblemScoringStandard'})
|
await router.push({name: 'AdminProblemScoringStandard',query:{courseId:courseId}})
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
$message.error("评分细则不能为空")
|
$message.error("评分细则不能为空")
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {useRouter} from "vue-router";
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import api from "@/api/admin";
|
import api from "@/api/admin";
|
||||||
import { useTagsStore } from '@/store'
|
import { useTagsStore } from '@/store'
|
||||||
import RubricList from
|
import RubricList from
|
||||||
'@/views/admin/problem/components/RubricList.vue'
|
'@/views/admin/problem/components/RubricList.vue'
|
||||||
import RichTextEditor
|
const route = useRoute()
|
||||||
from '@/components/common/RichTextEditor.vue'
|
const { courseId, history } = route.query
|
||||||
const tagsStore = useTagsStore()
|
const tagsStore = useTagsStore()
|
||||||
const path=ref('')
|
const path=ref('')
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
@ -70,11 +70,15 @@ const ScoringStandardInfoValue = ref({
|
||||||
});
|
});
|
||||||
const problemInfoRef = ref(null)
|
const problemInfoRef = ref(null)
|
||||||
|
|
||||||
const cancel = ()=>{
|
const cancel = async () => {
|
||||||
|
await api.deleteScoringRubric({})
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
|
await router.push({name:
|
||||||
|
'AdminProblemAdd',query:{courseId:courseId}})
|
||||||
}
|
}
|
||||||
const onAdd = ()=>{
|
const onAdd = ()=>{
|
||||||
router.push({name: 'AdminProblemScoringRubric'})
|
router.push({name:
|
||||||
|
'AdminProblemScoringRubric',query:{courseId:courseId}})
|
||||||
}
|
}
|
||||||
const submit =async ()=>{
|
const submit =async ()=>{
|
||||||
if(ScoringStandardInfoValue.value.dimension!==''&&ScoringStandardInfoValue.value.weight!==''){
|
if(ScoringStandardInfoValue.value.dimension!==''&&ScoringStandardInfoValue.value.weight!==''){
|
||||||
|
|
@ -84,10 +88,15 @@ const submit =async ()=>{
|
||||||
})
|
})
|
||||||
$message.success("添加评分标准成功")
|
$message.success("添加评分标准成功")
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
await router.push({name: 'AdminProblemAdd'})
|
await router.push({name:
|
||||||
|
'AdminProblemAdd', query: {
|
||||||
|
courseId: courseId
|
||||||
|
}})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
await router.push({name: 'AdminProblemAdd'})
|
await router.push({name: 'AdminProblemAdd', query: {
|
||||||
|
courseId: courseId
|
||||||
|
}})
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
$message.error("维度或权重不能为空")
|
$message.error("维度或权重不能为空")
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
class="flex-item"
|
class="flex-item"
|
||||||
style="margin-left: -30px">
|
style="margin-left: -30px">
|
||||||
<n-input
|
<n-input
|
||||||
v-model:value="ProblemInfoValue.ProblemId"
|
v-model:value="ProblemInfoValue.title"
|
||||||
style="min-width: 80px" placeholder=""></n-input>
|
style="min-width: 80px" placeholder=""></n-input>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item style="margin-left: 20px">
|
<n-form-item style="margin-left: 20px">
|
||||||
|
|
@ -56,9 +56,11 @@ import ProblemActions from
|
||||||
'./components/ProblemActions.vue';
|
'./components/ProblemActions.vue';
|
||||||
import {formatDateTime} from '@/utils';
|
import {formatDateTime} from '@/utils';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import ProblemActions2
|
import ProblemActions2
|
||||||
from '@/views/admin/problem/components/ProblemActions2.vue'
|
from '@/views/admin/problem/components/ProblemActions2.vue'
|
||||||
|
import problem
|
||||||
|
from '@/views/user/problem/index.vue'
|
||||||
const rules=ref(null)
|
const rules=ref(null)
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
@ -69,6 +71,8 @@ const ProblemList =
|
||||||
const options1=ref([])
|
const options1=ref([])
|
||||||
const role=userStore.getRole()
|
const role=userStore.getRole()
|
||||||
const teacherId=ref()
|
const teacherId=ref()
|
||||||
|
const route = useRoute()
|
||||||
|
const { courseId, history } = route.query
|
||||||
const paginationReactive = reactive({
|
const paginationReactive = reactive({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 50,
|
pageSize: 50,
|
||||||
|
|
@ -83,6 +87,7 @@ const ProblemInfoValue = ref({
|
||||||
pageSize:paginationReactive.pageSize,
|
pageSize:paginationReactive.pageSize,
|
||||||
id:0,
|
id:0,
|
||||||
teacherId:'',
|
teacherId:'',
|
||||||
|
title:""
|
||||||
});
|
});
|
||||||
const onAdd = ()=>{
|
const onAdd = ()=>{
|
||||||
router.push({name: 'AdminProblemAdd'})
|
router.push({name: 'AdminProblemAdd'})
|
||||||
|
|
@ -110,9 +115,7 @@ watch(()=>ProblemInfoValue.value.id,
|
||||||
options1.value=[]
|
options1.value=[]
|
||||||
queryByPage1(newVal)
|
queryByPage1(newVal)
|
||||||
})
|
})
|
||||||
let columns
|
let columns = [
|
||||||
if (role[0]=='admin'){
|
|
||||||
columns = [
|
|
||||||
{
|
{
|
||||||
key: 'title',
|
key: 'title',
|
||||||
title: '作业标题',
|
title: '作业标题',
|
||||||
|
|
@ -120,7 +123,7 @@ if (role[0]=='admin'){
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
key: 'creater',
|
key: 'teacherName',
|
||||||
title: '创建者',
|
title: '创建者',
|
||||||
width: '60',
|
width: '60',
|
||||||
align:'center'
|
align:'center'
|
||||||
|
|
@ -143,93 +146,37 @@ if (role[0]=='admin'){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}else {
|
|
||||||
columns = [
|
|
||||||
{
|
|
||||||
key: 'name',
|
|
||||||
title: '班级名称',
|
|
||||||
width: '260',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'studentNum',
|
|
||||||
title: '学生数',
|
|
||||||
width: '80',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'createTime',
|
|
||||||
title: '创建时间',
|
|
||||||
width: '190',
|
|
||||||
render: (row) => {
|
|
||||||
return row["createTime"]=formatDateTime(row["createTime"]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'inviteCode',
|
|
||||||
title: '邀请码',
|
|
||||||
width: '130',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'actions',
|
|
||||||
title: '操作',
|
|
||||||
width: '450',
|
|
||||||
render(row) {
|
|
||||||
if(role[0]==='teacher'){
|
|
||||||
return h(
|
|
||||||
ProblemActions2,
|
|
||||||
{
|
|
||||||
onClickStudent: () => onStudentProblem(row),
|
|
||||||
onClickAssistant: () => onAssistantProblem(row),
|
|
||||||
onClickEdit: () => onEditProblem(row),
|
|
||||||
onClickDelete: () => onDeleteProblem(row),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if(role[0]==='assistant'){
|
|
||||||
return h(
|
|
||||||
ProblemActions2,
|
|
||||||
{
|
|
||||||
onClickStudent: () => onStudentProblem(row),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
const queryByPage = async (currentPage)=>{
|
const queryByPage = async (currentPage)=>{
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
|
ProblemInfoValue.value.pageNum=currentPage
|
||||||
|
ProblemInfoValue.value.pageSize=paginationReactive.pageSize
|
||||||
try {
|
try {
|
||||||
ProblemInfoValue.value.pageSize=paginationReactive.pageSize
|
|
||||||
const res = await api.findAllProblemPage(
|
const res = await
|
||||||
|
api.findAllProblemByCourseId(
|
||||||
{
|
{
|
||||||
...ProblemInfoValue.value
|
...ProblemInfoValue.value,
|
||||||
|
courseId:courseId
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
console.log(res.data)
|
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
|
const {pageNum, pageSize, total, list} = res.data
|
||||||
paginationReactive.page = pageNum
|
paginationReactive.page = pageNum
|
||||||
paginationReactive.pageSize = pageSize
|
paginationReactive.pageSize = pageSize
|
||||||
paginationReactive.itemCount = total
|
paginationReactive.itemCount = total
|
||||||
ProblemList.value=list.map((item,i)=>{return item;})
|
ProblemList.value =
|
||||||
|
list.map((item,i)=>{return item;})
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const search=async ()=>{
|
||||||
|
ProblemInfoRef.value?.validate(async (errors) => {
|
||||||
|
await queryByPage(1)
|
||||||
|
})
|
||||||
|
}
|
||||||
const onDeleteProblem = async (problemid)=>{
|
const onDeleteProblem = async (problemid)=>{
|
||||||
const {id} = problemid
|
const {id} = problemid
|
||||||
try {
|
try {
|
||||||
|
|
@ -263,24 +210,7 @@ const onPostProblem = async (problemid)=>{
|
||||||
await router.push({name: 'AdminProblemPost',
|
await router.push({name: 'AdminProblemPost',
|
||||||
params: {clId: id}})
|
params: {clId: id}})
|
||||||
}
|
}
|
||||||
const search=async ()=>{
|
|
||||||
loading.value=true
|
|
||||||
try {
|
|
||||||
if (userStore.getRole().some((r)=>r==='admin')){
|
|
||||||
const res=await api.findAllProblemPage({
|
|
||||||
...ProblemInfoValue.value
|
|
||||||
})
|
|
||||||
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){
|
|
||||||
}finally {
|
|
||||||
loading.value=false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const handleSearchSchool = async (query) => {
|
const handleSearchSchool = async (query) => {
|
||||||
const res = await api.getSchoolByschoolName({
|
const res = await api.getSchoolByschoolName({
|
||||||
name: query,
|
name: query,
|
||||||
|
|
@ -321,7 +251,7 @@ const onChangePage = (page) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
queryByPage()
|
queryByPage(paginationReactive.page)
|
||||||
})
|
})
|
||||||
watch(
|
watch(
|
||||||
()=>router.currentRoute.value.fullPath,
|
()=>router.currentRoute.value.fullPath,
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,7 @@ export default {
|
||||||
{
|
{
|
||||||
name: 'AdminProblemTest',
|
name: 'AdminProblemTest',
|
||||||
path: 'problem-test',
|
path: 'problem-test',
|
||||||
|
isHidden: true,
|
||||||
component: () => import('@/views/admin/problem/test.vue'),
|
component: () => import('@/views/admin/problem/test.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '测试页',
|
title: '测试页',
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,9 @@ 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;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.example.aes.user.model.DataGrid;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.swing.event.ListDataEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -95,6 +96,25 @@ public class ProblemController {
|
||||||
return RespBean.error("获取评分标准列表失败!");
|
return RespBean.error("获取评分标准列表失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@PostMapping("/deleteScoringRubric")
|
||||||
|
public RespBean deleteScoringRubric(){
|
||||||
|
problemServiceI.deleteScoringRubric();
|
||||||
|
return RespBean.ok("删除评分细则成功");
|
||||||
|
}
|
||||||
|
@PostMapping("/deleteScoringStandard")
|
||||||
|
public RespBean deleteScoringStandrd(){
|
||||||
|
problemServiceI.deleteScoringStandard();
|
||||||
|
return RespBean.ok("删除评分标准成功");
|
||||||
|
}
|
||||||
|
@PostMapping("/findAllProblemByCourseId")
|
||||||
|
public RespBean findAllProblemByCourseId(@RequestBody PMProblem pmProblem){
|
||||||
|
if (pmProblem.getPageNum() < 1 || pmProblem.getPageSize() < 1)
|
||||||
|
return RespBean.error("参数错误!");
|
||||||
|
DataGrid dataGrid=
|
||||||
|
problemServiceI.findProblemByCourseId(pmProblem);
|
||||||
|
return RespBean.ok("查询作业库成功",dataGrid);
|
||||||
|
|
||||||
}
|
}
|
||||||
//获取作业列表
|
//获取作业列表
|
||||||
@GetMapping("/getExamList")
|
@GetMapping("/getExamList")
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,11 @@ 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.Course;
|
||||||
import com.example.aes.user.model.PMCourse;
|
import com.example.aes.user.model.PMCourse;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -18,6 +20,8 @@ public interface ProblemDaoI extends BaseDaoI<Problem> {
|
||||||
public String findProblemByTitle(String title);
|
public String findProblemByTitle(String title);
|
||||||
public List<Problem> findProblemIdByTitle(String title);
|
public List<Problem> findProblemIdByTitle(String title);
|
||||||
public void addProblem(Problem problem);
|
public void addProblem(Problem problem);
|
||||||
|
public long getAllProblemsNum(int courseId);
|
||||||
|
List<Problem> getProblemsByPage(Integer courseId,String title,
|
||||||
|
int page, int rows);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,7 @@ 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 void updateStandardId(Integer standardId);
|
||||||
|
public void deleteScoringRubric();
|
||||||
|
public void deleteScoringRubricByStandrdId(Integer standardId);
|
||||||
public List<ScoringRubric> getScoringRubricByStandardId(Integer standardId);
|
public List<ScoringRubric> getScoringRubricByStandardId(Integer standardId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.example.aes.problem.dao.impl;
|
package com.example.aes.problem.dao.impl;
|
||||||
|
|
||||||
|
import cn.hutool.poi.excel.cell.CellSetter;
|
||||||
import com.example.aes.problem.dao.ProblemDaoI;
|
import com.example.aes.problem.dao.ProblemDaoI;
|
||||||
import com.example.aes.problem.model.PMProblem;
|
import com.example.aes.problem.model.PMProblem;
|
||||||
import com.example.aes.problem.model.PMScoringRubric;
|
import com.example.aes.problem.model.PMScoringRubric;
|
||||||
|
|
@ -12,9 +13,11 @@ 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;
|
||||||
|
import org.springframework.security.core.parameters.P;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Repository("ProblemDao")
|
@Repository("ProblemDao")
|
||||||
public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
||||||
|
|
@ -61,6 +64,18 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
||||||
List<Problem> problemList = this.find(hql);
|
List<Problem> problemList = this.find(hql);
|
||||||
return problemList;
|
return problemList;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<Problem> getProblemsByPage(Integer courseId,String title,
|
||||||
|
int page,
|
||||||
|
int rows){
|
||||||
|
String hql="from Problem where courseId=" +
|
||||||
|
courseId+" and title like '%"+title+
|
||||||
|
"%'";
|
||||||
|
List<Problem> problemList =
|
||||||
|
this.find(hql,page,rows);
|
||||||
|
return problemList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addProblem(Problem problem) {
|
public void addProblem(Problem problem) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
@ -71,4 +86,11 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
||||||
problem1.setDescription(problem.getDescription());
|
problem1.setDescription(problem.getDescription());
|
||||||
this.save(problem1);
|
this.save(problem1);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public long getAllProblemsNum(int courseId){
|
||||||
|
String hql = "select count(*) from " +
|
||||||
|
"Problem where courseId="+courseId;
|
||||||
|
long count=this.count(hql);
|
||||||
|
return count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,4 +43,18 @@ public class ScoringRubricDaoImpl extends BaseDaoImpl<ScoringRubric> implements
|
||||||
this.find(hql);
|
this.find(hql);
|
||||||
return scoringRubricList;
|
return scoringRubricList;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void deleteScoringRubric(){
|
||||||
|
String hql =
|
||||||
|
"delete from ScoringRubric where" +
|
||||||
|
" standardId is null";
|
||||||
|
this.executeHql(hql);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void deleteScoringRubricByStandrdId(Integer standardId){
|
||||||
|
String hql =
|
||||||
|
"delete from ScoringRubric where" +
|
||||||
|
" standardId="+standardId;
|
||||||
|
this.executeHql(hql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ public class PMProblem extends Problem implements java.io.Serializable{//继承P
|
||||||
// 作业列表分页exam
|
// 作业列表分页exam
|
||||||
private int pageNum;
|
private int pageNum;
|
||||||
private int pageSize;
|
private int pageSize;
|
||||||
|
private String teacherName;
|
||||||
|
|
||||||
|
|
||||||
// (作业列表)页面上其他需要的属性
|
// (作业列表)页面上其他需要的属性
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,4 @@
|
||||||
package com.example.aes.problem.model;
|
package com.example.aes.problem.model;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class UProblem {
|
public class UProblem {
|
||||||
private String title;
|
|
||||||
private String description;
|
|
||||||
private int courseId;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,8 @@ import com.example.aes.problem.dao.ScoringRubricDaoI;
|
||||||
import com.example.aes.problem.dao.ScoringStandardDaoI;
|
import com.example.aes.problem.dao.ScoringStandardDaoI;
|
||||||
import com.example.aes.problem.model.*;
|
import com.example.aes.problem.model.*;
|
||||||
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.dao.AdminusersDaoI;
|
||||||
import com.example.aes.user.model.DataGrid;
|
import com.example.aes.user.model.DataGrid;
|
||||||
import com.example.aes.user.model.PMCourse;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
@ -20,6 +18,12 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
private ProblemDaoI problemDao;
|
private ProblemDaoI problemDao;
|
||||||
private ScoringRubricDaoI scoringRubricDao;
|
private ScoringRubricDaoI scoringRubricDao;
|
||||||
private ScoringStandardDaoI scoringStandardDao;
|
private ScoringStandardDaoI scoringStandardDao;
|
||||||
|
private AdminusersDaoI adminusersDao;
|
||||||
|
@Autowired
|
||||||
|
public void setAdminusersDao(AdminusersDaoI adminusersDao) {
|
||||||
|
this.adminusersDao = adminusersDao;
|
||||||
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setScoringStandardDao(ScoringStandardDaoI scoringStandardDao) {
|
public void setScoringStandardDao(ScoringStandardDaoI scoringStandardDao) {
|
||||||
this.scoringStandardDao = scoringStandardDao;
|
this.scoringStandardDao = scoringStandardDao;
|
||||||
|
|
@ -99,6 +103,21 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
scoringStandardDao.updateProblemId(problemId);
|
scoringStandardDao.updateProblemId(problemId);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public void deleteScoringRubric(){
|
||||||
|
scoringRubricDao.deleteScoringRubric();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void deleteScoringStandard(){
|
||||||
|
//先找出无problemid的standrd的list
|
||||||
|
List<ScoringStandard> scoringStandardList=scoringStandardDao.getStandardIdNoProblemId();
|
||||||
|
//再根据standardid删掉rubric
|
||||||
|
for(ScoringStandard scoringStandard:scoringStandardList){
|
||||||
|
scoringRubricDao.deleteScoringRubricByStandrdId(scoringStandard.getId());
|
||||||
|
//最后删掉无problemid的standrd
|
||||||
|
scoringStandardDao.delete(scoringStandard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public String findProblemByTitle(String title){
|
public String findProblemByTitle(String title){
|
||||||
return problemDao.findProblemByTitle(title);
|
return problemDao.findProblemByTitle(title);
|
||||||
}
|
}
|
||||||
|
|
@ -109,6 +128,35 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public DataGrid findProblemByCourseId(PMProblem pmProblem){
|
||||||
|
DataGrid dg = new DataGrid();
|
||||||
|
int totalLines;
|
||||||
|
List<Problem> theProblemList;
|
||||||
|
totalLines=
|
||||||
|
(int) problemDao.getAllProblemsNum(pmProblem.getCourseId());
|
||||||
|
int page= pmProblem.getPageNum();
|
||||||
|
if ((page-1)*pmProblem.getPageSize()>=totalLines){
|
||||||
|
pmProblem.setPageNum(1);
|
||||||
|
} theProblemList =
|
||||||
|
problemDao.getProblemsByPage(pmProblem.getCourseId(),pmProblem.getTitle(),pmProblem.getPageNum(), pmProblem.getPageSize());
|
||||||
|
if (theProblemList == null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
List<PMProblem> pmProblems=new ArrayList<>();
|
||||||
|
changeModel2(pmProblems,theProblemList);
|
||||||
|
dg.setTotal(totalLines);
|
||||||
|
dg.setPageSize(pmProblem.getPageSize());
|
||||||
|
dg.setTotalPages((long) (Math.ceil((double) dg.getTotal() / (double) dg.getPageSize())));
|
||||||
|
// // 设置当前显示第几页
|
||||||
|
dg.setPageNum(pmProblem.getPageNum());
|
||||||
|
// // 设置当前页的数据行数量
|
||||||
|
dg.setCurrentPageLineNum(pmProblems.size());
|
||||||
|
// // 设置当前页的所有数据行
|
||||||
|
dg.setList(pmProblems);
|
||||||
|
return dg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public void addProblem(Problem problem) {
|
public void addProblem(Problem problem) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
problemDao.addProblem(problem);
|
problemDao.addProblem(problem);
|
||||||
|
|
@ -126,4 +174,20 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void changeModel2(List<PMProblem> pmp,
|
||||||
|
List<Problem> p) {
|
||||||
|
if (p != null && p.size() > 0) {
|
||||||
|
for (Problem problem : p) {
|
||||||
|
PMProblem pmProblem=new PMProblem();
|
||||||
|
pmProblem.setId(problem.getId());
|
||||||
|
pmProblem.setCourseId(problem.getCourseId());
|
||||||
|
pmProblem.setAdminuserId(problem.getAdminuserId());
|
||||||
|
pmProblem.setTeacherName(adminusersDao.findTeacherNameByTeacherId(problem.getAdminuserId()));
|
||||||
|
pmProblem.setTitle(problem.getTitle());
|
||||||
|
pmProblem.setDescription(problem.getDescription());
|
||||||
|
pmp.add(pmProblem);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,8 @@ public interface ProblemServiceI {
|
||||||
public List<Problem> findProblemIdByTitle(String title);
|
public List<Problem> findProblemIdByTitle(String title);
|
||||||
public void addProblem(Problem problem);
|
public void addProblem(Problem problem);
|
||||||
public void updateProblemId(int problemId);
|
public void updateProblemId(int problemId);
|
||||||
|
public void deleteScoringRubric();
|
||||||
|
public void deleteScoringStandard();
|
||||||
|
public DataGrid findProblemByCourseId(PMProblem pmProblem);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,4 +35,5 @@ public interface AdminusersDaoI extends BaseDaoI<Adminusers> {
|
||||||
|
|
||||||
public long getAssistantNotBelongClassNum(int classId,
|
public long getAssistantNotBelongClassNum(int classId,
|
||||||
String account, String name, String email, String no);
|
String account, String name, String email, String no);
|
||||||
|
public String findTeacherNameByTeacherId(int teacherId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -446,4 +446,10 @@ public class AdminusersDaoImpl extends BaseDaoImpl<Adminusers> implements
|
||||||
q.setParameter("no", "%" + no + "%");
|
q.setParameter("no", "%" + no + "%");
|
||||||
return q.list().size();
|
return q.list().size();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public String findTeacherNameByTeacherId(int teacherId){
|
||||||
|
String hql=
|
||||||
|
"from Adminusers where id="+teacherId;
|
||||||
|
return this.find(hql).get(0).getName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue