|
@@ -7,7 +7,7 @@ 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.*;
|
|
|
+import java.util.Map;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.huimv.common.utils.PageUtils;
|
|
@@ -21,10 +21,8 @@ import com.huimv.management.service.YearPigBaseService;
|
|
|
@Service("yearPigBaseService")
|
|
|
public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigBaseEntity> implements YearPigBaseService {
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private YearPigBaseDao pigBaseDao;
|
|
|
|
|
|
// @Override
|
|
|
// public PageUtils queryPage(Map<String, Object> params) {
|
|
@@ -49,85 +47,6 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
// return new PageUtils(page);
|
|
|
// }
|
|
|
|
|
|
-//params 里面有耳标号
|
|
|
- @Override
|
|
|
- public Map<String ,Object> queryPageByRelationship(Map<String, Object> params) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /* 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());
|
|
|
-
|
|
|
-
|
|
|
- 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<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();
|
|
|
-
|
|
|
- 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));
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- //父亲父母
|
|
|
- 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;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
@Override
|
|
|
public PageUtils queryPage(Map<String, Object> params) {
|
|
@@ -181,13 +100,17 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
lambdaQuery.eq(YearPigBaseEntity::getUnitId,unitId);
|
|
|
}
|
|
|
|
|
|
+ //单元
|
|
|
+ String farmId = (String) params.get("formFarmId");
|
|
|
+ if (StringUtils.isNotEmpty(farmId)) {
|
|
|
+ lambdaQuery.eq(YearPigBaseEntity::getFarmId,farmId);
|
|
|
+ }
|
|
|
|
|
|
IPage<YearPigBaseEntity> page = page(this.page(
|
|
|
new Query<YearPigBaseEntity>().getPage(params)
|
|
|
), lambdaQuery);
|
|
|
|
|
|
|
|
|
-
|
|
|
return new PageUtils(page);
|
|
|
}
|
|
|
|
|
@@ -201,10 +124,17 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- //谁的代码。没做实现
|
|
|
@Override
|
|
|
public void such(Integer[] ids) {
|
|
|
+ pigBaseDao.such(ids);
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public Integer findByoutFenceStatus(int i, Integer farmId) {
|
|
|
+ LambdaQueryWrapper<YearPigBaseEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(YearPigBaseEntity::getFarmId,farmId);
|
|
|
+ wrapper.eq(YearPigBaseEntity::getOutFenceStatus,i);
|
|
|
+ Integer integer = pigBaseDao.selectCount(wrapper);
|
|
|
+ return integer;
|
|
|
}
|
|
|
}
|