Compare commits

...

2 Commits

Author SHA1 Message Date
zyk
f53375249f Merge remote-tracking branch 'origin/main' 2025-07-23 14:40:13 +08:00
zyk
cab2fd0234 公羊管理-采精记录和配种记录 2025-07-23 14:40:06 +08:00
12 changed files with 1872 additions and 0 deletions

View File

@ -0,0 +1,137 @@
package com.zhyc.module.produce.breed.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.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.produce.breed.domain.RawSpermRecord;
import com.zhyc.module.produce.breed.service.IRawSpermRecordService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 采精记录Controller
*
* @author ruoyi
* @date 2025-07-23
*/
@RestController
@RequestMapping("/Sperm/Sperm")
public class RawSpermRecordController extends BaseController
{
@Autowired
private IRawSpermRecordService rawSpermRecordService;
/**
* 查询采精记录列表
*/
@PreAuthorize("@ss.hasPermi('Sperm:Sperm:list')")
@GetMapping("/list")
public TableDataInfo list(RawSpermRecord rawSpermRecord)
{
startPage();
List<RawSpermRecord> list = rawSpermRecordService.selectRawSpermRecordList(rawSpermRecord);
return getDataTable(list);
}
/**
* 导出采精记录列表
*/
@PreAuthorize("@ss.hasPermi('Sperm:Sperm:export')")
@Log(title = "采精记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RawSpermRecord rawSpermRecord)
{
List<RawSpermRecord> list = rawSpermRecordService.selectRawSpermRecordList(rawSpermRecord);
ExcelUtil<RawSpermRecord> util = new ExcelUtil<RawSpermRecord>(RawSpermRecord.class);
util.exportExcel(response, list, "采精记录数据");
}
/**
* 获取采精记录详细信息
*/
@PreAuthorize("@ss.hasPermi('Sperm:Sperm:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(rawSpermRecordService.selectRawSpermRecordById(id));
}
/**
* 新增采精记录
*/
@PreAuthorize("@ss.hasPermi('Sperm:Sperm:add')")
@Log(title = "采精记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RawSpermRecord rawSpermRecord)
{
// 如果传入的是耳号需要先根据耳号查询羊只ID
if (StringUtils.isNotEmpty(rawSpermRecord.getManageTags()) && rawSpermRecord.getSheepId() == null) {
Long sheepId = rawSpermRecordService.getSheepIdByManageTags(rawSpermRecord.getManageTags());
if (sheepId == null) {
return error("未找到对应耳号的羊只信息");
}
rawSpermRecord.setSheepId(sheepId);
}
return toAjax(rawSpermRecordService.insertRawSpermRecord(rawSpermRecord));
}
/**
* 修改采精记录
*/
@PreAuthorize("@ss.hasPermi('Sperm:Sperm:edit')")
@Log(title = "采精记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RawSpermRecord rawSpermRecord)
{
// 如果传入的是耳号需要先根据耳号查询羊只ID
if (StringUtils.isNotEmpty(rawSpermRecord.getManageTags()) && rawSpermRecord.getSheepId() == null) {
Long sheepId = rawSpermRecordService.getSheepIdByManageTags(rawSpermRecord.getManageTags());
if (sheepId == null) {
return error("未找到对应耳号的羊只信息");
}
rawSpermRecord.setSheepId(sheepId);
}
return toAjax(rawSpermRecordService.updateRawSpermRecord(rawSpermRecord));
}
/**
* 删除采精记录
*/
@PreAuthorize("@ss.hasPermi('Sperm:Sperm:remove')")
@Log(title = "采精记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(rawSpermRecordService.deleteRawSpermRecordByIds(ids));
}
/**
* 根据耳号查询羊只信息
*/
@GetMapping("/getSheepByManageTags/{manageTags}")
public AjaxResult getSheepByManageTags(@PathVariable("manageTags") String manageTags)
{
Long sheepId = rawSpermRecordService.getSheepIdByManageTags(manageTags);
if (sheepId != null) {
return success(sheepId);
} else {
return error("未找到对应耳号的羊只信息");
}
}
}

View File

@ -0,0 +1,158 @@
package com.zhyc.module.produce.breed.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.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.produce.breed.domain.ScBreedRecord;
import com.zhyc.module.produce.breed.service.IScBreedRecordService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 配种记录Controller
*
* @author ruoyi
* @date 2025-07-23
*/
@RestController
@RequestMapping("/Breeding_records/Breeding_records")
public class ScBreedRecordController extends BaseController
{
@Autowired
private IScBreedRecordService scBreedRecordService;
/**
* 查询配种记录列表
*/
@PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:list')")
@GetMapping("/list")
public TableDataInfo list(ScBreedRecord scBreedRecord)
{
startPage();
List<ScBreedRecord> list = scBreedRecordService.selectScBreedRecordList(scBreedRecord);
return getDataTable(list);
}
/**
* 导出配种记录列表
*/
@PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:export')")
@Log(title = "配种记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScBreedRecord scBreedRecord)
{
List<ScBreedRecord> list = scBreedRecordService.selectScBreedRecordList(scBreedRecord);
ExcelUtil<ScBreedRecord> util = new ExcelUtil<ScBreedRecord>(ScBreedRecord.class);
util.exportExcel(response, list, "配种记录数据");
}
/**
* 获取配种记录详细信息
*/
@PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(scBreedRecordService.selectScBreedRecordById(id));
}
/**
* 根据耳号查询羊只信息
*/
@PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:query')")
@GetMapping(value = "/getSheepByTags/{manageTags}")
public AjaxResult getSheepInfoByTags(@PathVariable("manageTags") String manageTags)
{
return success(scBreedRecordService.getSheepInfoByTags(manageTags));
}
/**
* 根据母羊耳号获取配种计划信息
*/
@PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:query')")
@GetMapping(value = "/getBreedPlan/{manageTags}")
public AjaxResult getBreedPlanByEweTags(@PathVariable("manageTags") String manageTags)
{
return success(scBreedRecordService.getBreedPlanByEweTags(manageTags));
}
/**
* 新增配种记录
*/
@PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:add')")
@Log(title = "配种记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ScBreedRecord scBreedRecord)
{
// 如果传入的是耳号需要转换为羊只ID
if (scBreedRecord.getEweManageTags() != null && !scBreedRecord.getEweManageTags().isEmpty()) {
Long eweId = scBreedRecordService.getSheepIdByTags(scBreedRecord.getEweManageTags());
if (eweId == null) {
return error("未找到母羊耳号对应的羊只信息");
}
scBreedRecord.setEweId(eweId.toString());
}
if (scBreedRecord.getRamManageTags() != null && !scBreedRecord.getRamManageTags().isEmpty()) {
Long ramId = scBreedRecordService.getRamIdByTags(scBreedRecord.getRamManageTags());
if (ramId == null) {
return error("未找到公羊耳号对应的羊只信息");
}
scBreedRecord.setRamId(ramId.toString());
}
return toAjax(scBreedRecordService.insertScBreedRecord(scBreedRecord));
}
/**
* 修改配种记录
*/
@PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:edit')")
@Log(title = "配种记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ScBreedRecord scBreedRecord)
{
// 如果传入的是耳号需要转换为羊只ID
if (scBreedRecord.getEweManageTags() != null && !scBreedRecord.getEweManageTags().isEmpty()) {
Long eweId = scBreedRecordService.getSheepIdByTags(scBreedRecord.getEweManageTags());
if (eweId == null) {
return error("未找到母羊耳号对应的羊只信息");
}
scBreedRecord.setEweId(eweId.toString());
}
if (scBreedRecord.getRamManageTags() != null && !scBreedRecord.getRamManageTags().isEmpty()) {
Long ramId = scBreedRecordService.getRamIdByTags(scBreedRecord.getRamManageTags());
if (ramId == null) {
return error("未找到公羊耳号对应的羊只信息");
}
scBreedRecord.setRamId(ramId.toString());
}
return toAjax(scBreedRecordService.updateScBreedRecord(scBreedRecord));
}
/**
* 删除配种记录
*/
@PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:remove')")
@Log(title = "配种记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(scBreedRecordService.deleteScBreedRecordByIds(ids));
}
}

View File

@ -0,0 +1,237 @@
package com.zhyc.module.produce.breed.domain;
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;
/**
* 采精记录对象 raw_sperm_record
*
* @author ruoyi
* @date 2025-07-23
*/
public class RawSpermRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 羊只ID */
@Excel(name = "羊只ID")
private Long sheepId;
/** 耳号 */
@Excel(name = "耳号")
private String manageTags;
/** 电子耳号 */
@Excel(name = "电子耳号")
private String electronicTags;
/** 月龄 */
@Excel(name = "月龄")
private Long monthAge;
/** 采精日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "采精日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date pickDate;
/** 采精量 */
@Excel(name = "采精量")
private Long amount;
/** 精液密度 */
@Excel(name = "精液密度")
private String density;
/** 精液活力 */
@Excel(name = "精液活力")
private String vitallity;
/** 是否性控0否1是 */
@Excel(name = "是否性控", readConverterExp = "0=否,1=是")
private Long controlled;
/** 性欲情况 */
@Excel(name = "性欲情况")
private String sexualStatus;
/** 诊疗信息 */
@Excel(name = "诊疗信息")
private String info;
/** 技术员 */
@Excel(name = "技术员")
private String technician;
/** 采集备注 */
@Excel(name = "采集备注")
private String comment;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSheepId(Long sheepId)
{
this.sheepId = sheepId;
}
public Long getSheepId()
{
return sheepId;
}
public void setManageTags(String manageTags)
{
this.manageTags = manageTags;
}
public String getManageTags()
{
return manageTags;
}
public void setElectronicTags(String electronicTags)
{
this.electronicTags = electronicTags;
}
public String getElectronicTags()
{
return electronicTags;
}
public void setMonthAge(Long monthAge)
{
this.monthAge = monthAge;
}
public Long getMonthAge()
{
return monthAge;
}
public void setPickDate(Date pickDate)
{
this.pickDate = pickDate;
}
public Date getPickDate()
{
return pickDate;
}
public void setAmount(Long amount)
{
this.amount = amount;
}
public Long getAmount()
{
return amount;
}
public void setDensity(String density)
{
this.density = density;
}
public String getDensity()
{
return density;
}
public void setVitallity(String vitallity)
{
this.vitallity = vitallity;
}
public String getVitallity()
{
return vitallity;
}
public void setControlled(Long controlled)
{
this.controlled = controlled;
}
public Long getControlled()
{
return controlled;
}
public void setSexualStatus(String sexualStatus)
{
this.sexualStatus = sexualStatus;
}
public String getSexualStatus()
{
return sexualStatus;
}
public void setInfo(String info)
{
this.info = info;
}
public String getInfo()
{
return info;
}
public void setTechnician(String technician)
{
this.technician = technician;
}
public String getTechnician()
{
return technician;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sheepId", getSheepId())
.append("manageTags", getManageTags())
.append("electronicTags", getElectronicTags())
.append("monthAge", getMonthAge())
.append("pickDate", getPickDate())
.append("amount", getAmount())
.append("density", getDensity())
.append("vitallity", getVitallity())
.append("controlled", getControlled())
.append("sexualStatus", getSexualStatus())
.append("info", getInfo())
.append("technician", getTechnician())
.append("comment", getComment())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,359 @@
package com.zhyc.module.produce.breed.domain;
import java.math.BigDecimal;
import java.util.Date;
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;
/**
* 配种记录对象 sc_breed_record
*
* @author ruoyi
* @date 2025-07-23
*/
public class ScBreedRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 羊只id */
@Excel(name = "羊只id")
private Long sheepId;
/** 配种公羊id */
@Excel(name = "配种公羊id")
private String ramId;
/** 配种母羊id */
@Excel(name = "配种母羊id")
private String eweId;
/** 技术员 */
@Excel(name = "技术员")
private String technician;
/** 繁殖用药/耗精量 */
@Excel(name = "耗精量")
private String breedDrugs;
// ============ 显示字段 ============
/** 母羊耳号 */
@Excel(name = "耳号")
private String eweManageTags;
/** 母羊品种 */
@Excel(name = "品种")
private String eweVariety;
/** 公羊耳号 */
@Excel(name = "配种公羊")
private String ramManageTags;
/** 公羊品种 */
@Excel(name = "配种公羊品种")
private String ramVariety;
/** 胎次 */
@Excel(name = "胎次")
private Integer eweParity;
/** 月龄 */
@Excel(name = "月龄")
private Integer eweMonthAge;
/** 羊舍名称 */
@Excel(name = "当前羊舍")
private String eweSheepfoldName;
/** 繁育状态 */
@Excel(name = "繁育状态")
private String eweBreedStatus;
/** 是否性控 */
@Excel(name = "是否性控", readConverterExp = "0=否,1=是")
private Integer eweControlled;
/** 羊只备注 */
@Excel(name = "羊只备注")
private String eweComment;
/** 牧场名称 */
@Excel(name = "所在牧场")
private String ranchName;
/** 配种方式 */
@Excel(name = "配种方式")
private String matingType;
/** 羊只类别 */
@Excel(name = "配种时羊只类别")
private String sheepType;
/** 配次 */
@Excel(name = "配次")
private Integer matingCount;
/** 发情后配种时间 */
@Excel(name = "发情后配种时间(小时)")
private Long timeSincePlanning;
/** 牧场ID */
private Long ranchId;
// ============ Getter/Setter 方法 ============
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSheepId(Long sheepId)
{
this.sheepId = sheepId;
}
public Long getSheepId()
{
return sheepId;
}
public void setRamId(String ramId)
{
this.ramId = ramId;
}
public String getRamId()
{
return ramId;
}
public void setEweId(String eweId)
{
this.eweId = eweId;
}
public String getEweId()
{
return eweId;
}
public void setTechnician(String technician)
{
this.technician = technician;
}
public String getTechnician()
{
return technician;
}
public void setBreedDrugs(String breedDrugs)
{
this.breedDrugs = breedDrugs;
}
public String getBreedDrugs()
{
return breedDrugs;
}
public String getEweManageTags()
{
return eweManageTags;
}
public void setEweManageTags(String eweManageTags)
{
this.eweManageTags = eweManageTags;
}
public String getEweVariety()
{
return eweVariety;
}
public void setEweVariety(String eweVariety)
{
this.eweVariety = eweVariety;
}
public String getRamManageTags()
{
return ramManageTags;
}
public void setRamManageTags(String ramManageTags)
{
this.ramManageTags = ramManageTags;
}
public String getRamVariety()
{
return ramVariety;
}
public void setRamVariety(String ramVariety)
{
this.ramVariety = ramVariety;
}
public Integer getEweParity()
{
return eweParity;
}
public void setEweParity(Integer eweParity)
{
this.eweParity = eweParity;
}
public Integer getEweMonthAge()
{
return eweMonthAge;
}
public void setEweMonthAge(Integer eweMonthAge)
{
this.eweMonthAge = eweMonthAge;
}
public String getEweSheepfoldName()
{
return eweSheepfoldName;
}
public void setEweSheepfoldName(String eweSheepfoldName)
{
this.eweSheepfoldName = eweSheepfoldName;
}
public String getEweBreedStatus()
{
return eweBreedStatus;
}
public void setEweBreedStatus(String eweBreedStatus)
{
this.eweBreedStatus = eweBreedStatus;
}
public Integer getEweControlled()
{
return eweControlled;
}
public void setEweControlled(Integer eweControlled)
{
this.eweControlled = eweControlled;
}
public String getEweComment()
{
return eweComment;
}
public void setEweComment(String eweComment)
{
this.eweComment = eweComment;
}
public String getRanchName()
{
return ranchName;
}
public void setRanchName(String ranchName)
{
this.ranchName = ranchName;
}
public String getMatingType()
{
return matingType;
}
public void setMatingType(String matingType)
{
this.matingType = matingType;
}
public String getSheepType()
{
return sheepType;
}
public void setSheepType(String sheepType)
{
this.sheepType = sheepType;
}
public Integer getMatingCount()
{
return matingCount;
}
public void setMatingCount(Integer matingCount)
{
this.matingCount = matingCount;
}
public Long getTimeSincePlanning()
{
return timeSincePlanning;
}
public void setTimeSincePlanning(Long timeSincePlanning)
{
this.timeSincePlanning = timeSincePlanning;
}
public Long getRanchId()
{
return ranchId;
}
public void setRanchId(Long ranchId)
{
this.ranchId = ranchId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sheepId", getSheepId())
.append("ramId", getRamId())
.append("eweId", getEweId())
.append("technician", getTechnician())
.append("breedDrugs", getBreedDrugs())
.append("eweManageTags", getEweManageTags())
.append("eweVariety", getEweVariety())
.append("ramManageTags", getRamManageTags())
.append("ramVariety", getRamVariety())
.append("eweParity", getEweParity())
.append("eweMonthAge", getEweMonthAge())
.append("eweSheepfoldName", getEweSheepfoldName())
.append("eweBreedStatus", getEweBreedStatus())
.append("eweControlled", getEweControlled())
.append("eweComment", getEweComment())
.append("ranchName", getRanchName())
.append("matingType", getMatingType())
.append("sheepType", getSheepType())
.append("matingCount", getMatingCount())
.append("timeSincePlanning", getTimeSincePlanning())
.append("ranchId", getRanchId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,69 @@
package com.zhyc.module.produce.breed.mapper;
import java.util.List;
import com.zhyc.module.produce.breed.domain.RawSpermRecord;
/**
* 采精记录Mapper接口
*
* @author ruoyi
* @date 2025-07-23
*/
public interface RawSpermRecordMapper
{
/**
* 查询采精记录
*
* @param id 采精记录主键
* @return 采精记录
*/
public RawSpermRecord selectRawSpermRecordById(Long id);
/**
* 查询采精记录列表
*
* @param rawSpermRecord 采精记录
* @return 采精记录集合
*/
public List<RawSpermRecord> selectRawSpermRecordList(RawSpermRecord rawSpermRecord);
/**
* 新增采精记录
*
* @param rawSpermRecord 采精记录
* @return 结果
*/
public int insertRawSpermRecord(RawSpermRecord rawSpermRecord);
/**
* 修改采精记录
*
* @param rawSpermRecord 采精记录
* @return 结果
*/
public int updateRawSpermRecord(RawSpermRecord rawSpermRecord);
/**
* 删除采精记录
*
* @param id 采精记录主键
* @return 结果
*/
public int deleteRawSpermRecordById(Long id);
/**
* 批量删除采精记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRawSpermRecordByIds(Long[] ids);
/**
* 根据耳号查询羊只ID
*
* @param manageTags 耳号
* @return 羊只ID
*/
public Long selectSheepIdByManageTags(String manageTags);
}

View File

@ -0,0 +1,94 @@
package com.zhyc.module.produce.breed.mapper;
import java.util.List;
import java.util.Map;
import com.zhyc.module.produce.breed.domain.ScBreedRecord;
/**
* 配种记录Mapper接口
*
* @author ruoyi
* @date 2025-07-23
*/
public interface ScBreedRecordMapper
{
/**
* 查询配种记录
*
* @param id 配种记录主键
* @return 配种记录
*/
public ScBreedRecord selectScBreedRecordById(Long id);
/**
* 查询配种记录列表
*
* @param scBreedRecord 配种记录
* @return 配种记录集合
*/
public List<ScBreedRecord> selectScBreedRecordList(ScBreedRecord scBreedRecord);
/**
* 新增配种记录
*
* @param scBreedRecord 配种记录
* @return 结果
*/
public int insertScBreedRecord(ScBreedRecord scBreedRecord);
/**
* 修改配种记录
*
* @param scBreedRecord 配种记录
* @return 结果
*/
public int updateScBreedRecord(ScBreedRecord scBreedRecord);
/**
* 删除配种记录
*
* @param id 配种记录主键
* @return 结果
*/
public int deleteScBreedRecordById(Long id);
/**
* 批量删除配种记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteScBreedRecordByIds(Long[] ids);
/**
* 根据耳号查询羊只ID
*
* @param manageTags 管理耳号
* @return 羊只ID
*/
public Long getSheepIdByManageTags(String manageTags);
/**
* 根据公羊耳号查询羊只ID
*
* @param manageTags 管理耳号
* @return 羊只ID
*/
public Long getRamIdByManageTags(String manageTags);
/**
* 根据耳号查询羊只详细信息
*
* @param manageTags 管理耳号
* @return 羊只信息
*/
public Map<String, Object> getSheepInfoByTags(String manageTags);
/**
* 根据母羊耳号获取配种计划信息
*
* @param manageTags 母羊管理耳号
* @return 配种计划信息
*/
public Map<String, Object> getBreedPlanByEweTags(String manageTags);
}

View File

@ -0,0 +1,69 @@
package com.zhyc.module.produce.breed.service;
import java.util.List;
import com.zhyc.module.produce.breed.domain.RawSpermRecord;
/**
* 采精记录Service接口
*
* @author ruoyi
* @date 2025-07-23
*/
public interface IRawSpermRecordService
{
/**
* 查询采精记录
*
* @param id 采精记录主键
* @return 采精记录
*/
public RawSpermRecord selectRawSpermRecordById(Long id);
/**
* 查询采精记录列表
*
* @param rawSpermRecord 采精记录
* @return 采精记录集合
*/
public List<RawSpermRecord> selectRawSpermRecordList(RawSpermRecord rawSpermRecord);
/**
* 新增采精记录
*
* @param rawSpermRecord 采精记录
* @return 结果
*/
public int insertRawSpermRecord(RawSpermRecord rawSpermRecord);
/**
* 修改采精记录
*
* @param rawSpermRecord 采精记录
* @return 结果
*/
public int updateRawSpermRecord(RawSpermRecord rawSpermRecord);
/**
* 批量删除采精记录
*
* @param ids 需要删除的采精记录主键集合
* @return 结果
*/
public int deleteRawSpermRecordByIds(Long[] ids);
/**
* 删除采精记录信息
*
* @param id 采精记录主键
* @return 结果
*/
public int deleteRawSpermRecordById(Long id);
/**
* 根据耳号查询羊只ID
*
* @param manageTags 耳号
* @return 羊只ID
*/
public Long getSheepIdByManageTags(String manageTags);
}

View File

@ -0,0 +1,94 @@
package com.zhyc.module.produce.breed.service;
import java.util.List;
import java.util.Map;
import com.zhyc.module.produce.breed.domain.ScBreedRecord;
/**
* 配种记录Service接口
*
* @author ruoyi
* @date 2025-07-23
*/
public interface IScBreedRecordService
{
/**
* 查询配种记录
*
* @param id 配种记录主键
* @return 配种记录
*/
public ScBreedRecord selectScBreedRecordById(Long id);
/**
* 查询配种记录列表
*
* @param scBreedRecord 配种记录
* @return 配种记录集合
*/
public List<ScBreedRecord> selectScBreedRecordList(ScBreedRecord scBreedRecord);
/**
* 新增配种记录
*
* @param scBreedRecord 配种记录
* @return 结果
*/
public int insertScBreedRecord(ScBreedRecord scBreedRecord);
/**
* 修改配种记录
*
* @param scBreedRecord 配种记录
* @return 结果
*/
public int updateScBreedRecord(ScBreedRecord scBreedRecord);
/**
* 批量删除配种记录
*
* @param ids 需要删除的配种记录主键集合
* @return 结果
*/
public int deleteScBreedRecordByIds(Long[] ids);
/**
* 删除配种记录信息
*
* @param id 配种记录主键
* @return 结果
*/
public int deleteScBreedRecordById(Long id);
/**
* 根据耳号查询羊只ID
*
* @param manageTags 管理耳号
* @return 羊只ID
*/
public Long getSheepIdByTags(String manageTags);
/**
* 根据公羊耳号查询羊只ID
*
* @param manageTags 管理耳号
* @return 羊只ID
*/
public Long getRamIdByTags(String manageTags);
/**
* 根据耳号查询羊只详细信息
*
* @param manageTags 管理耳号
* @return 羊只信息
*/
public Map<String, Object> getSheepInfoByTags(String manageTags);
/**
* 根据母羊耳号获取配种计划信息
*
* @param manageTags 母羊管理耳号
* @return 配种计划信息
*/
public Map<String, Object> getBreedPlanByEweTags(String manageTags);
}

View File

@ -0,0 +1,120 @@
package com.zhyc.module.produce.breed.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.produce.breed.mapper.RawSpermRecordMapper;
import com.zhyc.module.produce.breed.domain.RawSpermRecord;
import com.zhyc.module.produce.breed.service.IRawSpermRecordService;
/**
* 采精记录Service业务层处理
*
* @author ruoyi
* @date 2025-07-23
*/
@Service
public class RawSpermRecordServiceImpl implements IRawSpermRecordService
{
@Autowired
private RawSpermRecordMapper rawSpermRecordMapper;
/**
* 查询采精记录
*
* @param id 采精记录主键
* @return 采精记录
*/
@Override
public RawSpermRecord selectRawSpermRecordById(Long id)
{
return rawSpermRecordMapper.selectRawSpermRecordById(id);
}
/**
* 查询采精记录列表
*
* @param rawSpermRecord 采精记录
* @return 采精记录
*/
@Override
public List<RawSpermRecord> selectRawSpermRecordList(RawSpermRecord rawSpermRecord)
{
return rawSpermRecordMapper.selectRawSpermRecordList(rawSpermRecord);
}
/**
* 新增采精记录
*
* @param rawSpermRecord 采精记录
* @return 结果
*/
@Override
public int insertRawSpermRecord(RawSpermRecord rawSpermRecord)
{
// 如果传入的是耳号需要先根据耳号查询羊只ID
if (StringUtils.isNotEmpty(rawSpermRecord.getManageTags()) && rawSpermRecord.getSheepId() == null) {
Long sheepId = getSheepIdByManageTags(rawSpermRecord.getManageTags());
rawSpermRecord.setSheepId(sheepId);
}
rawSpermRecord.setCreateTime(DateUtils.getNowDate());
return rawSpermRecordMapper.insertRawSpermRecord(rawSpermRecord);
}
/**
* 修改采精记录
*
* @param rawSpermRecord 采精记录
* @return 结果
*/
@Override
public int updateRawSpermRecord(RawSpermRecord rawSpermRecord)
{
// 如果传入的是耳号需要先根据耳号查询羊只ID
if (StringUtils.isNotEmpty(rawSpermRecord.getManageTags()) && rawSpermRecord.getSheepId() == null) {
Long sheepId = getSheepIdByManageTags(rawSpermRecord.getManageTags());
rawSpermRecord.setSheepId(sheepId);
}
return rawSpermRecordMapper.updateRawSpermRecord(rawSpermRecord);
}
/**
* 批量删除采精记录
*
* @param ids 需要删除的采精记录主键
* @return 结果
*/
@Override
public int deleteRawSpermRecordByIds(Long[] ids)
{
return rawSpermRecordMapper.deleteRawSpermRecordByIds(ids);
}
/**
* 删除采精记录信息
*
* @param id 采精记录主键
* @return 结果
*/
@Override
public int deleteRawSpermRecordById(Long id)
{
return rawSpermRecordMapper.deleteRawSpermRecordById(id);
}
/**
* 根据耳号查询羊只ID
*
* @param manageTags 耳号
* @return 羊只ID
*/
@Override
public Long getSheepIdByManageTags(String manageTags)
{
return rawSpermRecordMapper.selectSheepIdByManageTags(manageTags);
}
}

View File

@ -0,0 +1,164 @@
package com.zhyc.module.produce.breed.service.impl;
import java.util.List;
import java.util.Map;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.produce.breed.mapper.ScBreedRecordMapper;
import com.zhyc.module.produce.breed.domain.ScBreedRecord;
import com.zhyc.module.produce.breed.service.IScBreedRecordService;
/**
* 配种记录Service业务层处理
*
* @author ruoyi
* @date 2025-07-23
*/
@Service
public class ScBreedRecordServiceImpl implements IScBreedRecordService
{
@Autowired
private ScBreedRecordMapper scBreedRecordMapper;
/**
* 查询配种记录
*
* @param id 配种记录主键
* @return 配种记录
*/
@Override
public ScBreedRecord selectScBreedRecordById(Long id)
{
return scBreedRecordMapper.selectScBreedRecordById(id);
}
/**
* 查询配种记录列表
*
* @param scBreedRecord 配种记录
* @return 配种记录
*/
@Override
public List<ScBreedRecord> selectScBreedRecordList(ScBreedRecord scBreedRecord)
{
// 如果查询条件中有耳号需要先转换为ID
if (StringUtils.isNotEmpty(scBreedRecord.getEweManageTags()))
{
Long eweId = scBreedRecordMapper.getSheepIdByManageTags(scBreedRecord.getEweManageTags());
if (eweId != null)
{
scBreedRecord.setEweId(eweId.toString());
}
}
if (StringUtils.isNotEmpty(scBreedRecord.getRamManageTags()))
{
Long ramId = scBreedRecordMapper.getRamIdByManageTags(scBreedRecord.getRamManageTags());
if (ramId != null)
{
scBreedRecord.setRamId(ramId.toString());
}
}
return scBreedRecordMapper.selectScBreedRecordList(scBreedRecord);
}
/**
* 新增配种记录
*
* @param scBreedRecord 配种记录
* @return 结果
*/
@Override
public int insertScBreedRecord(ScBreedRecord scBreedRecord)
{
scBreedRecord.setCreateTime(DateUtils.getNowDate());
return scBreedRecordMapper.insertScBreedRecord(scBreedRecord);
}
/**
* 修改配种记录
*
* @param scBreedRecord 配种记录
* @return 结果
*/
@Override
public int updateScBreedRecord(ScBreedRecord scBreedRecord)
{
return scBreedRecordMapper.updateScBreedRecord(scBreedRecord);
}
/**
* 批量删除配种记录
*
* @param ids 需要删除的配种记录主键
* @return 结果
*/
@Override
public int deleteScBreedRecordByIds(Long[] ids)
{
return scBreedRecordMapper.deleteScBreedRecordByIds(ids);
}
/**
* 删除配种记录信息
*
* @param id 配种记录主键
* @return 结果
*/
@Override
public int deleteScBreedRecordById(Long id)
{
return scBreedRecordMapper.deleteScBreedRecordById(id);
}
/**
* 根据耳号查询羊只ID
*
* @param manageTags 管理耳号
* @return 羊只ID
*/
@Override
public Long getSheepIdByTags(String manageTags)
{
return scBreedRecordMapper.getSheepIdByManageTags(manageTags);
}
/**
* 根据公羊耳号查询羊只ID
*
* @param manageTags 管理耳号
* @return 羊只ID
*/
@Override
public Long getRamIdByTags(String manageTags)
{
return scBreedRecordMapper.getRamIdByManageTags(manageTags);
}
/**
* 根据耳号查询羊只详细信息
*
* @param manageTags 管理耳号
* @return 羊只信息
*/
@Override
public Map<String, Object> getSheepInfoByTags(String manageTags)
{
return scBreedRecordMapper.getSheepInfoByTags(manageTags);
}
/**
* 根据母羊耳号获取配种计划信息
*
* @param manageTags 母羊管理耳号
* @return 配种计划信息
*/
@Override
public Map<String, Object> getBreedPlanByEweTags(String manageTags)
{
return scBreedRecordMapper.getBreedPlanByEweTags(manageTags);
}
}

View File

@ -0,0 +1,235 @@
<?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.produce.breed.mapper.ScBreedRecordMapper">
<resultMap type="ScBreedRecord" id="ScBreedRecordResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="ramId" column="ram_id" />
<result property="eweId" column="ewe_id" />
<result property="technician" column="technician" />
<result property="breedDrugs" column="breed_drugs" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<!-- 新增显示字段 -->
<result property="eweManageTags" column="ewe_manage_tags" />
<result property="eweVariety" column="ewe_variety" />
<result property="ramManageTags" column="ram_manage_tags" />
<result property="ramVariety" column="ram_variety" />
<result property="eweParity" column="ewe_parity" />
<result property="eweMonthAge" column="ewe_month_age" />
<result property="eweSheepfoldName" column="ewe_sheepfold_name" />
<result property="eweBreedStatus" column="ewe_breed_status" />
<result property="eweControlled" column="ewe_controlled" />
<result property="eweComment" column="ewe_comment" />
<result property="ranchName" column="ranch_name" />
<result property="matingType" column="mating_type" />
<result property="sheepType" column="sheep_type" />
<result property="matingCount" column="mating_count" />
<result property="timeSincePlanning" column="time_since_planning" />
</resultMap>
<sql id="selectScBreedRecordVo">
select
br.id,
br.sheep_id,
br.ram_id,
br.ewe_id,
br.technician,
br.breed_drugs,
br.create_by,
br.create_time,
-- 母羊信息(从视图获取)
ewe_view.bs_manage_tags as ewe_manage_tags,
ewe_view.variety as ewe_variety,
ewe_view.parity as ewe_parity,
ewe_view.month_age as ewe_month_age,
ewe_view.sheepfold_name as ewe_sheepfold_name,
ewe_view.breed as ewe_breed_status,
ewe_view.controlled as ewe_controlled,
ewe_view.comment as ewe_comment,
ewe_view.dr_ranch as ranch_name,
ewe_view.name as sheep_type,
ewe_view.mating_total as mating_count,
-- 公羊信息(从视图获取)
ram_view.bs_manage_tags as ram_manage_tags,
ram_view.variety as ram_variety,
-- 配种方式(如果视图中没有,设为空或从其他地方获取)
'' as mating_type,
-- 发情后配种时间(小时数)
TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning
from sc_breed_record br
left join sheep_file ewe_view on br.ewe_id = ewe_view.id
left join sheep_file ram_view on br.ram_id = ram_view.id
</sql>
<select id="selectScBreedRecordList" parameterType="ScBreedRecord" resultMap="ScBreedRecordResult">
<include refid="selectScBreedRecordVo"/>
<where>
<if test="sheepId != null "> and br.sheep_id = #{sheepId}</if>
<if test="ramId != null and ramId != ''"> and br.ram_id = #{ramId}</if>
<if test="eweId != null and eweId != ''"> and br.ewe_id = #{eweId}</if>
<if test="technician != null and technician != ''"> and br.technician like concat('%', #{technician}, '%')</if>
<if test="breedDrugs != null and breedDrugs != ''"> and br.breed_drugs like concat('%', #{breedDrugs}, '%')</if>
<if test="createBy != null and createBy != ''"> and br.create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and date_format(br.create_time,'%y-%m-%d') = date_format(#{createTime},'%y-%m-%d')</if>
<!-- 新增耳号查询条件 -->
<if test="eweManageTags != null and eweManageTags != ''"> and ewe_view.bs_manage_tags like concat('%', #{eweManageTags}, '%')</if>
<if test="ramManageTags != null and ramManageTags != ''"> and ram_view.bs_manage_tags like concat('%', #{ramManageTags}, '%')</if>
<if test="eweVariety != null and eweVariety != ''"> and ewe_view.variety like concat('%', #{eweVariety}, '%')</if>
<if test="ramVariety != null and ramVariety != ''"> and ram_view.variety like concat('%', #{ramVariety}, '%')</if>
<if test="ranchId != null"> and ewe_view.ranch_id = #{ranchId}</if>
</where>
order by br.create_time desc
</select>
<select id="selectScBreedRecordById" parameterType="Long" resultMap="ScBreedRecordResult">
<include refid="selectScBreedRecordVo"/>
where br.id = #{id}
</select>
<!-- 根据母羊耳号查询羊只ID -->
<select id="getSheepIdByManageTags" parameterType="String" resultType="Long">
select id from sheep_file where bs_manage_tags = #{manageTags} and is_delete = 0
</select>
<!-- 根据公羊耳号查询羊只ID -->
<select id="getRamIdByManageTags" parameterType="String" resultType="Long">
select id from sheep_file where bs_manage_tags = #{manageTags} and gender = 2 and is_delete = 0
</select>
<!-- 根据耳号查询羊只详细信息 -->
<select id="getSheepInfoByTags" parameterType="String" resultType="map">
select
id,
bs_manage_tags as manage_tags,
ranch_id,
dr_ranch as ranch_name,
sheepfold_id,
sheepfold_name,
electronic_tags,
variety_id,
variety,
family,
name as type_name,
gender,
birthday,
day_age,
month_age,
parity,
birth_weight,
weaning_date,
status_id,
weaning_weight,
current_weight,
breed_status_id,
breed as breed_status,
bs_father_id as father_id,
father_manage_tags,
bs_mother_id as mother_id,
mother_manage_tags,
receptor_id,
receptor_manage_tags,
mating_date,
mating_type_id,
preg_date,
lambing_date,
lambing_day,
mating_day,
gestation_day,
expected_date,
post_lambing_day,
lactation_day,
anestrous_day,
mating_counts,
mating_total,
miscarriage_counts,
comment,
controlled,
body,
breast,
source,
source_date,
source_ranch_id,
source_ranch,
update_by,
update_time,
create_by,
create_time
from sheep_file
where bs_manage_tags = #{manageTags} and is_delete = 0
</select>
<!-- 根据母羊耳号获取配种计划信息 -->
<select id="getBreedPlanByEweTags" parameterType="String" resultType="map">
select
bp.id as plan_id,
bp.ewe_id,
ewe_view.bs_manage_tags as ewe_manage_tags,
bp.ram_id,
ram_view.bs_manage_tags as ram_manage_tags,
bp.plan_date,
bp.breed_type,
bp.technician,
bp.status,
bp.create_time as plan_create_time,
TIMESTAMPDIFF(HOUR, bp.create_time, NOW()) as hours_since_plan
from sc_breed_plan bp
left join sheep_file ewe_view on bp.ewe_id = ewe_view.id
left join sheep_file ram_view on bp.ram_id = ram_view.id
where ewe_view.bs_manage_tags = #{manageTags}
and bp.status = '待配种'
and bp.is_delete = 0
order by bp.create_time desc
limit 1
</select>
<insert id="insertScBreedRecord" parameterType="ScBreedRecord" useGeneratedKeys="true" keyProperty="id">
insert into sc_breed_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="ramId != null">ram_id,</if>
<if test="eweId != null">ewe_id,</if>
<if test="technician != null">technician,</if>
<if test="breedDrugs != null">breed_drugs,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="ramId != null">#{ramId},</if>
<if test="eweId != null">#{eweId},</if>
<if test="technician != null">#{technician},</if>
<if test="breedDrugs != null">#{breedDrugs},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateScBreedRecord" parameterType="ScBreedRecord">
update sc_breed_record
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="ramId != null">ram_id = #{ramId},</if>
<if test="eweId != null">ewe_id = #{eweId},</if>
<if test="technician != null">technician = #{technician},</if>
<if test="breedDrugs != null">breed_drugs = #{breedDrugs},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScBreedRecordById" parameterType="Long">
delete from sc_breed_record where id = #{id}
</delete>
<delete id="deleteScBreedRecordByIds" parameterType="String">
delete from sc_breed_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,136 @@
<?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.produce.breed.mapper.RawSpermRecordMapper">
<resultMap type="RawSpermRecord" id="RawSpermRecordResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="manageTags" column="bs_manage_tags" />
<result property="electronicTags" column="electronic_tags" />
<result property="monthAge" column="month_age" />
<result property="pickDate" column="pick_date" />
<result property="amount" column="amount" />
<result property="density" column="density" />
<result property="vitallity" column="vitallity" />
<result property="controlled" column="controlled" />
<result property="sexualStatus" column="sexual_status" />
<result property="info" column="info" />
<result property="technician" column="technician" />
<result property="comment" column="comment" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectRawSpermRecordVo">
select
rsr.id,
rsr.sheep_id,
sf.bs_manage_tags,
sf.electronic_tags,
sf.month_age,
rsr.pick_date,
rsr.amount,
rsr.density,
rsr.vitallity,
rsr.controlled,
rsr.sexual_status,
rsr.info,
rsr.technician,
rsr.comment,
rsr.create_by,
rsr.create_time
from raw_sperm_record rsr
left join sheep_file sf on rsr.sheep_id = sf.id
</sql>
<select id="selectRawSpermRecordList" parameterType="RawSpermRecord" resultMap="RawSpermRecordResult">
<include refid="selectRawSpermRecordVo"/>
<where>
<if test="manageTags != null and manageTags != ''"> and sf.bs_manage_tags like concat('%', #{manageTags}, '%')</if>
<if test="pickDate != null "> and rsr.pick_date = #{pickDate}</if>
<if test="amount != null "> and rsr.amount = #{amount}</if>
<if test="density != null and density != ''"> and rsr.density = #{density}</if>
<if test="vitallity != null and vitallity != ''"> and rsr.vitallity = #{vitallity}</if>
<if test="controlled != null "> and rsr.controlled = #{controlled}</if>
<if test="sexualStatus != null and sexualStatus != ''"> and rsr.sexual_status = #{sexualStatus}</if>
<if test="info != null and info != ''"> and rsr.info = #{info}</if>
<if test="technician != null and technician != ''"> and rsr.technician = #{technician}</if>
<if test="comment != null and comment != ''"> and rsr.comment = #{comment}</if>
</where>
order by rsr.pick_date desc
</select>
<select id="selectRawSpermRecordById" parameterType="Long" resultMap="RawSpermRecordResult">
<include refid="selectRawSpermRecordVo"/>
where rsr.id = #{id}
</select>
<!-- 根据耳号查询羊只ID -->
<select id="selectSheepIdByManageTags" parameterType="String" resultType="Long">
select id from sheep_file where bs_manage_tags = #{manageTags}
</select>
<insert id="insertRawSpermRecord" parameterType="RawSpermRecord" useGeneratedKeys="true" keyProperty="id">
insert into raw_sperm_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="pickDate != null">pick_date,</if>
<if test="amount != null">amount,</if>
<if test="density != null">density,</if>
<if test="vitallity != null">vitallity,</if>
<if test="controlled != null">controlled,</if>
<if test="sexualStatus != null">sexual_status,</if>
<if test="info != null">info,</if>
<if test="technician != null">technician,</if>
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="pickDate != null">#{pickDate},</if>
<if test="amount != null">#{amount},</if>
<if test="density != null">#{density},</if>
<if test="vitallity != null">#{vitallity},</if>
<if test="controlled != null">#{controlled},</if>
<if test="sexualStatus != null">#{sexualStatus},</if>
<if test="info != null">#{info},</if>
<if test="technician != null">#{technician},</if>
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateRawSpermRecord" parameterType="RawSpermRecord">
update raw_sperm_record
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="pickDate != null">pick_date = #{pickDate},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="density != null">density = #{density},</if>
<if test="vitallity != null">vitallity = #{vitallity},</if>
<if test="controlled != null">controlled = #{controlled},</if>
<if test="sexualStatus != null">sexual_status = #{sexualStatus},</if>
<if test="info != null">info = #{info},</if>
<if test="technician != null">technician = #{technician},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRawSpermRecordById" parameterType="Long">
delete from raw_sperm_record where id = #{id}
</delete>
<delete id="deleteRawSpermRecordByIds" parameterType="String">
delete from raw_sperm_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>