Browse Source

用户接口

wangyangyang 4 năm trước cách đây
mục cha
commit
ce59a651c3

+ 3 - 0
operation_manager/src/main/java/com/huaxu/client/UserCenterClient.java

@@ -27,4 +27,7 @@ public interface UserCenterClient {
 
     @GetMapping("/user/findUserIdsForOrg")
     List<Long> findUserIdsForOrg();
+
+    @GetMapping("/user/findUserListByType")
+    AjaxMessage<List<UserEntity>> findUserListByType();
 }

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

@@ -271,6 +271,16 @@ public class UserController {
         List<UserListDto> userList = userService.findUserList(type);
         return new AjaxMessage<>(ResultStatus.OK,userList);
     }
+
+    /**
+     * 查询运维人员信息
+     * @return
+     */
+    @RequestMapping(value = "/findUserListByType", method = RequestMethod.GET)
+    public AjaxMessage<List<UserEntity>> findUserListByType() {
+        List<UserEntity> userList = userService.findUserListBytype(3);
+        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

@@ -38,6 +38,8 @@ public interface UserMapper extends BaseMapper<UserEntity> {
 
     List<UserEntity> findUserList(@Param("user")UserEntity userEntity);
 
+    List<UserEntity> findUserListByType(@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);
 
 

+ 13 - 0
user_center/src/main/java/com/huaxu/service/UserService.java

@@ -425,4 +425,17 @@ public class UserService extends ServiceImpl<UserMapper,UserEntity> {
 		}
 		return userIds;
 	}
+
+	public List<UserEntity> findUserListBytype(int type) {
+		List<UserListDto> userListDtos = new ArrayList<>();
+		LoginUser currentUser = UserUtil.getCurrentUser();
+		UserEntity userEntity = new UserEntity();
+		userEntity.setTenantId(currentUser.getTenantId());
+		userEntity.setProgramItems(currentUser.getProgramItemList());
+		userEntity.setUserType(String.valueOf(type));
+		//1是公司,2是公司及以下,3部门,4部门及以下,5自定义
+		userEntity.setPermissonType(currentUser.getPermissonType());
+		List<UserEntity> userEntities = userMapper.findUserListByType(userEntity);
+		return userEntities;
+	}
 }

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

@@ -203,6 +203,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 </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
+        companyOrgName,department.ORG_NAME deptOrgName 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.deptOrgId != null  and user.deptOrgId != ''">
+                and (a.DEPT_ORG_ID = #{user.deptOrgId}
+                or a.COMPANY_ORG_ID = #{user.companyOrgId}
+                )
+            </if>
+            <if test="user.userType!=null and user.userType!=-999 and user.userType!=-9999 and  user.programItems != null and user.programItems.size() > 0">
+                <if test="user.permissonType == 5 or user.permissonType == 2">
+                    and ( a.DEPT_ORG_ID in
+                    <foreach collection="user.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    or
+                    a.COMPANY_ORG_ID in
+                    <foreach collection="user.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    )
+                </if>
+                <if test="user.permissonType == 4 or user.permissonType == 3">
+                    and a.DEPT_ORG_ID in
+                    <foreach collection="user.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                </if>
+                <if test="user.permissonType == 1">
+                    and a.COMPANY_ORG_ID in
+                    <foreach collection="user.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
+                </if>
+            </if>
+        </where>
+
     </select>
     <select id="findUserIdsByUserIds"  resultType="com.huaxu.entity.UserEntity">
         SELECT