@ -511,7 +511,7 @@ public class UsersService extends BaseService {
if (CollectionUtils.isNotEmpty(oldAuthorizedResIds)) {
// get all resource id of process definitions those is released
List<Map<String, Object>> list = processDefinitionMapper.listResources();
List<Map<String, Object>> list = processDefinitionMapper.listResourcesByUser(userId);
Map<Integer, Set<Integer>> resourceProcessMap = ResourceProcessDefinitionUtils.getResourceProcessDefinitionMap(list);
Set<Integer> resourceIdSet = resourceProcessMap.keySet();
@ -102,4 +102,11 @@ public interface ProcessDefinitionMapper extends BaseMapper<ProcessDefinition> {
*/
@MapKey("id")
List<Map<String, Object>> listResources();
/**
* list all resource ids by user id
* @return resource ids list
List<Map<String, Object>> listResourcesByUser(@Param("userId") Integer userId);
}
@ -96,4 +96,10 @@
FROM t_ds_process_definition
WHERE release_state = 1 and resource_ids is not null and resource_ids != ''
</select>
<select id="listResourcesByUser" resultType="java.util.HashMap">
SELECT id,resource_ids
WHERE user_id = #{userId} and release_state = 1 and resource_ids is not null and resource_ids != ''
</mapper>
@ -242,4 +242,13 @@ public class ProcessDefinitionMapperTest {
List<Map<String, Object>> maps = processDefinitionMapper.listResources();
Assert.assertNotNull(maps);
@Test
public void listResourcesByUserTest(){
ProcessDefinition processDefinition = insertOne();
processDefinition.setResourceIds("3,5");
processDefinition.setReleaseState(ReleaseState.ONLINE);
List<Map<String, Object>> maps = processDefinitionMapper.listResourcesByUser(processDefinition.getUserId());