From d7963a84282c548fee3595b3343e6ae6ca49bb29 Mon Sep 17 00:00:00 2001
From: yn147 <2270338776@qq.com>
Date: 星期五, 24 十一月 2023 14:12:01 +0800
Subject: [PATCH] 学籍,考勤

---
 src/main/java/com/qxueyou/scc/teach/subject/service/impl/SubjectService.java |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/qxueyou/scc/teach/subject/service/impl/SubjectService.java b/src/main/java/com/qxueyou/scc/teach/subject/service/impl/SubjectService.java
index aa9121f..d84ceda 100644
--- a/src/main/java/com/qxueyou/scc/teach/subject/service/impl/SubjectService.java
+++ b/src/main/java/com/qxueyou/scc/teach/subject/service/impl/SubjectService.java
@@ -107,7 +107,7 @@
 
 
     @Override
-    public Result add(String subjectName, String coverPageFileId, String contentFileId, int type) {
+    public Result add(String subjectName, String coverPageFileId, String contentFileId, int type,String startTime,String endTime) {
 
         Subject subject = new Subject();
         if (StringUtils.isNotEmpty(coverPageFileId)) {
@@ -122,6 +122,9 @@
         subject.setStatus(Subject.STATUS_DRAFT);
         subject.setLectureCount(0);
         subject.setType(type);
+        //绛惧埌鏃堕棿
+        subject.setStartTime(startTime);
+        subject.setEndTime(endTime);
         subject.setOrgId(ClientUtils.getOrgId());
 
         save(subject);
@@ -207,8 +210,8 @@
 
     @Override
     public List<Subject> list(String text, String teacherId, String status, Integer type, Integer pageSize, Integer pageNum) {
-
-        StringBuffer hql = new StringBuffer("from Subject where name like ? and orgId=? and deleteFlag is false and origSubjectId is null ");
+        //and origSubjectId is null
+        StringBuffer hql = new StringBuffer("from Subject where name like ? and orgId=? and deleteFlag is false  ");
 
         List<Object> args = CollectionUtils.newList(text + "%", ClientUtils.getOrgId());
 
@@ -222,8 +225,12 @@
             args.add(status);
         }
 
+//        if (!StringUtils.isEmpty(teacherId)) {
+//            hql.append(" and createId=?");
+//            args.add(teacherId);
+//        }
         if (!StringUtils.isEmpty(teacherId)) {
-            hql.append(" and createId=?");
+            hql.append(" and teacherId=?");
             args.add(teacherId);
         }
         hql.append(" order by createTime desc");
@@ -476,17 +483,17 @@
     @Override
     public Result addClsSubject(String classId, String origSubjectId, String teacherId, Integer schoolYear, Integer term) throws IllegalAccessException, InvocationTargetException {
         //鏂板鑰佸笀璇剧▼
-        Subject newSubject = new Subject();
-        Subject origSubject = this.read(origSubjectId);
+//        Subject newSubject = new Subject();
+        Subject newSubject = this.read(origSubjectId);
         UserTeacher teacher = this.read(UserTeacher.class, teacherId);
-        BeanUtils.copyProperties(newSubject, origSubject);
+//        BeanUtils.copyProperties(newSubject, origSubject);
 
         TraceUtils.setCreateTrace(newSubject);
-        newSubject.setSubjectId(null);
+//        newSubject.setSubjectId(null);
         newSubject.setTeacherId(teacherId);
         newSubject.setSchoolYear(schoolYear);
         newSubject.setTerm(term);
-        newSubject.setStatus(origSubject.getStatus());
+//        newSubject.setStatus(origSubject.getStatus());
         newSubject.setOrigSubjectId(origSubjectId);
         newSubject.setOrigCopySubjectId(origSubjectId);
         newSubject.setType(Subject.TYPE_CLS_SUBJECT);
@@ -1093,6 +1100,12 @@
         }
     }
 
+    @Override
+    public String findSubjectName(String subjectId) {
+        Subject subject = findUnique("from Subject where subjectId = ? ",CollectionUtils.newList(subjectId),Subject.class);
+        return subject.getName();
+    }
+
 
     /**
      * 鎴戠殑鍏紑璇惧垪琛�

--
Gitblit v1.8.0