Forráskód Böngészése

角色过滤用户接口修改

szjbdgzl 2 éve
szülő
commit
53ebe17ae1

+ 3 - 0
ibps-model-root/modules/org-model/src/main/resources/com/lc/ibps/org/party/persistence/mapping/DefaultPartyUser.map.xml

@@ -470,6 +470,9 @@
 			)
 		)
 		</if>
+		<if test="@o.Ognl@isNotEmpty(position)">
+			AND EXISTS (SELECT	1 FROM ibps_party_entity d	WHERE FIND_IN_SET( d.id_, a.positions_ ) AND ( d.path_ LIKE #{position} ) )
+		</if>
 		<if test="@o.Ognl@isNotEmpty(whereSql)">
 			AND ${whereSql}
 		</if>

+ 20 - 10
ibps-model-root/modules/org-model/src/main/resources/com/lc/ibps/org/party/persistence/mapping/PartyEmployee.map.xml

@@ -106,16 +106,26 @@
         (
         select ID_ ORG_ID_,NAME_ ORG_NAME_ from IBPS_PARTY_ORG
         )B on ORG_ID_ = GROUP_ID_
-        <where>
-            USER_ID_ != '-1'
-            AND STATUS_ != 'deleted'
-            <if test="@o.Ognl@isNotEmpty(whereSql)">
-                AND ${whereSql}
-            </if>
-        </where>
-        <if test="@o.Ognl@isNotEmpty(orderBySql)">
-            ORDER BY ${orderBySql}
-        </if>
+		WHERE USER_ID_ != '-1' 	AND STATUS_ != 'deleted'
+		<if test="@o.Ognl@isNotEmpty(roleId)">
+			AND ( USER_ID_ IN ( SELECT USER_ID_ FROM ibps_party_user_role WHERE ROLE_ID_ in	(#{roleId}) )	)
+		</if>
+		<if test="@o.Ognl@isNotEmpty(position)">
+			AND EXISTS (SELECT 1 FROM ibps_party_entity d WHERE FIND_IN_SET( d.id_, positions_ ) AND ( d.path_ LIKE #{position} ) )
+		</if>
+		<if test="@o.Ognl@isNotEmpty(whereSql)">
+			AND ${whereSql}
+		</if>
+<!--        <where>-->
+<!--            USER_ID_ != '-1'-->
+<!--            AND STATUS_ != 'deleted'-->
+<!--            <if test="@o.Ognl@isNotEmpty(whereSql)">-->
+<!--                AND ${whereSql}-->
+<!--            </if>-->
+<!--        </where>-->
+<!--        <if test="@o.Ognl@isNotEmpty(orderBySql)">-->
+<!--            ORDER BY ${orderBySql}-->
+<!--        </if>-->
         <if test="@o.Ognl@isEmpty(orderBySql)">
             ORDER BY CREATE_TIME_ DESC
         </if>

+ 27 - 15
ibps-provider-root/modules/provider-platform-default/src/main/java/com/lc/ibps/org/provider/PartyEmployeeProvider.java

@@ -492,22 +492,34 @@ public class PartyEmployeeProvider extends GenericProvider implements IPartyEmpl
 			logger.debug("com.lc.ibps.platform.org.controller.PartyRoleController.queryUsersByRoleId()--->roleId="+roleId);
 			
 			QueryFilter queryFilter=getQueryFilter(request);
-			StopWatchUtil.stopAndStartNewLocal(localId, step, "defaultpartyUserRepository.findUserByRoleId");
-			String ids = defaultpartyUserRepository.findUserByRoleId(roleId);//TODO 性能问题
-			
-			if(StringUtil.isNotBlank(ids)) {
-				//TODO 用户量太大时SQL会报错
-				queryFilter.addFilter("ID_", ids, QueryOP.IN);
-				StopWatchUtil.stopAndStartNewLocal(localId, step, "partyEmployeeRepository.query");
-				List<PartyEmployeePo> list = partyEmployeeRepository.query(queryFilter);//TODO 性能问题
-				//构建用户来源信息
-				StopWatchUtil.stopAndStartNewLocal(localId, step, "PartyRoleBuilder.buildPartyEmployeeSource");
-				list = PartyRoleBuilder.buildPartyEmployeeSource(list, roleId);//TODO 性能问题
-				
-				StopWatchUtil.stopAndStartNewLocal(localId, step, "getAPIPageList");
-				APIPageList<PartyEmployeePo> employeeList = getAPIPageList(list);
-				result.setData(employeeList);
+			queryFilter.addParamsFilter("roleId", roleId);
+			if (request.getCustoms()!=null){
+				queryFilter.addParamsFilter("position", "%" + request.getCustoms().get("position") + "%");
 			}
+			List<PartyEmployeePo> list = partyEmployeeRepository.query(queryFilter);//TODO 性能问题
+				//构建用户来源信息
+			StopWatchUtil.stopAndStartNewLocal(localId, step, "PartyRoleBuilder.buildPartyEmployeeSource");
+			list = PartyRoleBuilder.buildPartyEmployeeSource(list, roleId);//TODO 性能问题
+
+//			StopWatchUtil.stopAndStartNewLocal(localId, step, "defaultpartyUserRepository.findUserByRoleId");
+//			String ids = defaultpartyUserRepository.findUserByRoleId(roleId);//TODO 性能问题
+//
+//			if(StringUtil.isNotBlank(ids)) {
+//				//TODO 用户量太大时SQL会报错
+//				queryFilter.addFilter("ID_", ids, QueryOP.IN);
+//				StopWatchUtil.stopAndStartNewLocal(localId, step, "partyEmployeeRepository.query");
+//				List<PartyEmployeePo> list = partyEmployeeRepository.query(queryFilter);//TODO 性能问题
+//				//构建用户来源信息
+//				StopWatchUtil.stopAndStartNewLocal(localId, step, "PartyRoleBuilder.buildPartyEmployeeSource");
+//				list = PartyRoleBuilder.buildPartyEmployeeSource(list, roleId);//TODO 性能问题
+//
+//				StopWatchUtil.stopAndStartNewLocal(localId, step, "getAPIPageList");
+//				APIPageList<PartyEmployeePo> employeeList = getAPIPageList(list);
+//				result.setData(employeeList);
+//			}
+			StopWatchUtil.stopAndStartNewLocal(localId, step, "getAPIPageList");
+			APIPageList<PartyEmployeePo> employeeList = getAPIPageList(list);
+			result.setData(employeeList);
 		} catch (Exception e) {
 			setExceptionResult(result, StateEnum.ERROR_EMPLOYEE.getCode(), I18nUtil.getMessage(StateEnum.ERROR_EMPLOYEE.getCode()+""), e);
 		}