Преглед на файлове

教研保存

tags/正式3.10.0
雍文秀 преди 1 година
родител
ревизия
fd3f344cfc

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/mapper/research/ResearchUserMapper.java Целия файл

@@ -26,7 +26,7 @@ public interface ResearchUserMapper extends TkMapper<TResearchUser> {
26 26
      * @param timestamp
27 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 Целия файл

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

+ 1
- 1
sapi/src/main/resources/mapper/research/ResearchUserMapper.xml Целия файл

@@ -6,7 +6,7 @@
6 6
         INSERT INTO t_research_user (researchid,userid,rustate,schoolid,createtime)
7 7
         VALUES
8 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 10
         </foreach>
11 11
     </insert>
12 12
 

Loading…
Отказ
Запис