Merge remote-tracking branch 'origin/main'

# Conflicts:
#	zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/domain/ScTransGroup.java
#	zhyc-module/src/main/resources/mapper/produce/other/fixHoof/ScFixHoofMapper.xml
This commit is contained in:
wyt 2025-07-18 12:52:26 +08:00
commit a2d5c34995
51 changed files with 3460 additions and 356 deletions

View File

@ -51,6 +51,10 @@ spring:
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
profiles: profiles:
active: druid active: druid
# 文件上传 # 文件上传
@ -112,6 +116,7 @@ pagehelper:
supportMethodsArguments: true supportMethodsArguments: true
params: count=countSql params: count=countSql
# Swagger配置 # Swagger配置
swagger: swagger:
# 是否开启swagger # 是否开启swagger
@ -127,3 +132,6 @@ xss:
excludes: /system/notice excludes: /system/notice
# 匹配链接 # 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/* urlPatterns: /system/*,/monitor/*,/tool/*

View File

@ -97,7 +97,7 @@ public class TreatmentController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('treatment:treatment:remove')") @PreAuthorize("@ss.hasPermi('treatment:treatment:remove')")
@Log(title = "治疗记录", businessType = BusinessType.DELETE) @Log(title = "治疗记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids)
{ {
return toAjax(treatmentService.deleteTreatmentByIds(ids)); return toAjax(treatmentService.deleteTreatmentByIds(ids));

View File

@ -28,7 +28,7 @@ public class SwPrescription extends BaseEntity
private String name; private String name;
/** 类型(免疫/保健/驱虫/消毒/疾病治疗) */ /** 类型(免疫/保健/驱虫/消毒/疾病治疗) */
@Excel(name = "类型", readConverterExp = "=疫/保健/驱虫/消毒/疾病治疗") @Excel(name = "类型", readConverterExp = "疫/保健/驱虫/消毒/疾病治疗")
private Integer persType; private Integer persType;
/** 备注 */ /** 备注 */

View File

@ -1,7 +1,11 @@
package com.zhyc.module.biosafety.domain; package com.zhyc.module.biosafety.domain;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
@ -13,6 +17,7 @@ import com.zhyc.common.core.domain.BaseEntity;
* @author ruoyi * @author ruoyi
* @date 2025-07-15 * @date 2025-07-15
*/ */
@Data
public class Treatment extends BaseEntity public class Treatment extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -80,204 +85,11 @@ public class Treatment extends BaseEntity
@Excel(name = "药品使用记录id") @Excel(name = "药品使用记录id")
private Long usageId; private Long usageId;
// 药品使用
private List<SwMedicineUsageDetails> usageDetails;
/** 备注 */ /** 备注 */
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDiagId(Long diagId)
{
this.diagId = diagId;
}
public Long getDiagId()
{
return diagId;
}
public void setSheepId(Long sheepId)
{
this.sheepId = sheepId;
}
public Long getSheepId()
{
return sheepId;
}
public void setVariety(String variety)
{
this.variety = variety;
}
public String getVariety()
{
return variety;
}
public void setSheepType(String sheepType)
{
this.sheepType = sheepType;
}
public String getSheepType()
{
return sheepType;
}
public void setMonthAge(Long monthAge)
{
this.monthAge = monthAge;
}
public Long getMonthAge()
{
return monthAge;
}
public void setGender(String gender)
{
this.gender = gender;
}
public String getGender()
{
return gender;
}
public void setParity(Long parity)
{
this.parity = parity;
}
public Long getParity()
{
return parity;
}
public void setBreed(String breed)
{
this.breed = breed;
}
public String getBreed()
{
return breed;
}
public void setLactDay(Long lactDay)
{
this.lactDay = lactDay;
}
public Long getLactDay()
{
return lactDay;
}
public void setGestDay(Long gestDay)
{
this.gestDay = gestDay;
}
public Long getGestDay()
{
return gestDay;
}
public void setDatetime(Date datetime)
{
this.datetime = datetime;
}
public Date getDatetime()
{
return datetime;
}
public void setDiseaseId(Long diseaseId)
{
this.diseaseId = diseaseId;
}
public Long getDiseaseId()
{
return diseaseId;
}
public void setDiseasePid(String diseasePid)
{
this.diseasePid = diseasePid;
}
public String getDiseasePid()
{
return diseasePid;
}
public void setVeterinary(String veterinary)
{
this.veterinary = veterinary;
}
public String getVeterinary()
{
return veterinary;
}
public void setUsageId(Long usageId)
{
this.usageId = usageId;
}
public Long getUsageId()
{
return usageId;
}
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("diagId", getDiagId())
.append("sheepId", getSheepId())
.append("variety", getVariety())
.append("sheepType", getSheepType())
.append("monthAge", getMonthAge())
.append("gender", getGender())
.append("parity", getParity())
.append("breed", getBreed())
.append("lactDay", getLactDay())
.append("gestDay", getGestDay())
.append("datetime", getDatetime())
.append("diseaseId", getDiseaseId())
.append("diseasePid", getDiseasePid())
.append("veterinary", getVeterinary())
.append("usageId", getUsageId())
.append("comment", getComment())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
} }

View File

@ -2,11 +2,14 @@ package com.zhyc.module.biosafety.service.impl;
import java.util.List; import java.util.List;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.domain.SwPrescription;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zhyc.module.biosafety.mapper.TreatmentMapper; import com.zhyc.module.biosafety.mapper.TreatmentMapper;
import com.zhyc.module.biosafety.domain.Treatment; import com.zhyc.module.biosafety.domain.Treatment;
import com.zhyc.module.biosafety.service.ITreatmentService; import com.zhyc.module.biosafety.service.ITreatmentService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 治疗记录Service业务层处理 * 治疗记录Service业务层处理
@ -19,6 +22,8 @@ public class TreatmentServiceImpl implements ITreatmentService
{ {
@Autowired @Autowired
private TreatmentMapper treatmentMapper; private TreatmentMapper treatmentMapper;
@Autowired
private SwMedicineUsageServiceImpl medicineUsageService;
/** /**
* 查询治疗记录 * 查询治疗记录
@ -51,8 +56,15 @@ public class TreatmentServiceImpl implements ITreatmentService
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public int insertTreatment(Treatment treatment) public int insertTreatment(Treatment treatment)
{ {
SwMedicineUsage medicineUsage = new SwMedicineUsage();
medicineUsage.setName("羊只治疗");
medicineUsage.setUseType("4");
// 药品使用记录
medicineUsage.setSwMedicineUsageDetailsList(treatment.getUsageDetails());
medicineUsageService.insertSwMedicineUsage(medicineUsage);
treatment.setCreateTime(DateUtils.getNowDate()); treatment.setCreateTime(DateUtils.getNowDate());
return treatmentMapper.insertTreatment(treatment); return treatmentMapper.insertTreatment(treatment);
} }

View File

@ -0,0 +1,104 @@
package com.zhyc.module.dairyProducts.yogurtTest.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.dairyProducts.yogurtTest.domain.NpYogurtInsp;
import com.zhyc.module.dairyProducts.yogurtTest.service.INpYogurtInspService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 酸奶生产成品检疫记录Controller
*
* @author ruoyi
* @date 2025-07-17
*/
@RestController
@RequestMapping("/yogurtTest/yogurtTest")
public class NpYogurtInspController extends BaseController
{
@Autowired
private INpYogurtInspService npYogurtInspService;
/**
* 查询酸奶生产成品检疫记录列表
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:list')")
@GetMapping("/list")
public TableDataInfo list(NpYogurtInsp npYogurtInsp)
{
startPage();
List<NpYogurtInsp> list = npYogurtInspService.selectNpYogurtInspList(npYogurtInsp);
return getDataTable(list);
}
/**
* 导出酸奶生产成品检疫记录列表
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:export')")
@Log(title = "酸奶生产,成品检疫记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, NpYogurtInsp npYogurtInsp)
{
List<NpYogurtInsp> list = npYogurtInspService.selectNpYogurtInspList(npYogurtInsp);
ExcelUtil<NpYogurtInsp> util = new ExcelUtil<NpYogurtInsp>(NpYogurtInsp.class);
util.exportExcel(response, list, "酸奶生产,成品检疫记录数据");
}
/**
* 获取酸奶生产成品检疫记录详细信息
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(npYogurtInspService.selectNpYogurtInspById(id));
}
/**
* 新增酸奶生产成品检疫记录
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:add')")
@Log(title = "酸奶生产,成品检疫记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody NpYogurtInsp npYogurtInsp)
{
return toAjax(npYogurtInspService.insertNpYogurtInsp(npYogurtInsp));
}
/**
* 修改酸奶生产成品检疫记录
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:edit')")
@Log(title = "酸奶生产,成品检疫记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody NpYogurtInsp npYogurtInsp)
{
return toAjax(npYogurtInspService.updateNpYogurtInsp(npYogurtInsp));
}
/**
* 删除酸奶生产成品检疫记录
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:remove')")
@Log(title = "酸奶生产,成品检疫记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(npYogurtInspService.deleteNpYogurtInspByIds(ids));
}
}

View File

@ -0,0 +1,268 @@
package com.zhyc.module.dairyProducts.yogurtTest.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;
/**
* 酸奶生产成品检疫记录对象 np_yogurt_insp
*
* @author ruoyi
* @date 2025-07-17
*/
public class NpYogurtInsp extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 来源 */
@Excel(name = "来源")
private String source;
/** 检测日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "检测日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date datetime;
/** 脂肪g/100g */
@Excel(name = "脂肪g/100g")
private Double fat;
/** 蛋白质g/100g */
@Excel(name = "蛋白质g/100g")
private Double protein;
/** 非脂g/100g
*/
@Excel(name = "非脂g/100g")
private Double nonFat;
/** 酸度oT */
@Excel(name = "酸度oT")
private Double acidity;
/** 菌落总数CFU/g_1 */
@Excel(name = "菌落总数", readConverterExp = "C=FU/g")
private Double bacterialColony1;
/** 菌落总数CFU/g_2 */
@Excel(name = "菌落总数", readConverterExp = "C=FU/g")
private Double bacterialClony2;
/** 菌落总数CFU/g_3 */
@Excel(name = "菌落总数", readConverterExp = "C=FU/g")
private Double bacterialClony3;
/** 菌落总数CFU/g_4 */
@Excel(name = "菌落总数", readConverterExp = "C=FU/g")
private Double bacterialClony4;
/** 菌落总数CFU/g_5 */
@Excel(name = "菌落总数", readConverterExp = "C=FU/g")
private Double bacterialClony5;
/** 酵母菌(CFU/g) */
@Excel(name = "酵母菌(CFU/g)")
private Double yeast;
/** 霉菌CFU/g */
@Excel(name = "霉菌", readConverterExp = "C=FU/g")
private Double mould;
/** 乳酸菌数CFU/g */
@Excel(name = "乳酸菌数", readConverterExp = "C=FU/g")
private Double lacto;
/** 备注 */
@Excel(name = "备注")
private String comment;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSource(String source)
{
this.source = source;
}
public String getSource()
{
return source;
}
public void setDatetime(Date datetime)
{
this.datetime = datetime;
}
public Date getDatetime()
{
return datetime;
}
public void setFat(Double fat)
{
this.fat = fat;
}
public Double getFat()
{
return fat;
}
public void setProtein(Double protein)
{
this.protein = protein;
}
public Double getProtein()
{
return protein;
}
public void setNonFat(Double nonFat)
{
this.nonFat = nonFat;
}
public Double getNonFat()
{
return nonFat;
}
public void setAcidity(Double acidity)
{
this.acidity = acidity;
}
public Double getAcidity()
{
return acidity;
}
public void setBacterialColony1(Double bacterialColony1)
{
this.bacterialColony1 = bacterialColony1;
}
public Double getBacterialColony1()
{
return bacterialColony1;
}
public void setBacterialClony2(Double bacterialClony2)
{
this.bacterialClony2 = bacterialClony2;
}
public Double getBacterialClony2()
{
return bacterialClony2;
}
public void setBacterialClony3(Double bacterialClony3)
{
this.bacterialClony3 = bacterialClony3;
}
public Double getBacterialClony3()
{
return bacterialClony3;
}
public void setBacterialClony4(Double bacterialClony4)
{
this.bacterialClony4 = bacterialClony4;
}
public Double getBacterialClony4()
{
return bacterialClony4;
}
public void setBacterialClony5(Double bacterialClony5)
{
this.bacterialClony5 = bacterialClony5;
}
public Double getBacterialClony5()
{
return bacterialClony5;
}
public void setYeast(Double yeast)
{
this.yeast = yeast;
}
public Double getYeast()
{
return yeast;
}
public void setMould(Double mould)
{
this.mould = mould;
}
public Double getMould()
{
return mould;
}
public void setLacto(Double lacto)
{
this.lacto = lacto;
}
public Double getLacto()
{
return lacto;
}
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("source", getSource())
.append("datetime", getDatetime())
.append("fat", getFat())
.append("protein", getProtein())
.append("nonFat", getNonFat())
.append("acidity", getAcidity())
.append("bacterialColony1", getBacterialColony1())
.append("bacterialClony2", getBacterialClony2())
.append("bacterialClony3", getBacterialClony3())
.append("bacterialClony4", getBacterialClony4())
.append("bacterialClony5", getBacterialClony5())
.append("yeast", getYeast())
.append("mould", getMould())
.append("lacto", getLacto())
.append("comment", getComment())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.dairyProducts.yogurtTest.mapper;
import java.util.List;
import com.zhyc.module.dairyProducts.yogurtTest.domain.NpYogurtInsp;
/**
* 酸奶生产成品检疫记录Mapper接口
*
* @author ruoyi
* @date 2025-07-17
*/
public interface NpYogurtInspMapper
{
/**
* 查询酸奶生产成品检疫记录
*
* @param id 酸奶生产成品检疫记录主键
* @return 酸奶生产成品检疫记录
*/
public NpYogurtInsp selectNpYogurtInspById(Long id);
/**
* 查询酸奶生产成品检疫记录列表
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 酸奶生产成品检疫记录集合
*/
public List<NpYogurtInsp> selectNpYogurtInspList(NpYogurtInsp npYogurtInsp);
/**
* 新增酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
public int insertNpYogurtInsp(NpYogurtInsp npYogurtInsp);
/**
* 修改酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
public int updateNpYogurtInsp(NpYogurtInsp npYogurtInsp);
/**
* 删除酸奶生产成品检疫记录
*
* @param id 酸奶生产成品检疫记录主键
* @return 结果
*/
public int deleteNpYogurtInspById(Long id);
/**
* 批量删除酸奶生产成品检疫记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteNpYogurtInspByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.dairyProducts.yogurtTest.service;
import java.util.List;
import com.zhyc.module.dairyProducts.yogurtTest.domain.NpYogurtInsp;
/**
* 酸奶生产成品检疫记录Service接口
*
* @author ruoyi
* @date 2025-07-17
*/
public interface INpYogurtInspService
{
/**
* 查询酸奶生产成品检疫记录
*
* @param id 酸奶生产成品检疫记录主键
* @return 酸奶生产成品检疫记录
*/
public NpYogurtInsp selectNpYogurtInspById(Long id);
/**
* 查询酸奶生产成品检疫记录列表
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 酸奶生产成品检疫记录集合
*/
public List<NpYogurtInsp> selectNpYogurtInspList(NpYogurtInsp npYogurtInsp);
/**
* 新增酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
public int insertNpYogurtInsp(NpYogurtInsp npYogurtInsp);
/**
* 修改酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
public int updateNpYogurtInsp(NpYogurtInsp npYogurtInsp);
/**
* 批量删除酸奶生产成品检疫记录
*
* @param ids 需要删除的酸奶生产成品检疫记录主键集合
* @return 结果
*/
public int deleteNpYogurtInspByIds(Long[] ids);
/**
* 删除酸奶生产成品检疫记录信息
*
* @param id 酸奶生产成品检疫记录主键
* @return 结果
*/
public int deleteNpYogurtInspById(Long id);
}

View File

@ -0,0 +1,95 @@
package com.zhyc.module.dairyProducts.yogurtTest.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.dairyProducts.yogurtTest.mapper.NpYogurtInspMapper;
import com.zhyc.module.dairyProducts.yogurtTest.domain.NpYogurtInsp;
import com.zhyc.module.dairyProducts.yogurtTest.service.INpYogurtInspService;
/**
* 酸奶生产成品检疫记录Service业务层处理
*
* @author ruoyi
* @date 2025-07-17
*/
@Service
public class NpYogurtInspServiceImpl implements INpYogurtInspService
{
@Autowired
private NpYogurtInspMapper npYogurtInspMapper;
/**
* 查询酸奶生产成品检疫记录
*
* @param id 酸奶生产成品检疫记录主键
* @return 酸奶生产成品检疫记录
*/
@Override
public NpYogurtInsp selectNpYogurtInspById(Long id)
{
return npYogurtInspMapper.selectNpYogurtInspById(id);
}
/**
* 查询酸奶生产成品检疫记录列表
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 酸奶生产成品检疫记录
*/
@Override
public List<NpYogurtInsp> selectNpYogurtInspList(NpYogurtInsp npYogurtInsp)
{
return npYogurtInspMapper.selectNpYogurtInspList(npYogurtInsp);
}
/**
* 新增酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
@Override
public int insertNpYogurtInsp(NpYogurtInsp npYogurtInsp)
{
npYogurtInsp.setCreateTime(DateUtils.getNowDate());
return npYogurtInspMapper.insertNpYogurtInsp(npYogurtInsp);
}
/**
* 修改酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
@Override
public int updateNpYogurtInsp(NpYogurtInsp npYogurtInsp)
{
return npYogurtInspMapper.updateNpYogurtInsp(npYogurtInsp);
}
/**
* 批量删除酸奶生产成品检疫记录
*
* @param ids 需要删除的酸奶生产成品检疫记录主键
* @return 结果
*/
@Override
public int deleteNpYogurtInspByIds(Long[] ids)
{
return npYogurtInspMapper.deleteNpYogurtInspByIds(ids);
}
/**
* 删除酸奶生产成品检疫记录信息
*
* @param id 酸奶生产成品检疫记录主键
* @return 结果
*/
@Override
public int deleteNpYogurtInspById(Long id)
{
return npYogurtInspMapper.deleteNpYogurtInspById(id);
}
}

View File

@ -0,0 +1,115 @@
package com.zhyc.module.produce.drymilk.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.drymilk.domain.ScDryMilk;
import com.zhyc.module.produce.drymilk.service.IScDryMilkService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 干奶记录Controller
*
* @author ruoyi
* @date 2025-07-15
*/
@RestController
@RequestMapping("/drymilk/drymilk")
public class ScDryMilkController extends BaseController
{
@Autowired
private IScDryMilkService scDryMilkService;
/**
* 查询干奶记录列表
*/
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:list')")
@GetMapping("/list")
public TableDataInfo list(ScDryMilk scDryMilk)
{
startPage();
List<ScDryMilk> list = scDryMilkService.selectScDryMilkList(scDryMilk);
return getDataTable(list);
}
/**
* 导出干奶记录列表
*/
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:export')")
@Log(title = "干奶记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScDryMilk scDryMilk)
{
List<ScDryMilk> list = scDryMilkService.selectScDryMilkList(scDryMilk);
ExcelUtil<ScDryMilk> util = new ExcelUtil<ScDryMilk>(ScDryMilk.class);
util.exportExcel(response, list, "干奶记录数据");
}
/**
* 获取干奶记录详细信息
*/
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(scDryMilkService.selectScDryMilkById(id));
}
/**
* 根据耳号查询羊只ID
*/
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:query')")
@GetMapping(value = "/sheep/{manageTags}")
public AjaxResult getSheepIdByManageTags(@PathVariable("manageTags") String manageTags)
{
Long sheepId = scDryMilkService.selectSheepIdByManageTags(manageTags);
return success(sheepId);
}
/**
* 新增干奶记录
*/
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:add')")
@Log(title = "干奶记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ScDryMilk scDryMilk)
{
return toAjax(scDryMilkService.insertScDryMilk(scDryMilk));
}
/**
* 修改干奶记录
*/
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:edit')")
@Log(title = "干奶记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ScDryMilk scDryMilk)
{
return toAjax(scDryMilkService.updateScDryMilk(scDryMilk));
}
/**
* 删除干奶记录
*/
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:remove')")
@Log(title = "干奶记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(scDryMilkService.deleteScDryMilkByIds(ids));
}
}

View File

@ -0,0 +1,189 @@
package com.zhyc.module.produce.drymilk.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;
/**
* 干奶记录对象 sc_dry_milk
*
* @author ruoyi
* @date 2025-07-15
*/
public class ScDryMilk extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 羊只id */
@Excel(name = "羊只id")
private String sheepId;
/** 干奶日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "干奶日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date datetime;
/** 是否使用乳头封闭剂 */
@Excel(name = "是否使用乳头封闭剂")
private Long status;
/** 转入羊舍id */
@Excel(name = "转入羊舍id")
private Long sheepfold;
/** 技术员 */
@Excel(name = "技术员")
private String tecahnician;
/** 备注 */
@Excel(name = "备注")
private String comment;
// 以下为联表查询字段不存储在sc_dry_milk表中
/** 管理耳号 */
@Excel(name = "耳号")
private String manageTags;
/** 品种 */
@Excel(name = "品种")
private String variety;
/** 羊舍名称 */
@Excel(name = "转入羊舍")
private String sheepfoldName;
/** 事件类型 */
@Excel(name = "事件类型")
private String eventType;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSheepId(String sheepId)
{
this.sheepId = sheepId;
}
public String getSheepId()
{
return sheepId;
}
public void setDatetime(Date datetime)
{
this.datetime = datetime;
}
public Date getDatetime()
{
return datetime;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public void setSheepfold(Long sheepfold)
{
this.sheepfold = sheepfold;
}
public Long getSheepfold()
{
return sheepfold;
}
public void setTecahnician(String tecahnician)
{
this.tecahnician = tecahnician;
}
public String getTecahnician()
{
return tecahnician;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
public void setManageTags(String manageTags)
{
this.manageTags = manageTags;
}
public String getManageTags()
{
return manageTags;
}
public void setVariety(String variety)
{
this.variety = variety;
}
public String getVariety()
{
return variety;
}
public void setSheepfoldName(String sheepfoldName)
{
this.sheepfoldName = sheepfoldName;
}
public String getSheepfoldName()
{
return sheepfoldName;
}
public void setEventType(String eventType)
{
this.eventType = eventType;
}
public String getEventType()
{
return eventType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sheepId", getSheepId())
.append("datetime", getDatetime())
.append("status", getStatus())
.append("sheepfold", getSheepfold())
.append("tecahnician", getTecahnician())
.append("comment", getComment())
.append("manageTags", getManageTags())
.append("variety", getVariety())
.append("sheepfoldName", getSheepfoldName())
.append("eventType", getEventType())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,69 @@
package com.zhyc.module.produce.drymilk.mapper;
import java.util.List;
import com.zhyc.module.produce.drymilk.domain.ScDryMilk;
/**
* 干奶记录Mapper接口
*
* @author ruoyi
* @date 2025-07-15
*/
public interface ScDryMilkMapper
{
/**
* 查询干奶记录
*
* @param id 干奶记录主键
* @return 干奶记录
*/
public ScDryMilk selectScDryMilkById(Long id);
/**
* 查询干奶记录列表
*
* @param scDryMilk 干奶记录
* @return 干奶记录集合
*/
public List<ScDryMilk> selectScDryMilkList(ScDryMilk scDryMilk);
/**
* 根据耳号查询羊只ID
*
* @param manageTags 管理耳号
* @return 羊只ID
*/
public Long selectSheepIdByManageTags(String manageTags);
/**
* 新增干奶记录
*
* @param scDryMilk 干奶记录
* @return 结果
*/
public int insertScDryMilk(ScDryMilk scDryMilk);
/**
* 修改干奶记录
*
* @param scDryMilk 干奶记录
* @return 结果
*/
public int updateScDryMilk(ScDryMilk scDryMilk);
/**
* 删除干奶记录
*
* @param id 干奶记录主键
* @return 结果
*/
public int deleteScDryMilkById(Long id);
/**
* 批量删除干奶记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteScDryMilkByIds(Long[] ids);
}

View File

@ -0,0 +1,63 @@
package com.zhyc.module.produce.drymilk.service;
import java.util.List;
import com.zhyc.module.produce.drymilk.domain.ScDryMilk;
/**
* 干奶记录Service接口
*
* @author ruoyi
* @date 2025-07-15
*/
public interface IScDryMilkService
{
/**
* 查询干奶记录
*
* @param id 干奶记录主键
* @return 干奶记录
*/
public ScDryMilk selectScDryMilkById(Long id);
/**
* 查询干奶记录列表
*
* @param scDryMilk 干奶记录
* @return 干奶记录集合
*/
public List<ScDryMilk> selectScDryMilkList(ScDryMilk scDryMilk);
Long selectSheepIdByManageTags(String manageTags);
/**
* 新增干奶记录
*
* @param scDryMilk 干奶记录
* @return 结果
*/
public int insertScDryMilk(ScDryMilk scDryMilk);
/**
* 修改干奶记录
*
* @param scDryMilk 干奶记录
* @return 结果
*/
public int updateScDryMilk(ScDryMilk scDryMilk);
/**
* 批量删除干奶记录
*
* @param ids 需要删除的干奶记录主键集合
* @return 结果
*/
public int deleteScDryMilkByIds(Long[] ids);
/**
* 删除干奶记录信息
*
* @param id 干奶记录主键
* @return 结果
*/
public int deleteScDryMilkById(Long id);
}

View File

@ -0,0 +1,127 @@
package com.zhyc.module.produce.drymilk.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.produce.drymilk.mapper.ScDryMilkMapper;
import com.zhyc.module.produce.drymilk.domain.ScDryMilk;
import com.zhyc.module.produce.drymilk.service.IScDryMilkService;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.common.exception.ServiceException;
/**
* 干奶记录Service业务层处理
*
* @author ruoyi
* @date 2025-07-15
*/
@Service
public class ScDryMilkServiceImpl implements IScDryMilkService
{
@Autowired
private ScDryMilkMapper scDryMilkMapper;
/**
* 查询干奶记录
*
* @param id 干奶记录主键
* @return 干奶记录
*/
@Override
public ScDryMilk selectScDryMilkById(Long id)
{
return scDryMilkMapper.selectScDryMilkById(id);
}
/**
* 查询干奶记录列表
*
* @param scDryMilk 干奶记录
* @return 干奶记录
*/
@Override
public List<ScDryMilk> selectScDryMilkList(ScDryMilk scDryMilk)
{
return scDryMilkMapper.selectScDryMilkList(scDryMilk);
}
/**
* 根据耳号查询羊只ID
*
* @param manageTags 管理耳号
* @return 羊只ID
*/
@Override
public Long selectSheepIdByManageTags(String manageTags)
{
return scDryMilkMapper.selectSheepIdByManageTags(manageTags);
}
/**
* 新增干奶记录
*
* @param scDryMilk 干奶记录
* @return 结果
*/
@Override
public int insertScDryMilk(ScDryMilk scDryMilk)
{
// 如果传入的是耳号需要转换为羊只ID
if (StringUtils.isNotEmpty(scDryMilk.getManageTags()) && StringUtils.isEmpty(scDryMilk.getSheepId()))
{
Long sheepId = scDryMilkMapper.selectSheepIdByManageTags(scDryMilk.getManageTags());
if (sheepId == null)
{
throw new ServiceException("未找到对应耳号的羊只信息");
}
scDryMilk.setSheepId(String.valueOf(sheepId));
}
return scDryMilkMapper.insertScDryMilk(scDryMilk);
}
/**
* 修改干奶记录
*
* @param scDryMilk 干奶记录
* @return 结果
*/
@Override
public int updateScDryMilk(ScDryMilk scDryMilk)
{
// 如果传入的是耳号需要转换为羊只ID
if (StringUtils.isNotEmpty(scDryMilk.getManageTags()) && StringUtils.isEmpty(scDryMilk.getSheepId()))
{
Long sheepId = scDryMilkMapper.selectSheepIdByManageTags(scDryMilk.getManageTags());
if (sheepId == null)
{
throw new ServiceException("未找到对应耳号的羊只信息");
}
scDryMilk.setSheepId(String.valueOf(sheepId));
}
return scDryMilkMapper.updateScDryMilk(scDryMilk);
}
/**
* 批量删除干奶记录
*
* @param ids 需要删除的干奶记录主键
* @return 结果
*/
@Override
public int deleteScDryMilkByIds(Long[] ids)
{
return scDryMilkMapper.deleteScDryMilkByIds(ids);
}
/**
* 删除干奶记录信息
*
* @param id 干奶记录主键
* @return 结果
*/
@Override
public int deleteScDryMilkById(Long id)
{
return scDryMilkMapper.deleteScDryMilkById(id);
}
}

View File

@ -31,8 +31,7 @@ import com.zhyc.common.core.page.TableDataInfo;
*/ */
@RestController @RestController
@RequestMapping("produce/manage_sheep/trans_group") @RequestMapping("produce/manage_sheep/trans_group")
public class ScTransGroupController extends BaseController public class ScTransGroupController extends BaseController {
{
@Autowired @Autowired
private IScTransGroupService scTransGroupService; private IScTransGroupService scTransGroupService;
@ -41,8 +40,7 @@ public class ScTransGroupController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('produce:trans_group:list')") @PreAuthorize("@ss.hasPermi('produce:trans_group:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(ScTransGroup scTransGroup) public TableDataInfo list(ScTransGroup scTransGroup) {
{
startPage(); startPage();
List<ScTransGroup> list = scTransGroupService.selectScTransGroupList(scTransGroup); List<ScTransGroup> list = scTransGroupService.selectScTransGroupList(scTransGroup);
return getDataTable(list); return getDataTable(list);
@ -65,8 +63,7 @@ public class ScTransGroupController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('produce:trans_group:query')") @PreAuthorize("@ss.hasPermi('produce:trans_group:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id) public AjaxResult getInfo(@PathVariable("id") Integer id) {
{
return success(scTransGroupService.selectScTransGroupById(id)); return success(scTransGroupService.selectScTransGroupById(id));
} }
@ -76,8 +73,7 @@ public class ScTransGroupController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:trans_group:add')") @PreAuthorize("@ss.hasPermi('produce:trans_group:add')")
@Log(title = "转群记录", businessType = BusinessType.INSERT) @Log(title = "转群记录", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ScTransGroup scTransGroup) public AjaxResult add(@RequestBody ScTransGroup scTransGroup) {
{
return toAjax(scTransGroupService.insertScTransGroup(scTransGroup)); return toAjax(scTransGroupService.insertScTransGroup(scTransGroup));
} }
@ -87,8 +83,7 @@ public class ScTransGroupController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:trans_group:edit')") @PreAuthorize("@ss.hasPermi('produce:trans_group:edit')")
@Log(title = "转群记录", businessType = BusinessType.UPDATE) @Log(title = "转群记录", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ScTransGroup scTransGroup) public AjaxResult edit(@RequestBody ScTransGroup scTransGroup) {
{
return toAjax(scTransGroupService.updateScTransGroup(scTransGroup)); return toAjax(scTransGroupService.updateScTransGroup(scTransGroup));
} }
@ -98,8 +93,7 @@ public class ScTransGroupController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:trans_group:remove')") @PreAuthorize("@ss.hasPermi('produce:trans_group:remove')")
@Log(title = "转群记录", businessType = BusinessType.DELETE) @Log(title = "转群记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids) public AjaxResult remove(@PathVariable Integer[] ids) {
{
return toAjax(scTransGroupService.deleteScTransGroupByIds(ids)); return toAjax(scTransGroupService.deleteScTransGroupByIds(ids));
} }
} }

View File

@ -18,52 +18,83 @@ import org.springframework.beans.factory.annotation.Autowired;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class ScTransGroup extends BaseEntity public class ScTransGroup extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /**
* $column.columnComment
*/
private Integer id; private Integer id;
/** 羊只id */ /**
* 羊只id
*/
@Excel(name = "羊只id") @Excel(name = "羊只id")
private Integer sheepId; private Integer sheepId;
/** 转入羊舍 */ /**
* 转入羊舍
*/
private String foldTo; private String foldTo;
/** 转出羊舍 */ /**
* 转出羊舍
*/
private String foldFrom; private String foldFrom;
/** 转出羊舍名称 */ /**
* 转出羊舍名称
*/
@Excel(name = "转出羊舍") @Excel(name = "转出羊舍")
private String foldFromName; private String foldFromName;
/** 转入羊舍名称 */ /**
* 转入羊舍名称
*/
@Excel(name = "转入羊舍") @Excel(name = "转入羊舍")
private String foldToName; private String foldToName;
/** 转群原因 */ /** 转群原因 */
/**
* 品种id
*/
private Long varietyId;
/**
* 品种名称联表查询返回非数据库字段
*/
@Excel(name = "品种")
private String varietyName;
private Integer reason; private Integer reason;
/** 转群原因描述 用于导出*/ /**
* 转群原因描述 用于导出
*/
@Excel(name = "转群原因") @Excel(name = "转群原因")
private String reasonText; private String reasonText;
/** 技术员 */ /**
* 技术员
*/
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/** 状态 */ /**
* 状态
*/
private Integer status; private Integer status;
/** 状态描述 用于导出*/ /**
* 状态描述 用于导出
*/
@Excel(name = "状态") @Excel(name = "状态")
private String statusText; private String statusText;
/** 备注 */ /**
* 备注
*/
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
} }

View File

@ -1,6 +1,7 @@
package com.zhyc.module.produce.manage_sheep.trans_group.mapper; package com.zhyc.module.produce.manage_sheep.trans_group.mapper;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup; import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
/** /**
@ -9,8 +10,7 @@ import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
* @author ruoyi * @author ruoyi
* @date 2025-07-10 * @date 2025-07-10
*/ */
public interface ScTransGroupMapper public interface ScTransGroupMapper {
{
/** /**
* 查询转群记录 * 查询转群记录
* *

View File

@ -1,6 +1,7 @@
package com.zhyc.module.produce.manage_sheep.trans_group.service; package com.zhyc.module.produce.manage_sheep.trans_group.service;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup; import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
/** /**
@ -9,8 +10,7 @@ import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
* @author ruoyi * @author ruoyi
* @date 2025-07-10 * @date 2025-07-10
*/ */
public interface IScTransGroupService public interface IScTransGroupService {
{
/** /**
* 查询转群记录 * 查询转群记录
* *

View File

@ -17,38 +17,69 @@ import com.zhyc.common.core.domain.BaseEntity;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class ScTransitionInfo extends BaseEntity public class ScTransitionInfo extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** */ /**
*
*/
private Integer id; private Integer id;
/** 羊只id */ /**
* 羊只id
*/
@Excel(name = "羊只id") @Excel(name = "羊只id")
private Integer sheepId; private Integer sheepId;
/** 转入牧场 */ /**
* 品种id
*/
private Long varietyId;
/**
* 品种名称联表返回非数据库字段
*/
@Excel(name = "品种")
private String varietyName;
/**
* 转入牧场
*/
@Excel(name = "转入牧场") @Excel(name = "转入牧场")
private String transTo; private String transTo;
/** 当前牧场 */ /**
* 当前牧场
*/
@Excel(name = "当前牧场") @Excel(name = "当前牧场")
private String transFrom; private String transFrom;
/** 转场类型 */ /**
@Excel(name = "转场类型") * 转场类型
*/
private Integer transType; private Integer transType;
/** 技术员 */ /**
* 转场类型名称 只用于导出
*/
@Excel(name = "转场类型")
private String transTypeText;
/**
* 技术员
*/
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/** 状态 */ /**
* 状态
*/
@Excel(name = "状态") @Excel(name = "状态")
private Integer status; private Integer status;
/** 备注 */ /**
* 备注
*/
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;

View File

@ -0,0 +1,104 @@
package com.zhyc.module.produce.mating_plan.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.mating_plan.domain.ScBreedPlan;
import com.zhyc.module.produce.mating_plan.service.IScBreedPlanService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 配种计划Controller
*
* @author ruoyi
* @date 2025-07-16
*/
@RestController
@RequestMapping("/mating_plan/mating_plan")
public class ScBreedPlanController extends BaseController
{
@Autowired
private IScBreedPlanService scBreedPlanService;
/**
* 查询配种计划列表
*/
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:list')")
@GetMapping("/list")
public TableDataInfo list(ScBreedPlan scBreedPlan)
{
startPage();
List<ScBreedPlan> list = scBreedPlanService.selectScBreedPlanList(scBreedPlan);
return getDataTable(list);
}
/**
* 导出配种计划列表
*/
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:export')")
@Log(title = "配种计划", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScBreedPlan scBreedPlan)
{
List<ScBreedPlan> list = scBreedPlanService.selectScBreedPlanList(scBreedPlan);
ExcelUtil<ScBreedPlan> util = new ExcelUtil<ScBreedPlan>(ScBreedPlan.class);
util.exportExcel(response, list, "配种计划数据");
}
/**
* 获取配种计划详细信息
*/
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(scBreedPlanService.selectScBreedPlanById(id));
}
/**
* 新增配种计划
*/
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:add')")
@Log(title = "配种计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ScBreedPlan scBreedPlan)
{
return toAjax(scBreedPlanService.insertScBreedPlan(scBreedPlan));
}
/**
* 修改配种计划
*/
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:edit')")
@Log(title = "配种计划", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ScBreedPlan scBreedPlan)
{
return toAjax(scBreedPlanService.updateScBreedPlan(scBreedPlan));
}
/**
* 删除配种计划
*/
@PreAuthorize("@ss.hasPermi('mating_plan:mating_plan:remove')")
@Log(title = "配种计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(scBreedPlanService.deleteScBreedPlanByIds(ids));
}
}

View File

@ -0,0 +1,188 @@
package com.zhyc.module.produce.mating_plan.controller;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
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.mating_plan.domain.ScBreedPlan;
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlanGenerate;
import com.zhyc.module.produce.mating_plan.service.IScBreedPlanService;
import com.zhyc.module.produce.mating_plan.service.IScBreedPlanGenerateService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 配种计划生成Controller
*
* @author ruoyi
* @date 2025-07-16
*/
@RestController
@RequestMapping("/mating_plan/generate")
public class ScBreedPlanGenerateController extends BaseController
{
@Autowired
private IScBreedPlanGenerateService scBreedPlanGenerateService;
/**
* 查询配种计划生成列表
*/
@PreAuthorize("@ss.hasPermi('mating_plan:generate:list')")
@GetMapping("/list")
public TableDataInfo list(ScBreedPlanGenerate scBreedPlanGenerate)
{
startPage();
List<ScBreedPlanGenerate> list = scBreedPlanGenerateService.selectScBreedPlanGenerateList(scBreedPlanGenerate);
return getDataTable(list);
}
/**
* 筛选符合条件的母羊
*/
@PreAuthorize("@ss.hasPermi('mating_plan:generate:selectEwe')")
@GetMapping("/selectEwe")
public AjaxResult selectEligibleEwe()
{
List<Map<String, Object>> eligibleEwe = scBreedPlanGenerateService.selectEligibleEwe();
return success(eligibleEwe);
}
/**
* 筛选符合条件的公羊
*/
@PreAuthorize("@ss.hasPermi('mating_plan:generate:selectRam')")
@GetMapping("/selectRam")
public AjaxResult selectEligibleRam()
{
List<Map<String, Object>> eligibleRam = scBreedPlanGenerateService.selectEligibleRam();
return success(eligibleRam);
}
/**
* 自动生成配种计划
*/
@PreAuthorize("@ss.hasPermi('mating_plan:generate:auto')")
@PostMapping("/auto")
@Log(title = "自动生成配种计划", businessType = BusinessType.INSERT)
public AjaxResult autoGenerateBreedPlan(@RequestBody Map<String, Object> params)
{
try {
// 安全的类型转换
List<?> eweIdsRaw = (List<?>) params.get("eweIds");
List<?> ramIdsRaw = (List<?>) params.get("ramIds");
if (eweIdsRaw == null || ramIdsRaw == null) {
return error("参数不能为空");
}
List<Long> eweIds = eweIdsRaw.stream()
.map(obj -> {
if (obj instanceof Integer) {
return ((Integer) obj).longValue();
} else if (obj instanceof Long) {
return (Long) obj;
} else {
return Long.valueOf(obj.toString());
}
})
.collect(Collectors.toList());
List<Long> ramIds = ramIdsRaw.stream()
.map(obj -> {
if (obj instanceof Integer) {
return ((Integer) obj).longValue();
} else if (obj instanceof Long) {
return (Long) obj;
} else {
return Long.valueOf(obj.toString());
}
})
.collect(Collectors.toList());
ScBreedPlanGenerate planGenerate = scBreedPlanGenerateService.autoGenerateBreedPlan(eweIds, ramIds);
return success(planGenerate);
} catch (Exception e) {
logger.error("自动生成配种计划失败", e);
return error("自动生成配种计划失败:" + e.getMessage());
}
}
/**
* 获取配种计划生成详细信息
*/
@PreAuthorize("@ss.hasPermi('mating_plan:generate:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(scBreedPlanGenerateService.selectScBreedPlanGenerateById(id));
}
/**
* 保存配种计划生成
*/
@PreAuthorize("@ss.hasPermi('mating_plan:generate:add')")
@Log(title = "配种计划生成", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ScBreedPlanGenerate scBreedPlanGenerate)
{
return toAjax(scBreedPlanGenerateService.insertScBreedPlanGenerate(scBreedPlanGenerate));
}
/**
* 修改配种计划生成
*/
@PreAuthorize("@ss.hasPermi('mating_plan:generate:edit')")
@Log(title = "配种计划生成", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ScBreedPlanGenerate scBreedPlanGenerate)
{
return toAjax(scBreedPlanGenerateService.updateScBreedPlanGenerate(scBreedPlanGenerate));
}
/**
* 审批配种计划
*/
@PreAuthorize("@ss.hasPermi('mating_plan:generate:approve')")
@Log(title = "审批配种计划", businessType = BusinessType.UPDATE)
@PutMapping("/approve/{id}")
public AjaxResult approve(@PathVariable Long id)
{
return toAjax(scBreedPlanGenerateService.approveBreedPlan(id));
}
/**
* 获取配种计划详情
*/
@PreAuthorize("@ss.hasPermi('mating_plan:generate:view')")
@GetMapping("/view/{id}")
public AjaxResult viewBreedPlan(@PathVariable Long id)
{
Map<String, Object> planDetails = scBreedPlanGenerateService.getBreedPlanDetails(id);
return success(planDetails);
}
/**
* 删除配种计划生成
*/
@PreAuthorize("@ss.hasPermi('mating_plan:generate:remove')")
@Log(title = "配种计划生成", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(scBreedPlanGenerateService.deleteScBreedPlanGenerateByIds(ids));
}
}

View File

@ -0,0 +1,82 @@
package com.zhyc.module.produce.mating_plan.domain;
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_plan
*
* @author ruoyi
* @date 2025-07-16
*/
public class ScBreedPlan extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 公羊id */
@Excel(name = "公羊id")
private String ramId;
/** 母羊id */
@Excel(name = "母羊id")
private String eweId;
/** 配种类型 */
@Excel(name = "配种类型")
private Long breedType;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
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 setBreedType(Long breedType)
{
this.breedType = breedType;
}
public Long getBreedType()
{
return breedType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("ramId", getRamId())
.append("eweId", getEweId())
.append("breedType", getBreedType())
.toString();
}
}

View File

@ -0,0 +1,194 @@
package com.zhyc.module.produce.mating_plan.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;
/**
* 配种计划生成对象 sc_breed_plan_generate
*
* @author ruoyi
* @date 2025-07-16
*/
public class ScBreedPlanGenerate extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 计划名称 */
@Excel(name = "计划名称")
private String planName;
/** 计划类型1-同期发情配种计划 */
@Excel(name = "计划类型")
private Integer planType;
/** 计划日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date planDate;
/** 总母羊数 */
@Excel(name = "总母羊数")
private Integer totalEweCount;
/** 总公羊数 */
@Excel(name = "总公羊数")
private Integer totalRamCount;
/** 配种比例 */
@Excel(name = "配种比例")
private String breedRatio;
/** 状态0-待审批1-已审批2-已拒绝 */
@Excel(name = "状态")
private Integer status;
/** 审批人 */
@Excel(name = "审批人")
private String approver;
/** 审批时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "审批时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date approveTime;
/** 审批意见 */
private String approveRemark;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setPlanName(String planName)
{
this.planName = planName;
}
public String getPlanName()
{
return planName;
}
public void setPlanType(Integer planType)
{
this.planType = planType;
}
public Integer getPlanType()
{
return planType;
}
public void setPlanDate(Date planDate)
{
this.planDate = planDate;
}
public Date getPlanDate()
{
return planDate;
}
public void setTotalEweCount(Integer totalEweCount)
{
this.totalEweCount = totalEweCount;
}
public Integer getTotalEweCount()
{
return totalEweCount;
}
public void setTotalRamCount(Integer totalRamCount)
{
this.totalRamCount = totalRamCount;
}
public Integer getTotalRamCount()
{
return totalRamCount;
}
public void setBreedRatio(String breedRatio)
{
this.breedRatio = breedRatio;
}
public String getBreedRatio()
{
return breedRatio;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
public void setApprover(String approver)
{
this.approver = approver;
}
public String getApprover()
{
return approver;
}
public void setApproveTime(Date approveTime)
{
this.approveTime = approveTime;
}
public Date getApproveTime()
{
return approveTime;
}
public void setApproveRemark(String approveRemark)
{
this.approveRemark = approveRemark;
}
public String getApproveRemark()
{
return approveRemark;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("planName", getPlanName())
.append("planType", getPlanType())
.append("planDate", getPlanDate())
.append("totalEweCount", getTotalEweCount())
.append("totalRamCount", getTotalRamCount())
.append("breedRatio", getBreedRatio())
.append("status", getStatus())
.append("approver", getApprover())
.append("approveTime", getApproveTime())
.append("approveRemark", getApproveRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,172 @@
package com.zhyc.module.produce.mating_plan.domain;
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_plan_temp
*
* @author ruoyi
* @date 2025-07-16
*/
public class ScBreedPlanTemp extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 配种计划生成ID */
private Long planGenerateId;
/** 公羊ID */
@Excel(name = "公羊ID")
private String ramId;
/** 母羊ID */
@Excel(name = "母羊ID")
private String eweId;
/** 配种类型 */
@Excel(name = "配种类型")
private Long breedType;
/** 公羊管理耳号 */
@Excel(name = "公羊管理耳号")
private String ramManageTags;
/** 公羊品种 */
@Excel(name = "公羊品种")
private String ramVariety;
/** 母羊管理耳号 */
@Excel(name = "母羊管理耳号")
private String eweManageTags;
/** 母羊品种 */
@Excel(name = "母羊品种")
private String eweVariety;
/** 母羊体重 */
@Excel(name = "母羊体重")
private Double eweWeight;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setPlanGenerateId(Long planGenerateId)
{
this.planGenerateId = planGenerateId;
}
public Long getPlanGenerateId()
{
return planGenerateId;
}
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 setBreedType(Long breedType)
{
this.breedType = breedType;
}
public Long getBreedType()
{
return breedType;
}
public void setRamManageTags(String ramManageTags)
{
this.ramManageTags = ramManageTags;
}
public String getRamManageTags()
{
return ramManageTags;
}
public void setRamVariety(String ramVariety)
{
this.ramVariety = ramVariety;
}
public String getRamVariety()
{
return ramVariety;
}
public void setEweManageTags(String eweManageTags)
{
this.eweManageTags = eweManageTags;
}
public String getEweManageTags()
{
return eweManageTags;
}
public void setEweVariety(String eweVariety)
{
this.eweVariety = eweVariety;
}
public String getEweVariety()
{
return eweVariety;
}
public void setEweWeight(Double eweWeight)
{
this.eweWeight = eweWeight;
}
public Double getEweWeight()
{
return eweWeight;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("planGenerateId", getPlanGenerateId())
.append("ramId", getRamId())
.append("eweId", getEweId())
.append("breedType", getBreedType())
.append("ramManageTags", getRamManageTags())
.append("ramVariety", getRamVariety())
.append("eweManageTags", getEweManageTags())
.append("eweVariety", getEweVariety())
.append("eweWeight", getEweWeight())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,104 @@
package com.zhyc.module.produce.mating_plan.mapper;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlanGenerate;
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
/**
* 配种计划生成Mapper接口
*
* @author ruoyi
* @date 2025-07-16
*/
public interface ScBreedPlanGenerateMapper
{
/**
* 查询配种计划生成
*
* @param id 配种计划生成主键
* @return 配种计划生成
*/
public ScBreedPlanGenerate selectScBreedPlanGenerateById(Long id);
/**
* 查询配种计划生成列表
*
* @param scBreedPlanGenerate 配种计划生成
* @return 配种计划生成集合
*/
public List<ScBreedPlanGenerate> selectScBreedPlanGenerateList(ScBreedPlanGenerate scBreedPlanGenerate);
/**
* 筛选符合条件的母羊
*
* @return 符合条件的母羊列表
*/
public List<Map<String, Object>> selectEligibleEwe();
/**
* 筛选符合条件的公羊
*
* @return 符合条件的公羊列表
*/
public List<Map<String, Object>> selectEligibleRam();
/**
* 新增配种计划生成
*
* @param scBreedPlanGenerate 配种计划生成
* @return 结果
*/
public int insertScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate);
/**
* 插入临时配种计划
*
* @param planGenerateId 配种计划生成ID
* @param breedPlan 配种计划
* @return 结果
*/
public int insertTempBreedPlan(@Param("planGenerateId") Long planGenerateId,
@Param("breedPlan") ScBreedPlan breedPlan);
/**
* 修改配种计划生成
*
* @param scBreedPlanGenerate 配种计划生成
* @return 结果
*/
public int updateScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate);
/**
* 将临时配种计划转为正式配种计划
*
* @param planGenerateId 配种计划生成ID
* @return 结果
*/
public int transferTempToFormal(Long planGenerateId);
/**
* 获取配种计划详情
*
* @param planGenerateId 配种计划生成ID
* @return 配种计划详情列表
*/
public List<Map<String, Object>> selectBreedPlanDetails(Long planGenerateId);
/**
* 删除配种计划生成
*
* @param id 配种计划生成主键
* @return 结果
*/
public int deleteScBreedPlanGenerateById(Long id);
/**
* 批量删除配种计划生成
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteScBreedPlanGenerateByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.produce.mating_plan.mapper;
import java.util.List;
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
/**
* 配种计划Mapper接口
*
* @author ruoyi
* @date 2025-07-16
*/
public interface ScBreedPlanMapper
{
/**
* 查询配种计划
*
* @param id 配种计划主键
* @return 配种计划
*/
public ScBreedPlan selectScBreedPlanById(Long id);
/**
* 查询配种计划列表
*
* @param scBreedPlan 配种计划
* @return 配种计划集合
*/
public List<ScBreedPlan> selectScBreedPlanList(ScBreedPlan scBreedPlan);
/**
* 新增配种计划
*
* @param scBreedPlan 配种计划
* @return 结果
*/
public int insertScBreedPlan(ScBreedPlan scBreedPlan);
/**
* 修改配种计划
*
* @param scBreedPlan 配种计划
* @return 结果
*/
public int updateScBreedPlan(ScBreedPlan scBreedPlan);
/**
* 删除配种计划
*
* @param id 配种计划主键
* @return 结果
*/
public int deleteScBreedPlanById(Long id);
/**
* 批量删除配种计划
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteScBreedPlanByIds(Long[] ids);
}

View File

@ -0,0 +1,101 @@
package com.zhyc.module.produce.mating_plan.service;
import java.util.List;
import java.util.Map;
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlanGenerate;
/**
* 配种计划生成Service接口
*
* @author ruoyi
* @date 2025-07-16
*/
public interface IScBreedPlanGenerateService
{
/**
* 查询配种计划生成
*
* @param id 配种计划生成主键
* @return 配种计划生成
*/
public ScBreedPlanGenerate selectScBreedPlanGenerateById(Long id);
/**
* 查询配种计划生成列表
*
* @param scBreedPlanGenerate 配种计划生成
* @return 配种计划生成集合
*/
public List<ScBreedPlanGenerate> selectScBreedPlanGenerateList(ScBreedPlanGenerate scBreedPlanGenerate);
/**
* 筛选符合条件的母羊
*
* @return 符合条件的母羊列表
*/
public List<Map<String, Object>> selectEligibleEwe();
/**
* 筛选符合条件的公羊
*
* @return 符合条件的公羊列表
*/
public List<Map<String, Object>> selectEligibleRam();
/**
* 自动生成配种计划
*
* @param eweIds 母羊ID列表
* @param ramIds 公羊ID列表
* @return 生成的配种计划
*/
public ScBreedPlanGenerate autoGenerateBreedPlan(List<Long> eweIds, List<Long> ramIds);
/**
* 新增配种计划生成
*
* @param scBreedPlanGenerate 配种计划生成
* @return 结果
*/
public int insertScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate);
/**
* 修改配种计划生成
*
* @param scBreedPlanGenerate 配种计划生成
* @return 结果
*/
public int updateScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate);
/**
* 审批配种计划
*
* @param id 配种计划ID
* @return 结果
*/
public int approveBreedPlan(Long id);
/**
* 获取配种计划详情
*
* @param id 配种计划ID
* @return 配种计划详情
*/
public Map<String, Object> getBreedPlanDetails(Long id);
/**
* 批量删除配种计划生成
*
* @param ids 需要删除的配种计划生成主键集合
* @return 结果
*/
public int deleteScBreedPlanGenerateByIds(Long[] ids);
/**
* 删除配种计划生成信息
*
* @param id 配种计划生成主键
* @return 结果
*/
public int deleteScBreedPlanGenerateById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.produce.mating_plan.service;
import java.util.List;
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
/**
* 配种计划Service接口
*
* @author ruoyi
* @date 2025-07-16
*/
public interface IScBreedPlanService
{
/**
* 查询配种计划
*
* @param id 配种计划主键
* @return 配种计划
*/
public ScBreedPlan selectScBreedPlanById(Long id);
/**
* 查询配种计划列表
*
* @param scBreedPlan 配种计划
* @return 配种计划集合
*/
public List<ScBreedPlan> selectScBreedPlanList(ScBreedPlan scBreedPlan);
/**
* 新增配种计划
*
* @param scBreedPlan 配种计划
* @return 结果
*/
public int insertScBreedPlan(ScBreedPlan scBreedPlan);
/**
* 修改配种计划
*
* @param scBreedPlan 配种计划
* @return 结果
*/
public int updateScBreedPlan(ScBreedPlan scBreedPlan);
/**
* 批量删除配种计划
*
* @param ids 需要删除的配种计划主键集合
* @return 结果
*/
public int deleteScBreedPlanByIds(Long[] ids);
/**
* 删除配种计划信息
*
* @param id 配种计划主键
* @return 结果
*/
public int deleteScBreedPlanById(Long id);
}

View File

@ -0,0 +1,240 @@
package com.zhyc.module.produce.mating_plan.service.impl;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Date;
import java.text.SimpleDateFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.module.produce.mating_plan.mapper.ScBreedPlanGenerateMapper;
import com.zhyc.module.produce.mating_plan.mapper.ScBreedPlanMapper;
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlanGenerate;
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
import com.zhyc.module.produce.mating_plan.service.IScBreedPlanGenerateService;
/**
* 配种计划生成Service业务层处理
*
* @author ruoyi
* @date 2025-07-16
*/
@Service
public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateService
{
@Autowired
private ScBreedPlanGenerateMapper scBreedPlanGenerateMapper;
@Autowired
private ScBreedPlanMapper scBreedPlanMapper;
/**
* 查询配种计划生成
*
* @param id 配种计划生成主键
* @return 配种计划生成
*/
@Override
public ScBreedPlanGenerate selectScBreedPlanGenerateById(Long id)
{
return scBreedPlanGenerateMapper.selectScBreedPlanGenerateById(id);
}
/**
* 查询配种计划生成列表
*
* @param scBreedPlanGenerate 配种计划生成
* @return 配种计划生成
*/
@Override
public List<ScBreedPlanGenerate> selectScBreedPlanGenerateList(ScBreedPlanGenerate scBreedPlanGenerate)
{
return scBreedPlanGenerateMapper.selectScBreedPlanGenerateList(scBreedPlanGenerate);
}
/**
* 筛选符合条件的母羊
*
* @return 符合条件的母羊列表
*/
@Override
public List<Map<String, Object>> selectEligibleEwe()
{
return scBreedPlanGenerateMapper.selectEligibleEwe();
}
/**
* 筛选符合条件的公羊
*
* @return 符合条件的公羊列表
*/
@Override
public List<Map<String, Object>> selectEligibleRam()
{
return scBreedPlanGenerateMapper.selectEligibleRam();
}
/**
* 自动生成配种计划
*
* @param eweIds 母羊ID列表
* @param ramIds 公羊ID列表
* @return 生成的配种计划
*/
@Override
@Transactional
public ScBreedPlanGenerate autoGenerateBreedPlan(List<Long> eweIds, List<Long> ramIds)
{
// 创建配种计划生成记录
ScBreedPlanGenerate planGenerate = new ScBreedPlanGenerate();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateStr = sdf.format(new Date());
planGenerate.setPlanName(dateStr + "同期发情配种计划");
planGenerate.setPlanType(1);
planGenerate.setPlanDate(new Date());
planGenerate.setTotalEweCount(eweIds.size());
planGenerate.setTotalRamCount(ramIds.size());
// 计算配种比例
double ratio = (double) eweIds.size() / ramIds.size();
planGenerate.setBreedRatio(String.format("%.1f:1", ratio));
planGenerate.setStatus(0); // 待审批
planGenerate.setCreateBy(SecurityUtils.getUsername());
planGenerate.setCreateTime(new Date());
// 保存配种计划生成记录
scBreedPlanGenerateMapper.insertScBreedPlanGenerate(planGenerate);
// 生成具体的配种计划
generateBreedPlanDetails(planGenerate.getId(), eweIds, ramIds);
return planGenerate;
}
/**
* 生成具体的配种计划详情
*/
private void generateBreedPlanDetails(Long planGenerateId, List<Long> eweIds, List<Long> ramIds)
{
int ramIndex = 0;
int ewesPerRam = (int) Math.ceil((double) eweIds.size() / ramIds.size());
for (int i = 0; i < eweIds.size(); i++) {
ScBreedPlan breedPlan = new ScBreedPlan();
breedPlan.setRamId(ramIds.get(ramIndex).toString());
breedPlan.setEweId(eweIds.get(i).toString());
breedPlan.setBreedType(1L); // 默认配种类型
// 插入临时配种计划关联到生成记录
scBreedPlanGenerateMapper.insertTempBreedPlan(planGenerateId, breedPlan);
// 每个公羊配种指定数量的母羊后切换到下一个公羊
if ((i + 1) % ewesPerRam == 0 && ramIndex < ramIds.size() - 1) {
ramIndex++;
}
}
}
/**
* 新增配种计划生成
*
* @param scBreedPlanGenerate 配种计划生成
* @return 结果
*/
@Override
public int insertScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate)
{
scBreedPlanGenerate.setCreateTime(new Date());
return scBreedPlanGenerateMapper.insertScBreedPlanGenerate(scBreedPlanGenerate);
}
/**
* 修改配种计划生成
*
* @param scBreedPlanGenerate 配种计划生成
* @return 结果
*/
@Override
public int updateScBreedPlanGenerate(ScBreedPlanGenerate scBreedPlanGenerate)
{
scBreedPlanGenerate.setUpdateTime(new Date());
return scBreedPlanGenerateMapper.updateScBreedPlanGenerate(scBreedPlanGenerate);
}
/**
* 审批配种计划
*
* @param id 配种计划ID
* @return 结果
*/
@Override
@Transactional
public int approveBreedPlan(Long id)
{
// 更新审批状态
ScBreedPlanGenerate planGenerate = new ScBreedPlanGenerate();
planGenerate.setId(id);
planGenerate.setStatus(1); // 已审批
planGenerate.setApprover(SecurityUtils.getUsername());
planGenerate.setApproveTime(new Date());
planGenerate.setUpdateTime(new Date());
int result = scBreedPlanGenerateMapper.updateScBreedPlanGenerate(planGenerate);
// 将临时配种计划转为正式配种计划
if (result > 0) {
scBreedPlanGenerateMapper.transferTempToFormal(id);
}
return result;
}
/**
* 获取配种计划详情
*
* @param id 配种计划ID
* @return 配种计划详情
*/
@Override
public Map<String, Object> getBreedPlanDetails(Long id)
{
Map<String, Object> result = new HashMap<>();
// 获取配种计划基本信息
ScBreedPlanGenerate planGenerate = scBreedPlanGenerateMapper.selectScBreedPlanGenerateById(id);
result.put("planInfo", planGenerate);
// 获取配种计划详情列表
List<Map<String, Object>> planDetails = scBreedPlanGenerateMapper.selectBreedPlanDetails(id);
result.put("planDetails", planDetails);
return result;
}
/**
* 批量删除配种计划生成
*
* @param ids 需要删除的配种计划生成主键
* @return 结果
*/
@Override
public int deleteScBreedPlanGenerateByIds(Long[] ids)
{
return scBreedPlanGenerateMapper.deleteScBreedPlanGenerateByIds(ids);
}
/**
* 删除配种计划生成信息
*
* @param id 配种计划生成主键
* @return 结果
*/
@Override
public int deleteScBreedPlanGenerateById(Long id)
{
return scBreedPlanGenerateMapper.deleteScBreedPlanGenerateById(id);
}
}

View File

@ -0,0 +1,93 @@
package com.zhyc.module.produce.mating_plan.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.produce.mating_plan.mapper.ScBreedPlanMapper;
import com.zhyc.module.produce.mating_plan.domain.ScBreedPlan;
import com.zhyc.module.produce.mating_plan.service.IScBreedPlanService;
/**
* 配种计划Service业务层处理
*
* @author ruoyi
* @date 2025-07-16
*/
@Service
public class ScBreedPlanServiceImpl implements IScBreedPlanService
{
@Autowired
private ScBreedPlanMapper scBreedPlanMapper;
/**
* 查询配种计划
*
* @param id 配种计划主键
* @return 配种计划
*/
@Override
public ScBreedPlan selectScBreedPlanById(Long id)
{
return scBreedPlanMapper.selectScBreedPlanById(id);
}
/**
* 查询配种计划列表
*
* @param scBreedPlan 配种计划
* @return 配种计划
*/
@Override
public List<ScBreedPlan> selectScBreedPlanList(ScBreedPlan scBreedPlan)
{
return scBreedPlanMapper.selectScBreedPlanList(scBreedPlan);
}
/**
* 新增配种计划
*
* @param scBreedPlan 配种计划
* @return 结果
*/
@Override
public int insertScBreedPlan(ScBreedPlan scBreedPlan)
{
return scBreedPlanMapper.insertScBreedPlan(scBreedPlan);
}
/**
* 修改配种计划
*
* @param scBreedPlan 配种计划
* @return 结果
*/
@Override
public int updateScBreedPlan(ScBreedPlan scBreedPlan)
{
return scBreedPlanMapper.updateScBreedPlan(scBreedPlan);
}
/**
* 批量删除配种计划
*
* @param ids 需要删除的配种计划主键
* @return 结果
*/
@Override
public int deleteScBreedPlanByIds(Long[] ids)
{
return scBreedPlanMapper.deleteScBreedPlanByIds(ids);
}
/**
* 删除配种计划信息
*
* @param id 配种计划主键
* @return 结果
*/
@Override
public int deleteScBreedPlanById(Long id)
{
return scBreedPlanMapper.deleteScBreedPlanById(id);
}
}

View File

@ -77,9 +77,9 @@ public class ScFixHoofController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:fixHoof:add')") @PreAuthorize("@ss.hasPermi('produce:fixHoof:add')")
@Log(title = "修蹄", businessType = BusinessType.INSERT) @Log(title = "修蹄", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ScFixHoof scFixHoof) public AjaxResult add(@RequestBody ScFixHoof dto){
{ dto.setSheepId(scFixHoofService.findIdByManageTags(dto.getManageTags()).intValue());
return toAjax(scFixHoofService.insertScFixHoof(scFixHoof)); return toAjax(scFixHoofService.insertScFixHoof(dto));
} }
/** /**
@ -88,9 +88,9 @@ public class ScFixHoofController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:fixHoof:edit')") @PreAuthorize("@ss.hasPermi('produce:fixHoof:edit')")
@Log(title = "修蹄", businessType = BusinessType.UPDATE) @Log(title = "修蹄", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ScFixHoof scFixHoof) public AjaxResult edit(@RequestBody ScFixHoof dto){
{ dto.setSheepId(scFixHoofService.findIdByManageTags(dto.getManageTags()).intValue());
return toAjax(scFixHoofService.updateScFixHoof(scFixHoof)); return toAjax(scFixHoofService.updateScFixHoof(dto));
} }
/** /**

View File

@ -25,8 +25,11 @@ public class ScFixHoof extends BaseEntity
private Integer id; private Integer id;
/** 羊只id */ /** 羊只id */
@Excel(name = "羊只id")
private Integer sheepId; private Integer sheepId;
/** 管理耳号(仅用于接收参数/返回视图,不存库) */
@Excel(name = "管理耳号")
// @TableField(exist = false) // 非数据库字段
private String manageTags;
/** 羊舍id */ /** 羊舍id */
private Integer sheepfold; private Integer sheepfold;

View File

@ -1,7 +1,10 @@
package com.zhyc.module.produce.other.fixHoof.mapper; package com.zhyc.module.produce.other.fixHoof.mapper;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof; import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof;
import com.zhyc.module.produce.sheep.domain.BasSheep;
import org.apache.ibatis.annotations.Param;
/** /**
* 修蹄Mapper接口 * 修蹄Mapper接口
@ -9,8 +12,7 @@ import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof;
* @author ruoyi * @author ruoyi
* @date 2025-07-10 * @date 2025-07-10
*/ */
public interface ScFixHoofMapper public interface ScFixHoofMapper {
{
/** /**
* 查询修蹄 * 查询修蹄
* *
@ -58,4 +60,6 @@ public interface ScFixHoofMapper
* @return 结果 * @return 结果
*/ */
public int deleteScFixHoofByIds(Integer[] ids); public int deleteScFixHoofByIds(Integer[] ids);
} }

View File

@ -58,4 +58,13 @@ public interface IScFixHoofService
* @return 结果 * @return 结果
*/ */
public int deleteScFixHoofById(Integer id); public int deleteScFixHoofById(Integer id);
/**
* 根据管理耳号查询
* @param manageTags
* @return
*/
Long findIdByManageTags(String manageTags);
} }

View File

@ -1,12 +1,18 @@
package com.zhyc.module.produce.other.fixHoof.service.impl; package com.zhyc.module.produce.other.fixHoof.service.impl;
import java.util.List; import java.util.List;
import com.zhyc.common.exception.ServiceException;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof; import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof;
import com.zhyc.module.produce.other.fixHoof.mapper.ScFixHoofMapper; import com.zhyc.module.produce.other.fixHoof.mapper.ScFixHoofMapper;
import com.zhyc.module.produce.sheep.domain.BasSheep;
import com.zhyc.module.produce.sheep.mapper.BasSheepMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zhyc.module.produce.other.fixHoof.service.IScFixHoofService; import com.zhyc.module.produce.other.fixHoof.service.IScFixHoofService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 修蹄Service业务层处理 * 修蹄Service业务层处理
@ -15,11 +21,13 @@ import com.zhyc.module.produce.other.fixHoof.service.IScFixHoofService;
* @date 2025-07-10 * @date 2025-07-10
*/ */
@Service @Service
public class ScFixHoofServiceImpl implements IScFixHoofService public class ScFixHoofServiceImpl implements IScFixHoofService {
{
@Autowired @Autowired
private ScFixHoofMapper scFixHoofMapper; private ScFixHoofMapper scFixHoofMapper;
@Autowired
private BasSheepMapper basSheepMapper;
/** /**
* 查询修蹄 * 查询修蹄
* *
@ -27,8 +35,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 修蹄 * @return 修蹄
*/ */
@Override @Override
public ScFixHoof selectScFixHoofById(Integer id) public ScFixHoof selectScFixHoofById(Integer id) {
{
return scFixHoofMapper.selectScFixHoofById(id); return scFixHoofMapper.selectScFixHoofById(id);
} }
@ -39,8 +46,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 修蹄 * @return 修蹄
*/ */
@Override @Override
public List<ScFixHoof> selectScFixHoofList(ScFixHoof scFixHoof) public List<ScFixHoof> selectScFixHoofList(ScFixHoof scFixHoof) {
{
return scFixHoofMapper.selectScFixHoofList(scFixHoof); return scFixHoofMapper.selectScFixHoofList(scFixHoof);
} }
@ -51,8 +57,12 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertScFixHoof(ScFixHoof scFixHoof) public int insertScFixHoof(ScFixHoof scFixHoof) {
{ // 校验羊只是否存在
BasSheep sheep = basSheepMapper.selectBasSheepById(scFixHoof.getSheepId().longValue());
if (sheep == null) {
throw new ServiceException("该羊只ID不存在请检查后再添加");
}
scFixHoof.setCreateTime(DateUtils.getNowDate()); scFixHoof.setCreateTime(DateUtils.getNowDate());
return scFixHoofMapper.insertScFixHoof(scFixHoof); return scFixHoofMapper.insertScFixHoof(scFixHoof);
} }
@ -64,8 +74,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateScFixHoof(ScFixHoof scFixHoof) public int updateScFixHoof(ScFixHoof scFixHoof) {
{
return scFixHoofMapper.updateScFixHoof(scFixHoof); return scFixHoofMapper.updateScFixHoof(scFixHoof);
} }
@ -76,8 +85,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteScFixHoofByIds(Integer[] ids) public int deleteScFixHoofByIds(Integer[] ids) {
{
return scFixHoofMapper.deleteScFixHoofByIds(ids); return scFixHoofMapper.deleteScFixHoofByIds(ids);
} }
@ -88,8 +96,24 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteScFixHoofById(Integer id) public int deleteScFixHoofById(Integer id) {
{
return scFixHoofMapper.deleteScFixHoofById(id); return scFixHoofMapper.deleteScFixHoofById(id);
} }
/**
* 根据管理耳号查询
*/
@Override
public Long findIdByManageTags(String manageTags){
if(StringUtils.isBlank(manageTags))
throw new ServiceException("管理耳号不能为空");
BasSheep sheep = basSheepMapper.selectBasSheepByManageTags(manageTags.trim());
if(sheep == null)
throw new ServiceException("管理耳号不存在:" + manageTags);
return sheep.getId();
}
} }

View File

@ -1,20 +1,17 @@
package com.zhyc.module.produce.sheep.controller; package com.zhyc.module.produce.sheep.controller;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.produce.sheep.domain.BasSheep; import com.zhyc.module.produce.sheep.domain.BasSheep;
import com.zhyc.module.produce.sheep.mapper.BasSheepMapper;
import com.zhyc.module.produce.sheep.service.IBasSheepService; import com.zhyc.module.produce.sheep.service.IBasSheepService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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.annotation.Log;
import com.zhyc.common.core.controller.BaseController; import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.core.domain.AjaxResult;
@ -35,6 +32,8 @@ public class BasSheepController extends BaseController
@Autowired @Autowired
private IBasSheepService basSheepService; private IBasSheepService basSheepService;
@Autowired
private BasSheepMapper basSheepMapper;
/** /**
* 查询羊只基本信息列表 * 查询羊只基本信息列表
*/ */
@ -102,4 +101,14 @@ public class BasSheepController extends BaseController
{ {
return toAjax(basSheepService.deleteBasSheepByIds(ids)); return toAjax(basSheepService.deleteBasSheepByIds(ids));
} }
@GetMapping("/byManageTags/{manageTags}")
public AjaxResult byManageTags(@PathVariable String manageTags){
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
return success(sheep);
}
} }

View File

@ -38,6 +38,7 @@ public class BasSheep extends BaseEntity
/** 羊舍id */ /** 羊舍id */
@Excel(name = "羊舍id") @Excel(name = "羊舍id")
private Long sheepfoldId; private Long sheepfoldId;
private String sheepfoldName;
/** 电子耳号 */ /** 电子耳号 */
@Excel(name = "电子耳号") @Excel(name = "电子耳号")

View File

@ -2,6 +2,7 @@ package com.zhyc.module.produce.sheep.mapper;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.sheep.domain.BasSheep; import com.zhyc.module.produce.sheep.domain.BasSheep;
import org.apache.ibatis.annotations.Param;
/** /**
* 羊只基本信息Mapper接口 * 羊只基本信息Mapper接口
@ -58,4 +59,12 @@ public interface BasSheepMapper
* @return 结果 * @return 结果
*/ */
public int deleteBasSheepByIds(Long[] ids); public int deleteBasSheepByIds(Long[] ids);
/**
* 根据管理耳号查询
*/
BasSheep selectBasSheepByManageTags(String manageTags);
} }

View File

@ -58,4 +58,6 @@ public interface IBasSheepService
* @return 结果 * @return 结果
*/ */
public int deleteBasSheepById(Long id); public int deleteBasSheepById(Long id);
BasSheep selectBasSheepByManageTags(String trim);
} }

View File

@ -93,4 +93,10 @@ public class BasSheepServiceImpl implements IBasSheepService
{ {
return basSheepMapper.deleteBasSheepById(id); return basSheepMapper.deleteBasSheepById(id);
} }
@Override
public BasSheep selectBasSheepByManageTags(String manageTags){
return basSheepMapper.selectBasSheepByManageTags(manageTags);
}
} }

View File

@ -65,4 +65,12 @@ public interface ScWeanRecordMapper {
* @return 羊只ID * @return 羊只ID
*/ */
public Long selectSheepIdByEarNumber(String earNumber); public Long selectSheepIdByEarNumber(String earNumber);
/**
* 根据耳号更新bas_sheep表中的断奶信息
*
* @param scWeanRecord 断奶记录
* @return 结果
*/
public int updateBasSheepWeaningInfo(ScWeanRecord scWeanRecord);
} }

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.zhyc.module.produce.wean.mapper.ScWeanRecordMapper; import com.zhyc.module.produce.wean.mapper.ScWeanRecordMapper;
import com.zhyc.module.produce.wean.domain.ScWeanRecord; import com.zhyc.module.produce.wean.domain.ScWeanRecord;
import com.zhyc.module.produce.wean.service.IScWeanRecordService; import com.zhyc.module.produce.wean.service.IScWeanRecordService;
@ -48,6 +49,7 @@ public class ScWeanRecordServiceImpl implements IScWeanRecordService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public int insertScWeanRecord(ScWeanRecord scWeanRecord) { public int insertScWeanRecord(ScWeanRecord scWeanRecord) {
// 如果前端传递的是耳号需要先获取羊只ID // 如果前端传递的是耳号需要先获取羊只ID
if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) { if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) {
@ -57,7 +59,16 @@ public class ScWeanRecordServiceImpl implements IScWeanRecordService {
} }
} }
scWeanRecord.setCreateTime(DateUtils.getNowDate()); scWeanRecord.setCreateTime(DateUtils.getNowDate());
return scWeanRecordMapper.insertScWeanRecord(scWeanRecord);
// 插入断奶记录
int result = scWeanRecordMapper.insertScWeanRecord(scWeanRecord);
// 同步更新bas_sheep表中的断奶信息
if (result > 0 && scWeanRecord.getEarNumber() != null) {
scWeanRecordMapper.updateBasSheepWeaningInfo(scWeanRecord);
}
return result;
} }
/** /**
@ -67,6 +78,7 @@ public class ScWeanRecordServiceImpl implements IScWeanRecordService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public int updateScWeanRecord(ScWeanRecord scWeanRecord) { public int updateScWeanRecord(ScWeanRecord scWeanRecord) {
// 如果前端传递的是耳号需要先获取羊只ID // 如果前端传递的是耳号需要先获取羊只ID
if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) { if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) {
@ -75,7 +87,16 @@ public class ScWeanRecordServiceImpl implements IScWeanRecordService {
scWeanRecord.setSheepId(sheepId); scWeanRecord.setSheepId(sheepId);
} }
} }
return scWeanRecordMapper.updateScWeanRecord(scWeanRecord);
// 更新断奶记录
int result = scWeanRecordMapper.updateScWeanRecord(scWeanRecord);
// 同步更新bas_sheep表中的断奶信息
if (result > 0 && scWeanRecord.getEarNumber() != null) {
scWeanRecordMapper.updateBasSheepWeaningInfo(scWeanRecord);
}
return result;
} }
/** /**

View File

@ -119,6 +119,17 @@
where id = #{id} where id = #{id}
</update> </update>
<!-- 根据耳号更新bas_sheep表中的断奶信息 -->
<update id="updateBasSheepWeaningInfo" parameterType="ScWeanRecord">
update bas_sheep
<trim prefix="SET" suffixOverrides=",">
<if test="datetime != null">weaning_date = #{datetime},</if>
<if test="weight != null">weaning_weight = #{weight},</if>
<if test="electronicTags != null and electronicTags != ''">electronic_tags = #{electronicTags},</if>
</trim>
where manage_tags = #{earNumber}
</update>
<!-- 删除断奶记录 --> <!-- 删除断奶记录 -->
<delete id="deleteScWeanRecordById" parameterType="Long"> <delete id="deleteScWeanRecordById" parameterType="Long">
delete from sc_wean_record where id = #{id} delete from sc_wean_record where id = #{id}

View File

@ -0,0 +1,125 @@
<?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.yogurtTest.mapper.NpYogurtInspMapper">
<resultMap type="NpYogurtInsp" id="NpYogurtInspResult">
<result property="id" column="id" />
<result property="source" column="source" />
<result property="datetime" column="datetime" />
<result property="fat" column="fat" />
<result property="protein" column="protein" />
<result property="nonFat" column="non_fat" />
<result property="acidity" column="acidity" />
<result property="bacterialColony1" column="bacterial_colony_1" />
<result property="bacterialClony2" column="bacterial_clony_2" />
<result property="bacterialClony3" column="bacterial_clony_3" />
<result property="bacterialClony4" column="bacterial_clony_4" />
<result property="bacterialClony5" column="bacterial_clony_5" />
<result property="yeast" column="yeast" />
<result property="mould" column="mould" />
<result property="lacto" column="lacto" />
<result property="comment" column="comment" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectNpYogurtInspVo">
select id, source, datetime, fat, protein, non_fat, acidity, bacterial_colony_1, bacterial_clony_2, bacterial_clony_3, bacterial_clony_4, bacterial_clony_5, yeast, mould, lacto, comment, create_by, create_time from np_yogurt_insp
</sql>
<select id="selectNpYogurtInspList" parameterType="NpYogurtInsp" resultMap="NpYogurtInspResult">
<include refid="selectNpYogurtInspVo"/>
<where>
<if test="source != null and source != ''">
and source like concat('%', #{source}, '%')
</if>
<if test="datetime != null ">
and datetime = #{datetime}
</if>
</where>
</select>
<select id="selectNpYogurtInspById" parameterType="Long" resultMap="NpYogurtInspResult">
<include refid="selectNpYogurtInspVo"/>
where id = #{id}
</select>
<insert id="insertNpYogurtInsp" parameterType="NpYogurtInsp" useGeneratedKeys="true" keyProperty="id">
insert into np_yogurt_insp
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="source != null">source,</if>
<if test="datetime != null">datetime,</if>
<if test="fat != null">fat,</if>
<if test="protein != null">protein,</if>
<if test="nonFat != null">non_fat,</if>
<if test="acidity != null">acidity,</if>
<if test="bacterialColony1 != null">bacterial_colony_1,</if>
<if test="bacterialClony2 != null">bacterial_clony_2,</if>
<if test="bacterialClony3 != null">bacterial_clony_3,</if>
<if test="bacterialClony4 != null">bacterial_clony_4,</if>
<if test="bacterialClony5 != null">bacterial_clony_5,</if>
<if test="yeast != null">yeast,</if>
<if test="mould != null">mould,</if>
<if test="lacto != null">lacto,</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="source != null">#{source},</if>
<if test="datetime != null">#{datetime},</if>
<if test="fat != null">#{fat},</if>
<if test="protein != null">#{protein},</if>
<if test="nonFat != null">#{nonFat},</if>
<if test="acidity != null">#{acidity},</if>
<if test="bacterialColony1 != null">#{bacterialColony1},</if>
<if test="bacterialClony2 != null">#{bacterialClony2},</if>
<if test="bacterialClony3 != null">#{bacterialClony3},</if>
<if test="bacterialClony4 != null">#{bacterialClony4},</if>
<if test="bacterialClony5 != null">#{bacterialClony5},</if>
<if test="yeast != null">#{yeast},</if>
<if test="mould != null">#{mould},</if>
<if test="lacto != null">#{lacto},</if>
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateNpYogurtInsp" parameterType="NpYogurtInsp">
update np_yogurt_insp
<trim prefix="SET" suffixOverrides=",">
<if test="source != null">source = #{source},</if>
<if test="datetime != null">datetime = #{datetime},</if>
<if test="fat != null">fat = #{fat},</if>
<if test="protein != null">protein = #{protein},</if>
<if test="nonFat != null">non_fat = #{nonFat},</if>
<if test="acidity != null">acidity = #{acidity},</if>
<if test="bacterialColony1 != null">bacterial_colony_1 = #{bacterialColony1},</if>
<if test="bacterialClony2 != null">bacterial_clony_2 = #{bacterialClony2},</if>
<if test="bacterialClony3 != null">bacterial_clony_3 = #{bacterialClony3},</if>
<if test="bacterialClony4 != null">bacterial_clony_4 = #{bacterialClony4},</if>
<if test="bacterialClony5 != null">bacterial_clony_5 = #{bacterialClony5},</if>
<if test="yeast != null">yeast = #{yeast},</if>
<if test="mould != null">mould = #{mould},</if>
<if test="lacto != null">lacto = #{lacto},</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="deleteNpYogurtInspById" parameterType="Long">
delete from np_yogurt_insp where id = #{id}
</delete>
<delete id="deleteNpYogurtInspByIds" parameterType="String">
delete from np_yogurt_insp where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,108 @@
<?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.drymilk.mapper.ScDryMilkMapper">
<resultMap type="ScDryMilk" id="ScDryMilkResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="datetime" column="datetime" />
<result property="status" column="status" />
<result property="sheepfold" column="sheepfold" />
<result property="tecahnician" column="tecahnician" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="comment" column="comment" />
<!-- 联表查询字段 -->
<result property="manageTags" column="bs_manage_tags" />
<result property="variety" column="variety" />
<result property="sheepfoldName" column="sheepfold_name" />
<result property="eventType" column="event_type" />
</resultMap>
<sql id="selectScDryMilkVo">
select d.id, d.sheep_id, d.datetime, d.status, d.sheepfold, d.tecahnician,
d.create_by, d.create_time, d.comment,
s.bs_manage_tags, s.variety, s.sheepfold_name,
'干奶' as event_type
from sc_dry_milk d
left join sheep_file s on d.sheep_id = s.id
</sql>
<select id="selectScDryMilkList" parameterType="ScDryMilk" resultMap="ScDryMilkResult">
<include refid="selectScDryMilkVo"/>
<where>
<if test="sheepId != null and sheepId != ''"> and d.sheep_id = #{sheepId}</if>
<if test="manageTags != null and manageTags != ''"> and s.bs_manage_tags like concat('%', #{manageTags}, '%')</if>
<if test="datetime != null "> and d.datetime = #{datetime}</if>
<if test="status != null "> and d.status = #{status}</if>
<if test="sheepfold != null "> and d.sheepfold = #{sheepfold}</if>
<if test="tecahnician != null and tecahnician != ''"> and d.tecahnician like concat('%', #{tecahnician}, '%')</if>
<if test="createBy != null and createBy != ''"> and d.create_by = #{createBy}</if>
<if test="createTime != null "> and d.create_time = #{createTime}</if>
<if test="variety != null and variety != ''"> and s.variety like concat('%', #{variety}, '%')</if>
</where>
order by d.create_time desc
</select>
<select id="selectScDryMilkById" parameterType="Long" resultMap="ScDryMilkResult">
<include refid="selectScDryMilkVo"/>
where d.id = #{id}
</select>
<!-- 根据耳号查询羊只ID -->
<select id="selectSheepIdByManageTags" parameterType="String" resultType="Long">
select id from sheep_file where bs_manage_tags = #{manageTags}
</select>
<insert id="insertScDryMilk" parameterType="ScDryMilk" useGeneratedKeys="true" keyProperty="id">
insert into sc_dry_milk
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="datetime != null">datetime,</if>
<if test="status != null">status,</if>
<if test="sheepfold != null">sheepfold,</if>
<if test="tecahnician != null">tecahnician,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="comment != null">comment,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="datetime != null">#{datetime},</if>
<if test="status != null">#{status},</if>
<if test="sheepfold != null">#{sheepfold},</if>
<if test="tecahnician != null">#{tecahnician},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="comment != null">#{comment},</if>
</trim>
</insert>
<update id="updateScDryMilk" parameterType="ScDryMilk">
update sc_dry_milk
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="datetime != null">datetime = #{datetime},</if>
<if test="status != null">status = #{status},</if>
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
<if test="tecahnician != null">tecahnician = #{tecahnician},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="comment != null">comment = #{comment},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScDryMilkById" parameterType="Long">
delete from sc_dry_milk where id = #{id}
</delete>
<delete id="deleteScDryMilkByIds" parameterType="String">
delete from sc_dry_milk where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,208 @@
<?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.mating_plan.mapper.ScBreedPlanGenerateMapper">
<resultMap type="ScBreedPlanGenerate" id="ScBreedPlanGenerateResult">
<result property="id" column="id" />
<result property="planName" column="plan_name" />
<result property="planType" column="plan_type" />
<result property="planDate" column="plan_date" />
<result property="totalEweCount" column="total_ewe_count" />
<result property="totalRamCount" column="total_ram_count" />
<result property="breedRatio" column="breed_ratio" />
<result property="status" column="status" />
<result property="approver" column="approver" />
<result property="approveTime" column="approve_time" />
<result property="approveRemark" column="approve_remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectScBreedPlanGenerateVo">
select id, plan_name, plan_type, plan_date, total_ewe_count, total_ram_count,
breed_ratio, status, approver, approve_time, approve_remark,
create_by, create_time, update_by, update_time
from sc_breed_plan_generate
</sql>
<select id="selectScBreedPlanGenerateList" parameterType="ScBreedPlanGenerate" resultMap="ScBreedPlanGenerateResult">
<include refid="selectScBreedPlanGenerateVo"/>
<where>
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
<if test="planType != null"> and plan_type = #{planType}</if>
<if test="planDate != null"> and plan_date = #{planDate}</if>
<if test="status != null"> and status = #{status}</if>
</where>
order by create_time desc
</select>
<select id="selectScBreedPlanGenerateById" parameterType="Long" resultMap="ScBreedPlanGenerateResult">
<include refid="selectScBreedPlanGenerateVo"/>
where id = #{id}
</select>
<!-- 筛选符合条件的母羊 -->
<select id="selectEligibleEwe" resultType="Map">
select
sf.id,
sf.bs_manage_tags,
sf.variety,
sf.name as sheep_type,
sf.gender,
sf.month_age,
sf.current_weight,
sf.post_lambing_day,
sf.breed
from sheep_file sf
where sf.gender = 1
and sf.is_delete = 0
and (sf.status_id = 1 or sf.status_id is null)
and (
-- 青年羊或超龄羊的配种条件
(sf.name in ('青年羊', '超龄羊') and (
(sf.variety = '湖羊' and sf.month_age >= 7.5 and sf.current_weight >= 33) or
(sf.variety = '东佛里生' and sf.month_age >= 9 and sf.current_weight >= 50) or
(sf.variety not in ('湖羊', '东佛里生') and sf.month_age >= 9 and sf.current_weight >= 50)
))
or
-- 泌乳羊或种母羊的配种条件
(sf.name in ('泌乳羊', '种母羊') and sf.post_lambing_day > 45 and sf.current_weight > 0)
)
order by sf.variety, sf.month_age desc
</select>
<!-- 筛选符合条件的公羊 -->
<select id="selectEligibleRam" resultType="Map">
select
sf.id,
sf.manage_tags as bs_manage_tags,
bv.variety as variety,
bst.name as sheep_type,
sf.gender,
TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) as month_age,
sf.current_weight,
bbs.breed as breed
from bas_sheep sf
left join bas_sheep_variety bv on sf.variety_id = bv.id
left join bas_sheep_type bst on sf.type_id = bst.id
left join bas_breed_status bbs on sf.breed_status_id = bbs.id
where sf.gender = 2
and sf.is_delete = 0
and sf.status_id = 1
and (
-- 青年羊或超龄羊的参配条件
(bst.name in ('青年羊', '超龄羊') and (
(bv.variety = '湖羊' and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 7.5 and sf.current_weight >= 33) or
(bv.variety = '东佛里生' and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 9 and sf.current_weight >= 50) or
(bv.variety not in ('湖羊', '东佛里生') and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 9 and sf.current_weight >= 50)
))
or
-- 其他类型公羊
bst.name not in ('青年羊', '超龄羊')
)
order by bv.variety, TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) desc
</select>
<insert id="insertScBreedPlanGenerate" parameterType="ScBreedPlanGenerate" useGeneratedKeys="true" keyProperty="id">
insert into sc_breed_plan_generate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planName != null">plan_name,</if>
<if test="planType != null">plan_type,</if>
<if test="planDate != null">plan_date,</if>
<if test="totalEweCount != null">total_ewe_count,</if>
<if test="totalRamCount != null">total_ram_count,</if>
<if test="breedRatio != null">breed_ratio,</if>
<if test="status != null">status,</if>
<if test="approver != null">approver,</if>
<if test="approveTime != null">approve_time,</if>
<if test="approveRemark != null">approve_remark,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planName != null">#{planName},</if>
<if test="planType != null">#{planType},</if>
<if test="planDate != null">#{planDate},</if>
<if test="totalEweCount != null">#{totalEweCount},</if>
<if test="totalRamCount != null">#{totalRamCount},</if>
<if test="breedRatio != null">#{breedRatio},</if>
<if test="status != null">#{status},</if>
<if test="approver != null">#{approver},</if>
<if test="approveTime != null">#{approveTime},</if>
<if test="approveRemark != null">#{approveRemark},</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>
</trim>
</insert>
<!-- 插入临时配种计划 -->
<insert id="insertTempBreedPlan">
insert into sc_breed_plan_temp (plan_generate_id, ram_id, ewe_id, breed_type, create_time)
values (#{planGenerateId}, #{breedPlan.ramId}, #{breedPlan.eweId}, #{breedPlan.breedType}, now())
</insert>
<update id="updateScBreedPlanGenerate" parameterType="ScBreedPlanGenerate">
update sc_breed_plan_generate
<trim prefix="SET" suffixOverrides=",">
<if test="planName != null">plan_name = #{planName},</if>
<if test="planType != null">plan_type = #{planType},</if>
<if test="planDate != null">plan_date = #{planDate},</if>
<if test="totalEweCount != null">total_ewe_count = #{totalEweCount},</if>
<if test="totalRamCount != null">total_ram_count = #{totalRamCount},</if>
<if test="breedRatio != null">breed_ratio = #{breedRatio},</if>
<if test="status != null">status = #{status},</if>
<if test="approver != null">approver = #{approver},</if>
<if test="approveTime != null">approve_time = #{approveTime},</if>
<if test="approveRemark != null">approve_remark = #{approveRemark},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<!-- 将临时配种计划转为正式配种计划 -->
<insert id="transferTempToFormal">
insert into sc_breed_plan (ram_id, ewe_id, breed_type)
select ram_id, ewe_id, breed_type
from sc_breed_plan_temp
where plan_generate_id = #{planGenerateId}
</insert>
<!-- 获取配种计划详情 -->
<select id="selectBreedPlanDetails" parameterType="Long" resultType="Map">
select
temp.id,
temp.ram_id,
temp.ewe_id,
temp.breed_type,
ram.bs_manage_tags as ram_manage_tags,
ram.variety as ram_variety,
ewe.bs_manage_tags as ewe_manage_tags,
ewe.variety as ewe_variety,
ewe.current_weight as ewe_weight
from sc_breed_plan_temp temp
left join sheep_file ram on temp.ram_id = ram.id
left join sheep_file ewe on temp.ewe_id = ewe.id
where temp.plan_generate_id = #{planGenerateId}
order by temp.ram_id, temp.ewe_id
</select>
<delete id="deleteScBreedPlanGenerateById" parameterType="Long">
delete from sc_breed_plan_generate where id = #{id}
</delete>
<delete id="deleteScBreedPlanGenerateByIds" parameterType="String">
delete from sc_breed_plan_generate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,66 @@
<?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.mating_plan.mapper.ScBreedPlanMapper">
<resultMap type="ScBreedPlan" id="ScBreedPlanResult">
<result property="id" column="id" />
<result property="ramId" column="ram_id" />
<result property="eweId" column="ewe_id" />
<result property="breedType" column="breed_type" />
</resultMap>
<sql id="selectScBreedPlanVo">
select id, ram_id, ewe_id, breed_type from sc_breed_plan
</sql>
<select id="selectScBreedPlanList" parameterType="ScBreedPlan" resultMap="ScBreedPlanResult">
<include refid="selectScBreedPlanVo"/>
<where>
<if test="ramId != null and ramId != ''"> and ram_id = #{ramId}</if>
<if test="eweId != null and eweId != ''"> and ewe_id = #{eweId}</if>
<if test="breedType != null "> and breed_type = #{breedType}</if>
</where>
</select>
<select id="selectScBreedPlanById" parameterType="Long" resultMap="ScBreedPlanResult">
<include refid="selectScBreedPlanVo"/>
where id = #{id}
</select>
<insert id="insertScBreedPlan" parameterType="ScBreedPlan" useGeneratedKeys="true" keyProperty="id">
insert into sc_breed_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ramId != null">ram_id,</if>
<if test="eweId != null">ewe_id,</if>
<if test="breedType != null">breed_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ramId != null">#{ramId},</if>
<if test="eweId != null">#{eweId},</if>
<if test="breedType != null">#{breedType},</if>
</trim>
</insert>
<update id="updateScBreedPlan" parameterType="ScBreedPlan">
update sc_breed_plan
<trim prefix="SET" suffixOverrides=",">
<if test="ramId != null">ram_id = #{ramId},</if>
<if test="eweId != null">ewe_id = #{eweId},</if>
<if test="breedType != null">breed_type = #{breedType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScBreedPlanById" parameterType="Long">
delete from sc_breed_plan where id = #{id}
</delete>
<delete id="deleteScBreedPlanByIds" parameterType="String">
delete from sc_breed_plan where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -1,45 +1,60 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.manage_sheep.transition_info.mapper.ScTransitionInfoMapper"> <mapper namespace="com.zhyc.module.produce.manage_sheep.transition_info.mapper.ScTransitionInfoMapper">
<resultMap type="ScTransitionInfo" id="ScTransitionInfoResult"> <resultMap type="ScTransitionInfo" id="ScTransitionInfoResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="sheepId" column="sheep_id" /> <result property="sheepId" column="sheep_id"/>
<result property="transTo" column="trans_to" /> <result property="varietyId" column="variety_id"/>
<result property="transFrom" column="trans_from" /> <result property="varietyName" column="varietyName"/>
<result property="transType" column="trans_type" /> <result property="transTo" column="trans_to"/>
<result property="technician" column="technician" /> <result property="transFrom" column="trans_from"/>
<result property="status" column="status" /> <result property="transType" column="trans_type"/>
<result property="comment" column="comment" /> <result property="transTypeText" column="trans_type_text"/>
<result property="createBy" column="create_by" /> <result property="technician" column="technician"/>
<result property="createTime" column="create_time" /> <result property="status" column="status"/>
<result property="comment" column="comment"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap> </resultMap>
<sql id="selectScTransitionInfoVo"> <sql id="selectScTransitionInfoVo">
select id, sheep_id, trans_to, trans_from, trans_type, technician, status, comment, create_by, create_time from sc_transition_info SELECT t.*, bv.variety AS varietyName,
CASE t.trans_type
WHEN 0 THEN '内部转场'
WHEN 1 THEN '跨场转场'
WHEN 2 THEN '销售转场'
ELSE '未知'
END AS trans_type_text
FROM sc_transition_info t
LEFT JOIN bas_sheep_variety bv ON t.variety_id = bv.id
</sql> </sql>
<select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult"> <select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult">
<include refid="selectScTransitionInfoVo"/> <include refid="selectScTransitionInfoVo"/>
<where> <where>
<if test="sheepId != null "> and sheep_id = #{sheepId}</if> <if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<if test="transTo != null and transTo != ''"> and trans_to = #{transTo}</if> <if test="varietyId != null">and t.variety_id = #{varietyId}</if>
<if test="transFrom != null and transFrom != ''"> and trans_from = #{transFrom}</if> <if test="transTo != null and transTo != ''">and trans_to = #{transTo}</if>
<if test="status != null "> and status = #{status}</if> <if test="transFrom != null and transFrom != ''">and trans_from = #{transFrom}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> <if test="status != null ">and status = #{status}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where> </where>
</select> </select>
<select id="selectScTransitionInfoById" parameterType="Integer" resultMap="ScTransitionInfoResult"> <select id="selectScTransitionInfoById" parameterType="Integer" resultMap="ScTransitionInfoResult">
<include refid="selectScTransitionInfoVo"/> <include refid="selectScTransitionInfoVo"/>
where id = #{id} WHERE t.id = #{id}
</select> </select>
<insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id">
insert into sc_transition_info insert into sc_transition_info
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if> <if test="sheepId != null">sheep_id,</if>
<if test="varietyId != null">variety_id,</if>
<if test="transTo != null and transTo != ''">trans_to,</if> <if test="transTo != null and transTo != ''">trans_to,</if>
<if test="transFrom != null and transFrom != ''">trans_from,</if> <if test="transFrom != null and transFrom != ''">trans_from,</if>
<if test="transType != null">trans_type,</if> <if test="transType != null">trans_type,</if>
@ -48,9 +63,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="comment != null">comment,</if> <if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if> <if test="sheepId != null">#{sheepId},</if>
<if test="varietyId != null">#{varietyId},</if>
<if test="transTo != null and transTo != ''">#{transTo},</if> <if test="transTo != null and transTo != ''">#{transTo},</if>
<if test="transFrom != null and transFrom != ''">#{transFrom},</if> <if test="transFrom != null and transFrom != ''">#{transFrom},</if>
<if test="transType != null">#{transType},</if> <if test="transType != null">#{transType},</if>
@ -59,13 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="comment != null">#{comment},</if> <if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
</trim> </trim>
</insert> </insert>
<update id="updateScTransitionInfo" parameterType="ScTransitionInfo"> <update id="updateScTransitionInfo" parameterType="ScTransitionInfo">
update sc_transition_info update sc_transition_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if> <if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if>
<if test="transTo != null and transTo != ''">trans_to = #{transTo},</if> <if test="transTo != null and transTo != ''">trans_to = #{transTo},</if>
<if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if> <if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if>
<if test="transType != null">trans_type = #{transType},</if> <if test="transType != null">trans_type = #{transType},</if>
@ -79,7 +96,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteScTransitionInfoById" parameterType="Integer"> <delete id="deleteScTransitionInfoById" parameterType="Integer">
delete from sc_transition_info where id = #{id} delete
from sc_transition_info
where id = #{id}
</delete> </delete>
<delete id="deleteScTransitionInfoByIds" parameterType="String"> <delete id="deleteScTransitionInfoByIds" parameterType="String">

View File

@ -6,8 +6,9 @@
<resultMap type="ScFixHoof" id="ScFixHoofResult"> <resultMap type="ScFixHoof" id="ScFixHoofResult">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/> <result property="manageTags" column="manageTags"/>
<result property="sheepfold" column="sheepfold"/> <result property="sheepfold" column="sheepfold"/>
<result property="varietyId" column="variety_id"/>
<result property="sheepfoldName" column="sheepfoldName"/> <result property="sheepfoldName" column="sheepfoldName"/>
<result property="comment" column="comment"/> <result property="comment" column="comment"/>
<result property="technician" column="technician"/> <result property="technician" column="technician"/>
@ -17,15 +18,19 @@
<sql id="selectScFixHoofVo"> <sql id="selectScFixHoofVo">
select fh.id, select fh.id,
fh.sheep_id, bs.manage_tags AS manageTags,
fh.sheepfold, fh.sheepfold,
sf.sheepfold_name as sheepfoldName, sf.sheepfold_name AS sheepfoldName,
fh.variety_id,
bv.variety AS varietyName,
fh.comment, fh.comment,
fh.technician, fh.technician,
fh.create_by, fh.create_by,
fh.create_time fh.create_time
from sc_fix_hoof fh from sc_fix_hoof fh
left join bas_sheep bs on fh.sheep_id = bs.id
left join da_sheepfold sf on fh.sheepfold = sf.id left join da_sheepfold sf on fh.sheepfold = sf.id
left join bas_sheep_variety bv on fh.variety_id = bv.id
</sql> </sql>
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult"> <select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
@ -33,9 +38,15 @@
<where> <where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</if> <if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if> <if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
<if test="varietyId != null">
and fh.variety_id = #{varietyId}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime} and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
</where> </where>
</select> </select>
@ -44,24 +55,24 @@
where fh.id = #{id} where fh.id = #{id}
</select> </select>
<insert id="insertScFixHoof" parameterType="ScFixHoof" useGeneratedKeys="true" keyProperty="id"> <insert id="insertScFixHoof" parameterType="ScFixHoof"
insert into sc_fix_hoof useGeneratedKeys="true" keyProperty="id">
<trim prefix="(" suffix=")" suffixOverrides=","> INSERT INTO sc_fix_hoof
<if test="sheepId != null and sheepId != ''">and fh.sheep_id like concat('%', #{sheepId}, '%')</if> (sheep_id,
<if test="sheepfold != null">and fh.sheepfold = #{sheepfold}</if> sheepfold,
<if test="comment != null">comment,</if> variety_id,
<if test="technician != null and technician != ''">technician,</if> <if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if> <if test="technician != null and technician != ''">technician,</if>
<if test="createTime != null">create_time,</if> create_by,
</trim> create_time)
<trim prefix="values (" suffix=")" suffixOverrides=","> VALUES
<if test="sheepId != null">#{sheepId},</if> (#{sheepId},
<if test="sheepfold != null">#{sheepfold},</if> #{sheepfold},
<if test="comment != null">#{comment},</if> <if test="varietyId != null">#{varietyId},</if>
<if test="technician != null and technician != ''">#{technician},</if> <if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if> <if test="technician != null and technician != ''">#{technician},</if>
<if test="createTime != null">#{createTime},</if> #{createBy},
</trim> #{createTime})
</insert> </insert>
<update id="updateScFixHoof" parameterType="ScFixHoof"> <update id="updateScFixHoof" parameterType="ScFixHoof">
@ -69,6 +80,7 @@
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if> <if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="sheepfold != null">sheepfold = #{sheepfold},</if> <if test="sheepfold != null">sheepfold = #{sheepfold},</if>
<if test="varietyId != null">variety_id=#{varietyId},</if>
<if test="comment != null">comment = #{comment},</if> <if test="comment != null">comment = #{comment},</if>
<if test="technician != null and technician != ''">technician = #{technician},</if> <if test="technician != null and technician != ''">technician = #{technician},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
@ -89,4 +101,6 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@ -92,9 +92,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectBasSheepById" parameterType="Long" resultMap="BasSheepResult"> <select id="selectBasSheepById" parameterType="java.lang.Long" resultType="BasSheep">
<include refid="selectBasSheepVo"/> SELECT s.id,
where id = #{id} s.sheepfold_id AS sheepfoldId,
sf.sheepfold_name AS sheepfoldName,
s.variety_id AS varietyId,
bv.variety AS varietyName
FROM bas_sheep s
LEFT JOIN da_sheepfold sf ON s.sheepfold_id = sf.id
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
WHERE s.id = #{id}
</select>
<select id="selectBasSheepByManageTags" parameterType="string" resultType="com.zhyc.module.produce.sheep.domain.BasSheep">
SELECT id, sheepfold_id AS sheepfoldId, variety_id AS varietyId
FROM bas_sheep
WHERE LOWER(TRIM(manage_tags)) = LOWER(TRIM(#{manageTags}))
AND is_delete = 0
LIMIT 1
</select> </select>
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id"> <insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
@ -239,4 +254,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>