|
|
@@ -11,7 +11,11 @@ import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.organization.bo.DepOut;
|
|
|
import com.goafanti.organization.bo.OrganizationListOut;
|
|
|
import com.goafanti.organization.service.OrganizationService;
|
|
|
+import net.sourceforge.pinyin4j.PinyinHelper;
|
|
|
+import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
|
|
+import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
|
@@ -63,6 +67,23 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
|
|
|
hideSign=null;
|
|
|
}
|
|
|
List<DepOut> depList=departmentMapper.selectSuperId(hideSign,null,null);
|
|
|
+
|
|
|
+ return listSort(depList);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<DepOut> listSort(List<DepOut> depList) {
|
|
|
+ HanyuPinyinOutputFormat format=new HanyuPinyinOutputFormat();
|
|
|
+ Collections.sort(depList, (o1, o2) -> {
|
|
|
+ String str1=null;
|
|
|
+ String str2=null;
|
|
|
+ try {
|
|
|
+ str1= PinyinHelper.toHanYuPinyinString(o1.getName(),format," ",true);
|
|
|
+ str2= PinyinHelper.toHanYuPinyinString(o2.getName(),format," ",true);
|
|
|
+ } catch (BadHanyuPinyinOutputFormatCombination e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ return str1.compareTo(str2);
|
|
|
+ });
|
|
|
return depList;
|
|
|
}
|
|
|
|