Compare commits
3 Commits
fe5dffb508
...
8b4ddc5acd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b4ddc5acd | ||
|
|
54f7df70ca | ||
|
|
454c5bcb73 |
@ -1,6 +1,210 @@
|
|||||||
|
//package com.zhyc.module.base.controller;
|
||||||
|
//
|
||||||
|
//import java.util.List;
|
||||||
|
//import java.util.Map;
|
||||||
|
//import javax.servlet.http.HttpServletResponse;
|
||||||
|
//import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
//import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.RestController;
|
||||||
|
//import com.zhyc.common.annotation.Log;
|
||||||
|
//import com.zhyc.common.enums.BusinessType;
|
||||||
|
//import com.zhyc.module.base.domain.BreedRamFile;
|
||||||
|
//import com.zhyc.module.base.service.IBreedRamFileService;
|
||||||
|
//import com.zhyc.common.core.controller.BaseController;
|
||||||
|
//import com.zhyc.common.core.domain.AjaxResult;
|
||||||
|
//import com.zhyc.common.utils.poi.ExcelUtil;
|
||||||
|
//import com.zhyc.common.core.page.TableDataInfo;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 种公羊档案Controller
|
||||||
|
// *
|
||||||
|
// * @author zhyc
|
||||||
|
// * @date 2025-07-29
|
||||||
|
// */
|
||||||
|
//@RestController
|
||||||
|
//@RequestMapping("/ram_file/bas_ram_file")
|
||||||
|
//public class BreedRamFileController extends BaseController
|
||||||
|
//{
|
||||||
|
// @Autowired
|
||||||
|
// private IBreedRamFileService breedRamFileService;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询种公羊档案列表
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
|
// @GetMapping("/list")
|
||||||
|
// public TableDataInfo list(BreedRamFile breedRamFile)
|
||||||
|
// {
|
||||||
|
// startPage();
|
||||||
|
// List<BreedRamFile> list = breedRamFileService.selectBreedRamFileList(breedRamFile);
|
||||||
|
// return getDataTable(list);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 导出种公羊档案列表
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:export')")
|
||||||
|
// @Log(title = "种公羊档案", businessType = BusinessType.EXPORT)
|
||||||
|
// @PostMapping("/export")
|
||||||
|
// public void export(HttpServletResponse response, BreedRamFile breedRamFile)
|
||||||
|
// {
|
||||||
|
// List<BreedRamFile> list = breedRamFileService.selectBreedRamFileList(breedRamFile);
|
||||||
|
// ExcelUtil<BreedRamFile> util = new ExcelUtil<BreedRamFile>(BreedRamFile.class);
|
||||||
|
// util.exportExcel(response, list, "种公羊档案数据");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 获取种公羊档案详细信息
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:query')")
|
||||||
|
// @GetMapping(value = "/{id}")
|
||||||
|
// public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
// {
|
||||||
|
// return success(breedRamFileService.selectBreedRamFileById(id));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 新增种公羊档案
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:add')")
|
||||||
|
// @Log(title = "种公羊档案", businessType = BusinessType.INSERT)
|
||||||
|
// @PostMapping
|
||||||
|
// public AjaxResult add(@RequestBody BreedRamFile breedRamFile)
|
||||||
|
// {
|
||||||
|
// return toAjax(breedRamFileService.insertBreedRamFile(breedRamFile));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 修改种公羊档案
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:edit')")
|
||||||
|
// @Log(title = "种公羊档案", businessType = BusinessType.UPDATE)
|
||||||
|
// @PutMapping
|
||||||
|
// public AjaxResult edit(@RequestBody BreedRamFile breedRamFile)
|
||||||
|
// {
|
||||||
|
// return toAjax(breedRamFileService.updateBreedRamFile(breedRamFile));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 删除种公羊档案
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:remove')")
|
||||||
|
// @Log(title = "种公羊档案", businessType = BusinessType.DELETE)
|
||||||
|
// @DeleteMapping("/{ids}")
|
||||||
|
// public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
// {
|
||||||
|
// return toAjax(breedRamFileService.deleteBreedRamFileByIds(ids));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 从sheep_file同步公羊数据
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:sync')")
|
||||||
|
// @Log(title = "种公羊档案同步", businessType = BusinessType.UPDATE)
|
||||||
|
// @PostMapping("/sync")
|
||||||
|
// public AjaxResult syncFromSheepFile()
|
||||||
|
// {
|
||||||
|
// int syncCount = breedRamFileService.syncFromSheepFile();
|
||||||
|
// return AjaxResult.success("成功同步 " + syncCount + " 条公羊数据");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 以下方法可以添加到 BreedRamFileController.java 中
|
||||||
|
// * 提供更丰富的查询接口
|
||||||
|
// */
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 根据普通耳号查询种公羊档案
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:query')")
|
||||||
|
// @GetMapping("/byEarNumber/{earNumber}")
|
||||||
|
// public AjaxResult getByEarNumber(@PathVariable("earNumber") String earNumber)
|
||||||
|
// {
|
||||||
|
// BreedRamFile ram = breedRamFileService.selectBreedRamFileByEarNumber(earNumber);
|
||||||
|
// return success(ram);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 根据牧场ID查询种公羊档案列表
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
|
// @GetMapping("/byRanch/{ranchId}")
|
||||||
|
// public AjaxResult getByRanchId(@PathVariable("ranchId") Long ranchId)
|
||||||
|
// {
|
||||||
|
// List<BreedRamFile> list = breedRamFileService.selectBreedRamFileListByRanchId(ranchId);
|
||||||
|
// return success(list);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询核心羊群种公羊档案列表
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
|
// @GetMapping("/coreFlock")
|
||||||
|
// public TableDataInfo getCoreFlockList(BreedRamFile breedRamFile)
|
||||||
|
// {
|
||||||
|
// startPage();
|
||||||
|
// List<BreedRamFile> list = breedRamFileService.selectCoreFlockBreedRamFileList(breedRamFile);
|
||||||
|
// return getDataTable(list);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询种用种公羊档案列表
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
|
// @GetMapping("/breedingUse")
|
||||||
|
// public TableDataInfo getBreedingUseList(BreedRamFile breedRamFile)
|
||||||
|
// {
|
||||||
|
// startPage();
|
||||||
|
// List<BreedRamFile> list = breedRamFileService.selectBreedingUseBreedRamFileList(breedRamFile);
|
||||||
|
// return getDataTable(list);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 根据羊舍ID查询种公羊档案列表
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
|
// @GetMapping("/bySheepfold/{sheepfoldId}")
|
||||||
|
// public AjaxResult getBySheepfoldId(@PathVariable("sheepfoldId") Long sheepfoldId)
|
||||||
|
// {
|
||||||
|
// List<BreedRamFile> list = breedRamFileService.selectBreedRamFileListBySheepfoldId(sheepfoldId);
|
||||||
|
// return success(list);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 批量同步指定公羊的数据
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:sync')")
|
||||||
|
// @Log(title = "批量同步种公羊数据", businessType = BusinessType.UPDATE)
|
||||||
|
// @PostMapping("/syncBatch")
|
||||||
|
// public AjaxResult syncBatch(@RequestBody List<String> earNumbers)
|
||||||
|
// {
|
||||||
|
// int syncCount = breedRamFileService.syncSpecificRams(earNumbers);
|
||||||
|
// return AjaxResult.success("成功同步 " + syncCount + " 条公羊数据");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 获取种公羊统计信息
|
||||||
|
// */
|
||||||
|
// @PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
|
// @GetMapping("/statistics")
|
||||||
|
// public AjaxResult getStatistics()
|
||||||
|
// {
|
||||||
|
// Map<String, Object> statistics = breedRamFileService.getBreedRamStatistics();
|
||||||
|
// return success(statistics);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
package com.zhyc.module.base.controller;
|
package com.zhyc.module.base.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
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;
|
||||||
@ -15,6 +219,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.zhyc.common.annotation.Log;
|
import com.zhyc.common.annotation.Log;
|
||||||
import com.zhyc.common.enums.BusinessType;
|
import com.zhyc.common.enums.BusinessType;
|
||||||
import com.zhyc.module.base.domain.BreedRamFile;
|
import com.zhyc.module.base.domain.BreedRamFile;
|
||||||
|
import com.zhyc.module.base.domain.ViewBreedRamFile;
|
||||||
import com.zhyc.module.base.service.IBreedRamFileService;
|
import com.zhyc.module.base.service.IBreedRamFileService;
|
||||||
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,42 +240,42 @@ public class BreedRamFileController extends BaseController
|
|||||||
private IBreedRamFileService breedRamFileService;
|
private IBreedRamFileService breedRamFileService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询种公羊档案列表
|
* 查询种公羊档案列表(使用视图)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(BreedRamFile breedRamFile)
|
public TableDataInfo list(ViewBreedRamFile viewBreedRamFile)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<BreedRamFile> list = breedRamFileService.selectBreedRamFileList(breedRamFile);
|
List<ViewBreedRamFile> list = breedRamFileService.selectViewBreedRamFileList(viewBreedRamFile);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出种公羊档案列表
|
* 导出种公羊档案列表(使用视图)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:export')")
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:export')")
|
||||||
@Log(title = "种公羊档案", businessType = BusinessType.EXPORT)
|
@Log(title = "种公羊档案", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, BreedRamFile breedRamFile)
|
public void export(HttpServletResponse response, ViewBreedRamFile viewBreedRamFile)
|
||||||
{
|
{
|
||||||
List<BreedRamFile> list = breedRamFileService.selectBreedRamFileList(breedRamFile);
|
List<ViewBreedRamFile> list = breedRamFileService.selectViewBreedRamFileList(viewBreedRamFile);
|
||||||
ExcelUtil<BreedRamFile> util = new ExcelUtil<BreedRamFile>(BreedRamFile.class);
|
ExcelUtil<ViewBreedRamFile> util = new ExcelUtil<ViewBreedRamFile>(ViewBreedRamFile.class);
|
||||||
util.exportExcel(response, list, "种公羊档案数据");
|
util.exportExcel(response, list, "种公羊档案数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取种公羊档案详细信息
|
* 获取种公羊档案详细信息(使用视图)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:query')")
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
return success(breedRamFileService.selectBreedRamFileById(id));
|
return success(breedRamFileService.selectViewBreedRamFileById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增种公羊档案
|
* 新增种公羊档案(更新表)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:add')")
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:add')")
|
||||||
@Log(title = "种公羊档案", businessType = BusinessType.INSERT)
|
@Log(title = "种公羊档案", businessType = BusinessType.INSERT)
|
||||||
@ -81,7 +286,7 @@ public class BreedRamFileController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改种公羊档案
|
* 修改种公羊档案(更新表)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:edit')")
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:edit')")
|
||||||
@Log(title = "种公羊档案", businessType = BusinessType.UPDATE)
|
@Log(title = "种公羊档案", businessType = BusinessType.UPDATE)
|
||||||
@ -92,7 +297,7 @@ public class BreedRamFileController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除种公羊档案
|
* 删除种公羊档案(更新表)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:remove')")
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:remove')")
|
||||||
@Log(title = "种公羊档案", businessType = BusinessType.DELETE)
|
@Log(title = "种公羊档案", businessType = BusinessType.DELETE)
|
||||||
@ -101,4 +306,96 @@ public class BreedRamFileController extends BaseController
|
|||||||
{
|
{
|
||||||
return toAjax(breedRamFileService.deleteBreedRamFileByIds(ids));
|
return toAjax(breedRamFileService.deleteBreedRamFileByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从sheep_file同步公羊数据
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:sync')")
|
||||||
|
@Log(title = "种公羊档案同步", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/sync")
|
||||||
|
public AjaxResult syncFromSheepFile()
|
||||||
|
{
|
||||||
|
int syncCount = breedRamFileService.syncFromSheepFile();
|
||||||
|
return AjaxResult.success("成功同步 " + syncCount + " 条公羊数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据普通耳号查询种公羊档案(使用视图)
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:query')")
|
||||||
|
@GetMapping("/byEarNumber/{earNumber}")
|
||||||
|
public AjaxResult getByEarNumber(@PathVariable("earNumber") String earNumber)
|
||||||
|
{
|
||||||
|
ViewBreedRamFile ram = breedRamFileService.selectViewBreedRamFileByEarNumber(earNumber);
|
||||||
|
return success(ram);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据牧场ID查询种公羊档案列表(使用视图)
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
|
@GetMapping("/byRanch/{ranchId}")
|
||||||
|
public AjaxResult getByRanchId(@PathVariable("ranchId") Long ranchId)
|
||||||
|
{
|
||||||
|
List<ViewBreedRamFile> list = breedRamFileService.selectViewBreedRamFileListByRanchId(ranchId);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询核心羊群种公羊档案列表(使用视图)
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
|
@GetMapping("/coreFlock")
|
||||||
|
public TableDataInfo getCoreFlockList(ViewBreedRamFile viewBreedRamFile)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ViewBreedRamFile> list = breedRamFileService.selectCoreFlockViewBreedRamFileList(viewBreedRamFile);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询种用种公羊档案列表(使用视图)
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
|
@GetMapping("/breedingUse")
|
||||||
|
public TableDataInfo getBreedingUseList(ViewBreedRamFile viewBreedRamFile)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ViewBreedRamFile> list = breedRamFileService.selectBreedingUseViewBreedRamFileList(viewBreedRamFile);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据羊舍ID查询种公羊档案列表(使用视图)
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
|
@GetMapping("/bySheepfold/{sheepfoldId}")
|
||||||
|
public AjaxResult getBySheepfoldId(@PathVariable("sheepfoldId") Long sheepfoldId)
|
||||||
|
{
|
||||||
|
List<ViewBreedRamFile> list = breedRamFileService.selectViewBreedRamFileListBySheepfoldId(sheepfoldId);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量同步指定公羊的数据
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:sync')")
|
||||||
|
@Log(title = "批量同步种公羊数据", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/syncBatch")
|
||||||
|
public AjaxResult syncBatch(@RequestBody List<String> earNumbers)
|
||||||
|
{
|
||||||
|
int syncCount = breedRamFileService.syncSpecificRams(earNumbers);
|
||||||
|
return AjaxResult.success("成功同步 " + syncCount + " 条公羊数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取种公羊统计信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('breed_ram_file:breed_ram_file:list')")
|
||||||
|
@GetMapping("/statistics")
|
||||||
|
public AjaxResult getStatistics()
|
||||||
|
{
|
||||||
|
Map<String, Object> statistics = breedRamFileService.getBreedRamStatistics();
|
||||||
|
return success(statistics);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -21,9 +21,9 @@ public class BreedRamFile extends BaseEntity
|
|||||||
/** 种公羊id */
|
/** 种公羊id */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 普通耳号 */
|
/** 普通耳号(对应数据库字段 manage_tags) */
|
||||||
@Excel(name = "普通耳号")
|
@Excel(name = "普通耳号")
|
||||||
private String ordinaryEarNumber;
|
private String manageTags;
|
||||||
|
|
||||||
/** 牧场id */
|
/** 牧场id */
|
||||||
@Excel(name = "牧场id")
|
@Excel(name = "牧场id")
|
||||||
@ -263,6 +263,32 @@ public class BreedRamFile extends BaseEntity
|
|||||||
@Excel(name = "是否亲子鉴定", readConverterExp = "0=否,1=是")
|
@Excel(name = "是否亲子鉴定", readConverterExp = "0=否,1=是")
|
||||||
private Long isPaternityTested;
|
private Long isPaternityTested;
|
||||||
|
|
||||||
|
/** 公羊后代数 */
|
||||||
|
@Excel(name = "公羊后代数")
|
||||||
|
private Long offspringCount;
|
||||||
|
|
||||||
|
/** 多胎性 */
|
||||||
|
@Excel(name = "多胎性")
|
||||||
|
private BigDecimal prolificacy;
|
||||||
|
|
||||||
|
// 对应的Getter和Setter方法
|
||||||
|
|
||||||
|
public Long getOffspringCount() {
|
||||||
|
return offspringCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOffspringCount(Long offspringCount) {
|
||||||
|
this.offspringCount = offspringCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getProlificacy() {
|
||||||
|
return prolificacy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProlificacy(BigDecimal prolificacy) {
|
||||||
|
this.prolificacy = prolificacy;
|
||||||
|
}
|
||||||
|
|
||||||
/** 是否删除(0否1是) */
|
/** 是否删除(0否1是) */
|
||||||
private Long isDelete;
|
private Long isDelete;
|
||||||
|
|
||||||
@ -275,15 +301,22 @@ public class BreedRamFile extends BaseEntity
|
|||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
public void setOrdinaryEarNumber(String ordinaryEarNumber)
|
public void setOrdinaryEarNumber(String ordinaryEarNumber) {
|
||||||
{
|
this.manageTags = ordinaryEarNumber;
|
||||||
this.ordinaryEarNumber = ordinaryEarNumber;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOrdinaryEarNumber()
|
public String getOrdinaryEarNumber() {
|
||||||
{
|
return this.manageTags;
|
||||||
return ordinaryEarNumber;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setManageTags(String manageTags) {
|
||||||
|
this.manageTags = manageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getManageTags() {
|
||||||
|
return manageTags;
|
||||||
|
}
|
||||||
|
|
||||||
public void setRanchId(Long ranchId)
|
public void setRanchId(Long ranchId)
|
||||||
{
|
{
|
||||||
this.ranchId = ranchId;
|
this.ranchId = ranchId;
|
||||||
@ -885,6 +918,9 @@ public class BreedRamFile extends BaseEntity
|
|||||||
.append("updateBy", getUpdateBy())
|
.append("updateBy", getUpdateBy())
|
||||||
.append("updateTime", getUpdateTime())
|
.append("updateTime", getUpdateTime())
|
||||||
.append("isDelete", getIsDelete())
|
.append("isDelete", getIsDelete())
|
||||||
|
// 同时在toString()方法中添加这两个字段
|
||||||
|
.append("offspringCount", getOffspringCount())
|
||||||
|
.append("prolificacy", getProlificacy())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,897 @@
|
|||||||
|
package com.zhyc.module.base.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 种公羊档案视图对象 view_breed_ram_file
|
||||||
|
*
|
||||||
|
* @author zhyc
|
||||||
|
* @date 2025-07-29
|
||||||
|
*/
|
||||||
|
public class ViewBreedRamFile extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 种公羊id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 普通耳号 */
|
||||||
|
@Excel(name = "普通耳号")
|
||||||
|
private String ordinaryEarNumber;
|
||||||
|
|
||||||
|
/** 牧场id */
|
||||||
|
@Excel(name = "牧场id")
|
||||||
|
private Long ranchId;
|
||||||
|
|
||||||
|
/** 牧场名称 */
|
||||||
|
@Excel(name = "牧场名称")
|
||||||
|
private String ranchName;
|
||||||
|
|
||||||
|
/** 羊舍id */
|
||||||
|
@Excel(name = "羊舍id")
|
||||||
|
private Long sheepfoldId;
|
||||||
|
|
||||||
|
/** 羊舍名称 */
|
||||||
|
@Excel(name = "羊舍名称")
|
||||||
|
private String sheepfoldName;
|
||||||
|
|
||||||
|
/** 电子耳号 */
|
||||||
|
@Excel(name = "电子耳号")
|
||||||
|
private String electronicTags;
|
||||||
|
|
||||||
|
/** 品种id */
|
||||||
|
@Excel(name = "品种id")
|
||||||
|
private Long varietyId;
|
||||||
|
|
||||||
|
/** 品种 */
|
||||||
|
@Excel(name = "品种")
|
||||||
|
private String variety;
|
||||||
|
|
||||||
|
/** 羊只类别 */
|
||||||
|
@Excel(name = "羊只类别")
|
||||||
|
private String sheepCategory;
|
||||||
|
|
||||||
|
/** 性别 */
|
||||||
|
@Excel(name = "性别")
|
||||||
|
private Long gender;
|
||||||
|
|
||||||
|
/** 生日 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date birthday;
|
||||||
|
|
||||||
|
/** 月龄 */
|
||||||
|
@Excel(name = "月龄")
|
||||||
|
private Long monthAge;
|
||||||
|
|
||||||
|
/** 出生体重 */
|
||||||
|
@Excel(name = "出生体重")
|
||||||
|
private BigDecimal birthWeight;
|
||||||
|
|
||||||
|
/** 断奶日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "断奶日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date weaningDate;
|
||||||
|
|
||||||
|
/** 断奶日龄 */
|
||||||
|
@Excel(name = "断奶日龄")
|
||||||
|
private Long weaningDayAge;
|
||||||
|
|
||||||
|
/** 断奶体重 */
|
||||||
|
@Excel(name = "断奶体重")
|
||||||
|
private BigDecimal weaningWeight;
|
||||||
|
|
||||||
|
/** 断奶日增重 */
|
||||||
|
@Excel(name = "断奶日增重")
|
||||||
|
private BigDecimal weaningDailyGain;
|
||||||
|
|
||||||
|
/** 当前体重 */
|
||||||
|
@Excel(name = "当前体重")
|
||||||
|
private BigDecimal currentWeight;
|
||||||
|
|
||||||
|
/** 配种状态id */
|
||||||
|
@Excel(name = "配种状态id")
|
||||||
|
private Long breedingStatusId;
|
||||||
|
|
||||||
|
/** 配种状态 */
|
||||||
|
@Excel(name = "配种状态")
|
||||||
|
private String breedingStatus;
|
||||||
|
|
||||||
|
/** 父号id */
|
||||||
|
@Excel(name = "父号id")
|
||||||
|
private Long fatherId;
|
||||||
|
|
||||||
|
/** 父号 */
|
||||||
|
@Excel(name = "父号")
|
||||||
|
private String fatherEarNumber;
|
||||||
|
|
||||||
|
/** 母号id */
|
||||||
|
@Excel(name = "母号id")
|
||||||
|
private Long motherId;
|
||||||
|
|
||||||
|
/** 母号 */
|
||||||
|
@Excel(name = "母号")
|
||||||
|
private String motherEarNumber;
|
||||||
|
|
||||||
|
/** 祖父id */
|
||||||
|
@Excel(name = "祖父id")
|
||||||
|
private Long grandfatherId;
|
||||||
|
|
||||||
|
/** 祖父 */
|
||||||
|
@Excel(name = "祖父")
|
||||||
|
private String grandfatherEarNumber;
|
||||||
|
|
||||||
|
/** 祖母id */
|
||||||
|
@Excel(name = "祖母id")
|
||||||
|
private Long grandmotherId;
|
||||||
|
|
||||||
|
/** 祖母 */
|
||||||
|
@Excel(name = "祖母")
|
||||||
|
private String grandmotherEarNumber;
|
||||||
|
|
||||||
|
/** 外祖父 */
|
||||||
|
@Excel(name = "外祖父")
|
||||||
|
private String maternalGrandfatherEarNumber;
|
||||||
|
|
||||||
|
/** 外祖母 */
|
||||||
|
@Excel(name = "外祖母")
|
||||||
|
private String maternalGrandmotherEarNumber;
|
||||||
|
|
||||||
|
/** 配种日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "配种日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date matingDate;
|
||||||
|
|
||||||
|
/** 配种类型 */
|
||||||
|
@Excel(name = "配种类型")
|
||||||
|
private Long matingTypeId;
|
||||||
|
|
||||||
|
/** 孕检日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "孕检日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date pregnancyCheckDate;
|
||||||
|
|
||||||
|
/** 产羔日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "产羔日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date lambingDate;
|
||||||
|
|
||||||
|
/** 产羔时怀孕天数 */
|
||||||
|
@Excel(name = "产羔时怀孕天数")
|
||||||
|
private Long lambingDay;
|
||||||
|
|
||||||
|
/** 配种天数 */
|
||||||
|
@Excel(name = "配种天数")
|
||||||
|
private Long matingDay;
|
||||||
|
|
||||||
|
/** 怀孕天数 */
|
||||||
|
@Excel(name = "怀孕天数")
|
||||||
|
private Long gestationDay;
|
||||||
|
|
||||||
|
/** 预产日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "预产日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date expectedDate;
|
||||||
|
|
||||||
|
/** 产后天数 */
|
||||||
|
@Excel(name = "产后天数")
|
||||||
|
private Long postLambingDay;
|
||||||
|
|
||||||
|
/** 泌乳天数 */
|
||||||
|
@Excel(name = "泌乳天数")
|
||||||
|
private Long lactationDay;
|
||||||
|
|
||||||
|
/** 空怀天数 */
|
||||||
|
@Excel(name = "空怀天数")
|
||||||
|
private Long anestrusDay;
|
||||||
|
|
||||||
|
/** 配种次数 */
|
||||||
|
@Excel(name = "配种次数")
|
||||||
|
private Long matingCounts;
|
||||||
|
|
||||||
|
/** 总配次数 */
|
||||||
|
@Excel(name = "总配次数")
|
||||||
|
private Long matingTotal;
|
||||||
|
|
||||||
|
/** 流产次数 */
|
||||||
|
@Excel(name = "流产次数")
|
||||||
|
private Long miscarriageCounts;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
/** 是否性控 */
|
||||||
|
@Excel(name = "是否性控")
|
||||||
|
private Long controlled;
|
||||||
|
|
||||||
|
/** 体况评分 */
|
||||||
|
@Excel(name = "体况评分")
|
||||||
|
private BigDecimal bodyConditionScore;
|
||||||
|
|
||||||
|
/** 乳房评分 */
|
||||||
|
@Excel(name = "乳房评分")
|
||||||
|
private Long udderScore;
|
||||||
|
|
||||||
|
/** 入群来源 */
|
||||||
|
@Excel(name = "入群来源")
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
/** 入群日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "入群日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date sourceDate;
|
||||||
|
|
||||||
|
/** 来源牧场id */
|
||||||
|
@Excel(name = "来源牧场id")
|
||||||
|
private Long sourceRanchId;
|
||||||
|
|
||||||
|
/** 来源牧场 */
|
||||||
|
@Excel(name = "来源牧场")
|
||||||
|
private String sourceRanch;
|
||||||
|
|
||||||
|
/** 性欲情况 */
|
||||||
|
@Excel(name = "性欲情况")
|
||||||
|
private String sexualStatus;
|
||||||
|
|
||||||
|
/** 阴囊周长 */
|
||||||
|
@Excel(name = "阴囊周长")
|
||||||
|
private BigDecimal scrotumCircumference;
|
||||||
|
|
||||||
|
/** 采精时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "采精时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date spermCollectionTime;
|
||||||
|
|
||||||
|
/** 精液量 */
|
||||||
|
@Excel(name = "精液量")
|
||||||
|
private BigDecimal spermVolume;
|
||||||
|
|
||||||
|
/** 精液活力 */
|
||||||
|
@Excel(name = "精液活力")
|
||||||
|
private String spermVitality;
|
||||||
|
|
||||||
|
/** 精液密度 */
|
||||||
|
@Excel(name = "精液密度")
|
||||||
|
private String spermDensity;
|
||||||
|
|
||||||
|
/** 精液品质 */
|
||||||
|
@Excel(name = "精液品质")
|
||||||
|
private String semenQuality;
|
||||||
|
|
||||||
|
/** 总配母羊数 */
|
||||||
|
@Excel(name = "总配母羊数")
|
||||||
|
private Long totalMatedEwes;
|
||||||
|
|
||||||
|
/** 总孕检母羊数 */
|
||||||
|
@Excel(name = "总孕检母羊数")
|
||||||
|
private Long totalPregnantEwes;
|
||||||
|
|
||||||
|
/** 本交孕检母羊数 */
|
||||||
|
@Excel(name = "本交孕检母羊数")
|
||||||
|
private Long naturalPregnancyCheckEwes;
|
||||||
|
|
||||||
|
/** 本交受孕率% */
|
||||||
|
@Excel(name = "本交受孕率%")
|
||||||
|
private BigDecimal naturalConceptionRate;
|
||||||
|
|
||||||
|
/** 人工孕检母羊数 */
|
||||||
|
@Excel(name = "人工孕检母羊数")
|
||||||
|
private Long artificialPregnancyCheckEwes;
|
||||||
|
|
||||||
|
/** 人工受孕率% */
|
||||||
|
@Excel(name = "人工受孕率%")
|
||||||
|
private BigDecimal artificialConceptionRate;
|
||||||
|
|
||||||
|
/** 公羊后代数 */
|
||||||
|
@Excel(name = "公羊后代数")
|
||||||
|
private Long offspringCount;
|
||||||
|
|
||||||
|
/** 多胎性 */
|
||||||
|
@Excel(name = "多胎性")
|
||||||
|
private BigDecimal prolificacy;
|
||||||
|
|
||||||
|
/** 是否删除 */
|
||||||
|
private Long isDelete;
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrdinaryEarNumber() {
|
||||||
|
return ordinaryEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdinaryEarNumber(String ordinaryEarNumber) {
|
||||||
|
this.ordinaryEarNumber = ordinaryEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRanchId() {
|
||||||
|
return ranchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRanchId(Long ranchId) {
|
||||||
|
this.ranchId = ranchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRanchName() {
|
||||||
|
return ranchName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRanchName(String ranchName) {
|
||||||
|
this.ranchName = ranchName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSheepfoldId() {
|
||||||
|
return sheepfoldId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSheepfoldId(Long sheepfoldId) {
|
||||||
|
this.sheepfoldId = sheepfoldId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSheepfoldName() {
|
||||||
|
return sheepfoldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSheepfoldName(String sheepfoldName) {
|
||||||
|
this.sheepfoldName = sheepfoldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getElectronicTags() {
|
||||||
|
return electronicTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setElectronicTags(String electronicTags) {
|
||||||
|
this.electronicTags = electronicTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVarietyId() {
|
||||||
|
return varietyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVarietyId(Long varietyId) {
|
||||||
|
this.varietyId = varietyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVariety() {
|
||||||
|
return variety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVariety(String variety) {
|
||||||
|
this.variety = variety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSheepCategory() {
|
||||||
|
return sheepCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSheepCategory(String sheepCategory) {
|
||||||
|
this.sheepCategory = sheepCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(Long gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getBirthday() {
|
||||||
|
return birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBirthday(Date birthday) {
|
||||||
|
this.birthday = birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMonthAge() {
|
||||||
|
return monthAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMonthAge(Long monthAge) {
|
||||||
|
this.monthAge = monthAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getBirthWeight() {
|
||||||
|
return birthWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBirthWeight(BigDecimal birthWeight) {
|
||||||
|
this.birthWeight = birthWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getWeaningDate() {
|
||||||
|
return weaningDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeaningDate(Date weaningDate) {
|
||||||
|
this.weaningDate = weaningDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getWeaningDayAge() {
|
||||||
|
return weaningDayAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeaningDayAge(Long weaningDayAge) {
|
||||||
|
this.weaningDayAge = weaningDayAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getWeaningWeight() {
|
||||||
|
return weaningWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeaningWeight(BigDecimal weaningWeight) {
|
||||||
|
this.weaningWeight = weaningWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getWeaningDailyGain() {
|
||||||
|
return weaningDailyGain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeaningDailyGain(BigDecimal weaningDailyGain) {
|
||||||
|
this.weaningDailyGain = weaningDailyGain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getCurrentWeight() {
|
||||||
|
return currentWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentWeight(BigDecimal currentWeight) {
|
||||||
|
this.currentWeight = currentWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBreedingStatusId() {
|
||||||
|
return breedingStatusId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBreedingStatusId(Long breedingStatusId) {
|
||||||
|
this.breedingStatusId = breedingStatusId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBreedingStatus() {
|
||||||
|
return breedingStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBreedingStatus(String breedingStatus) {
|
||||||
|
this.breedingStatus = breedingStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getFatherId() {
|
||||||
|
return fatherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFatherId(Long fatherId) {
|
||||||
|
this.fatherId = fatherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFatherEarNumber() {
|
||||||
|
return fatherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFatherEarNumber(String fatherEarNumber) {
|
||||||
|
this.fatherEarNumber = fatherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMotherId() {
|
||||||
|
return motherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotherId(Long motherId) {
|
||||||
|
this.motherId = motherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMotherEarNumber() {
|
||||||
|
return motherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotherEarNumber(String motherEarNumber) {
|
||||||
|
this.motherEarNumber = motherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getGrandfatherId() {
|
||||||
|
return grandfatherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrandfatherId(Long grandfatherId) {
|
||||||
|
this.grandfatherId = grandfatherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGrandfatherEarNumber() {
|
||||||
|
return grandfatherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrandfatherEarNumber(String grandfatherEarNumber) {
|
||||||
|
this.grandfatherEarNumber = grandfatherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getGrandmotherId() {
|
||||||
|
return grandmotherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrandmotherId(Long grandmotherId) {
|
||||||
|
this.grandmotherId = grandmotherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGrandmotherEarNumber() {
|
||||||
|
return grandmotherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrandmotherEarNumber(String grandmotherEarNumber) {
|
||||||
|
this.grandmotherEarNumber = grandmotherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaternalGrandfatherEarNumber() {
|
||||||
|
return maternalGrandfatherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaternalGrandfatherEarNumber(String maternalGrandfatherEarNumber) {
|
||||||
|
this.maternalGrandfatherEarNumber = maternalGrandfatherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaternalGrandmotherEarNumber() {
|
||||||
|
return maternalGrandmotherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaternalGrandmotherEarNumber(String maternalGrandmotherEarNumber) {
|
||||||
|
this.maternalGrandmotherEarNumber = maternalGrandmotherEarNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getMatingDate() {
|
||||||
|
return matingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatingDate(Date matingDate) {
|
||||||
|
this.matingDate = matingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMatingTypeId() {
|
||||||
|
return matingTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatingTypeId(Long matingTypeId) {
|
||||||
|
this.matingTypeId = matingTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getPregnancyCheckDate() {
|
||||||
|
return pregnancyCheckDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPregnancyCheckDate(Date pregnancyCheckDate) {
|
||||||
|
this.pregnancyCheckDate = pregnancyCheckDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLambingDate() {
|
||||||
|
return lambingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLambingDate(Date lambingDate) {
|
||||||
|
this.lambingDate = lambingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getLambingDay() {
|
||||||
|
return lambingDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLambingDay(Long lambingDay) {
|
||||||
|
this.lambingDay = lambingDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMatingDay() {
|
||||||
|
return matingDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatingDay(Long matingDay) {
|
||||||
|
this.matingDay = matingDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getGestationDay() {
|
||||||
|
return gestationDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGestationDay(Long gestationDay) {
|
||||||
|
this.gestationDay = gestationDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getExpectedDate() {
|
||||||
|
return expectedDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpectedDate(Date expectedDate) {
|
||||||
|
this.expectedDate = expectedDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getPostLambingDay() {
|
||||||
|
return postLambingDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPostLambingDay(Long postLambingDay) {
|
||||||
|
this.postLambingDay = postLambingDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getLactationDay() {
|
||||||
|
return lactationDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLactationDay(Long lactationDay) {
|
||||||
|
this.lactationDay = lactationDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAnestrusDay() {
|
||||||
|
return anestrusDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnestrusDay(Long anestrusDay) {
|
||||||
|
this.anestrusDay = anestrusDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMatingCounts() {
|
||||||
|
return matingCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatingCounts(Long matingCounts) {
|
||||||
|
this.matingCounts = matingCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMatingTotal() {
|
||||||
|
return matingTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatingTotal(Long matingTotal) {
|
||||||
|
this.matingTotal = matingTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMiscarriageCounts() {
|
||||||
|
return miscarriageCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMiscarriageCounts(Long miscarriageCounts) {
|
||||||
|
this.miscarriageCounts = miscarriageCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getControlled() {
|
||||||
|
return controlled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setControlled(Long controlled) {
|
||||||
|
this.controlled = controlled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getBodyConditionScore() {
|
||||||
|
return bodyConditionScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBodyConditionScore(BigDecimal bodyConditionScore) {
|
||||||
|
this.bodyConditionScore = bodyConditionScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUdderScore() {
|
||||||
|
return udderScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUdderScore(Long udderScore) {
|
||||||
|
this.udderScore = udderScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getSourceDate() {
|
||||||
|
return sourceDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceDate(Date sourceDate) {
|
||||||
|
this.sourceDate = sourceDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSourceRanchId() {
|
||||||
|
return sourceRanchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceRanchId(Long sourceRanchId) {
|
||||||
|
this.sourceRanchId = sourceRanchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSourceRanch() {
|
||||||
|
return sourceRanch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceRanch(String sourceRanch) {
|
||||||
|
this.sourceRanch = sourceRanch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSexualStatus() {
|
||||||
|
return sexualStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSexualStatus(String sexualStatus) {
|
||||||
|
this.sexualStatus = sexualStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getScrotumCircumference() {
|
||||||
|
return scrotumCircumference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScrotumCircumference(BigDecimal scrotumCircumference) {
|
||||||
|
this.scrotumCircumference = scrotumCircumference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getSpermCollectionTime() {
|
||||||
|
return spermCollectionTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpermCollectionTime(Date spermCollectionTime) {
|
||||||
|
this.spermCollectionTime = spermCollectionTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSpermVolume() {
|
||||||
|
return spermVolume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpermVolume(BigDecimal spermVolume) {
|
||||||
|
this.spermVolume = spermVolume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpermVitality() {
|
||||||
|
return spermVitality;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpermVitality(String spermVitality) {
|
||||||
|
this.spermVitality = spermVitality;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpermDensity() {
|
||||||
|
return spermDensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpermDensity(String spermDensity) {
|
||||||
|
this.spermDensity = spermDensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSemenQuality() {
|
||||||
|
return semenQuality;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSemenQuality(String semenQuality) {
|
||||||
|
this.semenQuality = semenQuality;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTotalMatedEwes() {
|
||||||
|
return totalMatedEwes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalMatedEwes(Long totalMatedEwes) {
|
||||||
|
this.totalMatedEwes = totalMatedEwes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTotalPregnantEwes() {
|
||||||
|
return totalPregnantEwes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalPregnantEwes(Long totalPregnantEwes) {
|
||||||
|
this.totalPregnantEwes = totalPregnantEwes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getNaturalPregnancyCheckEwes() {
|
||||||
|
return naturalPregnancyCheckEwes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNaturalPregnancyCheckEwes(Long naturalPregnancyCheckEwes) {
|
||||||
|
this.naturalPregnancyCheckEwes = naturalPregnancyCheckEwes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getNaturalConceptionRate() {
|
||||||
|
return naturalConceptionRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNaturalConceptionRate(BigDecimal naturalConceptionRate) {
|
||||||
|
this.naturalConceptionRate = naturalConceptionRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getArtificialPregnancyCheckEwes() {
|
||||||
|
return artificialPregnancyCheckEwes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtificialPregnancyCheckEwes(Long artificialPregnancyCheckEwes) {
|
||||||
|
this.artificialPregnancyCheckEwes = artificialPregnancyCheckEwes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getArtificialConceptionRate() {
|
||||||
|
return artificialConceptionRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtificialConceptionRate(BigDecimal artificialConceptionRate) {
|
||||||
|
this.artificialConceptionRate = artificialConceptionRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getOffspringCount() {
|
||||||
|
return offspringCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOffspringCount(Long offspringCount) {
|
||||||
|
this.offspringCount = offspringCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getProlificacy() {
|
||||||
|
return prolificacy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProlificacy(BigDecimal prolificacy) {
|
||||||
|
this.prolificacy = prolificacy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getIsDelete() {
|
||||||
|
return isDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDelete(Long isDelete) {
|
||||||
|
this.isDelete = isDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("ordinaryEarNumber", getOrdinaryEarNumber())
|
||||||
|
.append("ranchId", getRanchId())
|
||||||
|
.append("ranchName", getRanchName())
|
||||||
|
.append("sheepfoldId", getSheepfoldId())
|
||||||
|
.append("sheepfoldName", getSheepfoldName())
|
||||||
|
.append("electronicTags", getElectronicTags())
|
||||||
|
.append("varietyId", getVarietyId())
|
||||||
|
.append("variety", getVariety())
|
||||||
|
.append("sheepCategory", getSheepCategory())
|
||||||
|
.append("gender", getGender())
|
||||||
|
.append("birthday", getBirthday())
|
||||||
|
.append("monthAge", getMonthAge())
|
||||||
|
.append("birthWeight", getBirthWeight())
|
||||||
|
.append("weaningDate", getWeaningDate())
|
||||||
|
.append("weaningDayAge", getWeaningDayAge())
|
||||||
|
.append("weaningWeight", getWeaningWeight())
|
||||||
|
.append("weaningDailyGain", getWeaningDailyGain())
|
||||||
|
.append("currentWeight", getCurrentWeight())
|
||||||
|
.append("breedingStatusId", getBreedingStatusId())
|
||||||
|
.append("breedingStatus", getBreedingStatus())
|
||||||
|
.append("sexualStatus", getSexualStatus())
|
||||||
|
.append("scrotumCircumference", getScrotumCircumference())
|
||||||
|
.append("spermCollectionTime", getSpermCollectionTime())
|
||||||
|
.append("spermVolume", getSpermVolume())
|
||||||
|
.append("spermVitality", getSpermVitality())
|
||||||
|
.append("spermDensity", getSpermDensity())
|
||||||
|
.append("semenQuality", getSemenQuality())
|
||||||
|
.append("totalMatedEwes", getTotalMatedEwes())
|
||||||
|
.append("totalPregnantEwes", getTotalPregnantEwes())
|
||||||
|
.append("naturalPregnancyCheckEwes", getNaturalPregnancyCheckEwes())
|
||||||
|
.append("naturalConceptionRate", getNaturalConceptionRate())
|
||||||
|
.append("artificialPregnancyCheckEwes", getArtificialPregnancyCheckEwes())
|
||||||
|
.append("artificialConceptionRate", getArtificialConceptionRate())
|
||||||
|
.append("offspringCount", getOffspringCount())
|
||||||
|
.append("prolificacy", getProlificacy())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -106,4 +106,10 @@ public interface BreedRamFileMapper
|
|||||||
* @return 种公羊档案集合
|
* @return 种公羊档案集合
|
||||||
*/
|
*/
|
||||||
public List<BreedRamFile> selectBreedingUseBreedRamFileList(BreedRamFile breedRamFile);
|
public List<BreedRamFile> selectBreedingUseBreedRamFileList(BreedRamFile breedRamFile);
|
||||||
|
/**
|
||||||
|
* 根据普通耳号查询种公羊档案
|
||||||
|
*
|
||||||
|
* @param ordinaryEarNumber 普通耳号
|
||||||
|
* @return 种公羊档案
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
@ -101,4 +101,21 @@ public interface SheepFileMapper
|
|||||||
List<String> selectFieldValuesByProvider(@Param("fieldName") String fieldName);
|
List<String> selectFieldValuesByProvider(@Param("fieldName") String fieldName);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有公羊(gender=2)
|
||||||
|
*
|
||||||
|
* @return 公羊列表
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 查询所有公羊(gender=2)
|
||||||
|
* @return 公羊列表
|
||||||
|
*/
|
||||||
|
List<SheepFile> selectRamList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据管理耳号查询羊只
|
||||||
|
* @param manageTags 管理耳号
|
||||||
|
* @return 羊只信息
|
||||||
|
*/
|
||||||
|
SheepFile selectSheepFileByManageTags(String manageTags);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,69 @@
|
|||||||
|
package com.zhyc.module.base.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.module.base.domain.ViewBreedRamFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 种公羊档案视图Mapper接口
|
||||||
|
*
|
||||||
|
* @author zhyc
|
||||||
|
* @date 2025-07-29
|
||||||
|
*/
|
||||||
|
public interface ViewBreedRamFileMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询种公羊档案视图
|
||||||
|
*
|
||||||
|
* @param id 种公羊档案主键
|
||||||
|
* @return 种公羊档案视图
|
||||||
|
*/
|
||||||
|
public ViewBreedRamFile selectViewBreedRamFileById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询种公羊档案视图列表
|
||||||
|
*
|
||||||
|
* @param viewBreedRamFile 种公羊档案视图
|
||||||
|
* @return 种公羊档案视图集合
|
||||||
|
*/
|
||||||
|
public List<ViewBreedRamFile> selectViewBreedRamFileList(ViewBreedRamFile viewBreedRamFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据普通耳号查询种公羊档案视图
|
||||||
|
*
|
||||||
|
* @param ordinaryEarNumber 普通耳号
|
||||||
|
* @return 种公羊档案视图
|
||||||
|
*/
|
||||||
|
public ViewBreedRamFile selectViewBreedRamFileByOrdinaryEarNumber(String ordinaryEarNumber);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据牧场ID查询种公羊档案视图列表
|
||||||
|
*
|
||||||
|
* @param ranchId 牧场ID
|
||||||
|
* @return 种公羊档案视图集合
|
||||||
|
*/
|
||||||
|
public List<ViewBreedRamFile> selectViewBreedRamFileListByRanchId(Long ranchId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据羊舍ID查询种公羊档案视图列表
|
||||||
|
*
|
||||||
|
* @param sheepfoldId 羊舍ID
|
||||||
|
* @return 种公羊档案视图集合
|
||||||
|
*/
|
||||||
|
public List<ViewBreedRamFile> selectViewBreedRamFileListBySheepfoldId(Long sheepfoldId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询核心羊群种公羊档案视图列表
|
||||||
|
*
|
||||||
|
* @param viewBreedRamFile 种公羊档案视图
|
||||||
|
* @return 种公羊档案视图集合
|
||||||
|
*/
|
||||||
|
public List<ViewBreedRamFile> selectCoreFlockViewBreedRamFileList(ViewBreedRamFile viewBreedRamFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询种用种公羊档案视图列表
|
||||||
|
*
|
||||||
|
* @param viewBreedRamFile 种公羊档案视图
|
||||||
|
* @return 种公羊档案视图集合
|
||||||
|
*/
|
||||||
|
public List<ViewBreedRamFile> selectBreedingUseViewBreedRamFileList(ViewBreedRamFile viewBreedRamFile);
|
||||||
|
}
|
||||||
@ -1,7 +1,149 @@
|
|||||||
|
//package com.zhyc.module.base.service;
|
||||||
|
//
|
||||||
|
//import java.util.List;
|
||||||
|
//import java.util.Map;
|
||||||
|
//
|
||||||
|
//import com.zhyc.module.base.domain.BreedRamFile;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 种公羊档案Service接口
|
||||||
|
// *
|
||||||
|
// * @author zhyc
|
||||||
|
// * @date 2025-07-29
|
||||||
|
// */
|
||||||
|
//public interface IBreedRamFileService
|
||||||
|
//{
|
||||||
|
// /**
|
||||||
|
// * 查询种公羊档案
|
||||||
|
// *
|
||||||
|
// * @param id 种公羊档案主键
|
||||||
|
// * @return 种公羊档案
|
||||||
|
// */
|
||||||
|
// public BreedRamFile selectBreedRamFileById(Long id);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询种公羊档案列表
|
||||||
|
// *
|
||||||
|
// * @param breedRamFile 种公羊档案
|
||||||
|
// * @return 种公羊档案集合
|
||||||
|
// */
|
||||||
|
// public List<BreedRamFile> selectBreedRamFileList(BreedRamFile breedRamFile);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 新增种公羊档案
|
||||||
|
// *
|
||||||
|
// * @param breedRamFile 种公羊档案
|
||||||
|
// * @return 结果
|
||||||
|
// */
|
||||||
|
// public int insertBreedRamFile(BreedRamFile breedRamFile);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 修改种公羊档案
|
||||||
|
// *
|
||||||
|
// * @param breedRamFile 种公羊档案
|
||||||
|
// * @return 结果
|
||||||
|
// */
|
||||||
|
// public int updateBreedRamFile(BreedRamFile breedRamFile);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 批量删除种公羊档案
|
||||||
|
// *
|
||||||
|
// * @param ids 需要删除的种公羊档案主键集合
|
||||||
|
// * @return 结果
|
||||||
|
// */
|
||||||
|
// public int deleteBreedRamFileByIds(Long[] ids);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 删除种公羊档案信息
|
||||||
|
// *
|
||||||
|
// * @param id 种公羊档案主键
|
||||||
|
// * @return 结果
|
||||||
|
// */
|
||||||
|
// public int deleteBreedRamFileById(Long id);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 从sheep_file同步公羊数据到公羊档案
|
||||||
|
// *
|
||||||
|
// * @return 同步的记录数
|
||||||
|
// */
|
||||||
|
// public int syncFromSheepFile();
|
||||||
|
//
|
||||||
|
// // ====================== Service接口中需要添加的方法 ======================
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 根据普通耳号查询种公羊档案
|
||||||
|
// *
|
||||||
|
// * @param earNumber 普通耳号
|
||||||
|
// * @return 种公羊档案
|
||||||
|
// */
|
||||||
|
// public BreedRamFile selectBreedRamFileByEarNumber(String earNumber);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 根据牧场ID查询种公羊档案列表
|
||||||
|
// *
|
||||||
|
// * @param ranchId 牧场ID
|
||||||
|
// * @return 种公羊档案集合
|
||||||
|
// */
|
||||||
|
// public List<BreedRamFile> selectBreedRamFileListByRanchId(Long ranchId);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 根据羊舍ID查询种公羊档案列表
|
||||||
|
// *
|
||||||
|
// * @param sheepfoldId 羊舍ID
|
||||||
|
// * @return 种公羊档案集合
|
||||||
|
// */
|
||||||
|
// public List<BreedRamFile> selectBreedRamFileListBySheepfoldId(Long sheepfoldId);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询核心羊群种公羊档案列表
|
||||||
|
// *
|
||||||
|
// * @param breedRamFile 种公羊档案
|
||||||
|
// * @return 种公羊档案集合
|
||||||
|
// */
|
||||||
|
// public List<BreedRamFile> selectCoreFlockBreedRamFileList(BreedRamFile breedRamFile);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询种用种公羊档案列表
|
||||||
|
// *
|
||||||
|
// * @param breedRamFile 种公羊档案
|
||||||
|
// * @return 种公羊档案集合
|
||||||
|
// */
|
||||||
|
// public List<BreedRamFile> selectBreedingUseBreedRamFileList(BreedRamFile breedRamFile);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 批量同步指定公羊的数据
|
||||||
|
// *
|
||||||
|
// * @param earNumbers 耳号列表
|
||||||
|
// * @return 同步的记录数
|
||||||
|
// */
|
||||||
|
// public int syncSpecificRams(List<String> earNumbers);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 获取种公羊统计信息
|
||||||
|
// *
|
||||||
|
// * @return 统计信息
|
||||||
|
// */
|
||||||
|
// public Map<String, Object> getBreedRamStatistics();
|
||||||
|
//
|
||||||
|
// // ============================================
|
||||||
|
//// 2. 在 IBreedRamFileService.java 接口中添加方法
|
||||||
|
//// ============================================
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 根据普通耳号查询种公羊档案
|
||||||
|
// *
|
||||||
|
// * @param ordinaryEarNumber 普通耳号
|
||||||
|
// * @return 种公羊档案
|
||||||
|
// */
|
||||||
|
// BreedRamFile selectBreedRamFileByOrdinaryEarNumber(String ordinaryEarNumber);
|
||||||
|
//}
|
||||||
package com.zhyc.module.base.service;
|
package com.zhyc.module.base.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.zhyc.module.base.domain.BreedRamFile;
|
import com.zhyc.module.base.domain.BreedRamFile;
|
||||||
|
import com.zhyc.module.base.domain.ViewBreedRamFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 种公羊档案Service接口
|
* 种公羊档案Service接口
|
||||||
@ -11,8 +153,68 @@ import com.zhyc.module.base.domain.BreedRamFile;
|
|||||||
*/
|
*/
|
||||||
public interface IBreedRamFileService
|
public interface IBreedRamFileService
|
||||||
{
|
{
|
||||||
|
// ========== 视图查询方法 ==========
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询种公羊档案
|
* 查询种公羊档案视图
|
||||||
|
*
|
||||||
|
* @param id 种公羊档案主键
|
||||||
|
* @return 种公羊档案视图
|
||||||
|
*/
|
||||||
|
public ViewBreedRamFile selectViewBreedRamFileById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询种公羊档案视图列表
|
||||||
|
*
|
||||||
|
* @param viewBreedRamFile 种公羊档案视图
|
||||||
|
* @return 种公羊档案视图集合
|
||||||
|
*/
|
||||||
|
public List<ViewBreedRamFile> selectViewBreedRamFileList(ViewBreedRamFile viewBreedRamFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据普通耳号查询种公羊档案视图
|
||||||
|
*
|
||||||
|
* @param earNumber 普通耳号
|
||||||
|
* @return 种公羊档案视图
|
||||||
|
*/
|
||||||
|
public ViewBreedRamFile selectViewBreedRamFileByEarNumber(String earNumber);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据牧场ID查询种公羊档案视图列表
|
||||||
|
*
|
||||||
|
* @param ranchId 牧场ID
|
||||||
|
* @return 种公羊档案视图集合
|
||||||
|
*/
|
||||||
|
public List<ViewBreedRamFile> selectViewBreedRamFileListByRanchId(Long ranchId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据羊舍ID查询种公羊档案视图列表
|
||||||
|
*
|
||||||
|
* @param sheepfoldId 羊舍ID
|
||||||
|
* @return 种公羊档案视图集合
|
||||||
|
*/
|
||||||
|
public List<ViewBreedRamFile> selectViewBreedRamFileListBySheepfoldId(Long sheepfoldId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询核心羊群种公羊档案视图列表
|
||||||
|
*
|
||||||
|
* @param viewBreedRamFile 种公羊档案视图
|
||||||
|
* @return 种公羊档案视图集合
|
||||||
|
*/
|
||||||
|
public List<ViewBreedRamFile> selectCoreFlockViewBreedRamFileList(ViewBreedRamFile viewBreedRamFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询种用种公羊档案视图列表
|
||||||
|
*
|
||||||
|
* @param viewBreedRamFile 种公羊档案视图
|
||||||
|
* @return 种公羊档案视图集合
|
||||||
|
*/
|
||||||
|
public List<ViewBreedRamFile> selectBreedingUseViewBreedRamFileList(ViewBreedRamFile viewBreedRamFile);
|
||||||
|
|
||||||
|
// ========== 表操作方法 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询种公羊档案(表)
|
||||||
*
|
*
|
||||||
* @param id 种公羊档案主键
|
* @param id 种公羊档案主键
|
||||||
* @return 种公羊档案
|
* @return 种公羊档案
|
||||||
@ -20,7 +222,7 @@ public interface IBreedRamFileService
|
|||||||
public BreedRamFile selectBreedRamFileById(Long id);
|
public BreedRamFile selectBreedRamFileById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询种公羊档案列表
|
* 查询种公羊档案列表(表)
|
||||||
*
|
*
|
||||||
* @param breedRamFile 种公羊档案
|
* @param breedRamFile 种公羊档案
|
||||||
* @return 种公羊档案集合
|
* @return 种公羊档案集合
|
||||||
@ -58,4 +260,66 @@ public interface IBreedRamFileService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteBreedRamFileById(Long id);
|
public int deleteBreedRamFileById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从sheep_file同步公羊数据到公羊档案
|
||||||
|
*
|
||||||
|
* @return 同步的记录数
|
||||||
|
*/
|
||||||
|
public int syncFromSheepFile();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据普通耳号查询种公羊档案(表)
|
||||||
|
*
|
||||||
|
* @param ordinaryEarNumber 普通耳号
|
||||||
|
* @return 种公羊档案
|
||||||
|
*/
|
||||||
|
public BreedRamFile selectBreedRamFileByOrdinaryEarNumber(String ordinaryEarNumber);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据牧场ID查询种公羊档案列表(表)
|
||||||
|
*
|
||||||
|
* @param ranchId 牧场ID
|
||||||
|
* @return 种公羊档案集合
|
||||||
|
*/
|
||||||
|
public List<BreedRamFile> selectBreedRamFileListByRanchId(Long ranchId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据羊舍ID查询种公羊档案列表(表)
|
||||||
|
*
|
||||||
|
* @param sheepfoldId 羊舍ID
|
||||||
|
* @return 种公羊档案集合
|
||||||
|
*/
|
||||||
|
public List<BreedRamFile> selectBreedRamFileListBySheepfoldId(Long sheepfoldId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询核心羊群种公羊档案列表(表)
|
||||||
|
*
|
||||||
|
* @param breedRamFile 种公羊档案
|
||||||
|
* @return 种公羊档案集合
|
||||||
|
*/
|
||||||
|
public List<BreedRamFile> selectCoreFlockBreedRamFileList(BreedRamFile breedRamFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询种用种公羊档案列表(表)
|
||||||
|
*
|
||||||
|
* @param breedRamFile 种公羊档案
|
||||||
|
* @return 种公羊档案集合
|
||||||
|
*/
|
||||||
|
public List<BreedRamFile> selectBreedingUseBreedRamFileList(BreedRamFile breedRamFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量同步指定公羊的数据
|
||||||
|
*
|
||||||
|
* @param earNumbers 耳号列表
|
||||||
|
* @return 同步的记录数
|
||||||
|
*/
|
||||||
|
public int syncSpecificRams(List<String> earNumbers);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取种公羊统计信息
|
||||||
|
*
|
||||||
|
* @return 统计信息
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getBreedRamStatistics();
|
||||||
}
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
package com.zhyc.module.base.service;
|
package com.zhyc.module.base.service;
|
||||||
|
|
||||||
import com.zhyc.module.base.domain.SheepFile;
|
import com.zhyc.module.base.domain.SheepFile;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -66,4 +67,10 @@ public interface ISheepFileService
|
|||||||
Map<String, Object> params,
|
Map<String, Object> params,
|
||||||
SheepFile sheepFile
|
SheepFile sheepFile
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
int insertSheepFile(SheepFile sheepFile);
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
int updateSheepFile(SheepFile sheepFile);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,504 @@
|
|||||||
|
//package com.zhyc.module.base.service.impl;
|
||||||
|
//
|
||||||
|
//import java.math.BigDecimal;
|
||||||
|
//import java.math.RoundingMode;
|
||||||
|
//import java.util.Date;
|
||||||
|
//import java.util.HashMap;
|
||||||
|
//import java.util.List;
|
||||||
|
//import java.util.Map;
|
||||||
|
//import java.util.stream.Collectors;
|
||||||
|
//import com.zhyc.common.utils.DateUtils;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.stereotype.Service;
|
||||||
|
//import org.springframework.transaction.annotation.Transactional;
|
||||||
|
//import com.zhyc.module.base.mapper.BreedRamFileMapper;
|
||||||
|
//import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||||
|
//import com.zhyc.module.produce.breed.mapper.RawSpermRecordMapper;
|
||||||
|
//import com.zhyc.module.produce.breed.mapper.ScBreedRecordMapper;
|
||||||
|
//import com.zhyc.module.produce.breed.mapper.ScLambingRecordMapper;
|
||||||
|
//import com.zhyc.module.produce.breed.mapper.ScPregnancyRecordMapper;
|
||||||
|
//import com.zhyc.module.base.domain.BreedRamFile;
|
||||||
|
//import com.zhyc.module.base.domain.SheepFile;
|
||||||
|
//import com.zhyc.module.produce.breed.domain.RawSpermRecord;
|
||||||
|
//import com.zhyc.module.produce.breed.domain.ScBreedRecord;
|
||||||
|
//import com.zhyc.module.produce.breed.domain.ScLambingRecord;
|
||||||
|
//import com.zhyc.module.produce.breed.domain.ScPregnancyRecord;
|
||||||
|
//import com.zhyc.module.base.service.IBreedRamFileService;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 种公羊档案Service业务层处理
|
||||||
|
// *
|
||||||
|
// * @author zhyc
|
||||||
|
// * @date 2025-07-29
|
||||||
|
// */
|
||||||
|
//@Service
|
||||||
|
//public class BreedRamFileServiceImpl implements IBreedRamFileService {
|
||||||
|
// @Autowired
|
||||||
|
// private BreedRamFileMapper breedRamFileMapper;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private SheepFileMapper sheepFileMapper;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private RawSpermRecordMapper rawSpermRecordMapper;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private ScBreedRecordMapper scBreedRecordMapper;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private ScLambingRecordMapper scLambingRecordMapper;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private ScPregnancyRecordMapper scPregnancyRecordMapper;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询种公羊档案
|
||||||
|
// *
|
||||||
|
// * @param id 种公羊档案主键
|
||||||
|
// * @return 种公羊档案
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// public BreedRamFile selectBreedRamFileById(Long id) {
|
||||||
|
// return breedRamFileMapper.selectBreedRamFileById(id);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询种公羊档案列表
|
||||||
|
// *
|
||||||
|
// * @param breedRamFile 种公羊档案
|
||||||
|
// * @return 种公羊档案
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// public List<BreedRamFile> selectBreedRamFileList(BreedRamFile breedRamFile) {
|
||||||
|
// return breedRamFileMapper.selectBreedRamFileList(breedRamFile);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 新增种公羊档案
|
||||||
|
// *
|
||||||
|
// * @param breedRamFile 种公羊档案
|
||||||
|
// * @return 结果
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// @Transactional
|
||||||
|
// public int insertBreedRamFile(BreedRamFile breedRamFile) {
|
||||||
|
// breedRamFile.setCreateTime(DateUtils.getNowDate());
|
||||||
|
// return breedRamFileMapper.insertBreedRamFile(breedRamFile);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 修改种公羊档案
|
||||||
|
// *
|
||||||
|
// * @param breedRamFile 种公羊档案
|
||||||
|
// * @return 结果
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// @Transactional
|
||||||
|
// public int updateBreedRamFile(BreedRamFile breedRamFile) {
|
||||||
|
// breedRamFile.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
// return breedRamFileMapper.updateBreedRamFile(breedRamFile);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 批量删除种公羊档案
|
||||||
|
// *
|
||||||
|
// * @param ids 需要删除的种公羊档案主键
|
||||||
|
// * @return 结果
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// @Transactional
|
||||||
|
// public int deleteBreedRamFileByIds(Long[] ids) {
|
||||||
|
// return breedRamFileMapper.deleteBreedRamFileByIds(ids);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 删除种公羊档案信息
|
||||||
|
// *
|
||||||
|
// * @param id 种公羊档案主键
|
||||||
|
// * @return 结果
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// @Transactional
|
||||||
|
// public int deleteBreedRamFileById(Long id) {
|
||||||
|
// return breedRamFileMapper.deleteBreedRamFileById(id);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // ====================== Service实现类中对应的实现 ======================
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public BreedRamFile selectBreedRamFileByEarNumber(String earNumber) {
|
||||||
|
// return breedRamFileMapper.selectBreedRamFileByOrdinaryEarNumber(earNumber);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public List<BreedRamFile> selectBreedRamFileListByRanchId(Long ranchId) {
|
||||||
|
// return breedRamFileMapper.selectBreedRamFileListByRanchId(ranchId);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public List<BreedRamFile> selectBreedRamFileListBySheepfoldId(Long sheepfoldId) {
|
||||||
|
// return breedRamFileMapper.selectBreedRamFileListBySheepfoldId(sheepfoldId);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public List<BreedRamFile> selectCoreFlockBreedRamFileList(BreedRamFile breedRamFile) {
|
||||||
|
// return breedRamFileMapper.selectCoreFlockBreedRamFileList(breedRamFile);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public List<BreedRamFile> selectBreedingUseBreedRamFileList(BreedRamFile breedRamFile) {
|
||||||
|
// return breedRamFileMapper.selectBreedingUseBreedRamFileList(breedRamFile);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public BreedRamFile selectBreedRamFileByOrdinaryEarNumber(String ordinaryEarNumber) {
|
||||||
|
// return breedRamFileMapper.selectBreedRamFileByOrdinaryEarNumber(ordinaryEarNumber);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// @Transactional
|
||||||
|
// public int syncSpecificRams(List<String> earNumbers) {
|
||||||
|
// int syncCount = 0;
|
||||||
|
// for (String earNumber : earNumbers) {
|
||||||
|
// try {
|
||||||
|
// // 查询指定耳号的公羊
|
||||||
|
// SheepFile sheep = sheepFileMapper.selectSheepFileByManageTags(earNumber);
|
||||||
|
// if (sheep != null && sheep.getGender() == 2) {
|
||||||
|
// BreedRamFile existingRam = breedRamFileMapper.selectBreedRamFileByOrdinaryEarNumber(earNumber);
|
||||||
|
// if (existingRam == null) {
|
||||||
|
// BreedRamFile newRam = buildRamFileFromSheep(sheep);
|
||||||
|
// breedRamFileMapper.insertBreedRamFile(newRam);
|
||||||
|
// } else {
|
||||||
|
// updateRamFileFromSheep(existingRam, sheep);
|
||||||
|
// breedRamFileMapper.updateBreedRamFile(existingRam);
|
||||||
|
// }
|
||||||
|
// syncCount++;
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// System.err.println("同步公羊档案失败,耳号:" + earNumber + ",错误:" + e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return syncCount;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public Map<String, Object> getBreedRamStatistics() {
|
||||||
|
// Map<String, Object> statistics = new HashMap<>();
|
||||||
|
//
|
||||||
|
// // 总公羊数
|
||||||
|
// BreedRamFile queryParam = new BreedRamFile();
|
||||||
|
// List<BreedRamFile> allRams = breedRamFileMapper.selectBreedRamFileList(queryParam);
|
||||||
|
// statistics.put("totalRams", allRams.size());
|
||||||
|
//
|
||||||
|
// // 核心羊群数
|
||||||
|
// List<BreedRamFile> coreFlockRams = breedRamFileMapper.selectCoreFlockBreedRamFileList(queryParam);
|
||||||
|
// statistics.put("coreFlockRams", coreFlockRams.size());
|
||||||
|
//
|
||||||
|
// // 种用公羊数
|
||||||
|
// List<BreedRamFile> breedingUseRams = breedRamFileMapper.selectBreedingUseBreedRamFileList(queryParam);
|
||||||
|
// statistics.put("breedingUseRams", breedingUseRams.size());
|
||||||
|
//
|
||||||
|
// // 按品种统计
|
||||||
|
// Map<String, Long> varietyCount = allRams.stream()
|
||||||
|
// .collect(Collectors.groupingBy(
|
||||||
|
// ram -> ram.getVariety() != null ? ram.getVariety() : "未知",
|
||||||
|
// Collectors.counting()
|
||||||
|
// ));
|
||||||
|
// statistics.put("varietyDistribution", varietyCount);
|
||||||
|
//
|
||||||
|
// // 按牧场统计
|
||||||
|
// Map<String, Long> ranchCount = allRams.stream()
|
||||||
|
// .collect(Collectors.groupingBy(
|
||||||
|
// ram -> ram.getRanchName() != null ? ram.getRanchName() : "未知",
|
||||||
|
// Collectors.counting()
|
||||||
|
// ));
|
||||||
|
// statistics.put("ranchDistribution", ranchCount);
|
||||||
|
//
|
||||||
|
// // 平均月龄
|
||||||
|
// Double avgMonthAge = allRams.stream()
|
||||||
|
// .filter(ram -> ram.getMonthAge() != null)
|
||||||
|
// .mapToLong(BreedRamFile::getMonthAge)
|
||||||
|
// .average()
|
||||||
|
// .orElse(0.0);
|
||||||
|
// statistics.put("avgMonthAge", avgMonthAge);
|
||||||
|
//
|
||||||
|
// // 平均多胎性
|
||||||
|
// Double avgProlificacy = allRams.stream()
|
||||||
|
// .filter(ram -> ram.getProlificacy() != null)
|
||||||
|
// .mapToDouble(ram -> ram.getProlificacy().doubleValue())
|
||||||
|
// .average()
|
||||||
|
// .orElse(0.0);
|
||||||
|
// statistics.put("avgProlificacy", avgProlificacy);
|
||||||
|
//
|
||||||
|
// return statistics;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 从sheep_file同步公羊数据到公羊档案
|
||||||
|
// * 同步逻辑:
|
||||||
|
// * 1. 从sheep_file获取基础信息(gender=2的公羊)
|
||||||
|
// * 2. 从raw_sperm_record获取采精相关数据
|
||||||
|
// * 3. 从sc_breed_record获取配种统计数据
|
||||||
|
// * 4. 从sc_lambing_record获取后代数统计
|
||||||
|
// * 5. 从sc_pregnancy_record获取孕检统计数据
|
||||||
|
// * 6. 计算多胎性、受孕率等指标
|
||||||
|
// *
|
||||||
|
// * @return 同步的记录数
|
||||||
|
// */
|
||||||
|
// /**
|
||||||
|
// * 从sheep_file同步公羊数据到公羊档案
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// @Transactional
|
||||||
|
// public int syncFromSheepFile() {
|
||||||
|
// // 1. 查询所有gender=2的羊只(公羊)
|
||||||
|
// List<SheepFile> rams = sheepFileMapper.selectRamList();
|
||||||
|
// int syncCount = 0;
|
||||||
|
// int updateCount = 0;
|
||||||
|
// int insertCount = 0;
|
||||||
|
//
|
||||||
|
// System.out.println("开始同步公羊数据,共找到 " + rams.size() + " 只公羊");
|
||||||
|
//
|
||||||
|
// for (SheepFile sheep : rams) {
|
||||||
|
// try {
|
||||||
|
// // 检查该公羊是否已存在于公羊档案
|
||||||
|
// BreedRamFile existingRam = breedRamFileMapper
|
||||||
|
// .selectBreedRamFileByOrdinaryEarNumber(sheep.getBsManageTags());
|
||||||
|
//
|
||||||
|
// if (existingRam == null) {
|
||||||
|
// // 新增公羊档案
|
||||||
|
// BreedRamFile newRam = buildRamFileFromSheep(sheep);
|
||||||
|
// int result = breedRamFileMapper.insertBreedRamFile(newRam);
|
||||||
|
// if (result > 0) {
|
||||||
|
// insertCount++;
|
||||||
|
// syncCount++;
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// // 更新公羊档案
|
||||||
|
// updateRamFileFromSheep(existingRam, sheep);
|
||||||
|
// int result = breedRamFileMapper.updateBreedRamFile(existingRam);
|
||||||
|
// if (result > 0) {
|
||||||
|
// updateCount++;
|
||||||
|
// syncCount++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// System.err.println("同步公羊档案失败,耳号:" + sheep.getBsManageTags()
|
||||||
|
// + ",错误:" + e.getMessage());
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// System.out.println("同步完成!新增: " + insertCount + " 只,更新: " + updateCount + " 只");
|
||||||
|
// return syncCount;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 从SheepFile构建完整的BreedRamFile对象
|
||||||
|
// */
|
||||||
|
// private BreedRamFile buildRamFileFromSheep(SheepFile sheep) {
|
||||||
|
// BreedRamFile ram = new BreedRamFile();
|
||||||
|
//
|
||||||
|
// // 1. 从sheep_file同步基础信息
|
||||||
|
// syncBasicInfoFromSheep(ram, sheep);
|
||||||
|
//
|
||||||
|
// // 2. 从raw_sperm_record同步采精信息
|
||||||
|
// syncSpermInfoFromRecords(ram, sheep.getId());
|
||||||
|
//
|
||||||
|
// // 3. 从sc_breed_record、sc_lambing_record、sc_pregnancy_record同步配种和繁殖统计
|
||||||
|
// syncBreedingStatistics(ram, sheep.getBsManageTags());
|
||||||
|
//
|
||||||
|
// ram.setCreateTime(DateUtils.getNowDate());
|
||||||
|
// ram.setIsDelete(0L);
|
||||||
|
//
|
||||||
|
// return ram;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 从SheepFile更新BreedRamFile
|
||||||
|
// */
|
||||||
|
// private void updateRamFileFromSheep(BreedRamFile ram, SheepFile sheep) {
|
||||||
|
// // 1. 更新基础信息
|
||||||
|
// syncBasicInfoFromSheep(ram, sheep);
|
||||||
|
//
|
||||||
|
// // 2. 更新采精信息
|
||||||
|
// syncSpermInfoFromRecords(ram, sheep.getId());
|
||||||
|
//
|
||||||
|
// // 3. 更新配种和繁殖统计
|
||||||
|
// syncBreedingStatistics(ram, sheep.getBsManageTags());
|
||||||
|
//
|
||||||
|
// ram.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 同步基础信息(从sheep_file)
|
||||||
|
// */
|
||||||
|
// private void syncBasicInfoFromSheep(BreedRamFile ram, SheepFile sheep) {
|
||||||
|
// // 【重要】使用 setManageTags 而不是 setOrdinaryEarNumber
|
||||||
|
// ram.setManageTags(sheep.getBsManageTags()); // 普通耳号(manage_tags)
|
||||||
|
// ram.setRanchId(sheep.getRanchId()); // 牧场id
|
||||||
|
// ram.setRanchName(sheep.getDrRanch()); // 牧场名称
|
||||||
|
// ram.setSheepfoldId(sheep.getSheepfoldId()); // 羊舍id
|
||||||
|
// ram.setSheepfoldName(sheep.getSheepfoldName()); // 羊舍名称
|
||||||
|
// ram.setElectronicTags(sheep.getElectronicTags()); // 电子耳号
|
||||||
|
// ram.setVarietyId(sheep.getVarietyId()); // 品种id
|
||||||
|
// ram.setVariety(sheep.getVariety()); // 品种
|
||||||
|
// ram.setSheepCategory(sheep.getName()); // 羊只类别
|
||||||
|
// ram.setCurrentStatus(String.valueOf(sheep.getStatusId())); // 当前状态
|
||||||
|
// ram.setBirthday(sheep.getBirthday()); // 出生日期
|
||||||
|
//
|
||||||
|
// // 【关键】从sheep_file获取month_age
|
||||||
|
// ram.setMonthAge(sheep.getMonthAge()); // 月龄
|
||||||
|
//
|
||||||
|
// // 体重相关数据
|
||||||
|
// ram.setBirthWeight(sheep.getBirthWeight() != null ?
|
||||||
|
// BigDecimal.valueOf(sheep.getBirthWeight()) : null);
|
||||||
|
// ram.setWeaningDate(sheep.getWeaningDate());
|
||||||
|
// ram.setWeaningDayAge(sheep.getWeaningDayAge() != null ?
|
||||||
|
// Long.valueOf(sheep.getWeaningDayAge()) : null);
|
||||||
|
// ram.setWeaningWeight(sheep.getWeaningWeight() != null ?
|
||||||
|
// BigDecimal.valueOf(sheep.getWeaningWeight()) : null);
|
||||||
|
// ram.setWeaningDailyGain(sheep.getWeaningDailyGain() != null ?
|
||||||
|
// BigDecimal.valueOf(sheep.getWeaningDailyGain()) : null);
|
||||||
|
// ram.setCurrentWeight(sheep.getCurrentWeight() != null ?
|
||||||
|
// BigDecimal.valueOf(sheep.getCurrentWeight()) : null);
|
||||||
|
//
|
||||||
|
// // 家系信息
|
||||||
|
// ram.setFatherNumber(sheep.getFatherManageTags());
|
||||||
|
// ram.setMotherNumber(sheep.getMotherManageTags());
|
||||||
|
// ram.setGrandfatherNumber(sheep.getGrandfatherManageTags());
|
||||||
|
// ram.setGrandmotherNumber(sheep.getGrandmotherManageTags());
|
||||||
|
// ram.setMaternalGrandfatherNumber(sheep.getMaternalGrandfatherManageTags());
|
||||||
|
// ram.setMaternalGrandmotherNumber(sheep.getMaternalGrandmotherManageTags());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 同步采精信息(从raw_sperm_record)
|
||||||
|
// */
|
||||||
|
// private void syncSpermInfoFromRecords(BreedRamFile ram, Long sheepId) {
|
||||||
|
// if (sheepId == null) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// RawSpermRecord latestSperm = rawSpermRecordMapper.selectLatestByRamId(sheepId);
|
||||||
|
//
|
||||||
|
// if (latestSperm != null) {
|
||||||
|
// ram.setSexualStatus(latestSperm.getSexualStatus());
|
||||||
|
// ram.setScrotumCircumference(latestSperm.getScrotumCircumference());
|
||||||
|
// ram.setSpermCollectionTime(latestSperm.getPickDate());
|
||||||
|
// ram.setSpermVolume(latestSperm.getAmount());
|
||||||
|
// ram.setSpermVitality(latestSperm.getVitallity());
|
||||||
|
// ram.setSpermDensity(latestSperm.getDensity());
|
||||||
|
// ram.setSpermQuality(latestSperm.getSemenQuality());
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// System.err.println("同步采精信息失败,羊只ID:" + sheepId + ",错误:" + e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 同步配种和繁殖统计数据
|
||||||
|
// */
|
||||||
|
// private void syncBreedingStatistics(BreedRamFile ram, String ramManageTags) {
|
||||||
|
// if (ramManageTags == null || ramManageTags.trim().isEmpty()) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // 1. 统计该公羊配了多少母羊(去重)
|
||||||
|
// Long totalMatedEwes = scBreedRecordMapper.countMatedEwesByRamId(ramManageTags);
|
||||||
|
// ram.setTotalMatedEwes(totalMatedEwes != null ? totalMatedEwes : 0L);
|
||||||
|
//
|
||||||
|
// // 2. 统计公羊后代数(从产羔记录)
|
||||||
|
// Long offspringCount = scLambingRecordMapper.countOffspringByRamId(ramManageTags);
|
||||||
|
// ram.setOffspringCount(offspringCount != null ? offspringCount : 0L);
|
||||||
|
//
|
||||||
|
// // 3. 计算多胎性 = 公羊后代数 / 配种母羊数
|
||||||
|
// if (totalMatedEwes != null && totalMatedEwes > 0 && offspringCount != null) {
|
||||||
|
// BigDecimal prolificacy = BigDecimal.valueOf(offspringCount)
|
||||||
|
// .divide(BigDecimal.valueOf(totalMatedEwes), 2, RoundingMode.HALF_UP);
|
||||||
|
// ram.setProlificacy(prolificacy);
|
||||||
|
// } else {
|
||||||
|
// ram.setProlificacy(BigDecimal.ZERO);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 4. 统计孕检相关数据
|
||||||
|
// syncPregnancyStatistics(ram, ramManageTags, totalMatedEwes);
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// System.err.println("同步配种统计失败,耳号:" + ramManageTags + ",错误:" + e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 同步孕检统计数据
|
||||||
|
// */
|
||||||
|
// private void syncPregnancyStatistics(BreedRamFile ram, String ramManageTags, Long totalMatedEwes) {
|
||||||
|
// try {
|
||||||
|
// // 本交孕检母羊数(配种方式为本交=2的孕检有胎记录)
|
||||||
|
// Long naturalPregnantEwes = scPregnancyRecordMapper
|
||||||
|
// .countPregnantEwesByRamIdAndBreedType(ramManageTags, 2); // 2=本交
|
||||||
|
// ram.setNaturalPregnancyCheckEwes(naturalPregnantEwes != null ? naturalPregnantEwes : 0L);
|
||||||
|
//
|
||||||
|
// // 本交受孕率%
|
||||||
|
// if (totalMatedEwes != null && totalMatedEwes > 0 && naturalPregnantEwes != null) {
|
||||||
|
// BigDecimal naturalRate = BigDecimal.valueOf(naturalPregnantEwes)
|
||||||
|
// .multiply(BigDecimal.valueOf(100))
|
||||||
|
// .divide(BigDecimal.valueOf(totalMatedEwes), 2, RoundingMode.HALF_UP);
|
||||||
|
// ram.setNaturalConceptionRate(naturalRate);
|
||||||
|
// } else {
|
||||||
|
// ram.setNaturalConceptionRate(BigDecimal.ZERO);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 人工孕检母羊数(配种方式为人工授精=1的孕检有胎记录)
|
||||||
|
// Long artificialPregnantEwes = scPregnancyRecordMapper
|
||||||
|
// .countPregnantEwesByRamIdAndBreedType(ramManageTags, 1); // 1=人工授精
|
||||||
|
// ram.setArtificialPregnancyCheckEwes(artificialPregnantEwes != null ? artificialPregnantEwes : 0L);
|
||||||
|
//
|
||||||
|
// // 人工受孕率%
|
||||||
|
// if (totalMatedEwes != null && totalMatedEwes > 0 && artificialPregnantEwes != null) {
|
||||||
|
// BigDecimal artificialRate = BigDecimal.valueOf(artificialPregnantEwes)
|
||||||
|
// .multiply(BigDecimal.valueOf(100))
|
||||||
|
// .divide(BigDecimal.valueOf(totalMatedEwes), 2, RoundingMode.HALF_UP);
|
||||||
|
// ram.setArtificialConceptionRate(artificialRate);
|
||||||
|
// } else {
|
||||||
|
// ram.setArtificialConceptionRate(BigDecimal.ZERO);
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// System.err.println("同步孕检统计失败,耳号:" + ramManageTags + ",错误:" + e.getMessage());
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
package com.zhyc.module.base.service.impl;
|
package com.zhyc.module.base.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
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.base.mapper.BreedRamFileMapper;
|
import com.zhyc.module.base.mapper.BreedRamFileMapper;
|
||||||
|
import com.zhyc.module.base.mapper.ViewBreedRamFileMapper;
|
||||||
|
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||||
|
import com.zhyc.module.produce.breed.mapper.RawSpermRecordMapper;
|
||||||
|
import com.zhyc.module.produce.breed.mapper.ScBreedRecordMapper;
|
||||||
|
import com.zhyc.module.produce.breed.mapper.ScLambingRecordMapper;
|
||||||
|
import com.zhyc.module.produce.breed.mapper.ScPregnancyRecordMapper;
|
||||||
import com.zhyc.module.base.domain.BreedRamFile;
|
import com.zhyc.module.base.domain.BreedRamFile;
|
||||||
|
import com.zhyc.module.base.domain.ViewBreedRamFile;
|
||||||
|
import com.zhyc.module.base.domain.SheepFile;
|
||||||
|
import com.zhyc.module.produce.breed.domain.RawSpermRecord;
|
||||||
|
import com.zhyc.module.produce.breed.domain.ScBreedRecord;
|
||||||
|
import com.zhyc.module.produce.breed.domain.ScLambingRecord;
|
||||||
|
import com.zhyc.module.produce.breed.domain.ScPregnancyRecord;
|
||||||
import com.zhyc.module.base.service.IBreedRamFileService;
|
import com.zhyc.module.base.service.IBreedRamFileService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,82 +508,440 @@ import com.zhyc.module.base.service.IBreedRamFileService;
|
|||||||
* @date 2025-07-29
|
* @date 2025-07-29
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class BreedRamFileServiceImpl implements IBreedRamFileService
|
public class BreedRamFileServiceImpl implements IBreedRamFileService {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BreedRamFileMapper breedRamFileMapper;
|
private BreedRamFileMapper breedRamFileMapper;
|
||||||
|
|
||||||
/**
|
@Autowired
|
||||||
* 查询种公羊档案
|
private ViewBreedRamFileMapper viewBreedRamFileMapper;
|
||||||
*
|
|
||||||
* @param id 种公羊档案主键
|
@Autowired
|
||||||
* @return 种公羊档案
|
private SheepFileMapper sheepFileMapper;
|
||||||
*/
|
|
||||||
|
@Autowired
|
||||||
|
private RawSpermRecordMapper rawSpermRecordMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScBreedRecordMapper scBreedRecordMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScLambingRecordMapper scLambingRecordMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScPregnancyRecordMapper scPregnancyRecordMapper;
|
||||||
|
|
||||||
|
// ========== 视图查询方法实现 ==========
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BreedRamFile selectBreedRamFileById(Long id)
|
public ViewBreedRamFile selectViewBreedRamFileById(Long id) {
|
||||||
{
|
return viewBreedRamFileMapper.selectViewBreedRamFileById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ViewBreedRamFile> selectViewBreedRamFileList(ViewBreedRamFile viewBreedRamFile) {
|
||||||
|
return viewBreedRamFileMapper.selectViewBreedRamFileList(viewBreedRamFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ViewBreedRamFile selectViewBreedRamFileByEarNumber(String earNumber) {
|
||||||
|
return viewBreedRamFileMapper.selectViewBreedRamFileByOrdinaryEarNumber(earNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ViewBreedRamFile> selectViewBreedRamFileListByRanchId(Long ranchId) {
|
||||||
|
return viewBreedRamFileMapper.selectViewBreedRamFileListByRanchId(ranchId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ViewBreedRamFile> selectViewBreedRamFileListBySheepfoldId(Long sheepfoldId) {
|
||||||
|
return viewBreedRamFileMapper.selectViewBreedRamFileListBySheepfoldId(sheepfoldId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ViewBreedRamFile> selectCoreFlockViewBreedRamFileList(ViewBreedRamFile viewBreedRamFile) {
|
||||||
|
return viewBreedRamFileMapper.selectCoreFlockViewBreedRamFileList(viewBreedRamFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ViewBreedRamFile> selectBreedingUseViewBreedRamFileList(ViewBreedRamFile viewBreedRamFile) {
|
||||||
|
return viewBreedRamFileMapper.selectBreedingUseViewBreedRamFileList(viewBreedRamFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 表操作方法实现 ==========
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BreedRamFile selectBreedRamFileById(Long id) {
|
||||||
return breedRamFileMapper.selectBreedRamFileById(id);
|
return breedRamFileMapper.selectBreedRamFileById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询种公羊档案列表
|
|
||||||
*
|
|
||||||
* @param breedRamFile 种公羊档案
|
|
||||||
* @return 种公羊档案
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public List<BreedRamFile> selectBreedRamFileList(BreedRamFile breedRamFile)
|
public List<BreedRamFile> selectBreedRamFileList(BreedRamFile breedRamFile) {
|
||||||
{
|
|
||||||
return breedRamFileMapper.selectBreedRamFileList(breedRamFile);
|
return breedRamFileMapper.selectBreedRamFileList(breedRamFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增种公羊档案
|
|
||||||
*
|
|
||||||
* @param breedRamFile 种公羊档案
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int insertBreedRamFile(BreedRamFile breedRamFile)
|
@Transactional
|
||||||
{
|
public int insertBreedRamFile(BreedRamFile breedRamFile) {
|
||||||
breedRamFile.setCreateTime(DateUtils.getNowDate());
|
breedRamFile.setCreateTime(DateUtils.getNowDate());
|
||||||
return breedRamFileMapper.insertBreedRamFile(breedRamFile);
|
return breedRamFileMapper.insertBreedRamFile(breedRamFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改种公羊档案
|
|
||||||
*
|
|
||||||
* @param breedRamFile 种公羊档案
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int updateBreedRamFile(BreedRamFile breedRamFile)
|
@Transactional
|
||||||
{
|
public int updateBreedRamFile(BreedRamFile breedRamFile) {
|
||||||
breedRamFile.setUpdateTime(DateUtils.getNowDate());
|
breedRamFile.setUpdateTime(DateUtils.getNowDate());
|
||||||
return breedRamFileMapper.updateBreedRamFile(breedRamFile);
|
return breedRamFileMapper.updateBreedRamFile(breedRamFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除种公羊档案
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的种公羊档案主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteBreedRamFileByIds(Long[] ids)
|
@Transactional
|
||||||
{
|
public int deleteBreedRamFileByIds(Long[] ids) {
|
||||||
return breedRamFileMapper.deleteBreedRamFileByIds(ids);
|
return breedRamFileMapper.deleteBreedRamFileByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除种公羊档案信息
|
|
||||||
*
|
|
||||||
* @param id 种公羊档案主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteBreedRamFileById(Long id)
|
@Transactional
|
||||||
{
|
public int deleteBreedRamFileById(Long id) {
|
||||||
return breedRamFileMapper.deleteBreedRamFileById(id);
|
return breedRamFileMapper.deleteBreedRamFileById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BreedRamFile selectBreedRamFileByOrdinaryEarNumber(String ordinaryEarNumber) {
|
||||||
|
return breedRamFileMapper.selectBreedRamFileByOrdinaryEarNumber(ordinaryEarNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BreedRamFile> selectBreedRamFileListByRanchId(Long ranchId) {
|
||||||
|
return breedRamFileMapper.selectBreedRamFileListByRanchId(ranchId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BreedRamFile> selectBreedRamFileListBySheepfoldId(Long sheepfoldId) {
|
||||||
|
return breedRamFileMapper.selectBreedRamFileListBySheepfoldId(sheepfoldId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BreedRamFile> selectCoreFlockBreedRamFileList(BreedRamFile breedRamFile) {
|
||||||
|
return breedRamFileMapper.selectCoreFlockBreedRamFileList(breedRamFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BreedRamFile> selectBreedingUseBreedRamFileList(BreedRamFile breedRamFile) {
|
||||||
|
return breedRamFileMapper.selectBreedingUseBreedRamFileList(breedRamFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public int syncSpecificRams(List<String> earNumbers) {
|
||||||
|
int syncCount = 0;
|
||||||
|
for (String earNumber : earNumbers) {
|
||||||
|
try {
|
||||||
|
SheepFile sheep = sheepFileMapper.selectSheepFileByManageTags(earNumber);
|
||||||
|
if (sheep != null && sheep.getGender() == 2) {
|
||||||
|
BreedRamFile existingRam = breedRamFileMapper.selectBreedRamFileByOrdinaryEarNumber(earNumber);
|
||||||
|
if (existingRam == null) {
|
||||||
|
BreedRamFile newRam = buildRamFileFromSheep(sheep);
|
||||||
|
breedRamFileMapper.insertBreedRamFile(newRam);
|
||||||
|
} else {
|
||||||
|
updateRamFileFromSheep(existingRam, sheep);
|
||||||
|
breedRamFileMapper.updateBreedRamFile(existingRam);
|
||||||
|
}
|
||||||
|
syncCount++;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("同步公羊档案失败,耳号:" + earNumber + ",错误:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return syncCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getBreedRamStatistics() {
|
||||||
|
Map<String, Object> statistics = new HashMap<>();
|
||||||
|
|
||||||
|
BreedRamFile queryParam = new BreedRamFile();
|
||||||
|
List<BreedRamFile> allRams = breedRamFileMapper.selectBreedRamFileList(queryParam);
|
||||||
|
statistics.put("totalRams", allRams.size());
|
||||||
|
|
||||||
|
List<BreedRamFile> coreFlockRams = breedRamFileMapper.selectCoreFlockBreedRamFileList(queryParam);
|
||||||
|
statistics.put("coreFlockRams", coreFlockRams.size());
|
||||||
|
|
||||||
|
List<BreedRamFile> breedingUseRams = breedRamFileMapper.selectBreedingUseBreedRamFileList(queryParam);
|
||||||
|
statistics.put("breedingUseRams", breedingUseRams.size());
|
||||||
|
|
||||||
|
Map<String, Long> varietyCount = allRams.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
ram -> ram.getVariety() != null ? ram.getVariety() : "未知",
|
||||||
|
Collectors.counting()
|
||||||
|
));
|
||||||
|
statistics.put("varietyDistribution", varietyCount);
|
||||||
|
|
||||||
|
Map<String, Long> ranchCount = allRams.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
ram -> ram.getRanchName() != null ? ram.getRanchName() : "未知",
|
||||||
|
Collectors.counting()
|
||||||
|
));
|
||||||
|
statistics.put("ranchDistribution", ranchCount);
|
||||||
|
|
||||||
|
Double avgMonthAge = allRams.stream()
|
||||||
|
.filter(ram -> ram.getMonthAge() != null)
|
||||||
|
.mapToLong(BreedRamFile::getMonthAge)
|
||||||
|
.average()
|
||||||
|
.orElse(0.0);
|
||||||
|
statistics.put("avgMonthAge", avgMonthAge);
|
||||||
|
|
||||||
|
Double avgProlificacy = allRams.stream()
|
||||||
|
.filter(ram -> ram.getProlificacy() != null)
|
||||||
|
.mapToDouble(ram -> ram.getProlificacy().doubleValue())
|
||||||
|
.average()
|
||||||
|
.orElse(0.0);
|
||||||
|
statistics.put("avgProlificacy", avgProlificacy);
|
||||||
|
|
||||||
|
return statistics;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从sheep_file同步公羊数据到公羊档案
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public int syncFromSheepFile() {
|
||||||
|
List<SheepFile> rams = sheepFileMapper.selectRamList();
|
||||||
|
int syncCount = 0;
|
||||||
|
int updateCount = 0;
|
||||||
|
int insertCount = 0;
|
||||||
|
|
||||||
|
System.out.println("开始同步公羊数据,共找到 " + rams.size() + " 只公羊");
|
||||||
|
|
||||||
|
for (SheepFile sheep : rams) {
|
||||||
|
try {
|
||||||
|
BreedRamFile existingRam = breedRamFileMapper
|
||||||
|
.selectBreedRamFileByOrdinaryEarNumber(sheep.getBsManageTags());
|
||||||
|
|
||||||
|
if (existingRam == null) {
|
||||||
|
BreedRamFile newRam = buildRamFileFromSheep(sheep);
|
||||||
|
int result = breedRamFileMapper.insertBreedRamFile(newRam);
|
||||||
|
if (result > 0) {
|
||||||
|
insertCount++;
|
||||||
|
syncCount++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updateRamFileFromSheep(existingRam, sheep);
|
||||||
|
int result = breedRamFileMapper.updateBreedRamFile(existingRam);
|
||||||
|
if (result > 0) {
|
||||||
|
updateCount++;
|
||||||
|
syncCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("同步公羊档案失败,耳号:" + sheep.getBsManageTags()
|
||||||
|
+ ",错误:" + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("同步完成:新增: " + insertCount + " 只,更新: " + updateCount + " 只");
|
||||||
|
return syncCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从SheepFile构建完整的BreedRamFile对象
|
||||||
|
*/
|
||||||
|
private BreedRamFile buildRamFileFromSheep(SheepFile sheep) {
|
||||||
|
BreedRamFile ram = new BreedRamFile();
|
||||||
|
|
||||||
|
// 1. 从sheep_file同步基础信息
|
||||||
|
syncBasicInfoFromSheep(ram, sheep);
|
||||||
|
|
||||||
|
// 2. 从raw_sperm_record同步采精信息 - 修复后的版本
|
||||||
|
syncSpermInfoFromRecords(ram, sheep.getId());
|
||||||
|
|
||||||
|
// 3. 从sc_breed_record、sc_lambing_record、sc_pregnancy_record同步配种和繁殖统计
|
||||||
|
syncBreedingStatistics(ram, sheep.getBsManageTags());
|
||||||
|
|
||||||
|
ram.setCreateTime(DateUtils.getNowDate());
|
||||||
|
ram.setIsDelete(0L);
|
||||||
|
|
||||||
|
return ram;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从SheepFile更新BreedRamFile
|
||||||
|
*/
|
||||||
|
private void updateRamFileFromSheep(BreedRamFile ram, SheepFile sheep) {
|
||||||
|
// 1. 更新基础信息
|
||||||
|
syncBasicInfoFromSheep(ram, sheep);
|
||||||
|
|
||||||
|
// 2. 更新采精信息 - 修复后的版本
|
||||||
|
syncSpermInfoFromRecords(ram, sheep.getId());
|
||||||
|
|
||||||
|
// 3. 更新配种和繁殖统计
|
||||||
|
syncBreedingStatistics(ram, sheep.getBsManageTags());
|
||||||
|
|
||||||
|
ram.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步基础信息(从sheep_file)
|
||||||
|
*/
|
||||||
|
private void syncBasicInfoFromSheep(BreedRamFile ram, SheepFile sheep) {
|
||||||
|
ram.setManageTags(sheep.getBsManageTags());
|
||||||
|
ram.setRanchId(sheep.getRanchId());
|
||||||
|
ram.setRanchName(sheep.getDrRanch());
|
||||||
|
ram.setSheepfoldId(sheep.getSheepfoldId());
|
||||||
|
ram.setSheepfoldName(sheep.getSheepfoldName());
|
||||||
|
ram.setElectronicTags(sheep.getElectronicTags());
|
||||||
|
ram.setVarietyId(sheep.getVarietyId());
|
||||||
|
ram.setVariety(sheep.getVariety());
|
||||||
|
ram.setSheepCategory(sheep.getName());
|
||||||
|
ram.setCurrentStatus(String.valueOf(sheep.getStatusId()));
|
||||||
|
ram.setBirthday(sheep.getBirthday());
|
||||||
|
ram.setMonthAge(sheep.getMonthAge());
|
||||||
|
|
||||||
|
ram.setBirthWeight(sheep.getBirthWeight() != null ?
|
||||||
|
BigDecimal.valueOf(sheep.getBirthWeight()) : null);
|
||||||
|
ram.setWeaningDate(sheep.getWeaningDate());
|
||||||
|
ram.setWeaningDayAge(sheep.getWeaningDayAge() != null ?
|
||||||
|
Long.valueOf(sheep.getWeaningDayAge()) : null);
|
||||||
|
ram.setWeaningWeight(sheep.getWeaningWeight() != null ?
|
||||||
|
BigDecimal.valueOf(sheep.getWeaningWeight()) : null);
|
||||||
|
ram.setWeaningDailyGain(sheep.getWeaningDailyGain() != null ?
|
||||||
|
BigDecimal.valueOf(sheep.getWeaningDailyGain()) : null);
|
||||||
|
ram.setCurrentWeight(sheep.getCurrentWeight() != null ?
|
||||||
|
BigDecimal.valueOf(sheep.getCurrentWeight()) : null);
|
||||||
|
|
||||||
|
ram.setFatherNumber(sheep.getFatherManageTags());
|
||||||
|
ram.setMotherNumber(sheep.getMotherManageTags());
|
||||||
|
ram.setGrandfatherNumber(sheep.getGrandfatherManageTags());
|
||||||
|
ram.setGrandmotherNumber(sheep.getGrandmotherManageTags());
|
||||||
|
ram.setMaternalGrandfatherNumber(sheep.getMaternalGrandfatherManageTags());
|
||||||
|
ram.setMaternalGrandmotherNumber(sheep.getMaternalGrandmotherManageTags());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步采精信息(从raw_sperm_record)
|
||||||
|
*
|
||||||
|
* 修复关键问题:
|
||||||
|
* 1. 正确设置所有字段(性欲情况、阴囊周长、采精时间、精液品质)
|
||||||
|
* 2. 确保字段名与数据库表字段对应
|
||||||
|
*/
|
||||||
|
private void syncSpermInfoFromRecords(BreedRamFile ram, Long sheepId) {
|
||||||
|
if (sheepId == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
RawSpermRecord latestSperm = rawSpermRecordMapper.selectLatestByRamId(sheepId);
|
||||||
|
|
||||||
|
if (latestSperm != null) {
|
||||||
|
// 【关键修复】确保所有字段都正确同步
|
||||||
|
|
||||||
|
// 1. 性欲情况 - sexual_status
|
||||||
|
ram.setSexualStatus(latestSperm.getSexualStatus());
|
||||||
|
|
||||||
|
// 2. 阴囊周长 - scrotum_circumference
|
||||||
|
ram.setScrotumCircumference(latestSperm.getScrotumCircumference());
|
||||||
|
|
||||||
|
// 3. 采精时间 - sperm_collection_time (对应 pick_date)
|
||||||
|
ram.setSpermCollectionTime(latestSperm.getPickDate());
|
||||||
|
|
||||||
|
// 4. 精液量 - sperm_volume (对应 amount)
|
||||||
|
ram.setSpermVolume(latestSperm.getAmount());
|
||||||
|
|
||||||
|
// 5. 精液活力 - sperm_vitality (对应 vitallity)
|
||||||
|
ram.setSpermVitality(latestSperm.getVitallity());
|
||||||
|
|
||||||
|
// 6. 精液密度 - sperm_density (对应 density)
|
||||||
|
ram.setSpermDensity(latestSperm.getDensity());
|
||||||
|
|
||||||
|
// 7. 精液品质 - sperm_quality (对应 semen_quality)
|
||||||
|
ram.setSpermQuality(latestSperm.getSemenQuality());
|
||||||
|
|
||||||
|
System.out.println("成功同步采精信息 - 羊只ID: " + sheepId +
|
||||||
|
", 性欲情况: " + latestSperm.getSexualStatus() +
|
||||||
|
", 阴囊周长: " + latestSperm.getScrotumCircumference() +
|
||||||
|
", 采精时间: " + latestSperm.getPickDate() +
|
||||||
|
", 精液品质: " + latestSperm.getSemenQuality());
|
||||||
|
} else {
|
||||||
|
System.out.println("未找到采精记录 - 羊只ID: " + sheepId);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("同步采精信息失败,羊只ID:" + sheepId + ",错误:" + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步配种和繁殖统计数据
|
||||||
|
*/
|
||||||
|
private void syncBreedingStatistics(BreedRamFile ram, String ramManageTags) {
|
||||||
|
if (ramManageTags == null || ramManageTags.trim().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. 统计该公羊配了多少母羊(去重)
|
||||||
|
Long totalMatedEwes = scBreedRecordMapper.countMatedEwesByRamId(ramManageTags);
|
||||||
|
ram.setTotalMatedEwes(totalMatedEwes != null ? totalMatedEwes : 0L);
|
||||||
|
|
||||||
|
// 2. 统计公羊后代数(从产羔记录)
|
||||||
|
Long offspringCount = scLambingRecordMapper.countOffspringByRamId(ramManageTags);
|
||||||
|
ram.setOffspringCount(offspringCount != null ? offspringCount : 0L);
|
||||||
|
|
||||||
|
// 3. 计算多胎性 = 公羊后代数 / 配种母羊数
|
||||||
|
if (totalMatedEwes != null && totalMatedEwes > 0 && offspringCount != null) {
|
||||||
|
BigDecimal prolificacy = BigDecimal.valueOf(offspringCount)
|
||||||
|
.divide(BigDecimal.valueOf(totalMatedEwes), 2, RoundingMode.HALF_UP);
|
||||||
|
ram.setProlificacy(prolificacy);
|
||||||
|
} else {
|
||||||
|
ram.setProlificacy(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 统计孕检相关数据
|
||||||
|
syncPregnancyStatistics(ram, ramManageTags, totalMatedEwes);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("同步配种统计失败,耳号:" + ramManageTags + ",错误:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步孕检统计数据
|
||||||
|
*/
|
||||||
|
private void syncPregnancyStatistics(BreedRamFile ram, String ramManageTags, Long totalMatedEwes) {
|
||||||
|
try {
|
||||||
|
// 本交孕检母羊数(配种方式为本交=2的孕检有胎记录)
|
||||||
|
Long naturalPregnantEwes = scPregnancyRecordMapper
|
||||||
|
.countPregnantEwesByRamIdAndBreedType(ramManageTags, 2);
|
||||||
|
ram.setNaturalPregnancyCheckEwes(naturalPregnantEwes != null ? naturalPregnantEwes : 0L);
|
||||||
|
|
||||||
|
// 本交受孕率%
|
||||||
|
if (totalMatedEwes != null && totalMatedEwes > 0 && naturalPregnantEwes != null) {
|
||||||
|
BigDecimal naturalRate = BigDecimal.valueOf(naturalPregnantEwes)
|
||||||
|
.multiply(BigDecimal.valueOf(100))
|
||||||
|
.divide(BigDecimal.valueOf(totalMatedEwes), 2, RoundingMode.HALF_UP);
|
||||||
|
ram.setNaturalConceptionRate(naturalRate);
|
||||||
|
} else {
|
||||||
|
ram.setNaturalConceptionRate(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 人工孕检母羊数(配种方式为人工授精=1的孕检有胎记录)
|
||||||
|
Long artificialPregnantEwes = scPregnancyRecordMapper
|
||||||
|
.countPregnantEwesByRamIdAndBreedType(ramManageTags, 1);
|
||||||
|
ram.setArtificialPregnancyCheckEwes(artificialPregnantEwes != null ? artificialPregnantEwes : 0L);
|
||||||
|
|
||||||
|
// 人工受孕率%
|
||||||
|
if (totalMatedEwes != null && totalMatedEwes > 0 && artificialPregnantEwes != null) {
|
||||||
|
BigDecimal artificialRate = BigDecimal.valueOf(artificialPregnantEwes)
|
||||||
|
.multiply(BigDecimal.valueOf(100))
|
||||||
|
.divide(BigDecimal.valueOf(totalMatedEwes), 2, RoundingMode.HALF_UP);
|
||||||
|
ram.setArtificialConceptionRate(artificialRate);
|
||||||
|
} else {
|
||||||
|
ram.setArtificialConceptionRate(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("同步孕检统计失败,耳号:" + ramManageTags + ",错误:" + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,11 +1,15 @@
|
|||||||
package com.zhyc.module.base.service.impl;
|
package com.zhyc.module.base.service.impl;
|
||||||
|
|
||||||
|
import com.zhyc.module.base.domain.BreedRamFile;
|
||||||
import com.zhyc.module.base.domain.SheepFile;
|
import com.zhyc.module.base.domain.SheepFile;
|
||||||
import com.zhyc.module.base.mapper.SheepFileMapper;
|
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||||
|
import com.zhyc.module.base.service.IBreedRamFileService;
|
||||||
import com.zhyc.module.base.service.ISheepFileService;
|
import com.zhyc.module.base.service.ISheepFileService;
|
||||||
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 java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;import java.util.Map;
|
import java.util.List;import java.util.Map;
|
||||||
|
|
||||||
@ -98,6 +102,16 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertSheepFile(SheepFile sheepFile) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateSheepFile(SheepFile sheepFile) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理条件参数,确保安全
|
* 处理条件参数,确保安全
|
||||||
*/
|
*/
|
||||||
@ -243,6 +257,80 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBreedRamFileService breedRamFileService; // 注入种公羊服务
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增羊只档案
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步公羊数据到种公羊档案表
|
||||||
|
*/
|
||||||
|
private void syncToBreedRamFile(SheepFile sheepFile) {
|
||||||
|
try {
|
||||||
|
// 检查是否已存在
|
||||||
|
BreedRamFile existingRam = breedRamFileService.selectBreedRamFileByOrdinaryEarNumber(
|
||||||
|
sheepFile.getBsManageTags()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (existingRam != null) {
|
||||||
|
// 已存在,更新
|
||||||
|
BreedRamFile updateRam = convertToBreedRamFile(sheepFile);
|
||||||
|
updateRam.setId(existingRam.getId());
|
||||||
|
breedRamFileService.updateBreedRamFile(updateRam);
|
||||||
|
} else {
|
||||||
|
// 不存在,新增
|
||||||
|
BreedRamFile newRam = convertToBreedRamFile(sheepFile);
|
||||||
|
breedRamFileService.insertBreedRamFile(newRam);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 记录日志,但不影响主流
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将SheepFile转换为BreedRamFile
|
||||||
|
*/
|
||||||
|
private BreedRamFile convertToBreedRamFile(SheepFile sheepFile) {
|
||||||
|
BreedRamFile breedRamFile = new BreedRamFile();
|
||||||
|
|
||||||
|
// 基本信息
|
||||||
|
breedRamFile.setOrdinaryEarNumber(sheepFile.getBsManageTags());
|
||||||
|
breedRamFile.setRanchId(sheepFile.getRanchId());
|
||||||
|
breedRamFile.setRanchName(sheepFile.getDrRanch());
|
||||||
|
breedRamFile.setSheepfoldId(sheepFile.getSheepfoldId());
|
||||||
|
breedRamFile.setSheepfoldName(sheepFile.getSheepfoldName());
|
||||||
|
breedRamFile.setElectronicTags(sheepFile.getElectronicTags());
|
||||||
|
breedRamFile.setVarietyId(sheepFile.getVarietyId());
|
||||||
|
breedRamFile.setVariety(sheepFile.getVariety());
|
||||||
|
breedRamFile.setSheepCategory(sheepFile.getName());
|
||||||
|
breedRamFile.setBirthday(sheepFile.getBirthday());
|
||||||
|
|
||||||
|
// 体重相关
|
||||||
|
breedRamFile.setBirthWeight(BigDecimal.valueOf(sheepFile.getBirthWeight()));
|
||||||
|
breedRamFile.setWeaningDate(sheepFile.getWeaningDate());
|
||||||
|
breedRamFile.setWeaningDayAge(sheepFile.getWeaningDayAge());
|
||||||
|
breedRamFile.setWeaningWeight(BigDecimal.valueOf(sheepFile.getWeaningWeight()));
|
||||||
|
breedRamFile.setWeaningDailyGain(BigDecimal.valueOf(sheepFile.getWeaningDailyGain()));
|
||||||
|
breedRamFile.setCurrentWeight(BigDecimal.valueOf(sheepFile.getCurrentWeight()));
|
||||||
|
|
||||||
|
// 家系信息
|
||||||
|
breedRamFile.setFatherNumber(sheepFile.getFatherManageTags());
|
||||||
|
breedRamFile.setMotherNumber(sheepFile.getMotherManageTags());
|
||||||
|
breedRamFile.setGrandfatherNumber(sheepFile.getGrandfatherManageTags());
|
||||||
|
breedRamFile.setGrandmotherNumber(sheepFile.getGrandmotherManageTags());
|
||||||
|
breedRamFile.setMaternalGrandfatherNumber(sheepFile.getMaternalGrandfatherManageTags());
|
||||||
|
breedRamFile.setMaternalGrandmotherNumber(sheepFile.getMaternalGrandmotherManageTags());
|
||||||
|
|
||||||
|
// 审计信息
|
||||||
|
breedRamFile.setCreateBy(sheepFile.getCreateBy());
|
||||||
|
breedRamFile.setCreateTime(sheepFile.getCreateTime());
|
||||||
|
breedRamFile.setUpdateBy(sheepFile.getUpdateBy());
|
||||||
|
breedRamFile.setUpdateTime(sheepFile.getUpdateTime());
|
||||||
|
breedRamFile.setIsDelete(sheepFile.getIsDelete());
|
||||||
|
|
||||||
|
return breedRamFile;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,95 @@
|
|||||||
|
//package com.zhyc.module.produce.breed.domain;
|
||||||
|
//
|
||||||
|
//import java.math.BigDecimal;
|
||||||
|
//import java.util.Date;
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
//import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
//import lombok.AllArgsConstructor;
|
||||||
|
//import lombok.Data;
|
||||||
|
//import lombok.NoArgsConstructor;
|
||||||
|
//import com.zhyc.common.annotation.Excel;
|
||||||
|
//import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 羔羊详情对象 sc_lamb_detail
|
||||||
|
// *
|
||||||
|
// * @author ruoyi
|
||||||
|
// * @date 2025-07-11
|
||||||
|
// */
|
||||||
|
//@Data
|
||||||
|
//@NoArgsConstructor
|
||||||
|
//@AllArgsConstructor
|
||||||
|
//public class ScLambDetail extends BaseEntity
|
||||||
|
//{
|
||||||
|
// private static final long serialVersionUID = 1L;
|
||||||
|
//
|
||||||
|
// /** 主键ID */
|
||||||
|
// private Long id;
|
||||||
|
//
|
||||||
|
// /** 产羔记录ID */
|
||||||
|
// @Excel(name = "产羔记录ID")
|
||||||
|
// private Long lambingRecordId;
|
||||||
|
//
|
||||||
|
// /** 羔羊耳号 */
|
||||||
|
// @Excel(name = "羔羊耳号")
|
||||||
|
// private String lambEarNumber;
|
||||||
|
//
|
||||||
|
// /** 羔羊品种ID */
|
||||||
|
// @Excel(name = "羔羊品种ID")
|
||||||
|
// private Integer lambBreed; // 改为Integer类型,存储品种ID
|
||||||
|
//
|
||||||
|
// /** 性别 */
|
||||||
|
// @Excel(name = "性别")
|
||||||
|
// private Integer gender;
|
||||||
|
//
|
||||||
|
// /** 出生重量 */
|
||||||
|
// @Excel(name = "出生重量")
|
||||||
|
// private BigDecimal birthWeight;
|
||||||
|
//
|
||||||
|
// /** 是否留养 */
|
||||||
|
// @Excel(name = "是否留养")
|
||||||
|
// private Boolean isRetained;
|
||||||
|
//
|
||||||
|
// /** 家系 */
|
||||||
|
// @Excel(name = "家系")
|
||||||
|
// private String lineage;
|
||||||
|
//
|
||||||
|
// /** 生日 */
|
||||||
|
// @JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
// @Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
// private Date birthday;
|
||||||
|
//
|
||||||
|
// private List<ScLambDetail> lambDetails;
|
||||||
|
//
|
||||||
|
// /** 母羊ID */
|
||||||
|
// private Long motherId;
|
||||||
|
//
|
||||||
|
// /** 父羊ID */
|
||||||
|
// private Long fatherId;
|
||||||
|
//
|
||||||
|
// /** 牧场ID */
|
||||||
|
// private Integer ranchId;
|
||||||
|
//
|
||||||
|
// /** 羊舍ID */
|
||||||
|
// private Integer sheepfoldId;
|
||||||
|
//
|
||||||
|
// /** 胎次 */
|
||||||
|
// private Integer parity;
|
||||||
|
//
|
||||||
|
// // getter和setter方法
|
||||||
|
// public void setId(Long id)
|
||||||
|
// {
|
||||||
|
// this.id = id;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Long getId()
|
||||||
|
// {
|
||||||
|
// return id;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//}
|
||||||
package com.zhyc.module.produce.breed.domain;
|
package com.zhyc.module.produce.breed.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -37,9 +129,9 @@ public class ScLambDetail extends BaseEntity
|
|||||||
|
|
||||||
/** 羔羊品种ID */
|
/** 羔羊品种ID */
|
||||||
@Excel(name = "羔羊品种ID")
|
@Excel(name = "羔羊品种ID")
|
||||||
private Integer lambBreed; // 改为Integer类型,存储品种ID
|
private Integer lambBreed;
|
||||||
|
|
||||||
/** 性别 */
|
/** 性别:1-母,2-公,3-阉羊,4-兼性 */
|
||||||
@Excel(name = "性别")
|
@Excel(name = "性别")
|
||||||
private Integer gender;
|
private Integer gender;
|
||||||
|
|
||||||
@ -47,9 +139,9 @@ public class ScLambDetail extends BaseEntity
|
|||||||
@Excel(name = "出生重量")
|
@Excel(name = "出生重量")
|
||||||
private BigDecimal birthWeight;
|
private BigDecimal birthWeight;
|
||||||
|
|
||||||
/** 是否留养 */
|
/** 是否留养:0-否,1-是 */
|
||||||
@Excel(name = "是否留养")
|
@Excel(name = "是否留养")
|
||||||
private Boolean isRetained;
|
private Integer isRetained;
|
||||||
|
|
||||||
/** 家系 */
|
/** 家系 */
|
||||||
@Excel(name = "家系")
|
@Excel(name = "家系")
|
||||||
@ -76,17 +168,4 @@ public class ScLambDetail extends BaseEntity
|
|||||||
|
|
||||||
/** 胎次 */
|
/** 胎次 */
|
||||||
private Integer parity;
|
private Integer parity;
|
||||||
|
|
||||||
// getter和setter方法
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -75,4 +75,12 @@ public interface RawSpermRecordMapper
|
|||||||
* @return 羊只信息 Map包含id、gender、monthAge、electronicTags等字段
|
* @return 羊只信息 Map包含id、gender、monthAge、electronicTags等字段
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> selectSheepInfoByManageTags(String manageTags);
|
public Map<String, Object> selectSheepInfoByManageTags(String manageTags);
|
||||||
|
// ====================== RawSpermRecordMapper.java 需要添加 ======================
|
||||||
|
/**
|
||||||
|
/**
|
||||||
|
* 获取指定公羊最新的采精记录
|
||||||
|
* @param sheepId 羊只ID
|
||||||
|
* @return 采精记录
|
||||||
|
*/
|
||||||
|
RawSpermRecord selectLatestByRamId(Long sheepId);
|
||||||
}
|
}
|
||||||
@ -137,4 +137,12 @@ public interface ScBreedRecordMapper
|
|||||||
public int incrementSheepMatingCount(@Param("sheepId") Long sheepId,
|
public int incrementSheepMatingCount(@Param("sheepId") Long sheepId,
|
||||||
@Param("matingDate") Date matingDate,
|
@Param("matingDate") Date matingDate,
|
||||||
@Param("updateBy") String updateBy);
|
@Param("updateBy") String updateBy);
|
||||||
|
|
||||||
|
// ====================== ScBreedRecordMapper.java 需要添加 ======================
|
||||||
|
/**
|
||||||
|
* 统计公羊配种的母羊数(去重)
|
||||||
|
* @param ramManageTags 公羊管理耳号
|
||||||
|
* @return 配种母羊数
|
||||||
|
*/
|
||||||
|
Long countMatedEwesByRamId(String ramManageTags);
|
||||||
}
|
}
|
||||||
@ -78,4 +78,11 @@ public interface ScLambingRecordMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScLambingRecordByIds(Long[] ids);
|
public int deleteScLambingRecordByIds(Long[] ids);
|
||||||
|
// ====================== ScLambingRecordMapper.java 需要添加 ======================
|
||||||
|
/**
|
||||||
|
* 统计公羊的后代总数
|
||||||
|
* @param ramManageTags 公羊管理耳号
|
||||||
|
* @return 后代总数
|
||||||
|
*/
|
||||||
|
Long countOffspringByRamId(String ramManageTags);
|
||||||
}
|
}
|
||||||
@ -84,4 +84,20 @@ public interface ScPregnancyRecordMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateSheepPregnancyInfo(Map<String, Object> params);
|
public int updateSheepPregnancyInfo(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计孕检有胎的母羊数(按配种方式)
|
||||||
|
*
|
||||||
|
* @param ramManageTags 公羊管理耳号
|
||||||
|
* @param breedType 配种方式(1=人工授精,2=本交)
|
||||||
|
* @return 孕检有胎的母羊数
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 根据配种方式统计孕检有胎的母羊数
|
||||||
|
* @param ramManageTags 公羊管理耳号
|
||||||
|
* @param breedType 配种方式(1=人工授精,2=本交)
|
||||||
|
* @return 孕检有胎母羊数
|
||||||
|
*/
|
||||||
|
Long countPregnantEwesByRamIdAndBreedType(@Param("ramManageTags") String ramManageTags,
|
||||||
|
@Param("breedType") Integer breedType);
|
||||||
}
|
}
|
||||||
@ -92,9 +92,9 @@ public class ScLambingRecordServiceImpl implements IScLambingRecordService {
|
|||||||
throw new RuntimeException("羔羊性别不能为空");
|
throw new RuntimeException("羔羊性别不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证性别值的有效性(假设0=母羊,1=公羊)
|
// 验证性别值的有效性:1-母,2-公,3-阉羊,4-兼性
|
||||||
if (lambDetail.getGender() < 0 || lambDetail.getGender() > 1) {
|
if (lambDetail.getGender() < 1 || lambDetail.getGender() > 4) {
|
||||||
throw new RuntimeException("羔羊性别值无效,请使用0(母羊)或1(公羊)");
|
throw new RuntimeException("羔羊性别值无效,请使用1(母)、2(公)、3(阉羊)或4(兼性)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查耳号是否已存在
|
// 检查耳号是否已存在
|
||||||
@ -105,7 +105,12 @@ public class ScLambingRecordServiceImpl implements IScLambingRecordService {
|
|||||||
|
|
||||||
// 设置默认值
|
// 设置默认值
|
||||||
if (lambDetail.getIsRetained() == null) {
|
if (lambDetail.getIsRetained() == null) {
|
||||||
lambDetail.setIsRetained(false);
|
lambDetail.setIsRetained(0); // 默认为0(否)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证是否留养值的有效性:0-否,1-是
|
||||||
|
if (lambDetail.getIsRetained() != 0 && lambDetail.getIsRetained() != 1) {
|
||||||
|
throw new RuntimeException("是否留养值无效,请使用0(否)或1(是)");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lambDetail.getBirthday() == null) {
|
if (lambDetail.getBirthday() == null) {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<resultMap type="BreedRamFile" id="BreedRamFileResult">
|
<resultMap type="BreedRamFile" id="BreedRamFileResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="ordinaryEarNumber" column="ordinary_ear_number" />
|
<result property="ordinaryEarNumber" column="manage_tags" />
|
||||||
<result property="ranchId" column="ranch_id" />
|
<result property="ranchId" column="ranch_id" />
|
||||||
<result property="ranchName" column="ranch_name" />
|
<result property="ranchName" column="ranch_name" />
|
||||||
<result property="sheepfoldId" column="sheepfold_id" />
|
<result property="sheepfoldId" column="sheepfold_id" />
|
||||||
@ -74,13 +74,13 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectBreedRamFileVo">
|
<sql id="selectBreedRamFileVo">
|
||||||
select id, ordinary_ear_number, ranch_id, ranch_name, sheepfold_id, sheepfold_name, electronic_tags, variety_id, variety, sheep_category, current_status, birthday, dynamic_info, month_age, birth_weight, weaning_date, weaning_day_age, weaning_weight, weaning_daily_gain, post_weaning_daily_gain, current_weight, current_weight_date, activity_level, sexual_status, scrotum_circumference, sperm_collection_time, sperm_volume, sperm_vitality, sperm_density, sperm_quality, breeding_status, last_plan_time, current_plan_time, comment, protein_rate_ebv, milk_fat_rate_ebv, scs_ebv, growth_performance_ebv, resistance_ebv, reproduction_performance_ebv, body_type_ebv, comprehensive_breeding_value, father_number, mother_number, grandfather_number, grandmother_number, maternal_grandfather_number, maternal_grandmother_number, is_core_flock, is_breeding_use, pregnancy_check, total_mated_ewes, natural_pregnancy_check_ewes, natural_conception_rate, artificial_pregnancy_check_ewes, artificial_conception_rate, ram_mother_milk_volume, milk_production_ebv, accuracy, information_count, is_paternity_tested, create_by, create_time, update_by, update_time, is_delete from breed_ram_file
|
select id, manage_tags, ranch_id, ranch_name, sheepfold_id, sheepfold_name, electronic_tags, variety_id, variety, sheep_category, current_status, birthday, dynamic_info, month_age, birth_weight, weaning_date, weaning_day_age, weaning_weight, weaning_daily_gain, post_weaning_daily_gain, current_weight, current_weight_date, activity_level, sexual_status, scrotum_circumference, sperm_collection_time, sperm_volume, sperm_vitality, sperm_density, sperm_quality, breeding_status, last_plan_time, current_plan_time, comment, protein_rate_ebv, milk_fat_rate_ebv, scs_ebv, growth_performance_ebv, resistance_ebv, reproduction_performance_ebv, body_type_ebv, comprehensive_breeding_value, father_number, mother_number, grandfather_number, grandmother_number, maternal_grandfather_number, maternal_grandmother_number, is_core_flock, is_breeding_use, pregnancy_check, total_mated_ewes, natural_pregnancy_check_ewes, natural_conception_rate, artificial_pregnancy_check_ewes, artificial_conception_rate, ram_mother_milk_volume, milk_production_ebv, accuracy, information_count, is_paternity_tested, create_by, create_time, update_by, update_time, is_delete from breed_ram_file
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectBreedRamFileList" parameterType="BreedRamFile" resultMap="BreedRamFileResult">
|
<select id="selectBreedRamFileList" parameterType="BreedRamFile" resultMap="BreedRamFileResult">
|
||||||
<include refid="selectBreedRamFileVo"/>
|
<include refid="selectBreedRamFileVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="ordinaryEarNumber != null and ordinaryEarNumber != ''"> and ordinary_ear_number like concat('%', #{ordinaryEarNumber}, '%')</if>
|
<if test="ordinaryEarNumber != null and ordinaryEarNumber != ''"> and manage_tags like concat('%', #{ordinaryEarNumber}, '%')</if>
|
||||||
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
|
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
|
||||||
<if test="ranchName != null and ranchName != ''"> and ranch_name like concat('%', #{ranchName}, '%')</if>
|
<if test="ranchName != null and ranchName != ''"> and ranch_name like concat('%', #{ranchName}, '%')</if>
|
||||||
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
|
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
|
||||||
@ -149,56 +149,74 @@
|
|||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBreedRamFileByOrdinaryEarNumber" parameterType="String" resultMap="BreedRamFileResult">
|
<!-- ====================== BreedRamFileMapper.xml 需要添加/更新 ====================== -->
|
||||||
<include refid="selectBreedRamFileVo"/>
|
<!-- 根据普通耳号查询种公羊档案 -->
|
||||||
where ordinary_ear_number = #{ordinaryEarNumber}
|
<!-- 查询方法也需要修改字段名 -->
|
||||||
|
<select id="selectBreedRamFileByOrdinaryEarNumber" resultMap="BreedRamFileResult">
|
||||||
|
SELECT * FROM breed_ram_file
|
||||||
|
WHERE manage_tags = #{ordinaryEarNumber} AND is_delete = 0
|
||||||
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBreedRamFileByElectronicTags" parameterType="String" resultMap="BreedRamFileResult">
|
<!-- 根据电子耳号查询种公羊档案 -->
|
||||||
<include refid="selectBreedRamFileVo"/>
|
<select id="selectBreedRamFileByElectronicTags" parameterType="String" resultType="BreedRamFile">
|
||||||
where electronic_tags = #{electronicTags}
|
SELECT * FROM breed_ram_file
|
||||||
|
WHERE electronic_tags = #{electronicTags}
|
||||||
|
AND is_delete = 0
|
||||||
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBreedRamFileListByRanchId" parameterType="Long" resultMap="BreedRamFileResult">
|
<!-- 根据牧场ID查询种公羊档案列表 -->
|
||||||
<include refid="selectBreedRamFileVo"/>
|
<select id="selectBreedRamFileListByRanchId" parameterType="Long" resultType="BreedRamFile">
|
||||||
where ranch_id = #{ranchId} and (is_delete = 0 or is_delete is null)
|
SELECT * FROM breed_ram_file
|
||||||
order by create_time desc
|
WHERE ranch_id = #{ranchId}
|
||||||
|
AND is_delete = 0
|
||||||
|
ORDER BY id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBreedRamFileListBySheepfoldId" parameterType="Long" resultMap="BreedRamFileResult">
|
<!-- 根据羊舍ID查询种公羊档案列表 -->
|
||||||
<include refid="selectBreedRamFileVo"/>
|
<select id="selectBreedRamFileListBySheepfoldId" parameterType="Long" resultType="BreedRamFile">
|
||||||
where sheepfold_id = #{sheepfoldId} and (is_delete = 0 or is_delete is null)
|
SELECT * FROM breed_ram_file
|
||||||
order by create_time desc
|
WHERE sheepfold_id = #{sheepfoldId}
|
||||||
|
AND is_delete = 0
|
||||||
|
ORDER BY id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectCoreFlockBreedRamFileList" parameterType="BreedRamFile" resultMap="BreedRamFileResult">
|
<!-- 查询核心羊群种公羊档案列表 -->
|
||||||
<include refid="selectBreedRamFileVo"/>
|
<select id="selectCoreFlockBreedRamFileList" parameterType="BreedRamFile" resultType="BreedRamFile">
|
||||||
<where>
|
SELECT * FROM breed_ram_file
|
||||||
is_core_flock = 1
|
WHERE is_core_flock = 1
|
||||||
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
|
AND is_delete = 0
|
||||||
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
|
<if test="ranchId != null">
|
||||||
<if test="breedingStatus != null "> and breeding_status = #{breedingStatus}</if>
|
AND ranch_id = #{ranchId}
|
||||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
</if>
|
||||||
</where>
|
<if test="varietyId != null">
|
||||||
order by create_time desc
|
AND variety_id = #{varietyId}
|
||||||
|
</if>
|
||||||
|
ORDER BY id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBreedingUseBreedRamFileList" parameterType="BreedRamFile" resultMap="BreedRamFileResult">
|
<!-- 查询种用种公羊档案列表 -->
|
||||||
<include refid="selectBreedRamFileVo"/>
|
<select id="selectBreedingUseBreedRamFileList" parameterType="BreedRamFile" resultType="BreedRamFile">
|
||||||
<where>
|
SELECT * FROM breed_ram_file
|
||||||
is_breeding_use = 1
|
WHERE is_breeding_use = 1
|
||||||
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
|
AND is_delete = 0
|
||||||
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
|
<if test="ranchId != null">
|
||||||
<if test="breedingStatus != null "> and breeding_status = #{breedingStatus}</if>
|
AND ranch_id = #{ranchId}
|
||||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
</if>
|
||||||
</where>
|
<if test="varietyId != null">
|
||||||
order by create_time desc
|
AND variety_id = #{varietyId}
|
||||||
|
</if>
|
||||||
|
ORDER BY id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 修正后的 insertBreedRamFile -->
|
||||||
<insert id="insertBreedRamFile" parameterType="BreedRamFile" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertBreedRamFile" parameterType="BreedRamFile" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into breed_ram_file
|
insert into breed_ram_file
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="ordinaryEarNumber != null">ordinary_ear_number,</if>
|
<if test="manageTags != null and manageTags != ''">manage_tags,</if>
|
||||||
<if test="ranchId != null">ranch_id,</if>
|
<if test="ranchId != null">ranch_id,</if>
|
||||||
<if test="ranchName != null">ranch_name,</if>
|
<if test="ranchName != null">ranch_name,</if>
|
||||||
<if test="sheepfoldId != null">sheepfold_id,</if>
|
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||||
@ -258,6 +276,8 @@
|
|||||||
<if test="accuracy != null">accuracy,</if>
|
<if test="accuracy != null">accuracy,</if>
|
||||||
<if test="informationCount != null">information_count,</if>
|
<if test="informationCount != null">information_count,</if>
|
||||||
<if test="isPaternityTested != null">is_paternity_tested,</if>
|
<if test="isPaternityTested != null">is_paternity_tested,</if>
|
||||||
|
<if test="offspringCount != null">offspring_count,</if>
|
||||||
|
<if test="prolificacy != null">prolificacy,</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>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
@ -265,7 +285,7 @@
|
|||||||
<if test="isDelete != null">is_delete,</if>
|
<if test="isDelete != null">is_delete,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="ordinaryEarNumber != null">#{ordinaryEarNumber},</if>
|
<if test="manageTags != null and manageTags != ''">#{manageTags},</if>
|
||||||
<if test="ranchId != null">#{ranchId},</if>
|
<if test="ranchId != null">#{ranchId},</if>
|
||||||
<if test="ranchName != null">#{ranchName},</if>
|
<if test="ranchName != null">#{ranchName},</if>
|
||||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||||
@ -325,6 +345,8 @@
|
|||||||
<if test="accuracy != null">#{accuracy},</if>
|
<if test="accuracy != null">#{accuracy},</if>
|
||||||
<if test="informationCount != null">#{informationCount},</if>
|
<if test="informationCount != null">#{informationCount},</if>
|
||||||
<if test="isPaternityTested != null">#{isPaternityTested},</if>
|
<if test="isPaternityTested != null">#{isPaternityTested},</if>
|
||||||
|
<if test="offspringCount != null">#{offspringCount},</if>
|
||||||
|
<if test="prolificacy != null">#{prolificacy},</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>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
@ -336,7 +358,7 @@
|
|||||||
<update id="updateBreedRamFile" parameterType="BreedRamFile">
|
<update id="updateBreedRamFile" parameterType="BreedRamFile">
|
||||||
update breed_ram_file
|
update breed_ram_file
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="ordinaryEarNumber != null">ordinary_ear_number = #{ordinaryEarNumber},</if>
|
<if test="ordinaryEarNumber != null">manage_tags = #{ordinaryEarNumber},</if>
|
||||||
<if test="ranchId != null">ranch_id = #{ranchId},</if>
|
<if test="ranchId != null">ranch_id = #{ranchId},</if>
|
||||||
<if test="ranchName != null">ranch_name = #{ranchName},</if>
|
<if test="ranchName != null">ranch_name = #{ranchName},</if>
|
||||||
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
||||||
@ -414,4 +436,5 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -262,4 +262,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
ORDER BY id DESC
|
ORDER BY id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- <!– 查询所有公羊(gender=2) –>-->
|
||||||
|
<!-- <select id="selectRamList" resultMap="SheepFileResult">-->
|
||||||
|
<!-- <include refid="selectSheepFileVo"/>-->
|
||||||
|
<!-- where gender = 2 and (is_delete = 0 or is_delete is null)-->
|
||||||
|
<!-- order by create_time desc-->
|
||||||
|
<!-- </select>-->
|
||||||
|
|
||||||
|
<!-- 查询所有公羊 -->
|
||||||
|
<select id="selectRamList" resultMap="SheepFileResult">
|
||||||
|
SELECT * FROM sheep_file
|
||||||
|
WHERE gender = 2 AND is_delete = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据管理耳号查询 -->
|
||||||
|
<select id="selectSheepFileByManageTags" resultMap="SheepFileResult">
|
||||||
|
SELECT * FROM sheep_file
|
||||||
|
WHERE bs_manage_tags = #{manageTags} AND is_delete = 0
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -0,0 +1,165 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.zhyc.module.base.mapper.ViewBreedRamFileMapper">
|
||||||
|
|
||||||
|
<resultMap type="ViewBreedRamFile" id="ViewBreedRamFileResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="ordinaryEarNumber" column="ordinary_ear_number" />
|
||||||
|
<result property="ranchId" column="ranch_id" />
|
||||||
|
<result property="ranchName" column="ranch_name" />
|
||||||
|
<result property="sheepfoldId" column="sheepfold_id" />
|
||||||
|
<result property="sheepfoldName" column="sheepfold_name" />
|
||||||
|
<result property="electronicTags" column="electronic_tags" />
|
||||||
|
<result property="varietyId" column="variety_id" />
|
||||||
|
<result property="variety" column="variety" />
|
||||||
|
<result property="sheepCategory" column="sheep_category" />
|
||||||
|
<result property="gender" column="gender" />
|
||||||
|
<result property="birthday" column="birthday" />
|
||||||
|
<result property="monthAge" column="month_age" />
|
||||||
|
<result property="birthWeight" column="birth_weight" />
|
||||||
|
<result property="weaningDate" column="weaning_date" />
|
||||||
|
<result property="weaningDayAge" column="weaning_day_age" />
|
||||||
|
<result property="weaningWeight" column="weaning_weight" />
|
||||||
|
<result property="weaningDailyGain" column="weaning_daily_gain" />
|
||||||
|
<result property="currentWeight" column="current_weight" />
|
||||||
|
<result property="breedingStatusId" column="breeding_status_id" />
|
||||||
|
<result property="breedingStatus" column="breeding_status" />
|
||||||
|
<result property="fatherId" column="father_id" />
|
||||||
|
<result property="fatherEarNumber" column="father_ear_number" />
|
||||||
|
<result property="motherId" column="mother_id" />
|
||||||
|
<result property="motherEarNumber" column="mother_ear_number" />
|
||||||
|
<result property="grandfatherId" column="grandfather_id" />
|
||||||
|
<result property="grandfatherEarNumber" column="grandfather_ear_number" />
|
||||||
|
<result property="grandmotherId" column="grandmother_id" />
|
||||||
|
<result property="grandmotherEarNumber" column="grandmother_ear_number" />
|
||||||
|
<result property="maternalGrandfatherEarNumber" column="maternal_grandfather_ear_number" />
|
||||||
|
<result property="maternalGrandmotherEarNumber" column="maternal_grandmother_ear_number" />
|
||||||
|
<result property="matingDate" column="mating_date" />
|
||||||
|
<result property="matingTypeId" column="mating_type_id" />
|
||||||
|
<result property="pregnancyCheckDate" column="pregnancy_check_date" />
|
||||||
|
<result property="lambingDate" column="lambing_date" />
|
||||||
|
<result property="lambingDay" column="lambing_day" />
|
||||||
|
<result property="matingDay" column="mating_day" />
|
||||||
|
<result property="gestationDay" column="gestation_day" />
|
||||||
|
<result property="expectedDate" column="expected_date" />
|
||||||
|
<result property="postLambingDay" column="post_lambing_day" />
|
||||||
|
<result property="lactationDay" column="lactation_day" />
|
||||||
|
<result property="anestrusDay" column="anestrous_day" />
|
||||||
|
<result property="matingCounts" column="mating_counts" />
|
||||||
|
<result property="matingTotal" column="mating_total" />
|
||||||
|
<result property="miscarriageCounts" column="miscarriage_counts" />
|
||||||
|
<result property="comment" column="comment" />
|
||||||
|
<result property="controlled" column="controlled" />
|
||||||
|
<result property="bodyConditionScore" column="body_condition_score" />
|
||||||
|
<result property="udderScore" column="udder_score" />
|
||||||
|
<result property="source" column="source" />
|
||||||
|
<result property="sourceDate" column="source_date" />
|
||||||
|
<result property="sourceRanchId" column="source_ranch_id" />
|
||||||
|
<result property="sourceRanch" column="source_ranch" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="isDelete" column="is_delete" />
|
||||||
|
<result property="sexualStatus" column="sexual_status" />
|
||||||
|
<result property="scrotumCircumference" column="scrotum_circumference" />
|
||||||
|
<result property="spermCollectionTime" column="sperm_collection_time" />
|
||||||
|
<result property="spermVolume" column="sperm_volume" />
|
||||||
|
<result property="spermVitality" column="sperm_vitality" />
|
||||||
|
<result property="spermDensity" column="sperm_density" />
|
||||||
|
<result property="semenQuality" column="semen_quality" />
|
||||||
|
<result property="totalMatedEwes" column="total_mated_ewes" />
|
||||||
|
<result property="totalPregnantEwes" column="total_pregnant_ewes" />
|
||||||
|
<result property="naturalPregnancyCheckEwes" column="natural_pregnancy_check_ewes" />
|
||||||
|
<result property="naturalConceptionRate" column="natural_conception_rate" />
|
||||||
|
<result property="artificialPregnancyCheckEwes" column="artificial_pregnancy_check_ewes" />
|
||||||
|
<result property="artificialConceptionRate" column="artificial_conception_rate" />
|
||||||
|
<result property="offspringCount" column="offspring_count" />
|
||||||
|
<result property="prolificacy" column="prolificacy" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectViewBreedRamFileVo">
|
||||||
|
select * from view_breed_ram_file
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectViewBreedRamFileList" parameterType="ViewBreedRamFile" resultMap="ViewBreedRamFileResult">
|
||||||
|
<include refid="selectViewBreedRamFileVo"/>
|
||||||
|
<where>
|
||||||
|
is_delete = 0
|
||||||
|
<if test="ordinaryEarNumber != null and ordinaryEarNumber != ''">
|
||||||
|
and ordinary_ear_number like concat('%', #{ordinaryEarNumber}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="ranchId != null">
|
||||||
|
and ranch_id = #{ranchId}
|
||||||
|
</if>
|
||||||
|
<if test="ranchName != null and ranchName != ''">
|
||||||
|
and ranch_name like concat('%', #{ranchName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="sheepfoldId != null">
|
||||||
|
and sheepfold_id = #{sheepfoldId}
|
||||||
|
</if>
|
||||||
|
<if test="electronicTags != null and electronicTags != ''">
|
||||||
|
and electronic_tags like concat('%', #{electronicTags}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="variety != null and variety != ''">
|
||||||
|
and variety like concat('%', #{variety}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="breedingStatusId != null">
|
||||||
|
and breeding_status_id = #{breedingStatusId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectViewBreedRamFileById" parameterType="Long" resultMap="ViewBreedRamFileResult">
|
||||||
|
<include refid="selectViewBreedRamFileVo"/>
|
||||||
|
where id = #{id} and is_delete = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectViewBreedRamFileByOrdinaryEarNumber" parameterType="String" resultMap="ViewBreedRamFileResult">
|
||||||
|
<include refid="selectViewBreedRamFileVo"/>
|
||||||
|
where ordinary_ear_number = #{ordinaryEarNumber} and is_delete = 0
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectViewBreedRamFileListByRanchId" parameterType="Long" resultMap="ViewBreedRamFileResult">
|
||||||
|
<include refid="selectViewBreedRamFileVo"/>
|
||||||
|
where ranch_id = #{ranchId} and is_delete = 0
|
||||||
|
order by id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectViewBreedRamFileListBySheepfoldId" parameterType="Long" resultMap="ViewBreedRamFileResult">
|
||||||
|
<include refid="selectViewBreedRamFileVo"/>
|
||||||
|
where sheepfold_id = #{sheepfoldId} and is_delete = 0
|
||||||
|
order by id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectCoreFlockViewBreedRamFileList" parameterType="ViewBreedRamFile" resultMap="ViewBreedRamFileResult">
|
||||||
|
select vbrf.* from view_breed_ram_file vbrf
|
||||||
|
inner join breed_ram_file brf on vbrf.id = brf.id
|
||||||
|
where brf.is_core_flock = 1 and vbrf.is_delete = 0
|
||||||
|
<if test="ranchId != null">
|
||||||
|
and vbrf.ranch_id = #{ranchId}
|
||||||
|
</if>
|
||||||
|
<if test="varietyId != null">
|
||||||
|
and vbrf.variety_id = #{varietyId}
|
||||||
|
</if>
|
||||||
|
order by vbrf.id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBreedingUseViewBreedRamFileList" parameterType="ViewBreedRamFile" resultMap="ViewBreedRamFileResult">
|
||||||
|
select vbrf.* from view_breed_ram_file vbrf
|
||||||
|
inner join breed_ram_file brf on vbrf.id = brf.id
|
||||||
|
where brf.is_breeding_use = 1 and vbrf.is_delete = 0
|
||||||
|
<if test="ranchId != null">
|
||||||
|
and vbrf.ranch_id = #{ranchId}
|
||||||
|
</if>
|
||||||
|
<if test="varietyId != null">
|
||||||
|
and vbrf.variety_id = #{varietyId}
|
||||||
|
</if>
|
||||||
|
order by vbrf.id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -148,4 +148,10 @@
|
|||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectLatestByRamId" resultType="RawSpermRecord">
|
||||||
|
SELECT * FROM raw_sperm_record
|
||||||
|
WHERE sheep_id = #{sheepId}
|
||||||
|
ORDER BY pick_date DESC
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -417,4 +417,12 @@
|
|||||||
where id = #{sheepId}
|
where id = #{sheepId}
|
||||||
and is_delete = 0
|
and is_delete = 0
|
||||||
</update>
|
</update>
|
||||||
|
<!-- ====================== ScBreedRecordMapper.xml 需要添加 ====================== -->
|
||||||
|
<!-- 统计该公羊配了多少母羊(去重) -->
|
||||||
|
<select id="countMatedEwesByRamId" resultType="Long">
|
||||||
|
SELECT COUNT(DISTINCT ewe_id)
|
||||||
|
FROM sc_breed_record
|
||||||
|
WHERE ram_id = #{ramManageTags} AND is_delete = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -221,4 +221,13 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<!-- ====================== ScLambingRecordMapper.xml 需要添加 ====================== -->
|
||||||
|
<!-- 统计公羊的后代数量 -->
|
||||||
|
<select id="countOffspringByRamId" resultType="Long">
|
||||||
|
SELECT IFNULL(SUM(lr.lambs_born), 0)
|
||||||
|
FROM sc_breed_record br
|
||||||
|
JOIN sc_lambing_record lr ON br.ewe_id = lr.sheep_id
|
||||||
|
WHERE br.ram_id = #{ramManageTags} AND br.is_delete = 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -229,4 +229,17 @@
|
|||||||
</set>
|
</set>
|
||||||
where id = #{sheepId}
|
where id = #{sheepId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!-- ====================== ScPregnancyRecordMapper.xml 需要添加 ====================== -->
|
||||||
|
<!-- 统计孕检有胎的母羊数(按配种方式) -->
|
||||||
|
<select id="countPregnantEwesByRamIdAndBreedType" resultType="Long">
|
||||||
|
SELECT COUNT(DISTINCT pr.sheep_id)
|
||||||
|
FROM sc_breed_record br
|
||||||
|
JOIN sc_pregnancy_record pr ON br.ewe_id = pr.sheep_id
|
||||||
|
WHERE br.ram_id = #{ramManageTags}
|
||||||
|
AND br.is_delete = 0
|
||||||
|
AND pr.is_delete = 0
|
||||||
|
AND br.breed_type = #{breedType}
|
||||||
|
AND pr.result IN ('有胎', '阳性', '怀孕')
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user