Просмотр исходного кода

更新文件 SmartAuthorGroupServiceImpl.java

陈士柏 2 лет назад
Родитель
Сommit
6dbf1aac30

+ 44 - 3
src/main/java/com/template/services/impl/SmartAuthorGroupServiceImpl.java

@@ -5,11 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.mapper.*;
-import com.template.model.pojo.SmartApply;
-import com.template.model.pojo.SmartAuthorGroup;
+import com.template.model.pojo.*;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.mapper.SmartAuthorGroupMapper;
-import com.template.model.pojo.SmartUser;
 import com.template.model.result.PageUtils;
 import com.template.model.weixin.AuthorListGroup;
 import com.template.services.SmartAuthorGroupService;
@@ -39,6 +37,8 @@ public class SmartAuthorGroupServiceImpl extends ServiceImpl<SmartAuthorGroupMap
     public SmartUserMapper smartUserMapper;
     @Autowired
     public SmartApplyMapper smartApplyMapper;
+    @Autowired
+    public SmartDepartmentMapper smartDepartmentMapper;
 
     @Override
     public int insertSmartAuthorGroup(SmartAuthorGroup sa) {
@@ -135,4 +135,45 @@ public class SmartAuthorGroupServiceImpl extends ServiceImpl<SmartAuthorGroupMap
         }
         return newTrees;
     }
+
+    @Override
+    public List<SmartAuthorGroupManager> getSmartAuthorGroupManager(String groupId){
+        List<SmartAuthorGroupManager> list = smartAuthorGroupMapper.getSmartAuthorGroupManager(groupId);
+        if (list.size()>0){
+            for (int i = 0; i < list.size(); i++) {
+                SmartAuthorGroupManager smartAuthorGroupManager = list.get(i);
+                if (smartAuthorGroupManager.getDepartmentManage()!=null && !smartAuthorGroupManager.getDepartmentManage().equals("")){
+                    String[] manageId = smartAuthorGroupManager.getDepartmentManage().split(",");
+                    QueryWrapper<SmartDepartment> queryWrapper1 = new QueryWrapper<>();
+                    queryWrapper1.eq("deleted", 0);
+                    queryWrapper1.in("id", Arrays.asList(manageId));
+                    List<SmartDepartment> list1 = smartDepartmentMapper.selectList(queryWrapper1);
+                    List<JSONObject> departmentManageJson = new ArrayList<>();
+                    for (int j = 0; j < list1.size(); j++) {
+                        JSONObject jsonObject1 = new JSONObject();
+                        jsonObject1.put("id", list1.get(i).getId());
+                        jsonObject1.put("name", list1.get(i).getName());
+                        departmentManageJson.add(jsonObject1);
+                    }
+                    list.get(i).setDepartmentManageJson(departmentManageJson);
+                }
+                if (smartAuthorGroupManager.getDepartmentView()!=null && !smartAuthorGroupManager.getDepartmentView().equals("")){
+                    String[] viewId = smartAuthorGroupManager.getDepartmentView().split(",");
+                    QueryWrapper<SmartDepartment> queryWrapper1 = new QueryWrapper<>();
+                    queryWrapper1.eq("deleted", 0);
+                    queryWrapper1.in("id", Arrays.asList(viewId));
+                    List<SmartDepartment> list1 = smartDepartmentMapper.selectList(queryWrapper1);
+                    List<JSONObject> departmentViewJson = new ArrayList<>();
+                    for (int j = 0; j < list1.size(); j++) {
+                        JSONObject jsonObject1 = new JSONObject();
+                        jsonObject1.put("id", list1.get(i).getId());
+                        jsonObject1.put("name", list1.get(i).getName());
+                        departmentViewJson.add(jsonObject1);
+                    }
+                    list.get(i).setDepartmentViewJson(departmentViewJson);
+                }
+            }
+        }
+        return list;
+    }
 }