From 0e62c15e4b010ffa2d5cff9474f3fd389e369338 Mon Sep 17 00:00:00 2001
From: EricsHu <hrr145632>
Date: 星期五, 24 十一月 2023 14:31:46 +0800
Subject: [PATCH] 优化作业、考试、试卷、题库

---
 src/main/java/com/qxueyou/scc/exam/action/ExamPaperController.java |   42 ++++++++++++++++++++++++++----------------
 1 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/qxueyou/scc/exam/action/ExamPaperController.java b/src/main/java/com/qxueyou/scc/exam/action/ExamPaperController.java
index 8021f1f..1f0f236 100644
--- a/src/main/java/com/qxueyou/scc/exam/action/ExamPaperController.java
+++ b/src/main/java/com/qxueyou/scc/exam/action/ExamPaperController.java
@@ -33,11 +33,11 @@
  * @history 2018-03-11 create kevin
  * 
  */
-@Api(tags="试卷管理接口")
+@Api(tags="璇曞嵎绠$悊鎺ュ彛")
 @Controller
 @RequestMapping(value = "/exam/paper")
 public class ExamPaperController {
-	//分页查询中,默认记录条数和页数
+	//鍒嗛〉鏌ヨ涓紝榛樿璁板綍鏉℃暟鍜岄〉鏁�
 	private static final int DEFAULT_PAGE_SIZE=Integer.MAX_VALUE;
 	private static final int DEFAULT_PAGE_NUM=1;
 	
@@ -56,32 +56,42 @@
 	
 	
 	/**
-	 * 试卷列表
+	 * 璇曞嵎鍒楄〃
 	 * */
 	@RequestMapping(value = "/list", method = RequestMethod.GET)
 	public @ResponseBody Result pageList(String keyword,Short status, Integer pageSize,Integer pageNum){
 		Result result = new Result(Boolean.TRUE);
+		//鍒ゆ柇鏄惁鏄暀甯�
+		String teacherId = ClientUtils.isAdmin() ? null : ClientUtils.getUserId();
 		Pager pager = new Pager();
 		List<Object> queryParamLst = null;
-		// 查询记录数
-		String hqlCount="from ExamPaperInfo where createId=? and examPaperName like ?  and deleteFlag is false";
+		// 鏌ヨ璁板綍鏁�
+		String hqlCount="from ExamPaperInfo where  examPaperName like ?  and deleteFlag is false";
 		if(status!=null){
 			hqlCount = hqlCount.concat(" and paperStatus = ?");
-			queryParamLst =  CollectionUtils.newList(ClientUtils.getUserId(),'%'+(keyword==null?"":keyword.trim())+'%',status);
+			queryParamLst =  CollectionUtils.newList('%'+(keyword==null?"":keyword.trim())+'%',status);
 		}else{
-			queryParamLst =  CollectionUtils.newList(ClientUtils.getUserId(),'%'+(keyword==null?"":keyword.trim())+'%');
+			queryParamLst =  CollectionUtils.newList('%'+(keyword==null?"":keyword.trim())+'%');
 		}
+		if (StringUtils.isNotBlank(teacherId)) {
+			hqlCount = hqlCount.concat(" and createId=?");
+			queryParamLst.add(teacherId);
+		}
+
 		int totalCount = commonDAO.findCount(hqlCount,queryParamLst);
         
-        // page赋值
+        // page璧嬪��
         pager.setTotalCount(totalCount);
         pager.setPageSize(pageSize!=null&&pageSize>0?pageSize:DEFAULT_PAGE_SIZE);
         pager.setPageNum (pageNum!=null&&pageNum>0?pageNum:DEFAULT_PAGE_NUM);
         
     	StringBuffer hqlBuffer =  new StringBuffer(500);
-		hqlBuffer.append("from ExamPaperInfo where createId=? and examPaperName like ? and deleteFlag is false ");
+		hqlBuffer.append("from ExamPaperInfo where   examPaperName like ? and deleteFlag is false ");
 		if(status!=null){
 			hqlBuffer.append(" and paperStatus = ? ");
+		}
+		if (StringUtils.isNotBlank(teacherId)) {
+			hqlBuffer.append(" and createId=?");
 		}
 		hqlBuffer.append(" order by createTime DESC");
         
@@ -99,7 +109,7 @@
 	}
 	
 	/**
-	 * 详情页面数据
+	 * 璇︽儏椤甸潰鏁版嵁
 	 * @param examPaperId
 	 * @return
 	 */
@@ -111,7 +121,7 @@
 	}
 	
 	/**
-	 * 保存
+	 * 淇濆瓨
 	 * 
 	 * @param examInfo
 	 * @return
@@ -129,7 +139,7 @@
 	}
 	
 	/**
-	 * 删除
+	 * 鍒犻櫎
 	 * @param examPaperIds
 	 * @return
 	 */
@@ -178,7 +188,7 @@
 	
 	
 	/**
-	 * 发布试卷
+	 * 鍙戝竷璇曞嵎
 	 * 
 	 * @param exerciseIds
 	 * @return
@@ -186,13 +196,13 @@
 	@RequestMapping(value = "/publish", method = RequestMethod.GET)
 	public @ResponseBody Result publishExamPaper(String examPaperIds) {
 		if (StringUtils.isEmpty(examPaperIds)) {
-			return new Result(false, "参数错误");
+			return new Result(false, "鍙傛暟閿欒");
 		}
 		return this.examPaperService.doPublishExamPaper(examPaperIds.split(","));
 	}
 
 	/**
-	 * 撤回试卷
+	 * 鎾ゅ洖璇曞嵎
 	 * 
 	 * @param exerciseIds
 	 * @return
@@ -200,7 +210,7 @@
 	@RequestMapping(value = "/revoke", method = RequestMethod.GET)
 	public @ResponseBody Result revokeExamPaper(String examPaperIds) {
 		if (StringUtils.isEmpty(examPaperIds)) {
-			return new Result(false, "参数错误");
+			return new Result(false, "鍙傛暟閿欒");
 		}
 		return this.examPaperService.doRevokeExamPaper(examPaperIds.split(","));
 	}

--
Gitblit v1.8.0