需求:存储所有站点使用 List ,以站点编码的首字母进行分类,比如:a开头的站点有哪些,b有哪些
mapper层和domain层就不写了,没什么区别
serviceImpl类
@Service
public class StationServiceImpl implements StationService {
@Resource
private StationMapper stationMapper;
@Override
public Map<String, List<Station>> getStations() {
Map<String, List<Station>> result =
new TreeMap<String, List<Station>>();
List<Station> stList = stationMapper.getStations();
for (Station station : stList) {
String key = String.valueOf(
station.getStationCode().charAt(0)).toUpperCase();
List