Browse Source

查询用户

wangyangyang 3 years ago
parent
commit
9b8cdcaea2

+ 3 - 3
user_center/src/main/java/com/huaxu/controller/OrgController.java

@@ -108,9 +108,9 @@ public class OrgController {
 
                                                              @RequestParam  String orgType) {
         Org org=new Org();
-        if("company".equals(orgType))
-        org.setOrgType(orgType);
-        ;
+        if("company".equals(orgType)) {
+            org.setOrgType(orgType);
+        }
         return new AjaxMessage<>(ResultStatus.OK, orgService.getTrees(org));
     }
     @LogAnnotation(module = "【机构管理】删除")

+ 10 - 0
user_center/src/main/java/com/huaxu/controller/UserController.java

@@ -282,6 +282,16 @@ public class UserController {
         List<UserEntity> userList = userService.findUserListBytype(3);
         return new AjaxMessage<>(ResultStatus.OK, userList);
     }
+
+    /**
+     * 按公司 租户及用户类型查询所有用户信息
+     * @return
+     */
+    @RequestMapping(value = "/findAllUserList", method = RequestMethod.GET)
+    public AjaxMessage<List<UserEntity>> findAllUserList(Integer companyOrgId, String tenantId,int type) {
+        List<UserEntity> userList = userService.findAllUserList(companyOrgId, tenantId, type);
+        return new AjaxMessage<>(ResultStatus.OK, userList);
+    }
     @RequestMapping(value = "/findUserIdsByUserIds", method = RequestMethod.POST)
     public List<UserEntity> findUserIdsByUserIds(Long[] ids) {
         List list = Arrays.asList(ids.clone());

+ 2 - 0
user_center/src/main/java/com/huaxu/dao/UserMapper.java

@@ -40,6 +40,8 @@ public interface UserMapper extends BaseMapper<UserEntity> {
 
     List<UserEntity> findUserListByType(@Param("user")UserEntity userEntity);
 
+    List<UserEntity> findAllUserListByType(@Param("user")UserEntity userEntity);
+
     List<UserEntity> findUserIdsForOrg(@Param("compayId")Integer compayId, @Param("deptId")Integer deptId,@Param("ids")List<Long> ids,@Param("compids")List<Long> comIds);
 
 

+ 18 - 1
user_center/src/main/java/com/huaxu/service/UserService.java

@@ -17,6 +17,7 @@ import com.huaxu.model.ProgramItem;
 import com.huaxu.util.ByteArrayUtils;
 import com.huaxu.util.RedisUtil;
 import com.huaxu.util.UserUtil;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
@@ -460,7 +461,7 @@ public class UserService extends ServiceImpl<UserMapper,UserEntity> {
 		return userIds;
 	}
 
-	public List<UserEntity> findUserListBytype(int type) {
+	public List<UserEntity> findUserListBytype(Integer type) {
 		List<UserListDto> userListDtos = new ArrayList<>();
 		LoginUser currentUser = UserUtil.getCurrentUser();
 		UserEntity userEntity = new UserEntity();
@@ -472,6 +473,22 @@ public class UserService extends ServiceImpl<UserMapper,UserEntity> {
 		List<UserEntity> userEntities = userMapper.findUserListByType(userEntity);
 		return userEntities;
 	}
+
+	/**
+	 * 按类型租户及公司查询用户信息
+	 * @param companyOrgId
+	 * @param tenantId
+	 * @param type
+	 * @return
+	 */
+	public List<UserEntity> findAllUserList(Integer companyOrgId, String tenantId,int type) {
+		UserEntity userEntity = new UserEntity();
+		userEntity.setUserType(String.valueOf(type));
+		userEntity.setTenantId(tenantId);
+		userEntity.setCompanyOrgId(Long.valueOf(companyOrgId));
+		List<UserEntity> userEntities = userMapper.findAllUserListByType(userEntity);
+		return userEntities;
+	}
 	public MaintainerCountDto findMaintainer(String startDate, String endDate, Integer statsType){
 		MaintainerCountDto result=new MaintainerCountDto();
 		try {

+ 0 - 1
user_center/src/main/java/com/huaxu/service/impl/OrgServiceImpl.java

@@ -209,7 +209,6 @@ public class OrgServiceImpl implements OrgService {
 
         List<OrgTree> trees=orgMapper.selectTrees(org);
         if(currentUser.getDepartmentId()==null){
-
             trees=getOrgTreeByOrg(trees,currentUser.getCompanyId(),orgIds);
         }else {
             trees=getOrgTreeByOrg(trees,currentUser.getDepartmentId(),orgIds);

+ 16 - 0
user_center/src/main/resources/mapper/UserMapper.xml

@@ -204,6 +204,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </where>
 
     </select>
+    <select id="findAllUserListByType" resultType="com.huaxu.entity.UserEntity">
+        select a.id,a.DEPT_ORG_ID,a.COMPANY_ORG_ID,
+        a.USERNAME,company.ORG_NAME
+        companyOrgName,department.ORG_NAME deptOrgName,
+        a.phone phone
+        from uims_user a
+        left join uims_org company on a.COMPANY_ORG_ID=company.ID
+        left join uims_org  department on a.DEPT_ORG_ID=department.ID
+        <where>
+            a.status=1 and a.user_type = #{user.userType}
+            <if test="user.tenantId != null  and user.tenantId != ''"> and a.tenant_id = #{user.tenantId} </if>
+            <if test="user.companyOrgId != null  and user.companyOrgId != ''">
+                and a.COMPANY_ORG_ID = #{user.companyOrgId}
+            </if>
+        </where>
+    </select>
     <select id="findUserListByType" resultType="com.huaxu.entity.UserEntity">
         select a.id,a.DEPT_ORG_ID,a.COMPANY_ORG_ID,
         a.USERNAME,company.ORG_NAME