新增羊只字段修改
This commit is contained in:
@@ -103,6 +103,14 @@ public class BasSheep extends BaseEntity
|
||||
@Excel(name = "母号id")
|
||||
private Long motherId;
|
||||
|
||||
/** 外祖父耳号 */
|
||||
@Excel(name = "外祖父")
|
||||
private String grandpa;
|
||||
|
||||
/** 外祖母耳号 */
|
||||
@Excel(name = "外祖母")
|
||||
private String grandma;
|
||||
|
||||
/** 受体id */
|
||||
@Excel(name = "受体id")
|
||||
private Long receptorId;
|
||||
|
||||
@@ -56,6 +56,25 @@ public class ScAddSheep extends BaseEntity {
|
||||
*/
|
||||
@Excel(name = "母号")
|
||||
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 String createBy;
|
||||
private Date createTime;
|
||||
/**
|
||||
* 出生体重
|
||||
*/
|
||||
@Excel(name = "出生体重")
|
||||
private BigDecimal bornWeight;
|
||||
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
@@ -103,7 +118,6 @@ public class ScAddSheep extends BaseEntity {
|
||||
* 羊只类别
|
||||
*/
|
||||
private Long typeId;
|
||||
@Excel(name = "羊只类型")
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
@@ -116,13 +130,11 @@ public class ScAddSheep extends BaseEntity {
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
||||
throw new ServiceException("添加失败,耳号已存在");
|
||||
}
|
||||
|
||||
// userId 和 deptId 已在 Controller 中设置,直接插入
|
||||
boolean ok = scAddSheepMapper.insert(scAddSheep) > 0;
|
||||
if (!ok) return false;
|
||||
|
||||
@@ -60,10 +59,28 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
||||
bs.setManageTags(scAddSheep.getEarNumber());
|
||||
bs.setRanchId(scAddSheep.getRanchId().longValue());
|
||||
bs.setSheepfoldId(scAddSheep.getSheepfold().longValue());
|
||||
bs.setFatherId(null);
|
||||
bs.setMotherId(null);
|
||||
if (StringUtils.isNotBlank(scAddSheep.getFather())) {
|
||||
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.setWeaningWeight(scAddSheep.getWeaningWeight().longValue());
|
||||
if (scAddSheep.getWeaningWeight() != null) {
|
||||
bs.setWeaningWeight(scAddSheep.getWeaningWeight().longValue());
|
||||
} else {
|
||||
bs.setWeaningWeight(null);
|
||||
}
|
||||
bs.setSource(String.valueOf(2));
|
||||
bs.setBirthday(scAddSheep.getBirthday());
|
||||
bs.setGender(scAddSheep.getGender().longValue());
|
||||
@@ -88,7 +105,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
||||
|
||||
//查询
|
||||
@Override
|
||||
@DataScope(deptAlias = "sas", userAlias = "sas") // sas 是 sc_add_sheep 的别名
|
||||
@DataScope(deptAlias = "sas", userAlias = "sas")
|
||||
public List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep) {
|
||||
return scAddSheepMapper.selectScAddSheepList(scAddSheep);
|
||||
}
|
||||
@@ -208,7 +225,23 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
||||
.append("】");
|
||||
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.setDeptId(deptId);
|
||||
|
||||
@@ -235,7 +235,7 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
|
||||
BasSheep upd = new BasSheep();
|
||||
upd.setId(sheep.getId());
|
||||
upd.setRanchId(targetRanchId);
|
||||
upd.setSheepfoldId(targetSheepfoldId); // 真正换舍
|
||||
upd.setSheepfoldId(targetSheepfoldId);
|
||||
basSheepMapper.updateBasSheep(upd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="father" column="father"/>
|
||||
<result property="mother" column="mother"/>
|
||||
<result property="grandpa" column="grandpa"/>
|
||||
<result property="grandma" column="grandma"/>
|
||||
<result property="bornWeight" column="born_weight"/>
|
||||
<result property="birthday" column="birthday"/>
|
||||
<result property="gender" column="gender"/>
|
||||
@@ -36,6 +38,8 @@
|
||||
sas.ranch_id,
|
||||
sas.father,
|
||||
sas.mother,
|
||||
sas.grandpa,
|
||||
sas.grandma,
|
||||
sas.born_weight,
|
||||
sas.birthday,
|
||||
sas.gender,
|
||||
@@ -90,6 +94,8 @@
|
||||
<if test="ranchId != null">ranch_id,</if>
|
||||
<if test="father != null">father,</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="birthday != null">birthday,</if>
|
||||
<if test="gender != null">gender,</if>
|
||||
@@ -110,6 +116,8 @@
|
||||
<if test="ranchId != null">#{ranchId},</if>
|
||||
<if test="father != null">#{father},</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="birthday != null">#{birthday},</if>
|
||||
<if test="gender != null">#{gender},</if>
|
||||
|
||||
Reference in New Issue
Block a user