|
|
@@ -1,6 +1,7 @@
|
|
|
package com.mokamrp.privates.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.mokamrp.privates.mapper.UserCorpMapper;
|
|
|
import com.mokamrp.privates.mapper.pojo.Corp;
|
|
|
@@ -12,7 +13,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
@@ -33,7 +36,6 @@ public class UserCorpServiceImpl extends ServiceImpl<UserCorpMapper, UserCorp> i
|
|
|
|
|
|
/**
|
|
|
* 获取指定管理账户管辖的企业信息
|
|
|
- *
|
|
|
* @param userId
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -48,8 +50,27 @@ public class UserCorpServiceImpl extends ServiceImpl<UserCorpMapper, UserCorp> i
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 获取指定管理账户管辖的企业信息 支持分页
|
|
|
+ * @param userId
|
|
|
+ * @param page
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String,Object> getCorpsInPageByUserId(Integer userId, Integer page, Integer pageSize){
|
|
|
+ List<Integer> corpIds = new ArrayList<Integer>();
|
|
|
+ Page<UserCorp> pageObj = this.page(new Page<UserCorp>(page,pageSize),new QueryWrapper<UserCorp>().eq("user_id", userId));
|
|
|
+ List<UserCorp> corps = pageObj.getRecords();
|
|
|
+ for (UserCorp userCorp : corps) {
|
|
|
+ corpIds.add(userCorp.getCorpId());
|
|
|
+ }
|
|
|
+ Map<String,Object> res = new HashMap<>();
|
|
|
+ res.put("list",corpService.getCorpInfoByCorpIds(corpIds));
|
|
|
+ res.put("total",pageObj.getTotal());
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取所有企业信息
|
|
|
- *
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Corp> getAllCorps() {
|
|
|
@@ -62,6 +83,25 @@ public class UserCorpServiceImpl extends ServiceImpl<UserCorpMapper, UserCorp> i
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取所有企业信息 支持分页
|
|
|
+ * @param page
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String, Object> getAllCorpsInPage(Integer page, Integer pageSize){
|
|
|
+ List<Integer> corpIds = new ArrayList<Integer>();
|
|
|
+ Page<UserCorp> pageObj = this.page(new Page<>(page,pageSize));
|
|
|
+ List<UserCorp> corps = pageObj.getRecords();
|
|
|
+ for (UserCorp userCorp : corps) {
|
|
|
+ corpIds.add(userCorp.getCorpId());
|
|
|
+ }
|
|
|
+ Map<String,Object> res = new HashMap<>();
|
|
|
+ res.put("list",corpService.getCorpInfoByCorpIds(corpIds));
|
|
|
+ res.put("total",pageObj.getTotal());
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取指定管理账户管辖的企业ID
|