Browse Source

教研保存

tags/正式3.10.0
雍文秀 1 year ago
parent
commit
fd3f344cfc

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/mapper/research/ResearchUserMapper.java View File

26
      * @param timestamp
26
      * @param timestamp
27
      * @return void
27
      * @return void
28
      */
28
      */
29
-    void saveBatchResearchUser(@Param("list") List<TResearchUser> list, @Param("timestamp") int timestamp);
29
+    void saveBatchResearchUser(@Param("list") List<TResearchUser> list, @Param("researchid") int researchid);
30
 
30
 
31
     /**
31
     /**
32
      *功能描述 删除--教研用户
32
      *功能描述 删除--教研用户

+ 6
- 3
sapi/src/main/java/com/xhkjedu/sapi/service/research/ResearchService.java View File

12
 import com.xhkjedu.sapi.vo.notice.NoticeTeacherVo;
12
 import com.xhkjedu.sapi.vo.notice.NoticeTeacherVo;
13
 import lombok.extern.slf4j.Slf4j;
13
 import lombok.extern.slf4j.Slf4j;
14
 import org.springframework.stereotype.Service;
14
 import org.springframework.stereotype.Service;
15
+import org.springframework.transaction.annotation.Transactional;
15
 
16
 
16
 import javax.annotation.Resource;
17
 import javax.annotation.Resource;
17
 import java.util.*;
18
 import java.util.*;
56
      * @author WN
57
      * @author WN
57
      * @date 2020/6/11
58
      * @date 2020/6/11
58
      */
59
      */
60
+    @Transactional(rollbackFor = Exception.class)
59
     public Integer save(TResearch research) {
61
     public Integer save(TResearch research) {
60
-        research.setCreatetime(N_Utils.getSecondTimestamp());
62
+        int timestamp = N_Utils.getSecondTimestamp();
63
+        research.setCreatetime(timestamp);
61
         research.setReadnum(0);
64
         research.setReadnum(0);
62
 
65
 
63
         List<TResearchUser> rslist = new ArrayList<>();
66
         List<TResearchUser> rslist = new ArrayList<>();
73
             ru.setUserid(teacherid);
76
             ru.setUserid(teacherid);
74
             ru.setRustate(0);
77
             ru.setRustate(0);
75
             ru.setSchoolid(u.get("schoolid"));
78
             ru.setSchoolid(u.get("schoolid"));
76
-            ru.setCreatetime(N_Utils.getSecondTimestamp());
79
+            ru.setCreatetime(timestamp);
77
 
80
 
78
             rslist.add(ru);
81
             rslist.add(ru);
79
         }
82
         }
103
         }
106
         }
104
 
107
 
105
         //批量保存教研老师关联信息
108
         //批量保存教研老师关联信息
106
-        researchUserMapper.saveBatchResearchUser(rslist, N_Utils.getSecondTimestamp());
109
+        researchUserMapper.saveBatchResearchUser(rslist, research.getId());
107
         research.setResearchid(research.getId());
110
         research.setResearchid(research.getId());
108
         convertVideo(research);//视频转换mq
111
         convertVideo(research);//视频转换mq
109
         return research.getId();
112
         return research.getId();

+ 1
- 1
sapi/src/main/resources/mapper/research/ResearchUserMapper.xml View File

6
         INSERT INTO t_research_user (researchid,userid,rustate,schoolid,createtime)
6
         INSERT INTO t_research_user (researchid,userid,rustate,schoolid,createtime)
7
         VALUES
7
         VALUES
8
         <foreach collection ="list" item="ru" index= "index" separator =",">
8
         <foreach collection ="list" item="ru" index= "index" separator =",">
9
-            (#{ru.researchid},#{ru.userid},#{ru.rustate},#{ru.schoolid},#{timestamp})
9
+            (#{researchid},#{ru.userid},#{ru.rustate},#{ru.schoolid},#{ru.createtime})
10
         </foreach>
10
         </foreach>
11
     </insert>
11
     </insert>
12
 
12
 

Loading…
Cancel
Save