|
@@ -5,12 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.huimv.management.entity.YearPigBaseEntity;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.huimv.common.utils.PageUtils;
|
|
@@ -29,13 +26,6 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
// @Override
|
|
|
// public PageUtils queryPage(Map<String, Object> params) {
|
|
|
//
|
|
@@ -59,33 +49,73 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
// return new PageUtils(page);
|
|
|
// }
|
|
|
|
|
|
-
|
|
|
+//params 里面有耳标号
|
|
|
@Override
|
|
|
- public List<Map> queryPageByRelationship(Map<String, Object> params) {
|
|
|
+ public Map<String ,Object> queryPageByRelationship(Map<String, Object> params) {
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- String eartag_no = "N92106";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Map parentmap = new HashMap();
|
|
|
+ /* Optional<BreedingSheepDetails> detail = breedingSheepDetailsRepository.findById(id);
|
|
|
+ if (!detail.isPresent()) {
|
|
|
+ throw new PlatformException("sheep doesn't exists", "羊只不存在");
|
|
|
+ }
|
|
|
+ BreedingSheepDetails self = detail.get();
|
|
|
+
|
|
|
+ EarTagBind earTag = earTagBindRepository.findBySheepId(id).orElse(null);
|
|
|
+ self.setEarTag(earTag == null ? null :earTag.getEarTag());
|
|
|
+
|
|
|
|
|
|
- parentmap.put("祖父",545);
|
|
|
- parentmap.put("外公",545);
|
|
|
+ result.put("self", self );
|
|
|
|
|
|
+ BreedingSheepDetails father = self.getFather() == null ? null : breedingSheepDetailsRepository.findById(self.getFather()).orElse(null);
|
|
|
+ BreedingSheepDetails mother = self.getMother() == null ? null : breedingSheepDetailsRepository.findById(self.getMother()).orElse(null);
|
|
|
|
|
|
+ result.put("father", father);
|
|
|
+ result.put("mother", mother);
|
|
|
+ result.put("fatherFather", father == null ? null : breedingSheepDetailsRepository.findById(father.getFather()).orElse(null));
|
|
|
+ result.put("fatherMother", father == null ? null : breedingSheepDetailsRepository.findById(father.getMother()).orElse(null));
|
|
|
+ result.put("motherFather", mother == null ? null : breedingSheepDetailsRepository.findById(mother.getFather()).orElse(null));
|
|
|
+ result.put("motherMother", mother == null ? null : breedingSheepDetailsRepository.findById(mother.getMother()).orElse(null));
|
|
|
|
|
|
+ return result;
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
- Map grantparentmap = new HashMap();
|
|
|
- Map childmap = new HashMap();
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ String eartag_no = (String) params.get("eartag");
|
|
|
+ System.out.println(eartag_no);
|
|
|
+ YearPigBaseEntity self = baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, eartag_no));
|
|
|
+ System.out.println(self);
|
|
|
+ result.put("self", self );
|
|
|
|
|
|
|
|
|
+ System.out.println("父亲ID"+self.getFatherEartag()); System.out.println("母亲ID"+self.getMotherEartag());
|
|
|
+ String math = self.getMotherEartag();
|
|
|
|
|
|
- List List1 = new ArrayList();
|
|
|
- List1.add(childmap);
|
|
|
+ YearPigBaseEntity father = self.getFatherEartag() == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, self.getFatherEartag()));
|
|
|
+ YearPigBaseEntity mother = self.getMotherEartag() == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, math));
|
|
|
|
|
|
- return List1;
|
|
|
+
|
|
|
+
|
|
|
+ //父亲父母
|
|
|
+ result.put("father", father);
|
|
|
+ result.put("mother", mother);
|
|
|
+ YearPigBaseEntity fathermother = father == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, father.getFatherEartag()));
|
|
|
+ YearPigBaseEntity fatherfather = father == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, father.getMotherEartag()));
|
|
|
+ result.put("fathermother", fathermother);
|
|
|
+ result.put("fatherfather", fatherfather);
|
|
|
+ //母亲父母
|
|
|
+ YearPigBaseEntity mothermother = mother == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, mother.getFatherEartag()));
|
|
|
+ YearPigBaseEntity motherfather = mother == null ? null : baseMapper.selectOne(Wrappers.<YearPigBaseEntity>lambdaQuery().eq(YearPigBaseEntity::getEartag, mother.getMotherEartag()));
|
|
|
+ result.put("mothermother", mothermother);
|
|
|
+ result.put("motherfather", motherfather);
|
|
|
+
|
|
|
+
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -94,6 +124,11 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public PageUtils queryPage(Map<String, Object> params) {
|
|
|
|
|
@@ -166,4 +201,10 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //谁的代码。没做实现
|
|
|
+ @Override
|
|
|
+ public void such(Integer[] ids) {
|
|
|
+
|
|
|
+ }
|
|
|
}
|