diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java index db9c9bc..92c683b 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java @@ -70,6 +70,10 @@ public class BasSheep extends BaseEntity @Excel(name = "出生体重") private Long birthWeight; + /** 出生体重 */ + @Excel(name = "当前体重") + private Long currentWeight; + /** 胎次 */ @Excel(name = "胎次") private Long parity; diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBodyMeasure.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBodyMeasure.java index ca2ce61..25f6410 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBodyMeasure.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBodyMeasure.java @@ -89,7 +89,8 @@ public class ScBodyMeasure extends BaseEntity { /** * 当前体重 */ - private BigDecimal currentWeight; + @Excel(name = "当前体重") + private Long currentWeight; /** * 体高 diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBodyMeasureServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBodyMeasureServiceImpl.java index 985960e..dad69e0 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBodyMeasureServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBodyMeasureServiceImpl.java @@ -51,13 +51,9 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService /** * 新增体尺测量 - * - * @param scBodyMeasure 体尺测量 - * @return 结果 */ @Override - public int insertScBodyMeasure(ScBodyMeasure scBodyMeasure) - { + public int insertScBodyMeasure(ScBodyMeasure scBodyMeasure) { String manageTags = scBodyMeasure.getManageTags(); if (StringUtils.isNotBlank(manageTags)) { BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags); @@ -66,6 +62,14 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService } scBodyMeasure.setSheepId(sheep.getId()); } + + if (scBodyMeasure.getCurrentWeight() != null) { + BasSheep updateSheep = new BasSheep(); + updateSheep.setId(scBodyMeasure.getSheepId()); + updateSheep.setCurrentWeight(scBodyMeasure.getCurrentWeight()); + basSheepService.updateBasSheep(updateSheep); + } + scBodyMeasure.setCreateTime(DateUtils.getNowDate()); scBodyMeasure.setCreateBy(SecurityUtils.getUsername()); return scBodyMeasureMapper.insertScBodyMeasure(scBodyMeasure); @@ -73,13 +77,9 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService /** * 修改体尺测量 - * - * @param scBodyMeasure 体尺测量 - * @return 结果 */ @Override - public int updateScBodyMeasure(ScBodyMeasure scBodyMeasure) - { + public int updateScBodyMeasure(ScBodyMeasure scBodyMeasure) { String manageTags = scBodyMeasure.getManageTags(); if (StringUtils.isNotBlank(manageTags)) { BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags); @@ -88,6 +88,14 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService } scBodyMeasure.setSheepId(sheep.getId()); } + + if (scBodyMeasure.getCurrentWeight() != null) { + BasSheep updateSheep = new BasSheep(); + updateSheep.setId(scBodyMeasure.getSheepId()); + updateSheep.setCurrentWeight(scBodyMeasure.getCurrentWeight()); + basSheepService.updateBasSheep(updateSheep); + } + return scBodyMeasureMapper.updateScBodyMeasure(scBodyMeasure); } diff --git a/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml b/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml index a035e60..001a2b7 100644 --- a/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml +++ b/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml @@ -104,6 +104,7 @@ and gender = #{gender} and birthday = #{birthday} and birth_weight = #{birthWeight} + current_weight = #{currentWeight}, and parity = #{parity} and status_id = #{statusId} and weaning_date = #{weaningDate} @@ -278,6 +279,7 @@ gender = #{gender}, birthday = #{birthday}, birth_weight = #{birthWeight}, + current_weight = #{currentWeight}, parity = #{parity}, status_id = #{statusId}, weaning_date = #{weaningDate}, diff --git a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml index df35238..80aa3cd 100644 --- a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml @@ -55,7 +55,7 @@ bs.parity, bs.birth_weight as birth_weight, bs.weaning_weight as weaning_weight, - bs.current_weight as current_weight, + sm.current_weight as current_weight, sm.height, sm.bust, sm.body_length, @@ -123,6 +123,7 @@ hip_height, rump_width, rump_heignt, + current_weight, hip_width, hip_cross_height, comment, @@ -141,6 +142,7 @@ #{hipHeight}, #{rumpWidth}, #{rumpHeignt}, + #{currentWeight}, #{hipWidth}, #{hipCrossHeight}, #{comment}, @@ -163,6 +165,7 @@ hip_height = #{hipHeight}, rump_width = #{rumpWidth}, rump_heignt = #{rumpHeignt}, + current_weight = #{currentWeight}, hip_width = #{hipWidth}, hip_cross_height = #{hipCrossHeight}, comment = #{comment},