瀏覽代碼

完善查询消息详情

chenzhengming 2 年之前
父節點
當前提交
f2c481f29a

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/system/mapper/LcdInfoMapper.java

@@ -84,5 +84,5 @@ public interface LcdInfoMapper
      * @param id
      * @return
      */
-    List<LcdInfoVo> selectMobile(Long id);
+    List<String> selectMobile(Long id);
 }

+ 9 - 12
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/LcdInfoServiceImpl.java

@@ -37,27 +37,22 @@ public class LcdInfoServiceImpl implements ILcdInfoService {
      * @param id 消息主键
      * @return 消息
      */
-  /*  @Override
+    @Override
     public List<LcdInfoVo> selectLcdInfoById(Long id) {
 
-        List list = new ArrayList<>();
         List<LcdInfo> records = lcdInfoMapper.selectLcdInfoById(id);
         List<LcdInfoVo> lcdInfoVos = records.stream().map((item) -> {
             LcdInfoVo lcdInfoVo = new LcdInfoVo();
             BeanUtils.copyProperties(item , lcdInfoVo);
-            List<LcdInfoVo> list1 = lcdInfoMapper.selectMobile(id);
-            list.add(list1);
-            lcdInfoVo.setmobile(String.valueOf(list));
+            List<String> list1 = lcdInfoMapper.selectMobile(id);
+            lcdInfoVo.setMobile(list1);
             return lcdInfoVo;
         }).collect(Collectors.toList());
         return lcdInfoVos;
     }
-*/
 
-    @Override
-    public List<LcdInfoVo> selectLcdInfoById(Long id) {
-        return null;
-    }
+
+
 
     /**
      * 查询消息列表
@@ -79,11 +74,13 @@ public class LcdInfoServiceImpl implements ILcdInfoService {
     @Override
     public int insertLcdInfo(LcdInfoVo lcdInfoVo) {
         lcdInfoVo.setCreateTime(DateUtils.getNowDate());
+        //插入前端传入的数据
         int id = lcdInfoMapper.insertLcdInfo(lcdInfoVo);
+        //根据前端传入数据查询消息id
         long info_id =lcdInfoVo.getId();
         for (int i = 0; i < lcdInfoVo.getMobile().size(); i++) {
-            int userId = lcdInfoMapper.selectUserId(lcdInfoVo.getMobile().get(i));
-            LcdInfoUserRelation lcdInfoUserRelation = new LcdInfoUserRelation();
+            int userId = lcdInfoMapper.selectUserId(lcdInfoVo.getMobile().get(i));//根据电话号获取userId
+            LcdInfoUserRelation lcdInfoUserRelation = new LcdInfoUserRelation();//插入中间表数据
             lcdInfoUserRelation.setLcdInfoId(info_id);
             lcdInfoUserRelation.setLcdReceiveUserId(userId);
             lcdInfoUserRelationMapper.insertLcdInfoUserRelation(lcdInfoUserRelation);