/*** 通过userID 获取对应的机构* @param userId* @return*/@Overridepublic BaseResult getUserIdOrg(String userId) {UserOrgMapping userOrgMapping = new UserOrgMapping();userOrgMapping.setUserId(userId);UserOrgMapping one = userOrgMappingMapper.selectOne(userOrgMapping);String code = one.getOrgCode();ArrayList<Object> list = Lists.newArrayList();list.add(code);while (code.length()!=2){code=code.substring(0,code.length()-2);list.add(code);}log.info("切割的机构orgCode"+list);Example listMapper = new Example(OrganizationChart.class);Example.Criteria criteria = listMapper.createCriteria();criteria.andIn("orgCode",list);//什么都不写 默认以主键ID排序listMapper.orderBy("orgCode");List<OrganizationChart> chartList = organizationChartMapper.selectByExample(listMapper);if (ObjectUtil.isEmpty(chartList)){return ResultTools.resultError(ErrorCodeConst.ERROR_CODE_NO,"");}for (OrganizationChart o:chartList) {log.info(o.getOrgCode()+" "+o.getOrgName()+" "+o.getOrgType());}return ResultTools.result(chartList);}
In 里面的字段
查询到的结果 默认为会以 主键Id 排序 升序排列
