更新课程考试题
This commit is contained in:
@@ -2,9 +2,12 @@ package com.peanut.modules.common.dao;
|
|||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.peanut.modules.common.entity.ClassExamOption;
|
import com.peanut.modules.common.entity.ClassExamOption;
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ClassExamOptionDao extends MPJBaseMapper<ClassExamOption> {
|
public interface ClassExamOptionDao extends MPJBaseMapper<ClassExamOption> {
|
||||||
|
@Delete("DELETE FROM class_exam_option WHERE subject_id = #{subjectId}")
|
||||||
|
int realDeleteClassExamOption(int subjectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class ClassExamServiceImpl extends ServiceImpl<ClassExamDao, ClassExam> i
|
|||||||
public void updateClassExamSubject(ClassExamSubject classExamSubject) {
|
public void updateClassExamSubject(ClassExamSubject classExamSubject) {
|
||||||
classExamSubjectDao.updateById(classExamSubject);
|
classExamSubjectDao.updateById(classExamSubject);
|
||||||
if (classExamSubject.getOptions()!=null&&classExamSubject.getOptions().size() > 0){
|
if (classExamSubject.getOptions()!=null&&classExamSubject.getOptions().size() > 0){
|
||||||
classExamOptionDao.delete(new LambdaQueryWrapper<ClassExamOption>().eq(ClassExamOption::getSubjectId,classExamSubject.getId()));
|
classExamOptionDao.realDeleteClassExamOption(classExamSubject.getId());
|
||||||
for (ClassExamOption option:classExamSubject.getOptions()){
|
for (ClassExamOption option:classExamSubject.getOptions()){
|
||||||
option.setSubjectId(classExamSubject.getId());
|
option.setSubjectId(classExamSubject.getId());
|
||||||
classExamOptionDao.insert(option);
|
classExamOptionDao.insert(option);
|
||||||
|
|||||||
Reference in New Issue
Block a user