派生自 projectDept/qhighschool

EricsHu
2023-11-23 784d643c8d073dc31652b03b7f1bd82a9d1c627f
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()));
    }