Browse Source

线下试题题型排序相关

ywx
王宁 1 month ago
parent
commit
c84781d996

+ 103
- 0
smarking/src/main/java/com/xhkjedu/smarking/controller/paper/MsPaperQtypeController.java View File

@@ -6,6 +6,7 @@ import com.xhkjedu.smarking.model.paper.MsPaperFile;
6 6
 import com.xhkjedu.smarking.model.paper.MsPaperQtype;
7 7
 import com.xhkjedu.smarking.model.paper.MsPaperQtypeQuestion;
8 8
 import com.xhkjedu.smarking.service.paper.MsPaperQtypeService;
9
+import com.xhkjedu.smarking.vo.paper.MsPaperParams;
9 10
 import com.xhkjedu.utils.N_Utils;
10 11
 import com.xhkjedu.vo.ResultVo;
11 12
 import org.springframework.web.bind.annotation.PostMapping;
@@ -175,6 +176,108 @@ public class MsPaperQtypeController {
175 176
         return new ResultVo(0,"获取成功" ,map);
176 177
     }
177 178
 
179
+    /*
180
+     * @Description 线下试卷-保存题型及试题
181
+     * @Date 2024/12/4 10:40:53
182
+     * @Author WN
183
+     * @Param [qtype]
184
+     * @Return com.xhkjedu.vo.ResultVo
185
+     **/
186
+    @PostMapping("/qtype_save")
187
+    public ResultVo saveOfflineQtype(@RequestBody MsPaperQtype qtype) {
188
+        N_Utils.validation(new Object[]{qtype.getMpid(),"试卷id",1});
189
+        List<MsPaperQtypeQuestion> questions = qtype.getQuestions();
190
+        if(questions == null || questions.isEmpty()){
191
+            return new ResultVo(1,"未设置试题");
192
+        }
193
+        return msPaperQtypeService.saveQtypeQuestionOffline(qtype);
194
+    }
195
+
196
+    /*
197
+     * @Description 线下试卷-修改题型及试题
198
+     * @Date 2024/12/4 10:42:29
199
+     * @Author WN
200
+     * @Param [qtype]
201
+     * @Return com.xhkjedu.vo.ResultVo
202
+     **/
203
+    @PostMapping("/qtype_update")
204
+    public ResultVo updateOfflineQtype(@RequestBody MsPaperQtype qtype) {
205
+        N_Utils.validation(new Object[]{qtype.getMpid(),"试卷id",1,qtype.getMptid(),"题型id",1});
206
+        List<MsPaperQtypeQuestion> questions = qtype.getQuestions();
207
+        if(questions == null || questions.isEmpty()){
208
+            return new ResultVo(1,"未设置试题");
209
+        }
210
+        return msPaperQtypeService.updateQtypeQuestionOffline(qtype);
211
+    }
212
+
213
+    /*
214
+     * @Description 线下试卷-删除题型
215
+     * @Date 2024/12/4 10:45:45
216
+     * @Author WN
217
+     * @Param [qtype]
218
+     * @Return com.xhkjedu.vo.ResultVo
219
+     **/
220
+    @PostMapping("/qtype_del")
221
+    public ResultVo deleteOfflineQtype(@RequestBody MsPaperQtype qtype) {
222
+        N_Utils.validation(new Object[]{qtype.getMpid(),"试卷id",1,qtype.getMptid(),"题型id",1});
223
+        return msPaperQtypeService.deleteQtypeOffline(qtype);
224
+    }
225
+
226
+    /*
227
+     * @Description 线下试卷-移动题型
228
+     * @Date 2024/12/4 10:54:08
229
+     * @Author WN
230
+     * @Param [params]
231
+     * @Return com.xhkjedu.vo.ResultVo
232
+     **/
233
+    @PostMapping("/qtype_move")
234
+    public ResultVo moveOfflineQtype(@RequestBody MsPaperParams params) {
235
+        N_Utils.validation(new Object[]{params.getMpid(),"试卷id",1,params.getMptid(),"题型id",1,params.getMovetype(),"移动类型",1});
236
+        msPaperQtypeService.updateQtypeOrderOffline(params);
237
+        return new ResultVo(0,"保存成功");
238
+    }
239
+
240
+    /*
241
+     * @Description 线下试卷-修改试题
242
+     * @Date 2024/12/4 10:55:44
243
+     * @Author WN
244
+     * @Param [question]
245
+     * @Return com.xhkjedu.vo.ResultVo
246
+     **/
247
+    @PostMapping("/que_update")
248
+    public ResultVo updateOfflineQuestion(@RequestBody MsPaperQtypeQuestion question) {
249
+        N_Utils.validation(new Object[]{question.getMpid(),"试卷id",1,question.getMptid(),"题型id",1,question.getMptqid(),"试题id",1});
250
+        msPaperQtypeService.updateQuestionOffline(question);
251
+        return new ResultVo(0,"保存成功");
252
+    }
253
+
254
+    /*
255
+     * @Description 线下试卷-删除试题
256
+     * @Date 2024/12/4 10:56:59
257
+     * @Author WN
258
+     * @Param [question]
259
+     * @Return com.xhkjedu.vo.ResultVo
260
+     **/
261
+    @PostMapping("/que_del")
262
+    public ResultVo deleteOfflineQuestion(@RequestBody MsPaperQtypeQuestion question) {
263
+        N_Utils.validation(new Object[]{question.getMpid(),"试卷id",1,question.getMptid(),"题型id",1,question.getMptqid(),"试题id",1});
264
+        msPaperQtypeService.deleteQuestionOffline(question);
265
+        return new ResultVo(0,"保存成功");
266
+    }
267
+
268
+    /*
269
+     * @Description 线下试卷-移动试题
270
+     * @Date 2024/12/4 10:58:39
271
+     * @Author WN
272
+     * @Param [params]
273
+     * @Return com.xhkjedu.vo.ResultVo
274
+     **/
275
+    @PostMapping("/que_move")
276
+    public ResultVo moveOfflineQuestion(@RequestBody MsPaperParams params) {
277
+        N_Utils.validation(new Object[]{params.getMpid(),"试卷id",1,params.getMptqid(),"试题id",1,params.getMovetype(),"移动类型",1});
278
+        msPaperQtypeService.updateQuestionOrderOffline(params);
279
+        return new ResultVo(0,"保存成功");
280
+    }
178 281
 
179 282
 
180 283
 

+ 6
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsPaperQtypeMapper.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.smarking.mapper.paper;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4 4
 import com.xhkjedu.smarking.model.paper.MsPaperQtype;
5
+import com.xhkjedu.smarking.vo.paper.MsPaperParams;
5 6
 import com.xhkjedu.smarking.vo.paper.MsPaperQtypeVo;
6 7
 import org.apache.ibatis.annotations.Param;
7 8
 
@@ -38,4 +39,9 @@ public interface MsPaperQtypeMapper extends TkMapper<MsPaperQtype> {
38 39
 
39 40
     //批量修改题型排序-线下
40 41
     int updateBatchQtypeOrder(@Param("list")List<MsPaperQtype> list);
42
+    //批量修改题型排序-移动-线下
43
+    int updateBatchMoveQtypeOrder(@Param("list")List<MsPaperQtype> list);
44
+
45
+    //题型移动-获取要交换位置的题型
46
+    MsPaperQtype getQtypeForMoverOrder(@Param("p") MsPaperParams p);
41 47
 }

+ 5
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsPaperQtypeQuestionMapper.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.smarking.mapper.paper;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4 4
 import com.xhkjedu.smarking.model.paper.MsPaperQtypeQuestion;
5
+import com.xhkjedu.smarking.vo.paper.MsPaperParams;
5 6
 import org.apache.ibatis.annotations.Param;
6 7
 
7 8
 import java.util.List;
@@ -36,11 +37,15 @@ public interface MsPaperQtypeQuestionMapper extends TkMapper<MsPaperQtypeQuestio
36 37
 
37 38
     //批量修改试题排序-线下
38 39
     int updateBatchQuestionOrder(@Param("list") List<MsPaperQtypeQuestion> list);
40
+    //批量修改试题排序-移动-线下
41
+    int updateBatchMoveQuestionOrder(@Param("list") List<MsPaperQtypeQuestion> list);
39 42
 
40 43
     //获取试卷中所有试题排序
41 44
     List<MsPaperQtypeQuestion> listQuesOrderByMpid(@Param("mpid")Integer mpid);
42 45
 
43 46
     //获取题型下试题数量
44 47
     int getQuesnumByMptid(@Param("mptid")Integer mptid);
48
+    //试题移动-获取要交换位置的试题
49
+    MsPaperQtypeQuestion getQuestionForMoverOrder(@Param("p")MsPaperParams p);
45 50
 
46 51
 }

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/model/exam/MsExam.java View File

@@ -27,7 +27,7 @@ public class MsExam extends BaseBean {
27 27
     private Integer exammode;
28 28
     //是否启用监控0未启用1启用
29 29
     private Integer monitored;
30
-    //考试状态0未开始1已开始2已结束3己生成报告(一键统分)4发布成绩
30
+    //考试状态0未开始1已开始2已结束3一键统分4生成报告5发布成绩
31 31
     private Integer examstate;
32 32
     //年级
33 33
     private Integer gradeid;

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/model/paper/MsPaperQtypeQuestion.java View File

@@ -45,7 +45,7 @@ public class MsPaperQtypeQuestion extends BaseBean {
45 45
     private String qanswer;
46 46
     //少选分值
47 47
     private Double loseoption;
48
-    //分值设置0默认1送分题 20分题
48
+    //分值设置0默认1送分题 2 0分题
49 49
     private Integer scoreset;
50 50
     //试题难易度
51 51
     private Integer complexity;

+ 140
- 27
smarking/src/main/java/com/xhkjedu/smarking/service/paper/MsPaperQtypeService.java View File

@@ -1341,14 +1341,9 @@ public class MsPaperQtypeService {
1341 1341
         //设置试卷题目数量和分值
1342 1342
         setPaperNumAndScore(paper);
1343 1343
         msPaperMapper.updateByPrimaryKeySelective(paper);
1344
-        //更改顺序
1345
-        List<MsPaperQtypeQuestion> queOrders = msPaperQtypeQuestionMapper.listQuesOrderByMpid(mptid);
1346
-        int qorder = 1;
1347
-        for(MsPaperQtypeQuestion que : queOrders){
1348
-            que.setQorder(qorder);
1349
-            qorder++;
1350
-        }
1351
-        msPaperQtypeQuestionMapper.updateBatchQuestionOrder(queOrders);
1344
+
1345
+        //试卷中小题重新排序
1346
+        chandleQuestionOrder(paper);
1352 1347
 
1353 1348
         savePaperAnalyzeForFj(paper);
1354 1349
         deletePaperOtherInfo(mpid);
@@ -1364,7 +1359,14 @@ public class MsPaperQtypeService {
1364 1359
      * @Return void
1365 1360
      **/
1366 1361
     @Transactional(rollbackFor = Exception.class)
1367
-    public void deleteQtypeOffline(MsPaperQtype paperQtype){
1362
+    public ResultVo deleteQtypeOffline(MsPaperQtype paperQtype){
1363
+        //根据试卷ID获取考试信息
1364
+        PExamSubjectVo exam = msPaperMapper.getExamSubjectForPaper(paperQtype.getMpid());
1365
+        //线下考试,发布成绩(生成报告)之前可以修改试卷结构
1366
+        if(exam.getExammode() < 3 && exam.getExamstate() > 2){
1367
+            throw new MissingParametersException("考试已统分禁止操作");
1368
+        }
1369
+
1368 1370
         msPaperQtypeMapper.deleteByPrimaryKey(paperQtype.getMptid());
1369 1371
         MsPaper paper = new MsPaper();
1370 1372
         paper.setMpid(paperQtype.getMpid());
@@ -1374,6 +1376,7 @@ public class MsPaperQtypeService {
1374 1376
 
1375 1377
         //重新生成试卷分析
1376 1378
         savePaperAnalyzeForFj(paper);
1379
+        return new ResultVo(0,"删除成功",paper.getMpid());
1377 1380
     }
1378 1381
 
1379 1382
     //处理试卷试题数量和分值,题型排序,试题排序
@@ -1408,10 +1411,70 @@ public class MsPaperQtypeService {
1408 1411
         msPaperMapper.updateByPrimaryKeySelective(paper);
1409 1412
     }
1410 1413
 
1414
+    //处理试卷中小题排序
1415
+    private void chandleQuestionOrder(MsPaper paper){
1416
+        //小题重新排序
1417
+        List<MsPaperQtypeQuestion> queOrders = msPaperQtypeQuestionMapper.listQuesOrderByMpid(paper.getMpid());
1418
+        int qorder = 1;
1419
+        int pnum = 0;
1420
+        double pscore = 0;
1421
+        for(MsPaperQtypeQuestion que : queOrders){
1422
+            que.setQorder(qorder);
1423
+            qorder++;
1424
+            pnum++;
1425
+            pscore = MarkingUtil.add(pscore, que.getQscore());
1426
+        }
1427
+        paper.setPnum(pnum);
1428
+        paper.setPscore(pscore);
1429
+        msPaperQtypeQuestionMapper.updateBatchQuestionOrder(queOrders);
1430
+    }
1431
+
1411 1432
 
1433
+    /*
1434
+     * @Description 线下试卷-题型上下移动
1435
+     * @Date 2024/12/4 10:30:51
1436
+     * @Author WN
1437
+     * @Param [params]
1438
+     * @Return void
1439
+     **/
1412 1440
     @Transactional(rollbackFor = Exception.class)
1413
-    public void updateQtypeOrderOffline(MsPaperQtype paperQtype){
1441
+    public void updateQtypeOrderOffline(MsPaperParams params){
1442
+
1443
+        //根据试卷ID获取考试信息
1444
+        PExamSubjectVo exam = msPaperMapper.getExamSubjectForPaper(params.getMpid());
1445
+        //线下考试,发布成绩(生成报告)之前可以修改试卷结构
1446
+        if(exam.getExammode() < 3 && exam.getExamstate() > 2){
1447
+            throw new MissingParametersException("考试已统分禁止操作");
1448
+        }
1449
+
1450
+        MsPaperQtype moveQtype = new MsPaperQtype();//要移动的题型
1451
+        moveQtype.setMptid(params.getMptid());
1414 1452
 
1453
+        int movevalue;//移动试题的order变换值
1454
+        int bmovevalue;//被移动试题的order变换值
1455
+        if(params.getMovetype() == 1){ //上移
1456
+            movevalue = -1;//在原来基础上减一
1457
+            bmovevalue = 1;
1458
+        }else{
1459
+            movevalue = 1;//在原来基础上加一
1460
+            bmovevalue = -1;
1461
+        }
1462
+        params.setMovevalue(1);
1463
+        moveQtype.setMptorder(movevalue);
1464
+        //被交换位置的试题
1465
+        MsPaperQtype qtype = msPaperQtypeMapper.getQtypeForMoverOrder(params);
1466
+        qtype.setMptorder(bmovevalue);
1467
+
1468
+        List<MsPaperQtype> changeQuestions = new ArrayList<>();
1469
+        changeQuestions.add(moveQtype);
1470
+        changeQuestions.add(qtype);
1471
+        msPaperQtypeMapper.updateBatchMoveQtypeOrder(changeQuestions);
1472
+
1473
+        MsPaper paper = new MsPaper();
1474
+        paper.setMpid(params.getMpid());
1475
+        chandleQuestionOrder(paper);//小题重新排序
1476
+
1477
+        rebuildPaperAnalyzeOffline(paper.getMpid(),paper);
1415 1478
     }
1416 1479
 
1417 1480
     /*
@@ -1423,6 +1486,14 @@ public class MsPaperQtypeService {
1423 1486
      **/
1424 1487
     @Transactional(rollbackFor = Exception.class)
1425 1488
     public void updateQuestionOffline(MsPaperQtypeQuestion question){
1489
+
1490
+        //根据试卷ID获取考试信息
1491
+        PExamSubjectVo exam = msPaperMapper.getExamSubjectForPaper(question.getMpid());
1492
+        //线下考试,发布成绩(生成报告)之前可以修改试卷结构
1493
+        if(exam.getExammode() < 3 && exam.getExamstate() > 2){
1494
+            throw new MissingParametersException("考试已统分禁止操作");
1495
+        }
1496
+
1426 1497
         //获取原小题信息
1427 1498
         MsPaperQtypeQuestion oldQuestion = msPaperQtypeQuestionMapper.selectByPrimaryKey(question.getMptqid());
1428 1499
         //修改小题信息
@@ -1430,6 +1501,9 @@ public class MsPaperQtypeService {
1430 1501
         if(!oldQuestion.getQscore().equals(question.getQscore())){
1431 1502
             //说明修改题型和试卷分值
1432 1503
             msPaperQtypeMapper.updateQtypeScore(question.getMptid(),question.getMpid());
1504
+
1505
+            //重新生成试卷分析
1506
+            rebuildPaperAnalyzeOffline(question.getMpid(),null);
1433 1507
         }
1434 1508
     }
1435 1509
 
@@ -1442,6 +1516,12 @@ public class MsPaperQtypeService {
1442 1516
      **/
1443 1517
     @Transactional(rollbackFor = Exception.class)
1444 1518
     public void deleteQuestionOffline(MsPaperQtypeQuestion question){
1519
+        //根据试卷ID获取考试信息
1520
+        PExamSubjectVo exam = msPaperMapper.getExamSubjectForPaper(question.getMpid());
1521
+        //线下考试,发布成绩(生成报告)之前可以修改试卷结构
1522
+        if(exam.getExammode() < 3 && exam.getExamstate() > 2){
1523
+            throw new MissingParametersException("考试已统分禁止操作");
1524
+        }
1445 1525
         Integer mptid = question.getMptid();
1446 1526
         msPaperQtypeQuestionMapper.deleteByPrimaryKey(question.getMptqid());
1447 1527
         //获取题型下试题数量
@@ -1454,33 +1534,66 @@ public class MsPaperQtypeService {
1454 1534
             msPaperQtypeMapper.deleteByPrimaryKey(mptid);
1455 1535
             //处理试卷试题数量和分值,题型排序,试题排序
1456 1536
             chandlePaperNumQtypeOrder(paper);
1457
-
1458 1537
         }else{
1459 1538
             //修改题型和试卷分值
1460
-            msPaperQtypeMapper.updateQtypeScore(mptid,question.getMpid());
1539
+            msPaperQtypeMapper.updateQtypeScoreAndNum(mptid,question.getMpid());
1461 1540
             //小题重新排序
1462
-            List<MsPaperQtypeQuestion> queOrders = msPaperQtypeQuestionMapper.listQuesOrderByMpid(mptid);
1463
-            int qorder = 1;
1464
-            int pnum = 0;
1465
-            double pscore = 0;
1466
-            for(MsPaperQtypeQuestion que : queOrders){
1467
-                que.setQorder(qorder);
1468
-                qorder++;
1469
-                pnum++;
1470
-                pscore = MarkingUtil.add(pscore, que.getQscore());
1471
-            }
1472
-            paper.setPnum(pnum);
1473
-            paper.setPscore(pscore);
1474
-            msPaperQtypeQuestionMapper.updateBatchQuestionOrder(queOrders);
1541
+            chandleQuestionOrder(paper);
1475 1542
         }
1476 1543
 
1477 1544
         //重新生成试卷分析
1478
-        savePaperAnalyzeForFj(paper);
1545
+        rebuildPaperAnalyzeOffline(question.getMpid(), paper);
1546
+        deletePaperOtherInfo(question.getMpid());
1479 1547
     }
1480 1548
 
1549
+    /*
1550
+     * @Description 线下试卷-试题上下移动
1551
+     * @Date 2024/12/4 10:13:29
1552
+     * @Author WN
1553
+     * @Param [params]
1554
+     * @Return void
1555
+     **/
1481 1556
     @Transactional(rollbackFor = Exception.class)
1482
-    public void updateQuestionOrderOffline(MsPaperQtypeQuestion question){
1557
+    public void updateQuestionOrderOffline(MsPaperParams params){
1558
+        //根据试卷ID获取考试信息
1559
+        PExamSubjectVo exam = msPaperMapper.getExamSubjectForPaper(params.getMpid());
1560
+        //线下考试,发布成绩(生成报告)之前可以修改试卷结构
1561
+        if(exam.getExammode() < 3 && exam.getExamstate() > 2){
1562
+            throw new MissingParametersException("考试已统分禁止操作");
1563
+        }
1564
+        MsPaperQtypeQuestion moveQuestion = new MsPaperQtypeQuestion();//要移动的试题
1565
+        moveQuestion.setMptqid(params.getMptqid());
1566
+
1567
+        int movevalue;//移动试题的order变换值
1568
+        int bmovevalue;//被移动试题的order变换值
1569
+        if(params.getMovetype() == 1){ //上移
1570
+            movevalue = -1;//在原来基础上减一
1571
+            bmovevalue = 1;
1572
+        }else{
1573
+            movevalue = 1;//在原来基础上加一
1574
+            bmovevalue = -1;
1575
+        }
1576
+        params.setMovevalue(1);
1577
+        moveQuestion.setQorder(movevalue);
1578
+        //被交换位置的试题
1579
+        MsPaperQtypeQuestion question = msPaperQtypeQuestionMapper.getQuestionForMoverOrder(params);
1580
+        question.setQorder(bmovevalue);
1581
+
1582
+        List<MsPaperQtypeQuestion> changeQuestions = new ArrayList<>();
1583
+        changeQuestions.add(moveQuestion);
1584
+        changeQuestions.add(question);
1585
+        msPaperQtypeQuestionMapper.updateBatchMoveQuestionOrder(changeQuestions);
1586
+
1587
+        //重新生成报告
1588
+        rebuildPaperAnalyzeOffline(params.getMpid(),null);
1589
+    }
1483 1590
 
1591
+    //重新生产线下试卷分析
1592
+    private void rebuildPaperAnalyzeOffline(Integer mpid,MsPaper paper){
1593
+        if(paper == null || !N_Utils.isTrueInteger(paper.getPnum())){
1594
+            paper = msPaperMapper.selectByPrimaryKey(mpid);
1595
+        }
1596
+        savePaperAnalyzeForFj(paper);
1484 1597
     }
1485 1598
 
1486 1599
 

+ 7
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/paper/MsPaperParams.java View File

@@ -21,4 +21,11 @@ public class MsPaperParams {
21 21
 
22 22
     private Integer mtid;//模板ID
23 23
     private List<MsTemplateBlock> tblocks; //模板题块列
24
+
25
+    private Integer mptid;//试题题型ID
26
+
27
+    private Integer mptqid;//试题ID
28
+
29
+    private Integer movetype;//移动类型1上移2下移
30
+    private Integer movevalue;//移动值
24 31
 }

+ 1
- 1
smarking/src/main/resources/mapper/paper/MsPaperMapper.xml View File

@@ -17,7 +17,7 @@
17 17
     <!--获取试卷详细信息-->
18 18
     <select id="getPaperInfoByMsid" resultType="java.util.Map">
19 19
         select s.examid,s.msid,s.subjectid,s.subjectname,s.sdate,s.begintime,s.endtime,s.pstate,
20
-        e.gradeid,e.examtype,e.examname,e.exammode,
20
+        e.gradeid,e.examtype,e.examname,e.exammode,e.examstate,
21 21
         p.mpid,p.ptype,p.pnum,p.pscore,u.username as teachername,u.username as handlename
22 22
         from ms_subject s left join ms_paper p on s.msid=p.msid
23 23
         left join ms_exam e on s.examid=e.examid

+ 12
- 0
smarking/src/main/resources/mapper/paper/MsPaperQtypeMapper.xml View File

@@ -214,6 +214,18 @@
214 214
             update ms_paper_qtype set mptorder=#{t.mptorder} where mptid=#{t.mptid}
215 215
         </foreach>
216 216
     </update>
217
+    <!--批量修改题型排序-移动-线下-->
218
+    <update id="updateBatchMoveQtypeOrder">
219
+        <foreach collection="list" item="q" separator=",">
220
+            update ms_paper_qtype set mptorder=mptorder + (#{t.mptorder}) where mptid=#{t.mptid}
221
+        </foreach>
222
+    </update>
223
+
224
+    <!--题型移动-获取要交换位置的题型-->
225
+    <select id="getQtypeForMoverOrder" resultType="com.xhkjedu.smarking.model.paper.MsPaperQtype">
226
+        select mptid,mptorder from ms_paper_qtype where mpid=#{p.mpid} and mptorder=(
227
+                (select mptorder from ms_paper_qtype where mptid=#{p.mptid})+(#{p.movevalue})) limit 1
228
+    </select>
217 229
 
218 230
 
219 231
 </mapper>

+ 12
- 0
smarking/src/main/resources/mapper/paper/MsPaperQtypeQuestionMapper.xml View File

@@ -90,6 +90,12 @@
90 90
             update ms_paper_qtype_question set qorder=#{q.qorder} where mptqid=#{q.mptqid}
91 91
         </foreach>
92 92
     </update>
93
+    <!--批量修改试题排序-移动-线下-->
94
+    <update id="updateBatchMoveQuestionOrder">
95
+        <foreach collection="list" item="q" separator=",">
96
+            update ms_paper_qtype_question set qorder=qorder + (#{q.qorder}) where mptqid=#{q.mptqid}
97
+        </foreach>
98
+    </update>
93 99
 
94 100
     <!--获取试卷中所有试题排序-->
95 101
     <select id="listQuesOrderByMpid" resultType="com.xhkjedu.smarking.model.paper.MsPaperQtypeQuestion">
@@ -102,4 +108,10 @@
102 108
     <select id="getQuesnumByMptid" resultType="java.lang.Integer">
103 109
         select count(*) from ms_paper_qtype_question where mptid = #{mptid}
104 110
     </select>
111
+
112
+    <!--试题移动-获取要交换位置的试题-->
113
+    <select id="getQuestionForMoverOrder" resultType="com.xhkjedu.smarking.model.paper.MsPaperQtypeQuestion">
114
+        select mptqid,qorder from ms_paper_qtype_question where mpid=#{p.mpid} and qorder=(
115
+                (select qorder from ms_paper_qtype_question where mptqid=#{p.mptqid})+(#{p.movevalue}))
116
+    </select>
105 117
 </mapper>

Loading…
Cancel
Save