From 784d643c8d073dc31652b03b7f1bd82a9d1c627f Mon Sep 17 00:00:00 2001 From: EricsHu <hrr145632> Date: 星期四, 23 十一月 2023 20:21:26 +0800 Subject: [PATCH] 优化班级课程 --- src/main/java/com/qxueyou/scc/admin/classes/service/impl/ClsClassService.java | 54 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/qxueyou/scc/admin/classes/service/impl/ClsClassService.java b/src/main/java/com/qxueyou/scc/admin/classes/service/impl/ClsClassService.java index dbf0cb3..12d3d5d 100644 --- a/src/main/java/com/qxueyou/scc/admin/classes/service/impl/ClsClassService.java +++ b/src/main/java/com/qxueyou/scc/admin/classes/service/impl/ClsClassService.java @@ -134,23 +134,59 @@ public ClsClass read(String classId) { return read(ClsClass.class, classId); } +// +// /** +// * 鍘熷锛氳幏鍙栫彮绾у垪琛� +// */ +// @Override +// public List<ClsClass> getClassLst(String keyword, String teacherId, Integer pageSize, Integer pageNum, Integer pageType) { +// String keyword_ = StringUtils.isBlank(keyword) ? "" : keyword; +//// System.out.println(keyword_); +// StringBuffer hql = new StringBuffer("from ClsClass c where c.deleteFlag is false and c.orgId=? and c.name like ? and c.createId=?"); +// +// if (pageType == 1) { +// hql.append(" and c.endTime >= sysdate() "); +// }else if(pageType == 2) { +// hql.append(" and c.endTime < sysdate() "); +// } +//// System.out.println("vvvvv"+ClientUtils.getOrgId()+"333333333"+ClientUtils.getUserId()); +// List<Object> args = CollectionUtils.newList(ClientUtils.getOrgId(),keyword_ + "%",ClientUtils.getUserId()); +//// System.out.println(args); +// if (!StringUtils.isEmpty(teacherId)) { +// hql.append(" and exists( select 1 from ClsClassReSubject r,Subject t where r.subjectId=t.subjectId and c.classId= r.classId and t.teacherId=? and r.deleteFlag is false and t.deleteFlag is false)"); +// args.add(teacherId); +// } +// +// hql.append(" order by c.createTime desc"); +//// System.out.println(hql.toString()); +//// System.out.println(findList(hql.toString(), new Pager(pageSize, pageNum), args, ClsClass.class)); +// return findList(hql.toString(), new Pager(pageSize, pageNum), args, ClsClass.class); +// } /** - * 鑾峰彇鐝骇鍒楄〃 + * 浼樺寲鑾峰彇鐝骇鍒楄〃 + * @param keyword + * @param teacherId + * @param pageSize + * @param pageNum + * @param pageType + * @return */ - @Override public List<ClsClass> getClassLst(String keyword, String teacherId, Integer pageSize, Integer pageNum, Integer pageType) { String keyword_ = StringUtils.isBlank(keyword) ? "" : keyword; // System.out.println(keyword_); - StringBuffer hql = new StringBuffer("from ClsClass c where c.deleteFlag is false and c.orgId=? and c.name like ? and c.createId=?"); + StringBuffer hql = new StringBuffer("from ClsClass c where c.deleteFlag is false and c.orgId=? and c.name like ? "); if (pageType == 1) { hql.append(" and c.endTime >= sysdate() "); }else if(pageType == 2) { hql.append(" and c.endTime < sysdate() "); } -// System.out.println("vvvvv"+ClientUtils.getOrgId()+"333333333"+ClientUtils.getUserId()); - List<Object> args = CollectionUtils.newList(ClientUtils.getOrgId(),keyword_ + "%",ClientUtils.getUserId()); +// if (!StringUtils.isEmpty(teacherId)) { +// hql.append("and c.createId=?)"); +// } +// System.out.println("vvvvv"+ClientUtils.getOrgId()+"333333333"+ClientUtils.getUserId()); ,ClientUtils.getUserId() + List<Object> args = CollectionUtils.newList(ClientUtils.getOrgId(),keyword_ + "%"); // System.out.println(args); if (!StringUtils.isEmpty(teacherId)) { hql.append(" and exists( select 1 from ClsClassReSubject r,Subject t where r.subjectId=t.subjectId and c.classId= r.classId and t.teacherId=? and r.deleteFlag is false and t.deleteFlag is false)"); @@ -317,11 +353,11 @@ @Override public List<Map<String,Object>> queryAvailableClassIdAndName(String teacherId,String subjectId) { StringBuffer hql = new StringBuffer(1000); - // and c.endTime>=sysdate() 澧炲姞鏉′欢杩囨护鎺夊巻鍙茬彮绾� - hql.append("select c.classId as classId ,c.name as className from ClsClass c where c.deleteFlag is false and c.orgId=:orgId and c.createId=:createId " ); + // and c.endTime>=sysdate() 澧炲姞鏉′欢杩囨护鎺夊巻鍙茬彮绾� and c.createId=:createId + hql.append("select c.classId as classId ,c.name as className from ClsClass c where c.deleteFlag is false and c.orgId=:orgId " ); Map<String,Object> queryParam = new HashMap<String,Object>(); queryParam.put("orgId", ClientUtils.getOrgId()); - queryParam.put("createId", ClientUtils.getUserId()); +// queryParam.put("createId", ClientUtils.getUserId()); if(StringUtils.isNotEmpty(teacherId)||StringUtils.isNotEmpty(subjectId)){ hql.append(" and exists (select 1 from ClsClassReSubject r ,Subject s where r.subjectId=s.subjectId and r.classId =c.classId and r.deleteFlag is false "); @@ -348,7 +384,7 @@ public List<Map<String,Object>> queryAllClassIdAndName() { StringBuffer hql = new StringBuffer(500); // c.deleteFlag is false and - hql.append("select c.classId as classId ,c.name as className from ClsClass c where c.endTime>=:endTime and c.orgId=:orgId " ); + hql.append("select c.classId as classId ,c.name as className from ClsClass c where c.endTime>=:endTime and deleteFlag is false and c.orgId=:orgId " ); return this.findListWithMapByHql(hql.toString(), CollectionUtils.newObjectMap("endTime",new Date(),"orgId",ClientUtils.getOrgId())); } -- Gitblit v1.8.0