Merge remote-tracking branch 'origin/main'

This commit is contained in:
zyh 2025-08-04 09:17:38 +08:00
commit 2083325e40
31 changed files with 2966 additions and 5 deletions

View File

@ -0,0 +1,104 @@
package com.zhyc.module.base.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.base.domain.BreedRamFile;
import com.zhyc.module.base.service.IBreedRamFileService;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 种公羊档案Controller
*
* @author zhyc
* @date 2025-07-29
*/
@RestController
@RequestMapping("/ram_file/bas_ram_file")
public class BreedRamFileController extends BaseController
{
@Autowired
private IBreedRamFileService breedRamFileService;
/**
* 查询种公羊档案列表
*/
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
@GetMapping("/list")
public TableDataInfo list(BreedRamFile breedRamFile)
{
startPage();
List<BreedRamFile> list = breedRamFileService.selectBreedRamFileList(breedRamFile);
return getDataTable(list);
}
/**
* 导出种公羊档案列表
*/
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:export')")
@Log(title = "种公羊档案", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BreedRamFile breedRamFile)
{
List<BreedRamFile> list = breedRamFileService.selectBreedRamFileList(breedRamFile);
ExcelUtil<BreedRamFile> util = new ExcelUtil<BreedRamFile>(BreedRamFile.class);
util.exportExcel(response, list, "种公羊档案数据");
}
/**
* 获取种公羊档案详细信息
*/
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(breedRamFileService.selectBreedRamFileById(id));
}
/**
* 新增种公羊档案
*/
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:add')")
@Log(title = "种公羊档案", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BreedRamFile breedRamFile)
{
return toAjax(breedRamFileService.insertBreedRamFile(breedRamFile));
}
/**
* 修改种公羊档案
*/
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:edit')")
@Log(title = "种公羊档案", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BreedRamFile breedRamFile)
{
return toAjax(breedRamFileService.updateBreedRamFile(breedRamFile));
}
/**
* 删除种公羊档案
*/
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:remove')")
@Log(title = "种公羊档案", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(breedRamFileService.deleteBreedRamFileByIds(ids));
}
}

View File

@ -41,4 +41,7 @@ public class BasSheepGroup extends TreeEntity
@Excel(name = "祖级列表名称")
private String ancestorNames;
private Integer isLeaf;
}

View File

@ -0,0 +1,890 @@
package com.zhyc.module.base.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 种公羊档案对象 breed_ram_file
*
* @author zhyc
* @date 2025-07-29
*/
public class BreedRamFile extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 种公羊id */
private Long id;
/** 普通耳号 */
@Excel(name = "普通耳号")
private String ordinaryEarNumber;
/** 牧场id */
@Excel(name = "牧场id")
private Long ranchId;
/** 牧场名称 */
@Excel(name = "牧场名称")
private String ranchName;
/** 羊舍id */
@Excel(name = "羊舍id")
private Long sheepfoldId;
/** 羊舍名称 */
@Excel(name = "羊舍名称")
private String sheepfoldName;
/** 电子耳号 */
@Excel(name = "电子耳号")
private String electronicTags;
/** 品种id */
@Excel(name = "品种id")
private Long varietyId;
/** 品种 */
@Excel(name = "品种")
private String variety;
/** 羊只类别 */
@Excel(name = "羊只类别")
private String sheepCategory;
/** 当前状态 */
@Excel(name = "当前状态")
private String currentStatus;
/** 生日 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
private Date birthday;
/** 动态 */
@Excel(name = "动态")
private String dynamicInfo;
/** 月龄 */
@Excel(name = "月龄")
private Long monthAge;
/** 出生体重 */
@Excel(name = "出生体重")
private BigDecimal birthWeight;
/** 断奶日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "断奶日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date weaningDate;
/** 断奶日龄 */
@Excel(name = "断奶日龄")
private Long weaningDayAge;
/** 断奶体重 */
@Excel(name = "断奶体重")
private BigDecimal weaningWeight;
/** 断奶日增重 */
@Excel(name = "断奶日增重")
private BigDecimal weaningDailyGain;
/** 断奶后日增重 */
@Excel(name = "断奶后日增重")
private BigDecimal postWeaningDailyGain;
/** 当前体重 */
@Excel(name = "当前体重")
private BigDecimal currentWeight;
/** 当前体重称重日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "当前体重称重日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date currentWeightDate;
/** 活动量 */
@Excel(name = "活动量")
private String activityLevel;
/** 性欲情况 */
@Excel(name = "性欲情况")
private String sexualStatus;
/** 阴囊周长 */
@Excel(name = "阴囊周长")
private BigDecimal scrotumCircumference;
/** 采精时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "采精时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date spermCollectionTime;
/** 精液量 */
@Excel(name = "精液量")
private BigDecimal spermVolume;
/** 精液活力 */
@Excel(name = "精液活力")
private String spermVitality;
/** 精液密度 */
@Excel(name = "精液密度")
private String spermDensity;
/** 精液品质 */
@Excel(name = "精液品质")
private String spermQuality;
/** 配种状态 */
@Excel(name = "配种状态")
private Long breedingStatus;
/** 上次计划时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上次计划时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastPlanTime;
/** 本次计划时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "本次计划时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date currentPlanTime;
/** 蛋白率%EBV */
@Excel(name = "蛋白率%EBV")
private BigDecimal proteinRateEbv;
/** 乳脂率%EBV */
@Excel(name = "乳脂率%EBV")
private BigDecimal milkFatRateEbv;
/** 乳体细胞SCSEBV */
@Excel(name = "乳体细胞", readConverterExp = "S=CS")
private BigDecimal scsEbv;
/** 生长性能EBV */
@Excel(name = "生长性能EBV")
private BigDecimal growthPerformanceEbv;
/** 抗逆性EBV */
@Excel(name = "抗逆性EBV")
private BigDecimal resistanceEbv;
/** 繁殖性能EBV */
@Excel(name = "繁殖性能EBV")
private BigDecimal reproductionPerformanceEbv;
/** 体型性状EBV */
@Excel(name = "体型性状EBV")
private BigDecimal bodyTypeEbv;
/** 综合育种值 */
@Excel(name = "综合育种值")
private BigDecimal comprehensiveBreedingValue;
/** 父号 */
@Excel(name = "父号")
private String fatherNumber;
/** 母号 */
@Excel(name = "母号")
private String motherNumber;
/** 祖父 */
@Excel(name = "祖父")
private String grandfatherNumber;
/** 祖母 */
@Excel(name = "祖母")
private String grandmotherNumber;
/** 外祖父 */
@Excel(name = "外祖父")
private String maternalGrandfatherNumber;
/** 外祖母 */
@Excel(name = "外祖母")
private String maternalGrandmotherNumber;
/** 是否核心羊群0否1是 */
@Excel(name = "是否核心羊群", readConverterExp = "0=否,1=是")
private Long isCoreFlock;
/** 是否种用0否1是 */
@Excel(name = "是否种用", readConverterExp = "0=否,1=是")
private Long isBreedingUse;
/** 孕检 */
@Excel(name = "孕检")
private String pregnancyCheck;
/** 总配母羊数 */
@Excel(name = "总配母羊数")
private Long totalMatedEwes;
/** 本交孕检母羊数 */
@Excel(name = "本交孕检母羊数")
private Long naturalPregnancyCheckEwes;
/** 本交受孕率% */
@Excel(name = "本交受孕率%")
private BigDecimal naturalConceptionRate;
/** 人工孕检母羊数 */
@Excel(name = "人工孕检母羊数")
private Long artificialPregnancyCheckEwes;
/** 人工受孕率% */
@Excel(name = "人工受孕率%")
private BigDecimal artificialConceptionRate;
/** 公羊母亲奶量 */
@Excel(name = "公羊母亲奶量")
private BigDecimal ramMotherMilkVolume;
/** 产奶量估计育种值Kg */
@Excel(name = "产奶量估计育种值", readConverterExp = "K=g")
private BigDecimal milkProductionEbv;
/** 准确性 */
@Excel(name = "准确性")
private BigDecimal accuracy;
/** 信息数 */
@Excel(name = "信息数")
private Long informationCount;
/** 是否亲子鉴定0否1是 */
@Excel(name = "是否亲子鉴定", readConverterExp = "0=否,1=是")
private Long isPaternityTested;
/** 是否删除0否1是 */
private Long isDelete;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setOrdinaryEarNumber(String ordinaryEarNumber)
{
this.ordinaryEarNumber = ordinaryEarNumber;
}
public String getOrdinaryEarNumber()
{
return ordinaryEarNumber;
}
public void setRanchId(Long ranchId)
{
this.ranchId = ranchId;
}
public Long getRanchId()
{
return ranchId;
}
public void setRanchName(String ranchName)
{
this.ranchName = ranchName;
}
public String getRanchName()
{
return ranchName;
}
public void setSheepfoldId(Long sheepfoldId)
{
this.sheepfoldId = sheepfoldId;
}
public Long getSheepfoldId()
{
return sheepfoldId;
}
public void setSheepfoldName(String sheepfoldName)
{
this.sheepfoldName = sheepfoldName;
}
public String getSheepfoldName()
{
return sheepfoldName;
}
public void setElectronicTags(String electronicTags)
{
this.electronicTags = electronicTags;
}
public String getElectronicTags()
{
return electronicTags;
}
public void setVarietyId(Long varietyId)
{
this.varietyId = varietyId;
}
public Long getVarietyId()
{
return varietyId;
}
public void setVariety(String variety)
{
this.variety = variety;
}
public String getVariety()
{
return variety;
}
public void setSheepCategory(String sheepCategory)
{
this.sheepCategory = sheepCategory;
}
public String getSheepCategory()
{
return sheepCategory;
}
public void setCurrentStatus(String currentStatus)
{
this.currentStatus = currentStatus;
}
public String getCurrentStatus()
{
return currentStatus;
}
public void setBirthday(Date birthday)
{
this.birthday = birthday;
}
public Date getBirthday()
{
return birthday;
}
public void setDynamicInfo(String dynamicInfo)
{
this.dynamicInfo = dynamicInfo;
}
public String getDynamicInfo()
{
return dynamicInfo;
}
public void setMonthAge(Long monthAge)
{
this.monthAge = monthAge;
}
public Long getMonthAge()
{
return monthAge;
}
public void setBirthWeight(BigDecimal birthWeight)
{
this.birthWeight = birthWeight;
}
public BigDecimal getBirthWeight()
{
return birthWeight;
}
public void setWeaningDate(Date weaningDate)
{
this.weaningDate = weaningDate;
}
public Date getWeaningDate()
{
return weaningDate;
}
public void setWeaningDayAge(Long weaningDayAge)
{
this.weaningDayAge = weaningDayAge;
}
public Long getWeaningDayAge()
{
return weaningDayAge;
}
public void setWeaningWeight(BigDecimal weaningWeight)
{
this.weaningWeight = weaningWeight;
}
public BigDecimal getWeaningWeight()
{
return weaningWeight;
}
public void setWeaningDailyGain(BigDecimal weaningDailyGain)
{
this.weaningDailyGain = weaningDailyGain;
}
public BigDecimal getWeaningDailyGain()
{
return weaningDailyGain;
}
public void setPostWeaningDailyGain(BigDecimal postWeaningDailyGain)
{
this.postWeaningDailyGain = postWeaningDailyGain;
}
public BigDecimal getPostWeaningDailyGain()
{
return postWeaningDailyGain;
}
public void setCurrentWeight(BigDecimal currentWeight)
{
this.currentWeight = currentWeight;
}
public BigDecimal getCurrentWeight()
{
return currentWeight;
}
public void setCurrentWeightDate(Date currentWeightDate)
{
this.currentWeightDate = currentWeightDate;
}
public Date getCurrentWeightDate()
{
return currentWeightDate;
}
public void setActivityLevel(String activityLevel)
{
this.activityLevel = activityLevel;
}
public String getActivityLevel()
{
return activityLevel;
}
public void setSexualStatus(String sexualStatus)
{
this.sexualStatus = sexualStatus;
}
public String getSexualStatus()
{
return sexualStatus;
}
public void setScrotumCircumference(BigDecimal scrotumCircumference)
{
this.scrotumCircumference = scrotumCircumference;
}
public BigDecimal getScrotumCircumference()
{
return scrotumCircumference;
}
public void setSpermCollectionTime(Date spermCollectionTime)
{
this.spermCollectionTime = spermCollectionTime;
}
public Date getSpermCollectionTime()
{
return spermCollectionTime;
}
public void setSpermVolume(BigDecimal spermVolume)
{
this.spermVolume = spermVolume;
}
public BigDecimal getSpermVolume()
{
return spermVolume;
}
public void setSpermVitality(String spermVitality)
{
this.spermVitality = spermVitality;
}
public String getSpermVitality()
{
return spermVitality;
}
public void setSpermDensity(String spermDensity)
{
this.spermDensity = spermDensity;
}
public String getSpermDensity()
{
return spermDensity;
}
public void setSpermQuality(String spermQuality)
{
this.spermQuality = spermQuality;
}
public String getSpermQuality()
{
return spermQuality;
}
public void setBreedingStatus(Long breedingStatus)
{
this.breedingStatus = breedingStatus;
}
public Long getBreedingStatus()
{
return breedingStatus;
}
public void setLastPlanTime(Date lastPlanTime)
{
this.lastPlanTime = lastPlanTime;
}
public Date getLastPlanTime()
{
return lastPlanTime;
}
public void setCurrentPlanTime(Date currentPlanTime)
{
this.currentPlanTime = currentPlanTime;
}
public Date getCurrentPlanTime()
{
return currentPlanTime;
}
public void setProteinRateEbv(BigDecimal proteinRateEbv)
{
this.proteinRateEbv = proteinRateEbv;
}
public BigDecimal getProteinRateEbv()
{
return proteinRateEbv;
}
public void setMilkFatRateEbv(BigDecimal milkFatRateEbv)
{
this.milkFatRateEbv = milkFatRateEbv;
}
public BigDecimal getMilkFatRateEbv()
{
return milkFatRateEbv;
}
public void setScsEbv(BigDecimal scsEbv)
{
this.scsEbv = scsEbv;
}
public BigDecimal getScsEbv()
{
return scsEbv;
}
public void setGrowthPerformanceEbv(BigDecimal growthPerformanceEbv)
{
this.growthPerformanceEbv = growthPerformanceEbv;
}
public BigDecimal getGrowthPerformanceEbv()
{
return growthPerformanceEbv;
}
public void setResistanceEbv(BigDecimal resistanceEbv)
{
this.resistanceEbv = resistanceEbv;
}
public BigDecimal getResistanceEbv()
{
return resistanceEbv;
}
public void setReproductionPerformanceEbv(BigDecimal reproductionPerformanceEbv)
{
this.reproductionPerformanceEbv = reproductionPerformanceEbv;
}
public BigDecimal getReproductionPerformanceEbv()
{
return reproductionPerformanceEbv;
}
public void setBodyTypeEbv(BigDecimal bodyTypeEbv)
{
this.bodyTypeEbv = bodyTypeEbv;
}
public BigDecimal getBodyTypeEbv()
{
return bodyTypeEbv;
}
public void setComprehensiveBreedingValue(BigDecimal comprehensiveBreedingValue)
{
this.comprehensiveBreedingValue = comprehensiveBreedingValue;
}
public BigDecimal getComprehensiveBreedingValue()
{
return comprehensiveBreedingValue;
}
public void setFatherNumber(String fatherNumber)
{
this.fatherNumber = fatherNumber;
}
public String getFatherNumber()
{
return fatherNumber;
}
public void setMotherNumber(String motherNumber)
{
this.motherNumber = motherNumber;
}
public String getMotherNumber()
{
return motherNumber;
}
public void setGrandfatherNumber(String grandfatherNumber)
{
this.grandfatherNumber = grandfatherNumber;
}
public String getGrandfatherNumber()
{
return grandfatherNumber;
}
public void setGrandmotherNumber(String grandmotherNumber)
{
this.grandmotherNumber = grandmotherNumber;
}
public String getGrandmotherNumber()
{
return grandmotherNumber;
}
public void setMaternalGrandfatherNumber(String maternalGrandfatherNumber)
{
this.maternalGrandfatherNumber = maternalGrandfatherNumber;
}
public String getMaternalGrandfatherNumber()
{
return maternalGrandfatherNumber;
}
public void setMaternalGrandmotherNumber(String maternalGrandmotherNumber)
{
this.maternalGrandmotherNumber = maternalGrandmotherNumber;
}
public String getMaternalGrandmotherNumber()
{
return maternalGrandmotherNumber;
}
public void setIsCoreFlock(Long isCoreFlock)
{
this.isCoreFlock = isCoreFlock;
}
public Long getIsCoreFlock()
{
return isCoreFlock;
}
public void setIsBreedingUse(Long isBreedingUse)
{
this.isBreedingUse = isBreedingUse;
}
public Long getIsBreedingUse()
{
return isBreedingUse;
}
public void setPregnancyCheck(String pregnancyCheck)
{
this.pregnancyCheck = pregnancyCheck;
}
public String getPregnancyCheck()
{
return pregnancyCheck;
}
public void setTotalMatedEwes(Long totalMatedEwes)
{
this.totalMatedEwes = totalMatedEwes;
}
public Long getTotalMatedEwes()
{
return totalMatedEwes;
}
public void setNaturalPregnancyCheckEwes(Long naturalPregnancyCheckEwes)
{
this.naturalPregnancyCheckEwes = naturalPregnancyCheckEwes;
}
public Long getNaturalPregnancyCheckEwes()
{
return naturalPregnancyCheckEwes;
}
public void setNaturalConceptionRate(BigDecimal naturalConceptionRate)
{
this.naturalConceptionRate = naturalConceptionRate;
}
public BigDecimal getNaturalConceptionRate()
{
return naturalConceptionRate;
}
public void setArtificialPregnancyCheckEwes(Long artificialPregnancyCheckEwes)
{
this.artificialPregnancyCheckEwes = artificialPregnancyCheckEwes;
}
public Long getArtificialPregnancyCheckEwes()
{
return artificialPregnancyCheckEwes;
}
public void setArtificialConceptionRate(BigDecimal artificialConceptionRate)
{
this.artificialConceptionRate = artificialConceptionRate;
}
public BigDecimal getArtificialConceptionRate()
{
return artificialConceptionRate;
}
public void setRamMotherMilkVolume(BigDecimal ramMotherMilkVolume)
{
this.ramMotherMilkVolume = ramMotherMilkVolume;
}
public BigDecimal getRamMotherMilkVolume()
{
return ramMotherMilkVolume;
}
public void setMilkProductionEbv(BigDecimal milkProductionEbv)
{
this.milkProductionEbv = milkProductionEbv;
}
public BigDecimal getMilkProductionEbv()
{
return milkProductionEbv;
}
public void setAccuracy(BigDecimal accuracy)
{
this.accuracy = accuracy;
}
public BigDecimal getAccuracy()
{
return accuracy;
}
public void setInformationCount(Long informationCount)
{
this.informationCount = informationCount;
}
public Long getInformationCount()
{
return informationCount;
}
public void setIsPaternityTested(Long isPaternityTested)
{
this.isPaternityTested = isPaternityTested;
}
public Long getIsPaternityTested()
{
return isPaternityTested;
}
public void setIsDelete(Long isDelete)
{
this.isDelete = isDelete;
}
public Long getIsDelete()
{
return isDelete;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("ordinaryEarNumber", getOrdinaryEarNumber())
.append("ranchId", getRanchId())
.append("ranchName", getRanchName())
.append("sheepfoldId", getSheepfoldId())
.append("sheepfoldName", getSheepfoldName())
.append("electronicTags", getElectronicTags())
.append("varietyId", getVarietyId())
.append("variety", getVariety())
.append("sheepCategory", getSheepCategory())
.append("currentStatus", getCurrentStatus())
.append("birthday", getBirthday())
.append("dynamicInfo", getDynamicInfo())
.append("monthAge", getMonthAge())
.append("birthWeight", getBirthWeight())
.append("weaningDate", getWeaningDate())
.append("weaningDayAge", getWeaningDayAge())
.append("weaningWeight", getWeaningWeight())
.append("weaningDailyGain", getWeaningDailyGain())
.append("postWeaningDailyGain", getPostWeaningDailyGain())
.append("currentWeight", getCurrentWeight())
.append("currentWeightDate", getCurrentWeightDate())
.append("activityLevel", getActivityLevel())
.append("sexualStatus", getSexualStatus())
.append("scrotumCircumference", getScrotumCircumference())
.append("spermCollectionTime", getSpermCollectionTime())
.append("spermVolume", getSpermVolume())
.append("spermVitality", getSpermVitality())
.append("spermDensity", getSpermDensity())
.append("spermQuality", getSpermQuality())
.append("breedingStatus", getBreedingStatus())
.append("lastPlanTime", getLastPlanTime())
.append("currentPlanTime", getCurrentPlanTime())
.append("remark", getRemark())
.append("proteinRateEbv", getProteinRateEbv())
.append("milkFatRateEbv", getMilkFatRateEbv())
.append("scsEbv", getScsEbv())
.append("growthPerformanceEbv", getGrowthPerformanceEbv())
.append("resistanceEbv", getResistanceEbv())
.append("reproductionPerformanceEbv", getReproductionPerformanceEbv())
.append("bodyTypeEbv", getBodyTypeEbv())
.append("comprehensiveBreedingValue", getComprehensiveBreedingValue())
.append("fatherNumber", getFatherNumber())
.append("motherNumber", getMotherNumber())
.append("grandfatherNumber", getGrandfatherNumber())
.append("grandmotherNumber", getGrandmotherNumber())
.append("maternalGrandfatherNumber", getMaternalGrandfatherNumber())
.append("maternalGrandmotherNumber", getMaternalGrandmotherNumber())
.append("isCoreFlock", getIsCoreFlock())
.append("isBreedingUse", getIsBreedingUse())
.append("pregnancyCheck", getPregnancyCheck())
.append("totalMatedEwes", getTotalMatedEwes())
.append("naturalPregnancyCheckEwes", getNaturalPregnancyCheckEwes())
.append("naturalConceptionRate", getNaturalConceptionRate())
.append("artificialPregnancyCheckEwes", getArtificialPregnancyCheckEwes())
.append("artificialConceptionRate", getArtificialConceptionRate())
.append("ramMotherMilkVolume", getRamMotherMilkVolume())
.append("milkProductionEbv", getMilkProductionEbv())
.append("accuracy", getAccuracy())
.append("informationCount", getInformationCount())
.append("isPaternityTested", getIsPaternityTested())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("isDelete", getIsDelete())
.toString();
}
}

View File

@ -0,0 +1,109 @@
package com.zhyc.module.base.mapper;
import java.util.List;
import com.zhyc.module.base.domain.BreedRamFile;
/**
* 种公羊档案Mapper接口
*
* @author zhyc
* @date 2025-07-29
*/
public interface BreedRamFileMapper
{
/**
* 查询种公羊档案
*
* @param id 种公羊档案主键
* @return 种公羊档案
*/
public BreedRamFile selectBreedRamFileById(Long id);
/**
* 查询种公羊档案列表
*
* @param breedRamFile 种公羊档案
* @return 种公羊档案集合
*/
public List<BreedRamFile> selectBreedRamFileList(BreedRamFile breedRamFile);
/**
* 新增种公羊档案
*
* @param breedRamFile 种公羊档案
* @return 结果
*/
public int insertBreedRamFile(BreedRamFile breedRamFile);
/**
* 修改种公羊档案
*
* @param breedRamFile 种公羊档案
* @return 结果
*/
public int updateBreedRamFile(BreedRamFile breedRamFile);
/**
* 删除种公羊档案
*
* @param id 种公羊档案主键
* @return 结果
*/
public int deleteBreedRamFileById(Long id);
/**
* 批量删除种公羊档案
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBreedRamFileByIds(Long[] ids);
/**
* 根据普通耳号查询种公羊档案
*
* @param ordinaryEarNumber 普通耳号
* @return 种公羊档案
*/
public BreedRamFile selectBreedRamFileByOrdinaryEarNumber(String ordinaryEarNumber);
/**
* 根据电子耳号查询种公羊档案
*
* @param electronicTags 电子耳号
* @return 种公羊档案
*/
public BreedRamFile selectBreedRamFileByElectronicTags(String electronicTags);
/**
* 根据牧场ID查询种公羊档案列表
*
* @param ranchId 牧场ID
* @return 种公羊档案集合
*/
public List<BreedRamFile> selectBreedRamFileListByRanchId(Long ranchId);
/**
* 根据羊舍ID查询种公羊档案列表
*
* @param sheepfoldId 羊舍ID
* @return 种公羊档案集合
*/
public List<BreedRamFile> selectBreedRamFileListBySheepfoldId(Long sheepfoldId);
/**
* 查询核心羊群种公羊档案列表
*
* @param breedRamFile 种公羊档案
* @return 种公羊档案集合
*/
public List<BreedRamFile> selectCoreFlockBreedRamFileList(BreedRamFile breedRamFile);
/**
* 查询种用种公羊档案列表
*
* @param breedRamFile 种公羊档案
* @return 种公羊档案集合
*/
public List<BreedRamFile> selectBreedingUseBreedRamFileList(BreedRamFile breedRamFile);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.base.service;
import java.util.List;
import com.zhyc.module.base.domain.BreedRamFile;
/**
* 种公羊档案Service接口
*
* @author zhyc
* @date 2025-07-29
*/
public interface IBreedRamFileService
{
/**
* 查询种公羊档案
*
* @param id 种公羊档案主键
* @return 种公羊档案
*/
public BreedRamFile selectBreedRamFileById(Long id);
/**
* 查询种公羊档案列表
*
* @param breedRamFile 种公羊档案
* @return 种公羊档案集合
*/
public List<BreedRamFile> selectBreedRamFileList(BreedRamFile breedRamFile);
/**
* 新增种公羊档案
*
* @param breedRamFile 种公羊档案
* @return 结果
*/
public int insertBreedRamFile(BreedRamFile breedRamFile);
/**
* 修改种公羊档案
*
* @param breedRamFile 种公羊档案
* @return 结果
*/
public int updateBreedRamFile(BreedRamFile breedRamFile);
/**
* 批量删除种公羊档案
*
* @param ids 需要删除的种公羊档案主键集合
* @return 结果
*/
public int deleteBreedRamFileByIds(Long[] ids);
/**
* 删除种公羊档案信息
*
* @param id 种公羊档案主键
* @return 结果
*/
public int deleteBreedRamFileById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.zhyc.module.base.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.base.mapper.BreedRamFileMapper;
import com.zhyc.module.base.domain.BreedRamFile;
import com.zhyc.module.base.service.IBreedRamFileService;
/**
* 种公羊档案Service业务层处理
*
* @author zhyc
* @date 2025-07-29
*/
@Service
public class BreedRamFileServiceImpl implements IBreedRamFileService
{
@Autowired
private BreedRamFileMapper breedRamFileMapper;
/**
* 查询种公羊档案
*
* @param id 种公羊档案主键
* @return 种公羊档案
*/
@Override
public BreedRamFile selectBreedRamFileById(Long id)
{
return breedRamFileMapper.selectBreedRamFileById(id);
}
/**
* 查询种公羊档案列表
*
* @param breedRamFile 种公羊档案
* @return 种公羊档案
*/
@Override
public List<BreedRamFile> selectBreedRamFileList(BreedRamFile breedRamFile)
{
return breedRamFileMapper.selectBreedRamFileList(breedRamFile);
}
/**
* 新增种公羊档案
*
* @param breedRamFile 种公羊档案
* @return 结果
*/
@Override
public int insertBreedRamFile(BreedRamFile breedRamFile)
{
breedRamFile.setCreateTime(DateUtils.getNowDate());
return breedRamFileMapper.insertBreedRamFile(breedRamFile);
}
/**
* 修改种公羊档案
*
* @param breedRamFile 种公羊档案
* @return 结果
*/
@Override
public int updateBreedRamFile(BreedRamFile breedRamFile)
{
breedRamFile.setUpdateTime(DateUtils.getNowDate());
return breedRamFileMapper.updateBreedRamFile(breedRamFile);
}
/**
* 批量删除种公羊档案
*
* @param ids 需要删除的种公羊档案主键
* @return 结果
*/
@Override
public int deleteBreedRamFileByIds(Long[] ids)
{
return breedRamFileMapper.deleteBreedRamFileByIds(ids);
}
/**
* 删除种公羊档案信息
*
* @param id 种公羊档案主键
* @return 结果
*/
@Override
public int deleteBreedRamFileById(Long id)
{
return breedRamFileMapper.deleteBreedRamFileById(id);
}
}

View File

@ -0,0 +1,70 @@
package com.zhyc.module.dairyProducts.controller;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
import com.zhyc.module.dairyProducts.service.INpMilkInOutStoreService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/milkInOutStore")
public class NpMilkInOutStoreController extends BaseController {
@Autowired
private INpMilkInOutStoreService service;
/** 查询(日期区间)+ 动态列 */
@PreAuthorize("@ss.hasPermi('milkInOutStore:list')")
@GetMapping("/list")
public TableDataInfo list(
@RequestParam(required=false) Date datetimeStart,
@RequestParam(required=false) Date datetimeEnd
) {
startPage();
List<Map<String, Object>> rows = service.selectWithDynamicColumns(datetimeStart, datetimeEnd);
return getDataTable(rows);
}
/** 导入 Excel */
@Log(title="导入羊奶出入库", businessType=BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('milkInOutStore:import')")
@PostMapping("/import")
public AjaxResult importExcel(@RequestParam("file") MultipartFile file) throws Exception {
List<Map<String,Object>> list = service.parseImportExcel(file);
service.batchInsertFromRows(list);
return AjaxResult.success("导入成功");
}
/** 导出 Excel */
@PreAuthorize("@ss.hasPermi('milkInOutStore:export')")
@Log(title="导出羊奶出入库", businessType=BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response,
@RequestParam(required=false) Date datetimeStart,
@RequestParam(required=false) Date datetimeEnd
) {
List<Map<String,Object>> rows = service.selectWithDynamicColumns(datetimeStart, datetimeEnd);
// 解决方案强制转换并压制警告
@SuppressWarnings("unchecked")
ExcelUtil<Map<String,Object>> util = new ExcelUtil<>((Class<Map<String,Object>>) (Class<?>) Map.class);
}
/** 获取可选列定义(饲喂来源 + 销售去向) */
@PreAuthorize("@ss.hasPermi('milkInOutStore:cols')")
@GetMapping("/columns")
public AjaxResult getColumns(){
return AjaxResult.success(service.getAllColumnOptions());
}
}

View File

@ -0,0 +1,69 @@
package com.zhyc.module.dairyProducts.controller;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.core.page.TableDataInfo;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.module.dairyProducts.domain.NpMilkProdClasses;
import com.zhyc.module.dairyProducts.service.INpMilkProdClassesService;
@RestController
@RequestMapping("/milkProdclasses/milkProdclasses")
public class NpMilkProdClassesController extends BaseController {
@Autowired
private INpMilkProdClassesService npMilkProdClassesService;
@PreAuthorize("@ss.hasPermi('milkProdclasses:milkProdclasses:list')")
@GetMapping("/list")
public TableDataInfo list(
@RequestParam(required = false) Date datetimeStart,
@RequestParam(required = false) Date datetimeEnd,
@RequestParam(required = false) String manageEarNo, // 改为单个字符串模糊
@RequestParam(required = false) String factory,
@RequestParam(required = false) Integer classes) {
startPage();
List<NpMilkProdClasses> list = npMilkProdClassesService
.selectNpMilkProdClassesList(datetimeStart, datetimeEnd,
manageEarNo, factory, classes);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('milkProdclasses:milkProdclasses:import')")
@Log(title = "班次产奶", businessType = BusinessType.IMPORT)
@PostMapping("/import")
public AjaxResult importData(MultipartFile file) {
try {
ExcelUtil<NpMilkProdClasses> util = new ExcelUtil<>(NpMilkProdClasses.class);
List<NpMilkProdClasses> list = util.importExcel(file.getInputStream());
int rows = npMilkProdClassesService.importMilkProdClasses(list);
return success("成功导入 " + rows + " 行数据");
} catch (Exception e) {
return error("导入失败:" + e.getMessage());
}
}
@PreAuthorize("@ss.hasPermi('milkProdclasses:milkProdclasses:export')")
@Log(title = "班次产奶", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response,
@RequestParam(required = false) Date datetimeStart,
@RequestParam(required = false) Date datetimeEnd,
@RequestParam(required = false) String manageEarNos,
@RequestParam(required = false) String factory,
@RequestParam(required = false) Integer classes) {
List<NpMilkProdClasses> list = npMilkProdClassesService.selectNpMilkProdClassesList(datetimeStart, datetimeEnd, manageEarNos, factory, classes);
ExcelUtil<NpMilkProdClasses> util = new ExcelUtil<>(NpMilkProdClasses.class);
util.exportExcel(response, list, "班次产奶数据");
}
}

View File

@ -0,0 +1,79 @@
package com.zhyc.module.dairyProducts.controller;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.core.page.TableDataInfo;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis;
import com.zhyc.module.dairyProducts.service.INpSheepMilkAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/dairyProducts/sheepMilkAnalysis")
public class NpSheepMilkAnalysisController extends BaseController {
@Autowired
private INpSheepMilkAnalysisService npSheepMilkAnalysisService;
/**
* 查询奶产量分析列表
*/
@GetMapping("/list")
public TableDataInfo list(NpSheepMilkAnalysis analysis) {
startPage();
List<NpSheepMilkAnalysis> list = npSheepMilkAnalysisService.selectNpSheepMilkAnalysisList(analysis);
return getDataTable(list);
}
/**
* 获取单个分析记录详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(npSheepMilkAnalysisService.selectNpSheepMilkAnalysisById(id));
}
/**
* 新增奶产量分析记录
*/
@Log(title = "奶产量分析", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody NpSheepMilkAnalysis analysis) {
return toAjax(npSheepMilkAnalysisService.insertNpSheepMilkAnalysis(analysis));
}
/**
* 修改奶产量分析记录
*/
@Log(title = "奶产量分析", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody NpSheepMilkAnalysis analysis) {
return toAjax(npSheepMilkAnalysisService.updateNpSheepMilkAnalysis(analysis));
}
/**
* 删除奶产量分析记录
*/
@Log(title = "奶产量分析", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(npSheepMilkAnalysisService.deleteNpSheepMilkAnalysisByIds(ids));
}
/**
* 导出奶产量分析记录
*/
@Log(title = "奶产量分析", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(NpSheepMilkAnalysis analysis) {
List<NpSheepMilkAnalysis> list = npSheepMilkAnalysisService.selectNpSheepMilkAnalysisList(analysis);
ExcelUtil<NpSheepMilkAnalysis> util = new ExcelUtil<>(NpSheepMilkAnalysis.class);
return util.exportExcel(list, "奶产量分析数据");
}
}

View File

@ -0,0 +1,23 @@
package com.zhyc.module.dairyProducts.controller;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.module.dairyProducts.domain.Ranch;
import com.zhyc.module.dairyProducts.service.IRanchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/dairyProducts/ranch")
public class RanchController extends BaseController {
@Autowired
private IRanchService ranchService;
@GetMapping("/list")
public AjaxResult list() {
return success(ranchService.selectAllRanch());
}
}

View File

@ -38,12 +38,20 @@ public class XzParityCorrectionController extends BaseController
* 查询胎次校正列表
*/
@PreAuthorize("@ss.hasPermi('parityCorrection:parityCorrection:list')")
@GetMapping("/list")
public TableDataInfo list(XzParityCorrection xzParityCorrection)
{
startPage();
// @GetMapping("/list")
// public TableDataInfo list(XzParityCorrection xzParityCorrection)
// {
// startPage();
// List<XzParityCorrection> list = xzParityCorrectionService.selectXzParityCorrectionList(xzParityCorrection);
// return getDataTable(list);
// }
/**
* 获取全部胎次校正无需分页供下拉/列表直接显示
*/
@GetMapping("/listAll")
public AjaxResult listAll(XzParityCorrection xzParityCorrection){
List<XzParityCorrection> list = xzParityCorrectionService.selectXzParityCorrectionList(xzParityCorrection);
return getDataTable(list);
return success(list); // 直接返回数组
}
/**

View File

@ -0,0 +1,128 @@
package com.zhyc.module.dairyProducts.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
public class NpMilkInOutStore extends BaseEntity {
private Integer id;
@Excel(name = "日期")
private Date datetime;
@Excel(name = "羊数")
private Integer num;
@Excel(name = "初乳羊")
private Integer colostSheep;
@Excel(name = "商乳入库")
private BigDecimal commercialIntake;
@Excel(name = "抗乳入库")
private BigDecimal antiIntake;
@Excel(name = "初乳入库")
private BigDecimal colostIntake;
@Excel(name = "入库小计")
private BigDecimal intakeTotal;
@Excel(name = "商乳实验用奶")
private BigDecimal commercialTest;
@Excel(name = "初乳实验用奶")
private BigDecimal colostTest;
@Excel(name = "商乳调拨出库")
private BigDecimal transferCommercial;
@Excel(name = "抗乳调拨出库")
private BigDecimal transferAnti;
@Excel(name = "初乳调拨出库")
private BigDecimal transferColost;
@Excel(name = "调拨小计")
private BigDecimal transferTotal;
@Excel(name = "损耗")
private BigDecimal loss;
@Excel(name = "商乳库存")
private BigDecimal stockCommercial;
@Excel(name = "抗乳库存")
private BigDecimal stockAnti;
@Excel(name = "初乳库存")
private BigDecimal colost;
@Excel(name = "爱特退回鲜奶")
private BigDecimal returnFresh;
@Excel(name = "爱特退回酸奶")
private BigDecimal returnYogurt;
// --- getters and setters ---
public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
public Date getDatetime() { return datetime; }
public void setDatetime(Date datetime) { this.datetime = datetime; }
public Integer getNum() { return num; }
public void setNum(Integer num) { this.num = num; }
public Integer getColostSheep() { return colostSheep; }
public void setColostSheep(Integer colostSheep) { this.colostSheep = colostSheep; }
public BigDecimal getCommercialIntake() { return commercialIntake; }
public void setCommercialIntake(BigDecimal commercialIntake) { this.commercialIntake = commercialIntake; }
public BigDecimal getAntiIntake() { return antiIntake; }
public void setAntiIntake(BigDecimal antiIntake) { this.antiIntake = antiIntake; }
public BigDecimal getColostIntake() { return colostIntake; }
public void setColostIntake(BigDecimal colostIntake) { this.colostIntake = colostIntake; }
public BigDecimal getIntakeTotal() { return intakeTotal; }
public void setIntakeTotal(BigDecimal intakeTotal) { this.intakeTotal = intakeTotal; }
public BigDecimal getCommercialTest() { return commercialTest; }
public void setCommercialTest(BigDecimal commercialTest) { this.commercialTest = commercialTest; }
public BigDecimal getColostTest() { return colostTest; }
public void setColostTest(BigDecimal colostTest) { this.colostTest = colostTest; }
public BigDecimal getTransferCommercial() { return transferCommercial; }
public void setTransferCommercial(BigDecimal transferCommercial) { this.transferCommercial = transferCommercial; }
public BigDecimal getTransferAnti() { return transferAnti; }
public void setTransferAnti(BigDecimal transferAnti) { this.transferAnti = transferAnti; }
public BigDecimal getTransferColost() { return transferColost; }
public void setTransferColost(BigDecimal transferColost) { this.transferColost = transferColost; }
public BigDecimal getTransferTotal() { return transferTotal; }
public void setTransferTotal(BigDecimal transferTotal) { this.transferTotal = transferTotal; }
public BigDecimal getLoss() { return loss; }
public void setLoss(BigDecimal loss) { this.loss = loss; }
public BigDecimal getStockCommercial() { return stockCommercial; }
public void setStockCommercial(BigDecimal stockCommercial) { this.stockCommercial = stockCommercial; }
public BigDecimal getStockAnti() { return stockAnti; }
public void setStockAnti(BigDecimal stockAnti) { this.stockAnti = stockAnti; }
public BigDecimal getColost() { return colost; }
public void setColost(BigDecimal colost) { this.colost = colost; }
public BigDecimal getReturnFresh() { return returnFresh; }
public void setReturnFresh(BigDecimal returnFresh) { this.returnFresh = returnFresh; }
public BigDecimal getReturnYogurt() { return returnYogurt; }
public void setReturnYogurt(BigDecimal returnYogurt) { this.returnYogurt = returnYogurt; }
}

View File

@ -0,0 +1,80 @@
package com.zhyc.module.dairyProducts.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhyc.common.annotation.Excel;
public class NpMilkProdClasses implements Serializable {
private static final long serialVersionUID = 1L;
private Long id; // 主键ID
private Date createTime; // 创建时间
private Date updateTime; // 更新时间
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "日期")
private Date datetime;
@Excel(name = "管理耳号")
private String manageEarNo;
@Excel(name = "电子耳号")
private String electronicEarNo;
@Excel(name = "胎次")
private Integer parity;
@Excel(name = "厂区")
private String factory;
@Excel(name = "班次")
private Integer classes;
@Excel(name = "班次产奶量")
private Double milk;
@Excel(name = "班次校正奶量")
private Double correctedMilk;
private String sheepId;
// Getters and Setters
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public Date getCreateTime() { return createTime; }
public void setCreateTime(Date createTime) { this.createTime = createTime; }
public Date getUpdateTime() { return updateTime; }
public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
public Date getDatetime() { return datetime; }
public void setDatetime(Date datetime) { this.datetime = datetime; }
public String getManageEarNo() { return manageEarNo; }
public void setManageEarNo(String manageEarNo) { this.manageEarNo = manageEarNo; }
public String getElectronicEarNo() { return electronicEarNo; }
public void setElectronicEarNo(String electronicEarNo) { this.electronicEarNo = electronicEarNo; }
public Integer getParity() { return parity; }
public void setParity(Integer parity) { this.parity = parity; }
public String getFactory() { return factory; }
public void setFactory(String factory) { this.factory = factory; }
public Integer getClasses() { return classes; }
public void setClasses(Integer classes) { this.classes = classes; }
public Double getMilk() { return milk; }
public void setMilk(Double milk) { this.milk = milk; }
public Double getCorrectedMilk() { return correctedMilk; }
public void setCorrectedMilk(Double correctedMilk) { this.correctedMilk = correctedMilk; }
public String getSheepId() { return sheepId; }
public void setSheepId(String sheepId) { this.sheepId = sheepId; }
}

View File

@ -0,0 +1,162 @@
package com.zhyc.module.dairyProducts.domain;
import java.util.Date;
public class NpSheepMilkAnalysis {
private String sheepId;
private String manageEarTag;
private String variety;
private Date milkingStartTime;
private Date dryEndTime;
private Integer milkingDays;
private Integer analysisDays;
private Integer maxParity;
private Double sumSystemMilk;
private Double sumCorrectedMilk;
private Double avgCorrectedDaily;
private Double sumParity1Milk;
private Double sumParity2Milk;
private Double sumParity3Milk;
private Double sumParity4Milk;
private Double avgParity1Daily;
private Double avgParity2Daily;
private Double avgParity3Daily;
private Double avgParity4Daily;
private Integer lactationDays;
private Double avgLast7Milk;
private Double avgLast7Corrected;
private Double avgLast14Milk;
private Double avgLast30Milk;
private String sheepCategory;
private Date birthday;
private Integer parity;
private Integer monthAge;
private Double currentWeight;
private String breedStatus;
private String fatherManageTags;
private String motherManageTags;
private String ranchName;
private String family;
private Integer motherMilkingDays;
private Double motherSumCorrected;
private Integer motherMaxParity;
private Double motherAvgCorrectedDaily;
private Date lastUpdate;
public String getSheepId() { return sheepId; }
public void setSheepId(String sheepId) { this.sheepId = sheepId; }
public String getManageEarTag() { return manageEarTag; }
public void setManageEarTag(String manageEarTag) { this.manageEarTag = manageEarTag; }
public String getVariety() { return variety; }
public void setVariety(String variety) { this.variety = variety; }
public Date getMilkingStartTime() { return milkingStartTime; }
public void setMilkingStartTime(Date milkingStartTime) { this.milkingStartTime = milkingStartTime; }
public Date getDryEndTime() { return dryEndTime; }
public void setDryEndTime(Date dryEndTime) { this.dryEndTime = dryEndTime; }
public Integer getMilkingDays() { return milkingDays; }
public void setMilkingDays(Integer milkingDays) { this.milkingDays = milkingDays; }
public Integer getAnalysisDays() { return analysisDays; }
public void setAnalysisDays(Integer analysisDays) { this.analysisDays = analysisDays; }
public Integer getMaxParity() { return maxParity; }
public void setMaxParity(Integer maxParity) { this.maxParity = maxParity; }
public Double getSumSystemMilk() { return sumSystemMilk; }
public void setSumSystemMilk(Double sumSystemMilk) { this.sumSystemMilk = sumSystemMilk; }
public Double getSumCorrectedMilk() { return sumCorrectedMilk; }
public void setSumCorrectedMilk(Double sumCorrectedMilk) { this.sumCorrectedMilk = sumCorrectedMilk; }
public Double getAvgCorrectedDaily() { return avgCorrectedDaily; }
public void setAvgCorrectedDaily(Double avgCorrectedDaily) { this.avgCorrectedDaily = avgCorrectedDaily; }
public Double getSumParity1Milk() { return sumParity1Milk; }
public void setSumParity1Milk(Double sumParity1Milk) { this.sumParity1Milk = sumParity1Milk; }
public Double getSumParity2Milk() { return sumParity2Milk; }
public void setSumParity2Milk(Double sumParity2Milk) { this.sumParity2Milk = sumParity2Milk; }
public Double getSumParity3Milk() { return sumParity3Milk; }
public void setSumParity3Milk(Double sumParity3Milk) { this.sumParity3Milk = sumParity3Milk; }
public Double getSumParity4Milk() { return sumParity4Milk; }
public void setSumParity4Milk(Double sumParity4Milk) { this.sumParity4Milk = sumParity4Milk; }
public Double getAvgParity1Daily() { return avgParity1Daily; }
public void setAvgParity1Daily(Double avgParity1Daily) { this.avgParity1Daily = avgParity1Daily; }
public Double getAvgParity2Daily() { return avgParity2Daily; }
public void setAvgParity2Daily(Double avgParity2Daily) { this.avgParity2Daily = avgParity2Daily; }
public Double getAvgParity3Daily() { return avgParity3Daily; }
public void setAvgParity3Daily(Double avgParity3Daily) { this.avgParity3Daily = avgParity3Daily; }
public Double getAvgParity4Daily() { return avgParity4Daily; }
public void setAvgParity4Daily(Double avgParity4Daily) { this.avgParity4Daily = avgParity4Daily; }
public Integer getLactationDays() { return lactationDays; }
public void setLactationDays(Integer lactationDays) { this.lactationDays = lactationDays; }
public Double getAvgLast7Milk() { return avgLast7Milk; }
public void setAvgLast7Milk(Double avgLast7Milk) { this.avgLast7Milk = avgLast7Milk; }
public Double getAvgLast7Corrected() { return avgLast7Corrected; }
public void setAvgLast7Corrected(Double avgLast7Corrected) { this.avgLast7Corrected = avgLast7Corrected; }
public Double getAvgLast14Milk() { return avgLast14Milk; }
public void setAvgLast14Milk(Double avgLast14Milk) { this.avgLast14Milk = avgLast14Milk; }
public Double getAvgLast30Milk() { return avgLast30Milk; }
public void setAvgLast30Milk(Double avgLast30Milk) { this.avgLast30Milk = avgLast30Milk; }
public String getSheepCategory() { return sheepCategory; }
public void setSheepCategory(String sheepCategory) { this.sheepCategory = sheepCategory; }
public Date getBirthday() { return birthday; }
public void setBirthday(Date birthday) { this.birthday = birthday; }
public Integer getParity() { return parity; }
public void setParity(Integer parity) { this.parity = parity; }
public Integer getMonthAge() { return monthAge; }
public void setMonthAge(Integer monthAge) { this.monthAge = monthAge; }
public Double getCurrentWeight() { return currentWeight; }
public void setCurrentWeight(Double currentWeight) { this.currentWeight = currentWeight; }
public String getBreedStatus() { return breedStatus; }
public void setBreedStatus(String breedStatus) { this.breedStatus = breedStatus; }
public String getFatherManageTags() { return fatherManageTags; }
public void setFatherManageTags(String fatherManageTags) { this.fatherManageTags = fatherManageTags; }
public String getMotherManageTags() { return motherManageTags; }
public void setMotherManageTags(String motherManageTags) { this.motherManageTags = motherManageTags; }
public String getRanchName() { return ranchName; }
public void setRanchName(String ranchName) { this.ranchName = ranchName; }
public String getFamily() { return family; }
public void setFamily(String family) { this.family = family; }
public Integer getMotherMilkingDays() { return motherMilkingDays; }
public void setMotherMilkingDays(Integer motherMilkingDays) { this.motherMilkingDays = motherMilkingDays; }
public Double getMotherSumCorrected() { return motherSumCorrected; }
public void setMotherSumCorrected(Double motherSumCorrected) { this.motherSumCorrected = motherSumCorrected; }
public Integer getMotherMaxParity() { return motherMaxParity; }
public void setMotherMaxParity(Integer motherMaxParity) { this.motherMaxParity = motherMaxParity; }
public Double getMotherAvgCorrectedDaily() { return motherAvgCorrectedDaily; }
public void setMotherAvgCorrectedDaily(Double motherAvgCorrectedDaily) { this.motherAvgCorrectedDaily = motherAvgCorrectedDaily; }
public Date getLastUpdate() { return lastUpdate; }
public void setLastUpdate(Date lastUpdate) { this.lastUpdate = lastUpdate; }
}

View File

@ -0,0 +1,12 @@
package com.zhyc.module.dairyProducts.domain;
public class Ranch {
private String ranchCode;
private String ranchName;
public String getRanchCode() { return ranchCode; }
public void setRanchCode(String ranchCode) { this.ranchCode = ranchCode; }
public String getRanchName() { return ranchName; }
public void setRanchName(String ranchName) { this.ranchName = ranchName; }
}

View File

@ -0,0 +1,23 @@
package com.zhyc.module.dairyProducts.mapper;
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface NpMilkInOutStoreMapper {
List<Map<String,Object>> selectWithColumns(
@Param("start") Date start, @Param("end") Date end,
@Param("feedSources") List<String> feedSources,
@Param("saleDestinations") List<String> saleDestinations
);
int insertStore(NpMilkInOutStore store);
void insertFeedRecord(@Param("storeId") Integer storeId, @Param("source") String source, @Param("amount") java.math.BigDecimal amount);
void insertSaleRecord(@Param("storeId") Integer storeId, @Param("destination") String dest, @Param("amount") java.math.BigDecimal amount);
List<String> selectFeedSources();
List<String> selectSaleDestinations();
}

View File

@ -0,0 +1,25 @@
package com.zhyc.module.dairyProducts.mapper;
import org.apache.ibatis.annotations.Param;
import com.zhyc.module.dairyProducts.domain.NpMilkProdClasses;
import java.util.Date;
import java.util.List;
public interface NpMilkProdClassesMapper {
List<NpMilkProdClasses> selectNpMilkProdClassesList(
@Param("datetimeStart") Date datetimeStart,
@Param("datetimeEnd") Date datetimeEnd,
@Param("manageEarNo") String manageEarNo,
@Param("factory") String factory,
@Param("classes") Integer classes);
int insertNpMilkProdClasses(NpMilkProdClasses row);
String selectSheepIdByManageEarNo(@Param("manageEarNo") String manageEarNo);
Double getWeightCorrection(@Param("date") Date date, @Param("factory") String factory);
Double getParityCorrection(@Param("parity") Integer parity);
Double getDryMatterCorrection(@Param("date") Date date, @Param("factory") String factory);
}

View File

@ -0,0 +1,19 @@
package com.zhyc.module.dairyProducts.mapper;
import com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis;
import java.util.List;
public interface NpSheepMilkAnalysisMapper {
NpSheepMilkAnalysis selectNpSheepMilkAnalysisById(Long id);
List<NpSheepMilkAnalysis> selectNpSheepMilkAnalysisList(NpSheepMilkAnalysis analysis);
int insertNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis);
int updateNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis);
int deleteNpSheepMilkAnalysisById(Long id);
int deleteNpSheepMilkAnalysisByIds(Long[] ids);
}

View File

@ -0,0 +1,10 @@
package com.zhyc.module.dairyProducts.mapper;
import com.zhyc.module.dairyProducts.domain.Ranch;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface RanchMapper {
@Select("SELECT ranch AS ranchName, ranch AS ranchCode FROM da_ranch")
List<Ranch> selectAllRanch();
}

View File

@ -0,0 +1,16 @@
package com.zhyc.module.dairyProducts.service;
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface INpMilkInOutStoreService {
List<Map<String,Object>> selectWithDynamicColumns(Date start, Date end);
List<Map<String,Object>> getAllColumnOptions();
List<Map<String,Object>> parseImportExcel(MultipartFile file) throws Exception;
void batchInsertFromRows(List<Map<String,Object>> rows) throws Exception;
}

View File

@ -0,0 +1,16 @@
package com.zhyc.module.dairyProducts.service;
import java.util.Date;
import java.util.List;
import com.zhyc.module.dairyProducts.domain.NpMilkProdClasses;
public interface INpMilkProdClassesService {
List<NpMilkProdClasses> selectNpMilkProdClassesList(
Date datetimeStart,
Date datetimeEnd,
String manageEarNo, // 改为单个 String
String factory,
Integer classes);
int importMilkProdClasses(List<NpMilkProdClasses> list);
}

View File

@ -0,0 +1,20 @@
package com.zhyc.module.dairyProducts.service;
import com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis;
import java.util.List;
public interface INpSheepMilkAnalysisService {
NpSheepMilkAnalysis selectNpSheepMilkAnalysisById(Long id);
List<NpSheepMilkAnalysis> selectNpSheepMilkAnalysisList(NpSheepMilkAnalysis analysis);
int insertNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis);
int updateNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis);
int deleteNpSheepMilkAnalysisById(Long id);
int deleteNpSheepMilkAnalysisByIds(Long[] ids);
}

View File

@ -0,0 +1,8 @@
package com.zhyc.module.dairyProducts.service;
import com.zhyc.module.dairyProducts.domain.Ranch;
import java.util.List;
public interface IRanchService {
List<Ranch> selectAllRanch();
}

View File

@ -0,0 +1,82 @@
package com.zhyc.module.dairyProducts.service.impl;
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
import com.zhyc.module.dairyProducts.mapper.NpMilkInOutStoreMapper;
import com.zhyc.module.dairyProducts.service.INpMilkInOutStoreService;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
@Service
public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
@Autowired
private NpMilkInOutStoreMapper mapper;
@Override
public List<Map<String, Object>> selectWithDynamicColumns(Date start, Date end) {
List<String> feed = mapper.selectFeedSources();
List<String> sale = mapper.selectSaleDestinations();
return mapper.selectWithColumns(start, end, feed, sale);
}
@Override
public List<Map<String, Object>> getAllColumnOptions() {
Map<String,Object> m = new HashMap<>();
m.put("feed", mapper.selectFeedSources());
m.put("sale", mapper.selectSaleDestinations());
return Collections.singletonList(m);
}
@Override
public List<Map<String, Object>> parseImportExcel(MultipartFile file) throws Exception {
// Apache POI 解析 Excel 第一行标题动态映射列名跟 unit cells
InputStream in = file.getInputStream();
Workbook wb = WorkbookFactory.create(in);
Sheet sheet = wb.getSheetAt(0);
Row header = sheet.getRow(0);
int cols = header.getLastCellNum();
List<String> titles = new ArrayList<>();
for (int i = 0; i < cols; i++) titles.add(header.getCell(i).getStringCellValue());
List<Map<String,Object>> rows = new ArrayList<>();
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r);
if (row == null) continue;
Map<String,Object> map = new LinkedHashMap<>();
for (int c = 0; c < cols; c++) {
Cell cell = row.getCell(c);
map.put(titles.get(c), cell == null ? null : cell.toString());
}
rows.add(map);
}
return rows;
}
@Override
public void batchInsertFromRows(List<Map<String, Object>> rows) throws Exception {
for (Map<String,Object> row : rows) {
// 提取主表字段
NpMilkInOutStore store = new NpMilkInOutStore();
store.setDatetime(java.sql.Date.valueOf(row.get("日期").toString()));
store.setNum(Integer.valueOf(row.get("羊数").toString()));
// ... 设置其它固定字段 ...
mapper.insertStore(store);
Integer sid = store.getId();
// 其余列为动态饲喂或销售根据字典决定分类
for (Map.Entry<String,Object> ent: row.entrySet()) {
String col = ent.getKey();
BigDecimal amt = new BigDecimal(ent.getValue().toString());
if (mapper.selectFeedSources().contains(col)) {
mapper.insertFeedRecord(sid, col, amt);
} else if (mapper.selectSaleDestinations().contains(col)) {
mapper.insertSaleRecord(sid, col, amt);
}
}
}
}
}

View File

@ -0,0 +1,62 @@
package com.zhyc.module.dairyProducts.service.impl;
import com.zhyc.module.dairyProducts.domain.NpMilkProdClasses;
import com.zhyc.module.dairyProducts.mapper.NpMilkProdClassesMapper;
import com.zhyc.module.dairyProducts.service.INpMilkProdClassesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class NpMilkProdClassesServiceImpl implements INpMilkProdClassesService {
@Autowired
private NpMilkProdClassesMapper mapper;
@Override
public List<NpMilkProdClasses> selectNpMilkProdClassesList(Date datetimeStart, Date datetimeEnd,
String manageEarNo, String factory, Integer classes) {
return mapper.selectNpMilkProdClassesList(datetimeStart, datetimeEnd, manageEarNo, factory, classes);
}
@Override
public int importMilkProdClasses(List<NpMilkProdClasses> list) {
int count = 0;
for (NpMilkProdClasses item : list) {
// 根据管理耳号查 sheep_id
String sheepId = mapper.selectSheepIdByManageEarNo(item.getManageEarNo());
if (sheepId == null) continue;
item.setSheepId(sheepId);
// 计算校正奶量
Double correctedMilk = calculateCorrectedMilk(item);
item.setCorrectedMilk(correctedMilk);
// 插入数据
count += mapper.insertNpMilkProdClasses(item);
}
return count;
}
private Double calculateCorrectedMilk(NpMilkProdClasses item) {
Double milk = item.getMilk();
if (milk == null) return null;
// 1. 称重矫正系数
Double weightCorrection = mapper.getWeightCorrection(item.getDatetime(), item.getFactory());
if (weightCorrection == null) weightCorrection = 1.0;
// 2. 胎次矫正系数
Double parityCorrection = mapper.getParityCorrection(item.getParity());
if (parityCorrection == null) parityCorrection = 1.0;
// 3. 干物质矫正系数
Double dryMatterCorrection = mapper.getDryMatterCorrection(item.getDatetime(), item.getFactory());
if (dryMatterCorrection == null) dryMatterCorrection = 1.0;
return milk * weightCorrection * parityCorrection * dryMatterCorrection;
}
}

View File

@ -0,0 +1,47 @@
package com.zhyc.module.dairyProducts.service.impl;
import java.util.List;
import com.zhyc.module.dairyProducts.mapper.NpSheepMilkAnalysisMapper;
import com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis;
import com.zhyc.module.dairyProducts.service.INpSheepMilkAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class NpSheepMilkAnalysisServiceImpl implements INpSheepMilkAnalysisService {
@Autowired
private NpSheepMilkAnalysisMapper npSheepMilkAnalysisMapper;
@Override
public NpSheepMilkAnalysis selectNpSheepMilkAnalysisById(Long id) {
return npSheepMilkAnalysisMapper.selectNpSheepMilkAnalysisById(id);
}
@Override
public List<NpSheepMilkAnalysis> selectNpSheepMilkAnalysisList(NpSheepMilkAnalysis analysis) {
return npSheepMilkAnalysisMapper.selectNpSheepMilkAnalysisList(analysis);
}
@Override
public int insertNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis) {
return npSheepMilkAnalysisMapper.insertNpSheepMilkAnalysis(analysis);
}
@Override
public int updateNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis) {
return npSheepMilkAnalysisMapper.updateNpSheepMilkAnalysis(analysis);
}
@Override
public int deleteNpSheepMilkAnalysisById(Long id) {
return npSheepMilkAnalysisMapper.deleteNpSheepMilkAnalysisById(id);
}
@Override
public int deleteNpSheepMilkAnalysisByIds(Long[] ids) {
return npSheepMilkAnalysisMapper.deleteNpSheepMilkAnalysisByIds(ids);
}
}

View File

@ -0,0 +1,19 @@
package com.zhyc.module.dairyProducts.service.impl;
import com.zhyc.module.dairyProducts.domain.Ranch;
import com.zhyc.module.dairyProducts.mapper.RanchMapper;
import com.zhyc.module.dairyProducts.service.IRanchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RanchServiceImpl implements IRanchService {
@Autowired
private RanchMapper ranchMapper;
@Override
public List<Ranch> selectAllRanch() {
return ranchMapper.selectAllRanch();
}
}

View File

@ -0,0 +1,417 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.base.mapper.BreedRamFileMapper">
<resultMap type="BreedRamFile" id="BreedRamFileResult">
<result property="id" column="id" />
<result property="ordinaryEarNumber" column="ordinary_ear_number" />
<result property="ranchId" column="ranch_id" />
<result property="ranchName" column="ranch_name" />
<result property="sheepfoldId" column="sheepfold_id" />
<result property="sheepfoldName" column="sheepfold_name" />
<result property="electronicTags" column="electronic_tags" />
<result property="varietyId" column="variety_id" />
<result property="variety" column="variety" />
<result property="sheepCategory" column="sheep_category" />
<result property="currentStatus" column="current_status" />
<result property="birthday" column="birthday" />
<result property="dynamicInfo" column="dynamic_info" />
<result property="monthAge" column="month_age" />
<result property="birthWeight" column="birth_weight" />
<result property="weaningDate" column="weaning_date" />
<result property="weaningDayAge" column="weaning_day_age" />
<result property="weaningWeight" column="weaning_weight" />
<result property="weaningDailyGain" column="weaning_daily_gain" />
<result property="postWeaningDailyGain" column="post_weaning_daily_gain" />
<result property="currentWeight" column="current_weight" />
<result property="currentWeightDate" column="current_weight_date" />
<result property="activityLevel" column="activity_level" />
<result property="sexualStatus" column="sexual_status" />
<result property="scrotumCircumference" column="scrotum_circumference" />
<result property="spermCollectionTime" column="sperm_collection_time" />
<result property="spermVolume" column="sperm_volume" />
<result property="spermVitality" column="sperm_vitality" />
<result property="spermDensity" column="sperm_density" />
<result property="spermQuality" column="sperm_quality" />
<result property="breedingStatus" column="breeding_status" />
<result property="lastPlanTime" column="last_plan_time" />
<result property="currentPlanTime" column="current_plan_time" />
<result property="remark" column="comment" />
<result property="proteinRateEbv" column="protein_rate_ebv" />
<result property="milkFatRateEbv" column="milk_fat_rate_ebv" />
<result property="scsEbv" column="scs_ebv" />
<result property="growthPerformanceEbv" column="growth_performance_ebv" />
<result property="resistanceEbv" column="resistance_ebv" />
<result property="reproductionPerformanceEbv" column="reproduction_performance_ebv" />
<result property="bodyTypeEbv" column="body_type_ebv" />
<result property="comprehensiveBreedingValue" column="comprehensive_breeding_value" />
<result property="fatherNumber" column="father_number" />
<result property="motherNumber" column="mother_number" />
<result property="grandfatherNumber" column="grandfather_number" />
<result property="grandmotherNumber" column="grandmother_number" />
<result property="maternalGrandfatherNumber" column="maternal_grandfather_number" />
<result property="maternalGrandmotherNumber" column="maternal_grandmother_number" />
<result property="isCoreFlock" column="is_core_flock" />
<result property="isBreedingUse" column="is_breeding_use" />
<result property="pregnancyCheck" column="pregnancy_check" />
<result property="totalMatedEwes" column="total_mated_ewes" />
<result property="naturalPregnancyCheckEwes" column="natural_pregnancy_check_ewes" />
<result property="naturalConceptionRate" column="natural_conception_rate" />
<result property="artificialPregnancyCheckEwes" column="artificial_pregnancy_check_ewes" />
<result property="artificialConceptionRate" column="artificial_conception_rate" />
<result property="ramMotherMilkVolume" column="ram_mother_milk_volume" />
<result property="milkProductionEbv" column="milk_production_ebv" />
<result property="accuracy" column="accuracy" />
<result property="informationCount" column="information_count" />
<result property="isPaternityTested" column="is_paternity_tested" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="isDelete" column="is_delete" />
</resultMap>
<sql id="selectBreedRamFileVo">
select id, ordinary_ear_number, ranch_id, ranch_name, sheepfold_id, sheepfold_name, electronic_tags, variety_id, variety, sheep_category, current_status, birthday, dynamic_info, month_age, birth_weight, weaning_date, weaning_day_age, weaning_weight, weaning_daily_gain, post_weaning_daily_gain, current_weight, current_weight_date, activity_level, sexual_status, scrotum_circumference, sperm_collection_time, sperm_volume, sperm_vitality, sperm_density, sperm_quality, breeding_status, last_plan_time, current_plan_time, comment, protein_rate_ebv, milk_fat_rate_ebv, scs_ebv, growth_performance_ebv, resistance_ebv, reproduction_performance_ebv, body_type_ebv, comprehensive_breeding_value, father_number, mother_number, grandfather_number, grandmother_number, maternal_grandfather_number, maternal_grandmother_number, is_core_flock, is_breeding_use, pregnancy_check, total_mated_ewes, natural_pregnancy_check_ewes, natural_conception_rate, artificial_pregnancy_check_ewes, artificial_conception_rate, ram_mother_milk_volume, milk_production_ebv, accuracy, information_count, is_paternity_tested, create_by, create_time, update_by, update_time, is_delete from breed_ram_file
</sql>
<select id="selectBreedRamFileList" parameterType="BreedRamFile" resultMap="BreedRamFileResult">
<include refid="selectBreedRamFileVo"/>
<where>
<if test="ordinaryEarNumber != null and ordinaryEarNumber != ''"> and ordinary_ear_number like concat('%', #{ordinaryEarNumber}, '%')</if>
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
<if test="ranchName != null and ranchName != ''"> and ranch_name like concat('%', #{ranchName}, '%')</if>
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
<if test="sheepfoldName != null and sheepfoldName != ''"> and sheepfold_name like concat('%', #{sheepfoldName}, '%')</if>
<if test="electronicTags != null and electronicTags != ''"> and electronic_tags like concat('%', #{electronicTags}, '%')</if>
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
<if test="variety != null and variety != ''"> and variety like concat('%', #{variety}, '%')</if>
<if test="sheepCategory != null and sheepCategory != ''"> and sheep_category = #{sheepCategory}</if>
<if test="currentStatus != null and currentStatus != ''"> and current_status = #{currentStatus}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="dynamicInfo != null and dynamicInfo != ''"> and dynamic_info = #{dynamicInfo}</if>
<if test="monthAge != null "> and month_age = #{monthAge}</if>
<if test="birthWeight != null "> and birth_weight = #{birthWeight}</if>
<if test="weaningDate != null "> and weaning_date = #{weaningDate}</if>
<if test="weaningDayAge != null "> and weaning_day_age = #{weaningDayAge}</if>
<if test="weaningWeight != null "> and weaning_weight = #{weaningWeight}</if>
<if test="weaningDailyGain != null "> and weaning_daily_gain = #{weaningDailyGain}</if>
<if test="postWeaningDailyGain != null "> and post_weaning_daily_gain = #{postWeaningDailyGain}</if>
<if test="currentWeight != null "> and current_weight = #{currentWeight}</if>
<if test="currentWeightDate != null "> and current_weight_date = #{currentWeightDate}</if>
<if test="activityLevel != null and activityLevel != ''"> and activity_level = #{activityLevel}</if>
<if test="sexualStatus != null and sexualStatus != ''"> and sexual_status = #{sexualStatus}</if>
<if test="scrotumCircumference != null "> and scrotum_circumference = #{scrotumCircumference}</if>
<if test="spermCollectionTime != null "> and sperm_collection_time = #{spermCollectionTime}</if>
<if test="spermVolume != null "> and sperm_volume = #{spermVolume}</if>
<if test="spermVitality != null and spermVitality != ''"> and sperm_vitality = #{spermVitality}</if>
<if test="spermDensity != null and spermDensity != ''"> and sperm_density = #{spermDensity}</if>
<if test="spermQuality != null and spermQuality != ''"> and sperm_quality = #{spermQuality}</if>
<if test="breedingStatus != null "> and breeding_status = #{breedingStatus}</if>
<if test="lastPlanTime != null "> and last_plan_time = #{lastPlanTime}</if>
<if test="currentPlanTime != null "> and current_plan_time = #{currentPlanTime}</if>
<if test="proteinRateEbv != null "> and protein_rate_ebv = #{proteinRateEbv}</if>
<if test="milkFatRateEbv != null "> and milk_fat_rate_ebv = #{milkFatRateEbv}</if>
<if test="scsEbv != null "> and scs_ebv = #{scsEbv}</if>
<if test="growthPerformanceEbv != null "> and growth_performance_ebv = #{growthPerformanceEbv}</if>
<if test="resistanceEbv != null "> and resistance_ebv = #{resistanceEbv}</if>
<if test="reproductionPerformanceEbv != null "> and reproduction_performance_ebv = #{reproductionPerformanceEbv}</if>
<if test="bodyTypeEbv != null "> and body_type_ebv = #{bodyTypeEbv}</if>
<if test="comprehensiveBreedingValue != null "> and comprehensive_breeding_value = #{comprehensiveBreedingValue}</if>
<if test="fatherNumber != null and fatherNumber != ''"> and father_number = #{fatherNumber}</if>
<if test="motherNumber != null and motherNumber != ''"> and mother_number = #{motherNumber}</if>
<if test="grandfatherNumber != null and grandfatherNumber != ''"> and grandfather_number = #{grandfatherNumber}</if>
<if test="grandmotherNumber != null and grandmotherNumber != ''"> and grandmother_number = #{grandmotherNumber}</if>
<if test="maternalGrandfatherNumber != null and maternalGrandfatherNumber != ''"> and maternal_grandfather_number = #{maternalGrandfatherNumber}</if>
<if test="maternalGrandmotherNumber != null and maternalGrandmotherNumber != ''"> and maternal_grandmother_number = #{maternalGrandmotherNumber}</if>
<if test="isCoreFlock != null "> and is_core_flock = #{isCoreFlock}</if>
<if test="isBreedingUse != null "> and is_breeding_use = #{isBreedingUse}</if>
<if test="pregnancyCheck != null and pregnancyCheck != ''"> and pregnancy_check = #{pregnancyCheck}</if>
<if test="totalMatedEwes != null "> and total_mated_ewes = #{totalMatedEwes}</if>
<if test="naturalPregnancyCheckEwes != null "> and natural_pregnancy_check_ewes = #{naturalPregnancyCheckEwes}</if>
<if test="naturalConceptionRate != null "> and natural_conception_rate = #{naturalConceptionRate}</if>
<if test="artificialPregnancyCheckEwes != null "> and artificial_pregnancy_check_ewes = #{artificialPregnancyCheckEwes}</if>
<if test="artificialConceptionRate != null "> and artificial_conception_rate = #{artificialConceptionRate}</if>
<if test="ramMotherMilkVolume != null "> and ram_mother_milk_volume = #{ramMotherMilkVolume}</if>
<if test="milkProductionEbv != null "> and milk_production_ebv = #{milkProductionEbv}</if>
<if test="accuracy != null "> and accuracy = #{accuracy}</if>
<if test="informationCount != null "> and information_count = #{informationCount}</if>
<if test="isPaternityTested != null "> and is_paternity_tested = #{isPaternityTested}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
</where>
order by create_time desc
</select>
<select id="selectBreedRamFileById" parameterType="Long" resultMap="BreedRamFileResult">
<include refid="selectBreedRamFileVo"/>
where id = #{id}
</select>
<select id="selectBreedRamFileByOrdinaryEarNumber" parameterType="String" resultMap="BreedRamFileResult">
<include refid="selectBreedRamFileVo"/>
where ordinary_ear_number = #{ordinaryEarNumber}
</select>
<select id="selectBreedRamFileByElectronicTags" parameterType="String" resultMap="BreedRamFileResult">
<include refid="selectBreedRamFileVo"/>
where electronic_tags = #{electronicTags}
</select>
<select id="selectBreedRamFileListByRanchId" parameterType="Long" resultMap="BreedRamFileResult">
<include refid="selectBreedRamFileVo"/>
where ranch_id = #{ranchId} and (is_delete = 0 or is_delete is null)
order by create_time desc
</select>
<select id="selectBreedRamFileListBySheepfoldId" parameterType="Long" resultMap="BreedRamFileResult">
<include refid="selectBreedRamFileVo"/>
where sheepfold_id = #{sheepfoldId} and (is_delete = 0 or is_delete is null)
order by create_time desc
</select>
<select id="selectCoreFlockBreedRamFileList" parameterType="BreedRamFile" resultMap="BreedRamFileResult">
<include refid="selectBreedRamFileVo"/>
<where>
is_core_flock = 1
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
<if test="breedingStatus != null "> and breeding_status = #{breedingStatus}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
</where>
order by create_time desc
</select>
<select id="selectBreedingUseBreedRamFileList" parameterType="BreedRamFile" resultMap="BreedRamFileResult">
<include refid="selectBreedRamFileVo"/>
<where>
is_breeding_use = 1
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
<if test="breedingStatus != null "> and breeding_status = #{breedingStatus}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
</where>
order by create_time desc
</select>
<insert id="insertBreedRamFile" parameterType="BreedRamFile" useGeneratedKeys="true" keyProperty="id">
insert into breed_ram_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ordinaryEarNumber != null">ordinary_ear_number,</if>
<if test="ranchId != null">ranch_id,</if>
<if test="ranchName != null">ranch_name,</if>
<if test="sheepfoldId != null">sheepfold_id,</if>
<if test="sheepfoldName != null">sheepfold_name,</if>
<if test="electronicTags != null">electronic_tags,</if>
<if test="varietyId != null">variety_id,</if>
<if test="variety != null">variety,</if>
<if test="sheepCategory != null">sheep_category,</if>
<if test="currentStatus != null">current_status,</if>
<if test="birthday != null">birthday,</if>
<if test="dynamicInfo != null">dynamic_info,</if>
<if test="monthAge != null">month_age,</if>
<if test="birthWeight != null">birth_weight,</if>
<if test="weaningDate != null">weaning_date,</if>
<if test="weaningDayAge != null">weaning_day_age,</if>
<if test="weaningWeight != null">weaning_weight,</if>
<if test="weaningDailyGain != null">weaning_daily_gain,</if>
<if test="postWeaningDailyGain != null">post_weaning_daily_gain,</if>
<if test="currentWeight != null">current_weight,</if>
<if test="currentWeightDate != null">current_weight_date,</if>
<if test="activityLevel != null">activity_level,</if>
<if test="sexualStatus != null">sexual_status,</if>
<if test="scrotumCircumference != null">scrotum_circumference,</if>
<if test="spermCollectionTime != null">sperm_collection_time,</if>
<if test="spermVolume != null">sperm_volume,</if>
<if test="spermVitality != null">sperm_vitality,</if>
<if test="spermDensity != null">sperm_density,</if>
<if test="spermQuality != null">sperm_quality,</if>
<if test="breedingStatus != null">breeding_status,</if>
<if test="lastPlanTime != null">last_plan_time,</if>
<if test="currentPlanTime != null">current_plan_time,</if>
<if test="remark != null">comment,</if>
<if test="proteinRateEbv != null">protein_rate_ebv,</if>
<if test="milkFatRateEbv != null">milk_fat_rate_ebv,</if>
<if test="scsEbv != null">scs_ebv,</if>
<if test="growthPerformanceEbv != null">growth_performance_ebv,</if>
<if test="resistanceEbv != null">resistance_ebv,</if>
<if test="reproductionPerformanceEbv != null">reproduction_performance_ebv,</if>
<if test="bodyTypeEbv != null">body_type_ebv,</if>
<if test="comprehensiveBreedingValue != null">comprehensive_breeding_value,</if>
<if test="fatherNumber != null">father_number,</if>
<if test="motherNumber != null">mother_number,</if>
<if test="grandfatherNumber != null">grandfather_number,</if>
<if test="grandmotherNumber != null">grandmother_number,</if>
<if test="maternalGrandfatherNumber != null">maternal_grandfather_number,</if>
<if test="maternalGrandmotherNumber != null">maternal_grandmother_number,</if>
<if test="isCoreFlock != null">is_core_flock,</if>
<if test="isBreedingUse != null">is_breeding_use,</if>
<if test="pregnancyCheck != null">pregnancy_check,</if>
<if test="totalMatedEwes != null">total_mated_ewes,</if>
<if test="naturalPregnancyCheckEwes != null">natural_pregnancy_check_ewes,</if>
<if test="naturalConceptionRate != null">natural_conception_rate,</if>
<if test="artificialPregnancyCheckEwes != null">artificial_pregnancy_check_ewes,</if>
<if test="artificialConceptionRate != null">artificial_conception_rate,</if>
<if test="ramMotherMilkVolume != null">ram_mother_milk_volume,</if>
<if test="milkProductionEbv != null">milk_production_ebv,</if>
<if test="accuracy != null">accuracy,</if>
<if test="informationCount != null">information_count,</if>
<if test="isPaternityTested != null">is_paternity_tested,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ordinaryEarNumber != null">#{ordinaryEarNumber},</if>
<if test="ranchId != null">#{ranchId},</if>
<if test="ranchName != null">#{ranchName},</if>
<if test="sheepfoldId != null">#{sheepfoldId},</if>
<if test="sheepfoldName != null">#{sheepfoldName},</if>
<if test="electronicTags != null">#{electronicTags},</if>
<if test="varietyId != null">#{varietyId},</if>
<if test="variety != null">#{variety},</if>
<if test="sheepCategory != null">#{sheepCategory},</if>
<if test="currentStatus != null">#{currentStatus},</if>
<if test="birthday != null">#{birthday},</if>
<if test="dynamicInfo != null">#{dynamicInfo},</if>
<if test="monthAge != null">#{monthAge},</if>
<if test="birthWeight != null">#{birthWeight},</if>
<if test="weaningDate != null">#{weaningDate},</if>
<if test="weaningDayAge != null">#{weaningDayAge},</if>
<if test="weaningWeight != null">#{weaningWeight},</if>
<if test="weaningDailyGain != null">#{weaningDailyGain},</if>
<if test="postWeaningDailyGain != null">#{postWeaningDailyGain},</if>
<if test="currentWeight != null">#{currentWeight},</if>
<if test="currentWeightDate != null">#{currentWeightDate},</if>
<if test="activityLevel != null">#{activityLevel},</if>
<if test="sexualStatus != null">#{sexualStatus},</if>
<if test="scrotumCircumference != null">#{scrotumCircumference},</if>
<if test="spermCollectionTime != null">#{spermCollectionTime},</if>
<if test="spermVolume != null">#{spermVolume},</if>
<if test="spermVitality != null">#{spermVitality},</if>
<if test="spermDensity != null">#{spermDensity},</if>
<if test="spermQuality != null">#{spermQuality},</if>
<if test="breedingStatus != null">#{breedingStatus},</if>
<if test="lastPlanTime != null">#{lastPlanTime},</if>
<if test="currentPlanTime != null">#{currentPlanTime},</if>
<if test="remark != null">#{remark},</if>
<if test="proteinRateEbv != null">#{proteinRateEbv},</if>
<if test="milkFatRateEbv != null">#{milkFatRateEbv},</if>
<if test="scsEbv != null">#{scsEbv},</if>
<if test="growthPerformanceEbv != null">#{growthPerformanceEbv},</if>
<if test="resistanceEbv != null">#{resistanceEbv},</if>
<if test="reproductionPerformanceEbv != null">#{reproductionPerformanceEbv},</if>
<if test="bodyTypeEbv != null">#{bodyTypeEbv},</if>
<if test="comprehensiveBreedingValue != null">#{comprehensiveBreedingValue},</if>
<if test="fatherNumber != null">#{fatherNumber},</if>
<if test="motherNumber != null">#{motherNumber},</if>
<if test="grandfatherNumber != null">#{grandfatherNumber},</if>
<if test="grandmotherNumber != null">#{grandmotherNumber},</if>
<if test="maternalGrandfatherNumber != null">#{maternalGrandfatherNumber},</if>
<if test="maternalGrandmotherNumber != null">#{maternalGrandmotherNumber},</if>
<if test="isCoreFlock != null">#{isCoreFlock},</if>
<if test="isBreedingUse != null">#{isBreedingUse},</if>
<if test="pregnancyCheck != null">#{pregnancyCheck},</if>
<if test="totalMatedEwes != null">#{totalMatedEwes},</if>
<if test="naturalPregnancyCheckEwes != null">#{naturalPregnancyCheckEwes},</if>
<if test="naturalConceptionRate != null">#{naturalConceptionRate},</if>
<if test="artificialPregnancyCheckEwes != null">#{artificialPregnancyCheckEwes},</if>
<if test="artificialConceptionRate != null">#{artificialConceptionRate},</if>
<if test="ramMotherMilkVolume != null">#{ramMotherMilkVolume},</if>
<if test="milkProductionEbv != null">#{milkProductionEbv},</if>
<if test="accuracy != null">#{accuracy},</if>
<if test="informationCount != null">#{informationCount},</if>
<if test="isPaternityTested != null">#{isPaternityTested},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
<update id="updateBreedRamFile" parameterType="BreedRamFile">
update breed_ram_file
<trim prefix="SET" suffixOverrides=",">
<if test="ordinaryEarNumber != null">ordinary_ear_number = #{ordinaryEarNumber},</if>
<if test="ranchId != null">ranch_id = #{ranchId},</if>
<if test="ranchName != null">ranch_name = #{ranchName},</if>
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
<if test="sheepfoldName != null">sheepfold_name = #{sheepfoldName},</if>
<if test="electronicTags != null">electronic_tags = #{electronicTags},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if>
<if test="variety != null">variety = #{variety},</if>
<if test="sheepCategory != null">sheep_category = #{sheepCategory},</if>
<if test="currentStatus != null">current_status = #{currentStatus},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="dynamicInfo != null">dynamic_info = #{dynamicInfo},</if>
<if test="monthAge != null">month_age = #{monthAge},</if>
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
<if test="weaningDate != null">weaning_date = #{weaningDate},</if>
<if test="weaningDayAge != null">weaning_day_age = #{weaningDayAge},</if>
<if test="weaningWeight != null">weaning_weight = #{weaningWeight},</if>
<if test="weaningDailyGain != null">weaning_daily_gain = #{weaningDailyGain},</if>
<if test="postWeaningDailyGain != null">post_weaning_daily_gain = #{postWeaningDailyGain},</if>
<if test="currentWeight != null">current_weight = #{currentWeight},</if>
<if test="currentWeightDate != null">current_weight_date = #{currentWeightDate},</if>
<if test="activityLevel != null">activity_level = #{activityLevel},</if>
<if test="sexualStatus != null">sexual_status = #{sexualStatus},</if>
<if test="scrotumCircumference != null">scrotum_circumference = #{scrotumCircumference},</if>
<if test="spermCollectionTime != null">sperm_collection_time = #{spermCollectionTime},</if>
<if test="spermVolume != null">sperm_volume = #{spermVolume},</if>
<if test="spermVitality != null">sperm_vitality = #{spermVitality},</if>
<if test="spermDensity != null">sperm_density = #{spermDensity},</if>
<if test="spermQuality != null">sperm_quality = #{spermQuality},</if>
<if test="breedingStatus != null">breeding_status = #{breedingStatus},</if>
<if test="lastPlanTime != null">last_plan_time = #{lastPlanTime},</if>
<if test="currentPlanTime != null">current_plan_time = #{currentPlanTime},</if>
<if test="remark != null">comment = #{remark},</if>
<if test="proteinRateEbv != null">protein_rate_ebv = #{proteinRateEbv},</if>
<if test="milkFatRateEbv != null">milk_fat_rate_ebv = #{milkFatRateEbv},</if>
<if test="scsEbv != null">scs_ebv = #{scsEbv},</if>
<if test="growthPerformanceEbv != null">growth_performance_ebv = #{growthPerformanceEbv},</if>
<if test="resistanceEbv != null">resistance_ebv = #{resistanceEbv},</if>
<if test="reproductionPerformanceEbv != null">reproduction_performance_ebv = #{reproductionPerformanceEbv},</if>
<if test="bodyTypeEbv != null">body_type_ebv = #{bodyTypeEbv},</if>
<if test="comprehensiveBreedingValue != null">comprehensive_breeding_value = #{comprehensiveBreedingValue},</if>
<if test="fatherNumber != null">father_number = #{fatherNumber},</if>
<if test="motherNumber != null">mother_number = #{motherNumber},</if>
<if test="grandfatherNumber != null">grandfather_number = #{grandfatherNumber},</if>
<if test="grandmotherNumber != null">grandmother_number = #{grandmotherNumber},</if>
<if test="maternalGrandfatherNumber != null">maternal_grandfather_number = #{maternalGrandfatherNumber},</if>
<if test="maternalGrandmotherNumber != null">maternal_grandmother_number = #{maternalGrandmotherNumber},</if>
<if test="isCoreFlock != null">is_core_flock = #{isCoreFlock},</if>
<if test="isBreedingUse != null">is_breeding_use = #{isBreedingUse},</if>
<if test="pregnancyCheck != null">pregnancy_check = #{pregnancyCheck},</if>
<if test="totalMatedEwes != null">total_mated_ewes = #{totalMatedEwes},</if>
<if test="naturalPregnancyCheckEwes != null">natural_pregnancy_check_ewes = #{naturalPregnancyCheckEwes},</if>
<if test="naturalConceptionRate != null">natural_conception_rate = #{naturalConceptionRate},</if>
<if test="artificialPregnancyCheckEwes != null">artificial_pregnancy_check_ewes = #{artificialPregnancyCheckEwes},</if>
<if test="artificialConceptionRate != null">artificial_conception_rate = #{artificialConceptionRate},</if>
<if test="ramMotherMilkVolume != null">ram_mother_milk_volume = #{ramMotherMilkVolume},</if>
<if test="milkProductionEbv != null">milk_production_ebv = #{milkProductionEbv},</if>
<if test="accuracy != null">accuracy = #{accuracy},</if>
<if test="informationCount != null">information_count = #{informationCount},</if>
<if test="isPaternityTested != null">is_paternity_tested = #{isPaternityTested},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBreedRamFileById" parameterType="Long">
delete from breed_ram_file where id = #{id}
</delete>
<delete id="deleteBreedRamFileByIds" parameterType="String">
delete from breed_ram_file where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.dairyProducts.mapper.NpMilkInOutStoreMapper">
<select id="selectWithColumns" resultType="map">
SELECT s.datetime, s.num, s.colost_sheep, s.commercial_intake, s.anti_intake,
s.colost_intake, s.intake_total, s.commercial_test, s.colost_test,
s.transfer_commercial, s.transfer_anti, s.transfer_colost, s.transfer_total,
s.loss, s.stock_commercial, s.stock_anti, s.colost, s.return_fresh, s.return_yogurt
<foreach collection="feedSources" item="f" open="," separator="," close="">
SUM(CASE WHEN fr.source_id = (SELECT id FROM np_milk_feed WHERE source_name = #{f}) THEN fr.amount ELSE NULL END) AS `${f}`
</foreach>
<foreach collection="saleDestinations" item="d" open="," separator="," close="">
SUM(CASE WHEN sr.destination_id = (SELECT id FROM np_milk_sale WHERE destination_name = #{d}) THEN sr.amount ELSE NULL END) AS `${d}`
</foreach>
FROM np_milk_in_out_store s
LEFT JOIN np_milk_feed_records fr ON fr.store_id = s.id
LEFT JOIN np_milk_sale_records sr ON sr.store_id = s.id
<where>
<if test="start != null"> s.datetime &gt;= #{start}</if>
<if test="end != null"> AND s.datetime &lt;= #{end}</if>
</where>
GROUP BY s.id
ORDER BY s.datetime
</select>
<select id="selectFeedSources" resultType="string">SELECT source_name FROM np_milk_feed</select>
<select id="selectSaleDestinations" resultType="string">SELECT destination_name FROM np_milk_sale</select>
<insert id="insertStore" useGeneratedKeys="true" keyProperty="id" parameterType="com.zhyc.module.dairyProducts.domain.NpMilkInOutStore">
INSERT INTO np_milk_in_out_store(datetime, num, colost_sheep, commercial_intake, anti_intake,
colost_intake, intake_total, commercial_test, colost_test, transfer_commercial,
transfer_anti, transfer_colost, transfer_total, loss, stock_commercial,
stock_anti, colost, return_fresh, return_yogurt)
VALUES (
#{datetime}, #{num}, #{colostSheep}, #{commercialIntake}, #{antiIntake},
#{colostIntake}, #{intakeTotal}, #{commercialTest}, #{colostTest},
#{transferCommercial}, #{transferAnti}, #{transferColost}, #{transferTotal},
#{loss}, #{stockCommercial}, #{stockAnti}, #{colost}, #{returnFresh}, #{returnYogurt}
)
</insert>
<insert id="insertFeedRecord">
INSERT INTO np_milk_feed_records(store_id, source_id, amount)
VALUES(#{storeId},
(SELECT id FROM np_milk_feed WHERE source_name = #{source}),
#{amount})
</insert>
<insert id="insertSaleRecord">
INSERT INTO np_milk_sale_records(store_id, destination_id, amount)
VALUES(#{storeId},
(SELECT id FROM np_milk_sale WHERE destination_name = #{destination}),
#{amount})
</insert>
</mapper>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.dairyProducts.mapper.NpMilkProdClassesMapper">
<resultMap id="NpMilkProdClassesResult" type="com.zhyc.module.dairyProducts.domain.NpMilkProdClasses">
<result property="id" column="id"/>
<result property="datetime" column="datetime"/>
<result property="manageEarNo" column="bs_manage_tags"/>
<result property="electronicEarNo" column="electronic_tags"/>
<result property="parity" column="parity"/>
<result property="factory" column="dr_ranch"/>
<result property="classes" column="classes"/>
<result property="milk" column="milk"/>
<result property="correctedMilk" column="corrected_milk"/>
</resultMap>
<select id="selectNpMilkProdClassesList" resultMap="NpMilkProdClassesResult">
SELECT
mpc.id,
mpc.datetime,
v.bs_manage_tags, <!-- 取消别名,使用原列名 -->
v.electronic_tags,
v.parity,
v.dr_ranch,
mpc.classes,
mpc.milk,
mpc.corrected_milk AS corrected_milk
<!-- 修改为与 resultMap 对应的列名 -->
FROM np_milk_prod_classes mpc
JOIN sheep_file v ON mpc.sheep_id = v.id
LEFT JOIN xz_wegih_correction wc ON DATE(mpc.datetime) = DATE(wc.datetime) AND v.dr_ranch = wc.factory
LEFT JOIN xz_parity_correction pc ON v.parity = pc.parity
LEFT JOIN xz_dry_matter_correction dmco ON DATE_FORMAT(mpc.datetime, '%Y-%m') = DATE_FORMAT(dmco.datetime, '%Y-%m') AND v.dr_ranch = dmco.standard
<where>
<if test="datetimeStart != null">
AND mpc.datetime &gt;= #{datetimeStart}
</if>
<if test="datetimeEnd != null">
AND mpc.datetime &lt;= #{datetimeEnd}
</if>
<if test="manageEarNo != null and manageEarNo != ''">
AND v.bs_manage_tags LIKE CONCAT('%', #{manageEarNo}, '%')
</if>
<if test="factory != null and factory != ''">
AND v.dr_ranch = #{factory}
</if>
<if test="classes != null">
AND mpc.classes = #{classes}
</if>
</where>
</select>
<!-- 称重矫正系数 -->
<select id="getWeightCorrection" resultType="java.lang.Double">
SELECT actual / system_milk
FROM xz_wegih_correction
WHERE DATE(datetime) = DATE(#{date})
AND factory = #{factory}
AND system_milk > 0
</select>
<!-- 胎次矫正系数 -->
<select id="getParityCorrection" resultType="java.lang.Double">
SELECT
CASE
WHEN parity = 1 THEN 1.2
WHEN parity BETWEEN 2 AND 4 THEN 0.96
ELSE 1
END
FROM xz_parity_correction
WHERE parity = #{parity}
</select>
<!-- 干物质矫正系数 -->
<select id="getDryMatterCorrection" resultType="java.lang.Double">
SELECT coefficient
FROM xz_dry_matter_correction
WHERE DATE_FORMAT(datetime, '%Y-%m') = DATE_FORMAT(#{date}, '%Y-%m')
AND factory = #{factory}
</select>
<insert id="insertNpMilkProdClasses" useGeneratedKeys="true" keyProperty="id">
INSERT INTO np_milk_prod_classes (datetime, sheep_id, classes, milk, corrected_milk)
VALUES (#{datetime}, #{sheepId}, #{classes}, #{milk}, #{correctedMilk})
</insert>
<select id="selectSheepIdByManageEarNo" resultType="java.lang.String">
SELECT id
FROM sheep_file
WHERE bs_manage_tags = #{manageEarNo}
</select>
</mapper>

View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.dairyProducts.mapper.NpSheepMilkAnalysisMapper">
<resultMap id="NpSheepMilkAnalysisResultMap" type="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
<id column="id" property="id"/>
<result column="manage_ear_tag" property="manageEarTag"/>
<result column="variety" property="variety"/>
<result column="milking_date" property="milkingDate"/>
<result column="dry_date" property="dryDate"/>
<result column="milking_days" property="milkingDays"/>
<result column="max_parity" property="maxParity"/>
<result column="total_milk" property="totalMilk"/>
<result column="total_corrected_milk" property="totalCorrectedMilk"/>
<result column="avg_daily_corrected_milk" property="avgDailyCorrectedMilk"/>
<result column="parity1_total_milk" property="parity1TotalMilk"/>
<result column="parity2_total_milk" property="parity2TotalMilk"/>
<result column="parity3_total_milk" property="parity3TotalMilk"/>
<result column="parity4_total_milk" property="parity4TotalMilk"/>
<result column="parity1_avg_milk" property="parity1AvgMilk"/>
<result column="parity2_avg_milk" property="parity2AvgMilk"/>
<result column="parity3_avg_milk" property="parity3AvgMilk"/>
<result column="parity4_avg_milk" property="parity4AvgMilk"/>
<result column="lactation_days" property="lactationDays"/>
<result column="last_7_avg_milk" property="last7AvgMilk"/>
<result column="last_7_corrected_milk" property="last7CorrectedMilk"/>
<result column="last_14_avg_milk" property="last14AvgMilk"/>
<result column="last_30_avg_milk" property="last30AvgMilk"/>
<result column="sheep_type" property="sheepType"/>
<result column="birthday" property="birthday"/>
<result column="current_parity" property="currentParity"/>
<result column="month_age" property="monthAge"/>
<result column="current_weight" property="currentWeight"/>
<result column="breed_status" property="breedStatus"/>
<result column="father_tag" property="fatherTag"/>
<result column="mother_tag" property="motherTag"/>
<result column="ranch" property="ranch"/>
<result column="family" property="family"/>
<result column="mother_milking_days" property="motherMilkingDays"/>
<result column="mother_total_corrected_milk" property="motherTotalCorrectedMilk"/>
<result column="mother_max_parity" property="motherMaxParity"/>
<result column="mother_avg_corrected" property="motherAvgCorrected"/>
</resultMap>
<sql id="Base_Column_List">
id, manage_ear_tag, variety, milking_date, dry_date, milking_days,
screen_days, max_parity, total_milk, total_corrected_milk,
avg_daily_corrected_milk, parity1_total_milk, parity2_total_milk,
parity3_total_milk, parity4_total_milk, parity1_avg_milk,
parity2_avg_milk, parity3_avg_milk, parity4_avg_milk,
lactation_days, last_7_avg_milk, last_7_corrected_milk,
last_14_avg_milk, last_30_avg_milk, sheep_type, birthday,
current_parity, month_age, current_weight, breed_status,
father_tag, mother_tag, ranch, family, mother_milking_days,
mother_total_corrected_milk, mother_max_parity,
mother_avg_corrected
</sql>
<select id="selectNpSheepMilkAnalysisById" resultMap="NpSheepMilkAnalysisResultMap">
SELECT <include refid="Base_Column_List"/>
FROM np_sheep_milk_analysis
WHERE id = #{id}
</select>
<select id="selectNpSheepMilkAnalysisList" resultMap="NpSheepMilkAnalysisResultMap">
SELECT <include refid="Base_Column_List"/>
FROM np_sheep_milk_analysis
<where>
<if test="manageEarTag != null and manageEarTag != ''">
AND manage_ear_tag LIKE CONCAT('%', #{manageEarTag}, '%')
</if>
<!-- 可继续添加其他搜索条件 -->
</where>
ORDER BY milking_date DESC
</select>
<insert id="insertNpSheepMilkAnalysis" parameterType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
INSERT INTO np_sheep_milk_analysis (
<include refid="Base_Column_List"/>
) VALUES (
#{id}, #{manageEarTag}, #{variety}, #{milkingDate}, #{dryDate},
#{milkingDays}, #{screenDays}, #{maxParity}, #{totalMilk},
#{totalCorrectedMilk}, #{avgDailyCorrectedMilk}, #{parity1TotalMilk},
#{parity2TotalMilk}, #{parity3TotalMilk}, #{parity4TotalMilk},
#{parity1AvgMilk}, #{parity2AvgMilk}, #{parity3AvgMilk},
#{parity4AvgMilk}, #{lactationDays}, #{last7AvgMilk},
#{last7CorrectedMilk}, #{last14AvgMilk}, #{last30AvgMilk},
#{sheepType}, #{birthday}, #{currentParity}, #{monthAge},
#{currentWeight}, #{breedStatus}, #{fatherTag}, #{motherTag},
#{ranch}, #{family}, #{motherMilkingDays},
#{motherTotalCorrectedMilk}, #{motherMaxParity},
#{motherAvgCorrected}
)
</insert>
<update id="updateNpSheepMilkAnalysis" parameterType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
UPDATE np_sheep_milk_analysis
SET manage_ear_tag = #{manageEarTag},
variety = #{variety},
milking_date = #{milkingDate},
dry_date = #{dryDate},
milking_days = #{milkingDays},
screen_days = #{screenDays},
max_parity = #{maxParity},
total_milk = #{totalMilk},
total_corrected_milk = #{totalCorrectedMilk},
avg_daily_corrected_milk = #{avgDailyCorrectedMilk},
parity1_total_milk = #{parity1TotalMilk},
parity2_total_milk = #{parity2TotalMilk},
parity3_total_milk = #{parity3TotalMilk},
parity4_total_milk = #{parity4TotalMilk},
parity1_avg_milk = #{parity1AvgMilk},
parity2_avg_milk = #{parity2AvgMilk},
parity3_avg_milk = #{parity3AvgMilk},
parity4_avg_milk = #{parity4AvgMilk},
lactation_days = #{lactationDays},
last_7_avg_milk = #{last7AvgMilk},
last_7_corrected_milk = #{last7CorrectedMilk},
last_14_avg_milk = #{last14AvgMilk},
last_30_avg_milk = #{last30AvgMilk},
sheep_type = #{sheepType},
birthday = #{birthday},
current_parity = #{currentParity},
month_age = #{monthAge},
current_weight = #{currentWeight},
breed_status = #{breedStatus},
father_tag = #{fatherTag},
mother_tag = #{motherTag},
ranch = #{ranch},
family = #{family},
mother_milking_days = #{motherMilkingDays},
mother_total_corrected_milk = #{motherTotalCorrectedMilk},
mother_max_parity = #{motherMaxParity},
mother_avg_corrected = #{motherAvgCorrected}
WHERE id = #{id}
</update>
<delete id="deleteNpSheepMilkAnalysisById" parameterType="Long">
DELETE FROM np_sheep_milk_analysis WHERE id = #{id}
</delete>
<delete id="deleteNpSheepMilkAnalysisByIds" parameterType="Long">
DELETE FROM np_sheep_milk_analysis WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>