|
|
|
@ -26,32 +26,8 @@ public class GarbageDao extends BaseDao<Garbage> { |
|
|
|
|
private MessageService messageService; |
|
|
|
|
|
|
|
|
|
//查询垃圾分类信息
|
|
|
|
|
public List<GarbageVo> query(QueryGarbageForm garbageForm) { |
|
|
|
|
List<GarbageVo> garbageVos = new ArrayList<>(); |
|
|
|
|
List<Garbage> garbageList = mongoTemplate.find(new Query(Criteria.where("name").regex(Pattern.compile(".*" + garbageForm.getName() + ".*"))), entityClass()); |
|
|
|
|
for (Garbage garbage : garbageList) { |
|
|
|
|
GarbageVo garbageVo = new GarbageVo(); |
|
|
|
|
garbageVo.setName(garbage.getName()); |
|
|
|
|
switch (garbage.getCategory()) { |
|
|
|
|
case 1: |
|
|
|
|
garbageVo.setSorting(messageService.getMessage(GarbageCateGory.type1)); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
garbageVo.setSorting(messageService.getMessage(GarbageCateGory.type2)); |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
garbageVo.setSorting(messageService.getMessage(GarbageCateGory.type4)); |
|
|
|
|
break; |
|
|
|
|
case 8: |
|
|
|
|
garbageVo.setSorting(messageService.getMessage(GarbageCateGory.type8)); |
|
|
|
|
break; |
|
|
|
|
case 16: |
|
|
|
|
garbageVo.setSorting(messageService.getMessage(GarbageCateGory.type16)); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
garbageVos.add(garbageVo); |
|
|
|
|
} |
|
|
|
|
return garbageVos; |
|
|
|
|
public List<Garbage> query(QueryGarbageForm garbageForm) { |
|
|
|
|
return mongoTemplate.find(new Query(Criteria.where("name").regex(Pattern.compile(".*" + garbageForm.getName() + ".*"))), entityClass()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|