新增羊只字段修改

This commit is contained in:
zyh
2026-02-10 13:30:35 +08:00
parent 094da396c1
commit 708589b420
5 changed files with 75 additions and 14 deletions

View File

@@ -103,6 +103,14 @@ public class BasSheep extends BaseEntity
@Excel(name = "母号id") @Excel(name = "母号id")
private Long motherId; private Long motherId;
/** 外祖父耳号 */
@Excel(name = "外祖父")
private String grandpa;
/** 外祖母耳号 */
@Excel(name = "外祖母")
private String grandma;
/** 受体id */ /** 受体id */
@Excel(name = "受体id") @Excel(name = "受体id")
private Long receptorId; private Long receptorId;

View File

@@ -56,6 +56,25 @@ public class ScAddSheep extends BaseEntity {
*/ */
@Excel(name = "母号") @Excel(name = "母号")
private String mother; private String mother;
/**
* 外祖父耳号
*/
@Excel(name = "外祖父")
private String grandpa;
/**
* 外祖母耳号
*/
@Excel(name = "外祖母")
private String grandma;
/**
* 出生体重
*/
@Excel(name = "出生体重")
private BigDecimal bornWeight;
/** /**
* 断奶体重(仅接收,不入库) * 断奶体重(仅接收,不入库)
*/ */
@@ -63,11 +82,7 @@ public class ScAddSheep extends BaseEntity {
private BigDecimal weaningWeight; private BigDecimal weaningWeight;
private String createBy; private String createBy;
private Date createTime; private Date createTime;
/**
* 出生体重
*/
@Excel(name = "出生体重")
private BigDecimal bornWeight;
/** /**
* 出生日期 * 出生日期
@@ -103,7 +118,6 @@ public class ScAddSheep extends BaseEntity {
* 羊只类别 * 羊只类别
*/ */
private Long typeId; private Long typeId;
@Excel(name = "羊只类型")
private String typeName; private String typeName;
/** /**
@@ -116,13 +130,11 @@ public class ScAddSheep extends BaseEntity {
/** /**
* 备注 * 备注
*/ */
@Excel(name = "备注")
private String comment; private String comment;
/** /**
* 技术员 * 技术员
*/ */
@Excel(name = "技术员")
private String technician; private String technician;

View File

@@ -52,7 +52,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
throw new ServiceException("添加失败,耳号已存在"); throw new ServiceException("添加失败,耳号已存在");
} }
// userId 和 deptId 已在 Controller 中设置,直接插入
boolean ok = scAddSheepMapper.insert(scAddSheep) > 0; boolean ok = scAddSheepMapper.insert(scAddSheep) > 0;
if (!ok) return false; if (!ok) return false;
@@ -60,10 +59,28 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
bs.setManageTags(scAddSheep.getEarNumber()); bs.setManageTags(scAddSheep.getEarNumber());
bs.setRanchId(scAddSheep.getRanchId().longValue()); bs.setRanchId(scAddSheep.getRanchId().longValue());
bs.setSheepfoldId(scAddSheep.getSheepfold().longValue()); bs.setSheepfoldId(scAddSheep.getSheepfold().longValue());
bs.setFatherId(null); if (StringUtils.isNotBlank(scAddSheep.getFather())) {
bs.setMotherId(null); BasSheep fatherSheep = basSheepService.selectBasSheepByManageTags(scAddSheep.getFather().trim());
if (fatherSheep == null) {
throw new ServiceException("父号【" + scAddSheep.getFather() + "】不存在");
}
bs.setFatherId(fatherSheep.getId());
}
if (StringUtils.isNotBlank(scAddSheep.getMother())) {
BasSheep motherSheep = basSheepService.selectBasSheepByManageTags(scAddSheep.getMother().trim());
if (motherSheep == null) {
throw new ServiceException("母号【" + scAddSheep.getMother() + "】不存在");
}
bs.setMotherId(motherSheep.getId());
}
bs.setGrandpa(scAddSheep.getGrandpa());
bs.setGrandma(scAddSheep.getGrandma());
bs.setBirthWeight(scAddSheep.getBornWeight().longValue()); bs.setBirthWeight(scAddSheep.getBornWeight().longValue());
if (scAddSheep.getWeaningWeight() != null) {
bs.setWeaningWeight(scAddSheep.getWeaningWeight().longValue()); bs.setWeaningWeight(scAddSheep.getWeaningWeight().longValue());
} else {
bs.setWeaningWeight(null);
}
bs.setSource(String.valueOf(2)); bs.setSource(String.valueOf(2));
bs.setBirthday(scAddSheep.getBirthday()); bs.setBirthday(scAddSheep.getBirthday());
bs.setGender(scAddSheep.getGender().longValue()); bs.setGender(scAddSheep.getGender().longValue());
@@ -88,7 +105,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
//查询 //查询
@Override @Override
@DataScope(deptAlias = "sas", userAlias = "sas") // sas 是 sc_add_sheep 的别名 @DataScope(deptAlias = "sas", userAlias = "sas")
public List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep) { public List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep) {
return scAddSheepMapper.selectScAddSheepList(scAddSheep); return scAddSheepMapper.selectScAddSheepList(scAddSheep);
} }
@@ -208,7 +225,23 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
.append(""); .append("");
continue; continue;
} }
if (StringUtils.isNotBlank(sheep.getFather())) {
BasSheep father = basSheepService.selectBasSheepByManageTags(sheep.getFather().trim());
if (father == null) {
failure++;
failureMsg.append("<br/>第").append(i + 1).append("行:父号不存在【").append(sheep.getFather()).append("");
continue;
}
}
if (StringUtils.isNotBlank(sheep.getMother())) {
BasSheep mother = basSheepService.selectBasSheepByManageTags(sheep.getMother().trim());
if (mother == null) {
failure++;
failureMsg.append("<br/>第").append(i + 1).append("行:母号不存在【").append(sheep.getMother()).append("");
continue;
}
}
// 数据分离:设置用户和部门 // 数据分离:设置用户和部门
sheep.setUserId(userId); sheep.setUserId(userId);
sheep.setDeptId(deptId); sheep.setDeptId(deptId);

View File

@@ -235,7 +235,7 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
BasSheep upd = new BasSheep(); BasSheep upd = new BasSheep();
upd.setId(sheep.getId()); upd.setId(sheep.getId());
upd.setRanchId(targetRanchId); upd.setRanchId(targetRanchId);
upd.setSheepfoldId(targetSheepfoldId); // 真正换舍 upd.setSheepfoldId(targetSheepfoldId);
basSheepMapper.updateBasSheep(upd); basSheepMapper.updateBasSheep(upd);
} }
} }

View File

@@ -12,6 +12,8 @@
<result property="sheepfoldName" column="sheepfoldName"/> <result property="sheepfoldName" column="sheepfoldName"/>
<result property="father" column="father"/> <result property="father" column="father"/>
<result property="mother" column="mother"/> <result property="mother" column="mother"/>
<result property="grandpa" column="grandpa"/>
<result property="grandma" column="grandma"/>
<result property="bornWeight" column="born_weight"/> <result property="bornWeight" column="born_weight"/>
<result property="birthday" column="birthday"/> <result property="birthday" column="birthday"/>
<result property="gender" column="gender"/> <result property="gender" column="gender"/>
@@ -36,6 +38,8 @@
sas.ranch_id, sas.ranch_id,
sas.father, sas.father,
sas.mother, sas.mother,
sas.grandpa,
sas.grandma,
sas.born_weight, sas.born_weight,
sas.birthday, sas.birthday,
sas.gender, sas.gender,
@@ -90,6 +94,8 @@
<if test="ranchId != null">ranch_id,</if> <if test="ranchId != null">ranch_id,</if>
<if test="father != null">father,</if> <if test="father != null">father,</if>
<if test="mother != null">mother,</if> <if test="mother != null">mother,</if>
<if test="grandpa != null">grandpa,</if>
<if test="grandma != null">grandma,</if>
<if test="bornWeight != null">born_weight,</if> <if test="bornWeight != null">born_weight,</if>
<if test="birthday != null">birthday,</if> <if test="birthday != null">birthday,</if>
<if test="gender != null">gender,</if> <if test="gender != null">gender,</if>
@@ -110,6 +116,8 @@
<if test="ranchId != null">#{ranchId},</if> <if test="ranchId != null">#{ranchId},</if>
<if test="father != null">#{father},</if> <if test="father != null">#{father},</if>
<if test="mother != null">#{mother},</if> <if test="mother != null">#{mother},</if>
<if test="grandpa != null">#{grandpa},</if>
<if test="grandma != null">#{grandma},</if>
<if test="bornWeight != null">#{bornWeight},</if> <if test="bornWeight != null">#{bornWeight},</if>
<if test="birthday != null">#{birthday},</if> <if test="birthday != null">#{birthday},</if>
<if test="gender != null">#{gender},</if> <if test="gender != null">#{gender},</if>