种公羊档案修改
This commit is contained in:
parent
454c5bcb73
commit
54f7df70ca
@ -1,3 +1,95 @@
|
||||
//package com.zhyc.module.produce.breed.domain;
|
||||
//
|
||||
//import java.math.BigDecimal;
|
||||
//import java.util.Date;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import lombok.Data;
|
||||
//import lombok.NoArgsConstructor;
|
||||
//import com.zhyc.common.annotation.Excel;
|
||||
//import com.zhyc.common.core.domain.BaseEntity;
|
||||
//
|
||||
///**
|
||||
// * 羔羊详情对象 sc_lamb_detail
|
||||
// *
|
||||
// * @author ruoyi
|
||||
// * @date 2025-07-11
|
||||
// */
|
||||
//@Data
|
||||
//@NoArgsConstructor
|
||||
//@AllArgsConstructor
|
||||
//public class ScLambDetail extends BaseEntity
|
||||
//{
|
||||
// private static final long serialVersionUID = 1L;
|
||||
//
|
||||
// /** 主键ID */
|
||||
// private Long id;
|
||||
//
|
||||
// /** 产羔记录ID */
|
||||
// @Excel(name = "产羔记录ID")
|
||||
// private Long lambingRecordId;
|
||||
//
|
||||
// /** 羔羊耳号 */
|
||||
// @Excel(name = "羔羊耳号")
|
||||
// private String lambEarNumber;
|
||||
//
|
||||
// /** 羔羊品种ID */
|
||||
// @Excel(name = "羔羊品种ID")
|
||||
// private Integer lambBreed; // 改为Integer类型,存储品种ID
|
||||
//
|
||||
// /** 性别 */
|
||||
// @Excel(name = "性别")
|
||||
// private Integer gender;
|
||||
//
|
||||
// /** 出生重量 */
|
||||
// @Excel(name = "出生重量")
|
||||
// private BigDecimal birthWeight;
|
||||
//
|
||||
// /** 是否留养 */
|
||||
// @Excel(name = "是否留养")
|
||||
// private Boolean isRetained;
|
||||
//
|
||||
// /** 家系 */
|
||||
// @Excel(name = "家系")
|
||||
// private String lineage;
|
||||
//
|
||||
// /** 生日 */
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd")
|
||||
// @Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
// private Date birthday;
|
||||
//
|
||||
// private List<ScLambDetail> lambDetails;
|
||||
//
|
||||
// /** 母羊ID */
|
||||
// private Long motherId;
|
||||
//
|
||||
// /** 父羊ID */
|
||||
// private Long fatherId;
|
||||
//
|
||||
// /** 牧场ID */
|
||||
// private Integer ranchId;
|
||||
//
|
||||
// /** 羊舍ID */
|
||||
// private Integer sheepfoldId;
|
||||
//
|
||||
// /** 胎次 */
|
||||
// private Integer parity;
|
||||
//
|
||||
// // getter和setter方法
|
||||
// public void setId(Long id)
|
||||
// {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public Long getId()
|
||||
// {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
package com.zhyc.module.produce.breed.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -37,9 +129,9 @@ public class ScLambDetail extends BaseEntity
|
||||
|
||||
/** 羔羊品种ID */
|
||||
@Excel(name = "羔羊品种ID")
|
||||
private Integer lambBreed; // 改为Integer类型,存储品种ID
|
||||
private Integer lambBreed;
|
||||
|
||||
/** 性别 */
|
||||
/** 性别:1-母,2-公,3-阉羊,4-兼性 */
|
||||
@Excel(name = "性别")
|
||||
private Integer gender;
|
||||
|
||||
@ -47,9 +139,9 @@ public class ScLambDetail extends BaseEntity
|
||||
@Excel(name = "出生重量")
|
||||
private BigDecimal birthWeight;
|
||||
|
||||
/** 是否留养 */
|
||||
/** 是否留养:0-否,1-是 */
|
||||
@Excel(name = "是否留养")
|
||||
private Boolean isRetained;
|
||||
private Integer isRetained;
|
||||
|
||||
/** 家系 */
|
||||
@Excel(name = "家系")
|
||||
@ -76,17 +168,4 @@ public class ScLambDetail extends BaseEntity
|
||||
|
||||
/** 胎次 */
|
||||
private Integer parity;
|
||||
|
||||
// getter和setter方法
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -92,9 +92,9 @@ public class ScLambingRecordServiceImpl implements IScLambingRecordService {
|
||||
throw new RuntimeException("羔羊性别不能为空");
|
||||
}
|
||||
|
||||
// 验证性别值的有效性(假设0=母羊,1=公羊)
|
||||
if (lambDetail.getGender() < 0 || lambDetail.getGender() > 1) {
|
||||
throw new RuntimeException("羔羊性别值无效,请使用0(母羊)或1(公羊)");
|
||||
// 验证性别值的有效性:1-母,2-公,3-阉羊,4-兼性
|
||||
if (lambDetail.getGender() < 1 || lambDetail.getGender() > 4) {
|
||||
throw new RuntimeException("羔羊性别值无效,请使用1(母)、2(公)、3(阉羊)或4(兼性)");
|
||||
}
|
||||
|
||||
// 检查耳号是否已存在
|
||||
@ -105,7 +105,12 @@ public class ScLambingRecordServiceImpl implements IScLambingRecordService {
|
||||
|
||||
// 设置默认值
|
||||
if (lambDetail.getIsRetained() == null) {
|
||||
lambDetail.setIsRetained(false);
|
||||
lambDetail.setIsRetained(0); // 默认为0(否)
|
||||
}
|
||||
|
||||
// 验证是否留养值的有效性:0-否,1-是
|
||||
if (lambDetail.getIsRetained() != 0 && lambDetail.getIsRetained() != 1) {
|
||||
throw new RuntimeException("是否留养值无效,请使用0(否)或1(是)");
|
||||
}
|
||||
|
||||
if (lambDetail.getBirthday() == null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user