Merge remote-tracking branch 'origin/main'

This commit is contained in:
ll 2025-07-15 16:11:46 +08:00
commit c7aa6007f5
44 changed files with 3720 additions and 239 deletions

View File

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

View File

@ -0,0 +1,52 @@
package com.zhyc.module.base.variety.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 羊只品种对象 bas_sheep_variety
*
* @author ruoyi
* @date 2025-07-15
*/
public class BasSheepVariety extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 品种 */
@Excel(name = "品种")
private String variety;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setVariety(String variety)
{
this.variety = variety;
}
public String getVariety()
{
return variety;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("variety", getVariety())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.base.variety.mapper;
import java.util.List;
import com.zhyc.module.base.variety.domain.BasSheepVariety;
/**
* 羊只品种Mapper接口
*
* @author ruoyi
* @date 2025-07-15
*/
public interface BasSheepVarietyMapper
{
/**
* 查询羊只品种
*
* @param id 羊只品种主键
* @return 羊只品种
*/
public BasSheepVariety selectBasSheepVarietyById(Long id);
/**
* 查询羊只品种列表
*
* @param basSheepVariety 羊只品种
* @return 羊只品种集合
*/
public List<BasSheepVariety> selectBasSheepVarietyList(BasSheepVariety basSheepVariety);
/**
* 新增羊只品种
*
* @param basSheepVariety 羊只品种
* @return 结果
*/
public int insertBasSheepVariety(BasSheepVariety basSheepVariety);
/**
* 修改羊只品种
*
* @param basSheepVariety 羊只品种
* @return 结果
*/
public int updateBasSheepVariety(BasSheepVariety basSheepVariety);
/**
* 删除羊只品种
*
* @param id 羊只品种主键
* @return 结果
*/
public int deleteBasSheepVarietyById(Long id);
/**
* 批量删除羊只品种
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBasSheepVarietyByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.base.variety.service;
import java.util.List;
import com.zhyc.module.base.variety.domain.BasSheepVariety;
/**
* 羊只品种Service接口
*
* @author ruoyi
* @date 2025-07-15
*/
public interface IBasSheepVarietyService
{
/**
* 查询羊只品种
*
* @param id 羊只品种主键
* @return 羊只品种
*/
public BasSheepVariety selectBasSheepVarietyById(Long id);
/**
* 查询羊只品种列表
*
* @param basSheepVariety 羊只品种
* @return 羊只品种集合
*/
public List<BasSheepVariety> selectBasSheepVarietyList(BasSheepVariety basSheepVariety);
/**
* 新增羊只品种
*
* @param basSheepVariety 羊只品种
* @return 结果
*/
public int insertBasSheepVariety(BasSheepVariety basSheepVariety);
/**
* 修改羊只品种
*
* @param basSheepVariety 羊只品种
* @return 结果
*/
public int updateBasSheepVariety(BasSheepVariety basSheepVariety);
/**
* 批量删除羊只品种
*
* @param ids 需要删除的羊只品种主键集合
* @return 结果
*/
public int deleteBasSheepVarietyByIds(Long[] ids);
/**
* 删除羊只品种信息
*
* @param id 羊只品种主键
* @return 结果
*/
public int deleteBasSheepVarietyById(Long id);
}

View File

@ -0,0 +1,93 @@
package com.zhyc.module.base.variety.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.base.variety.mapper.BasSheepVarietyMapper;
import com.zhyc.module.base.variety.domain.BasSheepVariety;
import com.zhyc.module.base.variety.service.IBasSheepVarietyService;
/**
* 羊只品种Service业务层处理
*
* @author ruoyi
* @date 2025-07-15
*/
@Service
public class BasSheepVarietyServiceImpl implements IBasSheepVarietyService
{
@Autowired
private BasSheepVarietyMapper basSheepVarietyMapper;
/**
* 查询羊只品种
*
* @param id 羊只品种主键
* @return 羊只品种
*/
@Override
public BasSheepVariety selectBasSheepVarietyById(Long id)
{
return basSheepVarietyMapper.selectBasSheepVarietyById(id);
}
/**
* 查询羊只品种列表
*
* @param basSheepVariety 羊只品种
* @return 羊只品种
*/
@Override
public List<BasSheepVariety> selectBasSheepVarietyList(BasSheepVariety basSheepVariety)
{
return basSheepVarietyMapper.selectBasSheepVarietyList(basSheepVariety);
}
/**
* 新增羊只品种
*
* @param basSheepVariety 羊只品种
* @return 结果
*/
@Override
public int insertBasSheepVariety(BasSheepVariety basSheepVariety)
{
return basSheepVarietyMapper.insertBasSheepVariety(basSheepVariety);
}
/**
* 修改羊只品种
*
* @param basSheepVariety 羊只品种
* @return 结果
*/
@Override
public int updateBasSheepVariety(BasSheepVariety basSheepVariety)
{
return basSheepVarietyMapper.updateBasSheepVariety(basSheepVariety);
}
/**
* 批量删除羊只品种
*
* @param ids 需要删除的羊只品种主键
* @return 结果
*/
@Override
public int deleteBasSheepVarietyByIds(Long[] ids)
{
return basSheepVarietyMapper.deleteBasSheepVarietyByIds(ids);
}
/**
* 删除羊只品种信息
*
* @param id 羊只品种主键
* @return 结果
*/
@Override
public int deleteBasSheepVarietyById(Long id)
{
return basSheepVarietyMapper.deleteBasSheepVarietyById(id);
}
}

View File

@ -0,0 +1,105 @@
package com.zhyc.module.biosafety.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.biosafety.domain.QuarantineItems;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.biosafety.service.IQuarantineItemsService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 检疫项目Controller
*
* @author ruoyi
* @date 2025-07-14
*/
@RestController
@RequestMapping("/biosafety/items")
public class QuarantineItemsController extends BaseController
{
@Autowired
private IQuarantineItemsService quarantineItemsService;
/**
* 查询检疫项目列表
*/
@PreAuthorize("@ss.hasPermi('biosafety:items:list')")
@GetMapping("/list")
public TableDataInfo list(QuarantineItems quarantineItems)
{
startPage();
List<QuarantineItems> list = quarantineItemsService.selectQuarantineItemsList(quarantineItems);
return getDataTable(list);
}
/**
* 导出检疫项目列表
*/
@PreAuthorize("@ss.hasPermi('biosafety:items:export')")
@Log(title = "检疫项目", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QuarantineItems quarantineItems)
{
List<QuarantineItems> list = quarantineItemsService.selectQuarantineItemsList(quarantineItems);
ExcelUtil<QuarantineItems> util = new ExcelUtil<QuarantineItems>(QuarantineItems.class);
util.exportExcel(response, list, "检疫项目数据");
}
/**
* 获取检疫项目详细信息
*/
@PreAuthorize("@ss.hasPermi('biosafety:items:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(quarantineItemsService.selectQuarantineItemsById(id));
}
/**
* 新增检疫项目
*/
@PreAuthorize("@ss.hasPermi('biosafety:items:add')")
@Log(title = "检疫项目", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QuarantineItems quarantineItems)
{
return toAjax(quarantineItemsService.insertQuarantineItems(quarantineItems));
}
/**
* 修改检疫项目
*/
@PreAuthorize("@ss.hasPermi('biosafety:items:edit')")
@Log(title = "检疫项目", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QuarantineItems quarantineItems)
{
return toAjax(quarantineItemsService.updateQuarantineItems(quarantineItems));
}
/**
* 删除检疫项目
*/
@PreAuthorize("@ss.hasPermi('biosafety:items:remove')")
@Log(title = "检疫项目", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(quarantineItemsService.deleteQuarantineItemsByIds(ids));
}
}

View File

@ -0,0 +1,105 @@
package com.zhyc.module.biosafety.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.biosafety.domain.QuarantineReport;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.biosafety.service.IQuarantineReportService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 检疫记录Controller
*
* @author ruoyi
* @date 2025-07-14
*/
@RestController
@RequestMapping("/bisosafety/quarantine")
public class QuarantineReportController extends BaseController
{
@Autowired
private IQuarantineReportService quarantineReportService;
/**
* 查询检疫记录列表
*/
@PreAuthorize("@ss.hasPermi('bisosafety:quarantine:list')")
@GetMapping("/list")
public TableDataInfo list(QuarantineReport quarantineReport)
{
startPage();
List<QuarantineReport> list = quarantineReportService.selectQuarantineReportList(quarantineReport);
return getDataTable(list);
}
/**
* 导出检疫记录列表
*/
@PreAuthorize("@ss.hasPermi('bisosafety:quarantine:export')")
@Log(title = "检疫记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QuarantineReport quarantineReport)
{
List<QuarantineReport> list = quarantineReportService.selectQuarantineReportList(quarantineReport);
ExcelUtil<QuarantineReport> util = new ExcelUtil<QuarantineReport>(QuarantineReport.class);
util.exportExcel(response, list, "检疫记录数据");
}
/**
* 获取检疫记录详细信息
*/
@PreAuthorize("@ss.hasPermi('bisosafety:quarantine:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(quarantineReportService.selectQuarantineReportById(id));
}
/**
* 新增检疫记录
*/
@PreAuthorize("@ss.hasPermi('bisosafety:quarantine:add')")
@Log(title = "检疫记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QuarantineReport quarantineReport)
{
return toAjax(quarantineReportService.insertQuarantineReport(quarantineReport));
}
/**
* 修改检疫记录
*/
@PreAuthorize("@ss.hasPermi('bisosafety:quarantine:edit')")
@Log(title = "检疫记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QuarantineReport quarantineReport)
{
return toAjax(quarantineReportService.updateQuarantineReport(quarantineReport));
}
/**
* 删除检疫记录
*/
@PreAuthorize("@ss.hasPermi('bisosafety:quarantine:remove')")
@Log(title = "检疫记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(quarantineReportService.deleteQuarantineReportByIds(ids));
}
}

View File

@ -0,0 +1,105 @@
package com.zhyc.module.biosafety.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.biosafety.domain.QuarantineSample;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.biosafety.service.IQuarantineSampleService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 样品类型Controller
*
* @author ruoyi
* @date 2025-07-14
*/
@RestController
@RequestMapping("/biosafety/sample")
public class QuarantineSampleController extends BaseController
{
@Autowired
private IQuarantineSampleService quarantineSampleService;
/**
* 查询样品类型列表
*/
@PreAuthorize("@ss.hasPermi('biosafety:sample:list')")
@GetMapping("/list")
public TableDataInfo list(QuarantineSample quarantineSample)
{
startPage();
List<QuarantineSample> list = quarantineSampleService.selectQuarantineSampleList(quarantineSample);
return getDataTable(list);
}
/**
* 导出样品类型列表
*/
@PreAuthorize("@ss.hasPermi('biosafety:sample:export')")
@Log(title = "样品类型", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QuarantineSample quarantineSample)
{
List<QuarantineSample> list = quarantineSampleService.selectQuarantineSampleList(quarantineSample);
ExcelUtil<QuarantineSample> util = new ExcelUtil<QuarantineSample>(QuarantineSample.class);
util.exportExcel(response, list, "样品类型数据");
}
/**
* 获取样品类型详细信息
*/
@PreAuthorize("@ss.hasPermi('biosafety:sample:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(quarantineSampleService.selectQuarantineSampleById(id));
}
/**
* 新增样品类型
*/
@PreAuthorize("@ss.hasPermi('biosafety:sample:add')")
@Log(title = "样品类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QuarantineSample quarantineSample)
{
return toAjax(quarantineSampleService.insertQuarantineSample(quarantineSample));
}
/**
* 修改样品类型
*/
@PreAuthorize("@ss.hasPermi('biosafety:sample:edit')")
@Log(title = "样品类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QuarantineSample quarantineSample)
{
return toAjax(quarantineSampleService.updateQuarantineSample(quarantineSample));
}
/**
* 删除样品类型
*/
@PreAuthorize("@ss.hasPermi('biosafety:sample:remove')")
@Log(title = "样品类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(quarantineSampleService.deleteQuarantineSampleByIds(ids));
}
}

View File

@ -0,0 +1,52 @@
package com.zhyc.module.biosafety.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 检疫项目对象 sw_quarantine_items
*
* @author ruoyi
* @date 2025-07-14
*/
public class QuarantineItems extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 名称 */
@Excel(name = "名称")
private String name;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.toString();
}
}

View File

@ -0,0 +1,83 @@
package com.zhyc.module.biosafety.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
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;
import org.apache.ibatis.type.Alias;
/**
* 检疫记录对象 sw_quarantine_report
*
* @author ruoyi
* @date 2025-07-14
*/
@Data
@Alias("QuarantineReport")
public class QuarantineReport extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 羊只 */
private Long sheepId;
@Excel(name = "羊只耳号")
private String sheepNo;
@Excel(name = "羊只类别")
private String sheepType;
@Excel(name = "羊只性别")
private String gender;
@Excel(name = "月龄")
private Integer monthAge;
@Excel(name = "胎次")
private Integer parity;
@Excel(name = "繁育状态")
private String breed;
/** 检疫日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "检疫日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date datetime;
/** 检疫项目 */
private Long quarItem;
/** 检疫项目 */
@Excel(name = "检疫项目")
private String itemName;
/** 样品类型 */
private Long sampleType;
/** 样品 */
@Excel(name = "样品类型")
private Long sample;
/** 采样员 */
@Excel(name = "采样员")
private String sampler;
/** 检疫员 */
@Excel(name = "检疫员")
private String quarOfficer;
/** 检疫结果 */
@Excel(name = "检疫结果")
private Long result;
/** 状态 */
@Excel(name = "状态")
private Long status;
}

View File

@ -0,0 +1,52 @@
package com.zhyc.module.biosafety.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 样品类型对象 sw_quarantine_sample
*
* @author ruoyi
* @date 2025-07-14
*/
public class QuarantineSample extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 样品类型 */
@Excel(name = "样品类型")
private String name;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.toString();
}
}

View File

@ -0,0 +1,62 @@
package com.zhyc.module.biosafety.mapper;
import java.util.List;
import com.zhyc.module.biosafety.domain.QuarantineItems;
/**
* 检疫项目Mapper接口
*
* @author ruoyi
* @date 2025-07-14
*/
public interface QuarantineItemsMapper
{
/**
* 查询检疫项目
*
* @param id 检疫项目主键
* @return 检疫项目
*/
public QuarantineItems selectQuarantineItemsById(Long id);
/**
* 查询检疫项目列表
*
* @param quarantineItems 检疫项目
* @return 检疫项目集合
*/
public List<QuarantineItems> selectQuarantineItemsList(QuarantineItems quarantineItems);
/**
* 新增检疫项目
*
* @param quarantineItems 检疫项目
* @return 结果
*/
public int insertQuarantineItems(QuarantineItems quarantineItems);
/**
* 修改检疫项目
*
* @param quarantineItems 检疫项目
* @return 结果
*/
public int updateQuarantineItems(QuarantineItems quarantineItems);
/**
* 删除检疫项目
*
* @param id 检疫项目主键
* @return 结果
*/
public int deleteQuarantineItemsById(Long id);
/**
* 批量删除检疫项目
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteQuarantineItemsByIds(Long[] ids);
}

View File

@ -0,0 +1,62 @@
package com.zhyc.module.biosafety.mapper;
import java.util.List;
import com.zhyc.module.biosafety.domain.QuarantineReport;
/**
* 检疫记录Mapper接口
*
* @author ruoyi
* @date 2025-07-14
*/
public interface QuarantineReportMapper
{
/**
* 查询检疫记录
*
* @param id 检疫记录主键
* @return 检疫记录
*/
public QuarantineReport selectQuarantineReportById(Long id);
/**
* 查询检疫记录列表
*
* @param quarantineReport 检疫记录
* @return 检疫记录集合
*/
public List<QuarantineReport> selectQuarantineReportList(QuarantineReport quarantineReport);
/**
* 新增检疫记录
*
* @param quarantineReport 检疫记录
* @return 结果
*/
public int insertQuarantineReport(QuarantineReport quarantineReport);
/**
* 修改检疫记录
*
* @param quarantineReport 检疫记录
* @return 结果
*/
public int updateQuarantineReport(QuarantineReport quarantineReport);
/**
* 删除检疫记录
*
* @param id 检疫记录主键
* @return 结果
*/
public int deleteQuarantineReportById(Long id);
/**
* 批量删除检疫记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteQuarantineReportByIds(Long[] ids);
}

View File

@ -0,0 +1,62 @@
package com.zhyc.module.biosafety.mapper;
import java.util.List;
import com.zhyc.module.biosafety.domain.QuarantineSample;
/**
* 样品类型Mapper接口
*
* @author ruoyi
* @date 2025-07-14
*/
public interface QuarantineSampleMapper
{
/**
* 查询样品类型
*
* @param id 样品类型主键
* @return 样品类型
*/
public QuarantineSample selectQuarantineSampleById(Long id);
/**
* 查询样品类型列表
*
* @param quarantineSample 样品类型
* @return 样品类型集合
*/
public List<QuarantineSample> selectQuarantineSampleList(QuarantineSample quarantineSample);
/**
* 新增样品类型
*
* @param quarantineSample 样品类型
* @return 结果
*/
public int insertQuarantineSample(QuarantineSample quarantineSample);
/**
* 修改样品类型
*
* @param quarantineSample 样品类型
* @return 结果
*/
public int updateQuarantineSample(QuarantineSample quarantineSample);
/**
* 删除样品类型
*
* @param id 样品类型主键
* @return 结果
*/
public int deleteQuarantineSampleById(Long id);
/**
* 批量删除样品类型
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteQuarantineSampleByIds(Long[] ids);
}

View File

@ -0,0 +1,62 @@
package com.zhyc.module.biosafety.service;
import java.util.List;
import com.zhyc.module.biosafety.domain.QuarantineItems;
/**
* 检疫项目Service接口
*
* @author ruoyi
* @date 2025-07-14
*/
public interface IQuarantineItemsService
{
/**
* 查询检疫项目
*
* @param id 检疫项目主键
* @return 检疫项目
*/
public QuarantineItems selectQuarantineItemsById(Long id);
/**
* 查询检疫项目列表
*
* @param quarantineItems 检疫项目
* @return 检疫项目集合
*/
public List<QuarantineItems> selectQuarantineItemsList(QuarantineItems quarantineItems);
/**
* 新增检疫项目
*
* @param quarantineItems 检疫项目
* @return 结果
*/
public int insertQuarantineItems(QuarantineItems quarantineItems);
/**
* 修改检疫项目
*
* @param quarantineItems 检疫项目
* @return 结果
*/
public int updateQuarantineItems(QuarantineItems quarantineItems);
/**
* 批量删除检疫项目
*
* @param ids 需要删除的检疫项目主键集合
* @return 结果
*/
public int deleteQuarantineItemsByIds(Long[] ids);
/**
* 删除检疫项目信息
*
* @param id 检疫项目主键
* @return 结果
*/
public int deleteQuarantineItemsById(Long id);
}

View File

@ -0,0 +1,62 @@
package com.zhyc.module.biosafety.service;
import java.util.List;
import com.zhyc.module.biosafety.domain.QuarantineReport;
/**
* 检疫记录Service接口
*
* @author ruoyi
* @date 2025-07-14
*/
public interface IQuarantineReportService
{
/**
* 查询检疫记录
*
* @param id 检疫记录主键
* @return 检疫记录
*/
public QuarantineReport selectQuarantineReportById(Long id);
/**
* 查询检疫记录列表
*
* @param quarantineReport 检疫记录
* @return 检疫记录集合
*/
public List<QuarantineReport> selectQuarantineReportList(QuarantineReport quarantineReport);
/**
* 新增检疫记录
*
* @param quarantineReport 检疫记录
* @return 结果
*/
public int insertQuarantineReport(QuarantineReport quarantineReport);
/**
* 修改检疫记录
*
* @param quarantineReport 检疫记录
* @return 结果
*/
public int updateQuarantineReport(QuarantineReport quarantineReport);
/**
* 批量删除检疫记录
*
* @param ids 需要删除的检疫记录主键集合
* @return 结果
*/
public int deleteQuarantineReportByIds(Long[] ids);
/**
* 删除检疫记录信息
*
* @param id 检疫记录主键
* @return 结果
*/
public int deleteQuarantineReportById(Long id);
}

View File

@ -0,0 +1,62 @@
package com.zhyc.module.biosafety.service;
import java.util.List;
import com.zhyc.module.biosafety.domain.QuarantineSample;
/**
* 样品类型Service接口
*
* @author ruoyi
* @date 2025-07-14
*/
public interface IQuarantineSampleService
{
/**
* 查询样品类型
*
* @param id 样品类型主键
* @return 样品类型
*/
public QuarantineSample selectQuarantineSampleById(Long id);
/**
* 查询样品类型列表
*
* @param quarantineSample 样品类型
* @return 样品类型集合
*/
public List<QuarantineSample> selectQuarantineSampleList(QuarantineSample quarantineSample);
/**
* 新增样品类型
*
* @param quarantineSample 样品类型
* @return 结果
*/
public int insertQuarantineSample(QuarantineSample quarantineSample);
/**
* 修改样品类型
*
* @param quarantineSample 样品类型
* @return 结果
*/
public int updateQuarantineSample(QuarantineSample quarantineSample);
/**
* 批量删除样品类型
*
* @param ids 需要删除的样品类型主键集合
* @return 结果
*/
public int deleteQuarantineSampleByIds(Long[] ids);
/**
* 删除样品类型信息
*
* @param id 样品类型主键
* @return 结果
*/
public int deleteQuarantineSampleById(Long id);
}

View File

@ -0,0 +1,94 @@
package com.zhyc.module.biosafety.service.impl;
import java.util.List;
import com.zhyc.module.biosafety.domain.QuarantineItems;
import com.zhyc.module.biosafety.mapper.QuarantineItemsMapper;
import com.zhyc.module.biosafety.service.IQuarantineItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 检疫项目Service业务层处理
*
* @author ruoyi
* @date 2025-07-14
*/
@Service
public class QuarantineItemsServiceImpl implements IQuarantineItemsService
{
@Autowired
private QuarantineItemsMapper quarantineItemsMapper;
/**
* 查询检疫项目
*
* @param id 检疫项目主键
* @return 检疫项目
*/
@Override
public QuarantineItems selectQuarantineItemsById(Long id)
{
return quarantineItemsMapper.selectQuarantineItemsById(id);
}
/**
* 查询检疫项目列表
*
* @param quarantineItems 检疫项目
* @return 检疫项目
*/
@Override
public List<QuarantineItems> selectQuarantineItemsList(QuarantineItems quarantineItems)
{
return quarantineItemsMapper.selectQuarantineItemsList(quarantineItems);
}
/**
* 新增检疫项目
*
* @param quarantineItems 检疫项目
* @return 结果
*/
@Override
public int insertQuarantineItems(QuarantineItems quarantineItems)
{
return quarantineItemsMapper.insertQuarantineItems(quarantineItems);
}
/**
* 修改检疫项目
*
* @param quarantineItems 检疫项目
* @return 结果
*/
@Override
public int updateQuarantineItems(QuarantineItems quarantineItems)
{
return quarantineItemsMapper.updateQuarantineItems(quarantineItems);
}
/**
* 批量删除检疫项目
*
* @param ids 需要删除的检疫项目主键
* @return 结果
*/
@Override
public int deleteQuarantineItemsByIds(Long[] ids)
{
return quarantineItemsMapper.deleteQuarantineItemsByIds(ids);
}
/**
* 删除检疫项目信息
*
* @param id 检疫项目主键
* @return 结果
*/
@Override
public int deleteQuarantineItemsById(Long id)
{
return quarantineItemsMapper.deleteQuarantineItemsById(id);
}
}

View File

@ -0,0 +1,96 @@
package com.zhyc.module.biosafety.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.biosafety.mapper.QuarantineReportMapper;
import com.zhyc.module.biosafety.domain.QuarantineReport;
import com.zhyc.module.biosafety.service.IQuarantineReportService;
/**
* 检疫记录Service业务层处理
*
* @author ruoyi
* @date 2025-07-14
*/
@Service
public class QuarantineReportServiceImpl implements IQuarantineReportService
{
@Autowired
private QuarantineReportMapper quarantineReportMapper;
/**
* 查询检疫记录
*
* @param id 检疫记录主键
* @return 检疫记录
*/
@Override
public QuarantineReport selectQuarantineReportById(Long id)
{
return quarantineReportMapper.selectQuarantineReportById(id);
}
/**
* 查询检疫记录列表
*
* @param quarantineReport 检疫记录
* @return 检疫记录
*/
@Override
public List<QuarantineReport> selectQuarantineReportList(QuarantineReport quarantineReport)
{
return quarantineReportMapper.selectQuarantineReportList(quarantineReport);
}
/**
* 新增检疫记录
*
* @param quarantineReport 检疫记录
* @return 结果
*/
@Override
public int insertQuarantineReport(QuarantineReport quarantineReport)
{
quarantineReport.setCreateTime(DateUtils.getNowDate());
return quarantineReportMapper.insertQuarantineReport(quarantineReport);
}
/**
* 修改检疫记录
*
* @param quarantineReport 检疫记录
* @return 结果
*/
@Override
public int updateQuarantineReport(QuarantineReport quarantineReport)
{
quarantineReport.setUpdateTime(DateUtils.getNowDate());
return quarantineReportMapper.updateQuarantineReport(quarantineReport);
}
/**
* 批量删除检疫记录
*
* @param ids 需要删除的检疫记录主键
* @return 结果
*/
@Override
public int deleteQuarantineReportByIds(Long[] ids)
{
return quarantineReportMapper.deleteQuarantineReportByIds(ids);
}
/**
* 删除检疫记录信息
*
* @param id 检疫记录主键
* @return 结果
*/
@Override
public int deleteQuarantineReportById(Long id)
{
return quarantineReportMapper.deleteQuarantineReportById(id);
}
}

View File

@ -0,0 +1,93 @@
package com.zhyc.module.biosafety.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.biosafety.mapper.QuarantineSampleMapper;
import com.zhyc.module.biosafety.domain.QuarantineSample;
import com.zhyc.module.biosafety.service.IQuarantineSampleService;
/**
* 样品类型Service业务层处理
*
* @author ruoyi
* @date 2025-07-14
*/
@Service
public class QuarantineSampleServiceImpl implements IQuarantineSampleService
{
@Autowired
private QuarantineSampleMapper quarantineSampleMapper;
/**
* 查询样品类型
*
* @param id 样品类型主键
* @return 样品类型
*/
@Override
public QuarantineSample selectQuarantineSampleById(Long id)
{
return quarantineSampleMapper.selectQuarantineSampleById(id);
}
/**
* 查询样品类型列表
*
* @param quarantineSample 样品类型
* @return 样品类型
*/
@Override
public List<QuarantineSample> selectQuarantineSampleList(QuarantineSample quarantineSample)
{
return quarantineSampleMapper.selectQuarantineSampleList(quarantineSample);
}
/**
* 新增样品类型
*
* @param quarantineSample 样品类型
* @return 结果
*/
@Override
public int insertQuarantineSample(QuarantineSample quarantineSample)
{
return quarantineSampleMapper.insertQuarantineSample(quarantineSample);
}
/**
* 修改样品类型
*
* @param quarantineSample 样品类型
* @return 结果
*/
@Override
public int updateQuarantineSample(QuarantineSample quarantineSample)
{
return quarantineSampleMapper.updateQuarantineSample(quarantineSample);
}
/**
* 批量删除样品类型
*
* @param ids 需要删除的样品类型主键
* @return 结果
*/
@Override
public int deleteQuarantineSampleByIds(Long[] ids)
{
return quarantineSampleMapper.deleteQuarantineSampleByIds(ids);
}
/**
* 删除样品类型信息
*
* @param id 样品类型主键
* @return 结果
*/
@Override
public int deleteQuarantineSampleById(Long id)
{
return quarantineSampleMapper.deleteQuarantineSampleById(id);
}
}

View File

@ -0,0 +1,102 @@
package com.zhyc.module.group_management.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.group_management.domain.BasSheepGroup;
import com.zhyc.module.group_management.service.IBasSheepGroupService;
import com.zhyc.common.utils.poi.ExcelUtil;
/**
* 分组管理Controller
*
* @author wyt
* @date 2025-07-14
*/
@RestController
@RequestMapping("/group_management/group_management")
public class BasSheepGroupController extends BaseController
{
@Autowired
private IBasSheepGroupService basSheepGroupService;
/**
* 查询分组管理列表
*/
@PreAuthorize("@ss.hasPermi('group_management:group_management:list')")
@GetMapping("/list")
public AjaxResult list(BasSheepGroup basSheepGroup)
{
List<BasSheepGroup> list = basSheepGroupService.selectBasSheepGroupList(basSheepGroup);
return success(list);
}
/**
* 导出分组管理列表
*/
@PreAuthorize("@ss.hasPermi('group_management:group_management:export')")
@Log(title = "分组管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BasSheepGroup basSheepGroup)
{
List<BasSheepGroup> list = basSheepGroupService.selectBasSheepGroupList(basSheepGroup);
ExcelUtil<BasSheepGroup> util = new ExcelUtil<BasSheepGroup>(BasSheepGroup.class);
util.exportExcel(response, list, "分组管理数据");
}
/**
* 获取分组管理详细信息
*/
@PreAuthorize("@ss.hasPermi('group_management:group_management:query')")
@GetMapping(value = "/{groupId}")
public AjaxResult getInfo(@PathVariable("groupId") Long groupId)
{
return success(basSheepGroupService.selectBasSheepGroupByGroupId(groupId));
}
/**
* 新增分组管理
*/
@PreAuthorize("@ss.hasPermi('group_management:group_management:add')")
@Log(title = "分组管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BasSheepGroup basSheepGroup)
{
return toAjax(basSheepGroupService.insertBasSheepGroup(basSheepGroup));
}
/**
* 修改分组管理
*/
@PreAuthorize("@ss.hasPermi('group_management:group_management:edit')")
@Log(title = "分组管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BasSheepGroup basSheepGroup)
{
return toAjax(basSheepGroupService.updateBasSheepGroup(basSheepGroup));
}
/**
* 删除分组管理
*/
@PreAuthorize("@ss.hasPermi('group_management:group_management:remove')")
@Log(title = "分组管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{groupIds}")
public AjaxResult remove(@PathVariable Long[] groupIds)
{
return toAjax(basSheepGroupService.deleteBasSheepGroupByGroupIds(groupIds));
}
}

View File

@ -0,0 +1,74 @@
package com.zhyc.module.group_management.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.TreeEntity;
/**
* 分组管理对象 bas_sheep_group
*
* @author wyt
* @date 2025-07-14
*/
public class BasSheepGroup extends TreeEntity
{
private static final long serialVersionUID = 1L;
/** 分组ID */
@Excel(name = "分组ID")
private Long groupId;
/** 分组名称 */
@Excel(name = "分组名称")
private String groupName;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
public void setGroupId(Long groupId)
{
this.groupId = groupId;
}
public Long getGroupId()
{
return groupId;
}
public void setGroupName(String groupName)
{
this.groupName = groupName;
}
public String getGroupName()
{
return groupName;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("groupId", getGroupId())
.append("parentId", getParentId())
.append("groupName", getGroupName())
.append("ancestors", getAncestors())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.group_management.mapper;
import java.util.List;
import com.zhyc.module.group_management.domain.BasSheepGroup;
/**
* 分组管理Mapper接口
*
* @author wyt
* @date 2025-07-14
*/
public interface BasSheepGroupMapper
{
/**
* 查询分组管理
*
* @param groupId 分组管理主键
* @return 分组管理
*/
public BasSheepGroup selectBasSheepGroupByGroupId(Long groupId);
/**
* 查询分组管理列表
*
* @param basSheepGroup 分组管理
* @return 分组管理集合
*/
public List<BasSheepGroup> selectBasSheepGroupList(BasSheepGroup basSheepGroup);
/**
* 新增分组管理
*
* @param basSheepGroup 分组管理
* @return 结果
*/
public int insertBasSheepGroup(BasSheepGroup basSheepGroup);
/**
* 修改分组管理
*
* @param basSheepGroup 分组管理
* @return 结果
*/
public int updateBasSheepGroup(BasSheepGroup basSheepGroup);
/**
* 删除分组管理
*
* @param groupId 分组管理主键
* @return 结果
*/
public int deleteBasSheepGroupByGroupId(Long groupId);
/**
* 批量删除分组管理
*
* @param groupIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteBasSheepGroupByGroupIds(Long[] groupIds);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.group_management.service;
import java.util.List;
import com.zhyc.module.group_management.domain.BasSheepGroup;
/**
* 分组管理Service接口
*
* @author wyt
* @date 2025-07-14
*/
public interface IBasSheepGroupService
{
/**
* 查询分组管理
*
* @param groupId 分组管理主键
* @return 分组管理
*/
public BasSheepGroup selectBasSheepGroupByGroupId(Long groupId);
/**
* 查询分组管理列表
*
* @param basSheepGroup 分组管理
* @return 分组管理集合
*/
public List<BasSheepGroup> selectBasSheepGroupList(BasSheepGroup basSheepGroup);
/**
* 新增分组管理
*
* @param basSheepGroup 分组管理
* @return 结果
*/
public int insertBasSheepGroup(BasSheepGroup basSheepGroup);
/**
* 修改分组管理
*
* @param basSheepGroup 分组管理
* @return 结果
*/
public int updateBasSheepGroup(BasSheepGroup basSheepGroup);
/**
* 批量删除分组管理
*
* @param groupIds 需要删除的分组管理主键集合
* @return 结果
*/
public int deleteBasSheepGroupByGroupIds(Long[] groupIds);
/**
* 删除分组管理信息
*
* @param groupId 分组管理主键
* @return 结果
*/
public int deleteBasSheepGroupByGroupId(Long groupId);
}

View File

@ -0,0 +1,96 @@
package com.zhyc.module.group_management.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.group_management.mapper.BasSheepGroupMapper;
import com.zhyc.module.group_management.domain.BasSheepGroup;
import com.zhyc.module.group_management.service.IBasSheepGroupService;
/**
* 分组管理Service业务层处理
*
* @author wyt
* @date 2025-07-14
*/
@Service
public class BasSheepGroupServiceImpl implements IBasSheepGroupService
{
@Autowired
private BasSheepGroupMapper basSheepGroupMapper;
/**
* 查询分组管理
*
* @param groupId 分组管理主键
* @return 分组管理
*/
@Override
public BasSheepGroup selectBasSheepGroupByGroupId(Long groupId)
{
return basSheepGroupMapper.selectBasSheepGroupByGroupId(groupId);
}
/**
* 查询分组管理列表
*
* @param basSheepGroup 分组管理
* @return 分组管理
*/
@Override
public List<BasSheepGroup> selectBasSheepGroupList(BasSheepGroup basSheepGroup)
{
return basSheepGroupMapper.selectBasSheepGroupList(basSheepGroup);
}
/**
* 新增分组管理
*
* @param basSheepGroup 分组管理
* @return 结果
*/
@Override
public int insertBasSheepGroup(BasSheepGroup basSheepGroup)
{
basSheepGroup.setCreateTime(DateUtils.getNowDate());
return basSheepGroupMapper.insertBasSheepGroup(basSheepGroup);
}
/**
* 修改分组管理
*
* @param basSheepGroup 分组管理
* @return 结果
*/
@Override
public int updateBasSheepGroup(BasSheepGroup basSheepGroup)
{
basSheepGroup.setUpdateTime(DateUtils.getNowDate());
return basSheepGroupMapper.updateBasSheepGroup(basSheepGroup);
}
/**
* 批量删除分组管理
*
* @param groupIds 需要删除的分组管理主键
* @return 结果
*/
@Override
public int deleteBasSheepGroupByGroupIds(Long[] groupIds)
{
return basSheepGroupMapper.deleteBasSheepGroupByGroupIds(groupIds);
}
/**
* 删除分组管理信息
*
* @param groupId 分组管理主键
* @return 结果
*/
@Override
public int deleteBasSheepGroupByGroupId(Long groupId)
{
return basSheepGroupMapper.deleteBasSheepGroupByGroupId(groupId);
}
}

View File

@ -24,24 +24,20 @@ import com.zhyc.common.core.page.TableDataInfo;
/**
* 产羔记录Controller
*
* @author ruoyi
* @date 2025-07-11
*/
@RestController
@RequestMapping("/breed/lambing_records")
public class ScLambingRecordController extends BaseController
{
public class ScLambingRecordController extends BaseController {
@Autowired
private IScLambingRecordService scLambingRecordService;
/**
* 查询产羔记录列表包含关联信息
* 查询产羔记录列表
*/
@PreAuthorize("@ss.hasPermi('breed:lambing_records:list')")
@GetMapping("/list")
public TableDataInfo list(ScLambingRecord scLambingRecord)
{
public TableDataInfo list(ScLambingRecord scLambingRecord) {
startPage();
List<ScLambingRecord> list = scLambingRecordService.selectScLambingRecordList(scLambingRecord);
return getDataTable(list);
@ -53,8 +49,7 @@ public class ScLambingRecordController extends BaseController
@PreAuthorize("@ss.hasPermi('breed:lambing_records:export')")
@Log(title = "产羔记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScLambingRecord scLambingRecord)
{
public void export(HttpServletResponse response, ScLambingRecord scLambingRecord) {
List<ScLambingRecord> list = scLambingRecordService.selectScLambingRecordList(scLambingRecord);
ExcelUtil<ScLambingRecord> util = new ExcelUtil<ScLambingRecord>(ScLambingRecord.class);
util.exportExcel(response, list, "产羔记录数据");
@ -65,41 +60,41 @@ public class ScLambingRecordController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(scLambingRecordService.selectScLambingRecordById(id));
}
/**
* 获取产羔记录详细信息包含关联信息
*/
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')")
@GetMapping(value = "/detail/{id}")
public AjaxResult getDetailInfo(@PathVariable("id") Long id)
{
return success(scLambingRecordService.selectScLambingRecordDetailById(id));
}
/**
* 查询产羔详情羔羊信息列表
*/
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')")
@GetMapping("/lamb_detail/{lambingRecordId}")
public AjaxResult getLambDetail(@PathVariable("lambingRecordId") Long lambingRecordId)
{
List<ScLambDetail> list = scLambingRecordService.selectLambDetailByLambingRecordId(lambingRecordId);
return success(list);
}
/**
* 新增产羔记录包含羔羊详情
*/
@PreAuthorize("@ss.hasPermi('breed:lambing_records:add')")
@Log(title = "产羔记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ScLambingRecord scLambingRecord)
{
return toAjax(scLambingRecordService.insertScLambingRecord(scLambingRecord));
public AjaxResult add(@RequestBody ScLambingRecord scLambingRecord) {
try {
// 设置创建人
scLambingRecord.setCreateBy(getUsername());
// 如果没有设置创建时间使用当前时间
if (scLambingRecord.getCreateTime() == null) {
scLambingRecord.setCreateTime(new java.util.Date());
}
int result = scLambingRecordService.insertScLambingRecord(scLambingRecord);
if (result > 0) {
String message = "新增产羔记录成功";
if (scLambingRecord.getLambDetails() != null && !scLambingRecord.getLambDetails().isEmpty()) {
message += ",同时录入了 " + scLambingRecord.getLambDetails().size() + " 只羔羊详情";
}
return success(message);
} else {
return error("新增产羔记录失败");
}
} catch (Exception e) {
logger.error("新增产羔记录异常", e);
return error("新增产羔记录失败:" + e.getMessage());
}
}
/**
@ -108,9 +103,15 @@ public class ScLambingRecordController extends BaseController
@PreAuthorize("@ss.hasPermi('breed:lambing_records:edit')")
@Log(title = "产羔记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ScLambingRecord scLambingRecord)
{
return toAjax(scLambingRecordService.updateScLambingRecord(scLambingRecord));
public AjaxResult edit(@RequestBody ScLambingRecord scLambingRecord) {
try {
scLambingRecord.setUpdateBy(getUsername());
scLambingRecord.setUpdateTime(new java.util.Date());
return toAjax(scLambingRecordService.updateScLambingRecord(scLambingRecord));
} catch (Exception e) {
logger.error("修改产羔记录异常", e);
return error("修改产羔记录失败:" + e.getMessage());
}
}
/**
@ -119,19 +120,27 @@ public class ScLambingRecordController extends BaseController
@PreAuthorize("@ss.hasPermi('breed:lambing_records:remove')")
@Log(title = "产羔记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(scLambingRecordService.deleteScLambingRecordByIds(ids));
public AjaxResult remove(@PathVariable Long[] ids) {
try {
return toAjax(scLambingRecordService.deleteScLambingRecordByIds(ids));
} catch (Exception e) {
logger.error("删除产羔记录异常", e);
return error("删除产羔记录失败:" + e.getMessage());
}
}
/**
* 批量新增羔羊详情
* 查询羔羊详情
*/
@PreAuthorize("@ss.hasPermi('breed:lambing_records:add')")
@Log(title = "羔羊详情", businessType = BusinessType.INSERT)
@PostMapping("/lamb_details/batch")
public AjaxResult addLambDetailsBatch(@RequestBody List<ScLambDetail> lambDetails)
{
return toAjax(scLambingRecordService.insertLambDetailsBatch(lambDetails));
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')")
@GetMapping("/lamb_detail/{lambingRecordId}")
public AjaxResult getLambDetail(@PathVariable("lambingRecordId") Long lambingRecordId) {
try {
List<ScLambDetail> lambDetails = scLambingRecordService.selectLambDetailByLambingRecordId(lambingRecordId);
return success(lambDetails);
} catch (Exception e) {
logger.error("查询羔羊详情异常", e);
return error("查询羔羊详情失败:" + e.getMessage());
}
}
}

View File

@ -2,6 +2,8 @@ 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 org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -29,13 +31,13 @@ public class ScLambDetail extends BaseEntity
@Excel(name = "羔羊耳号")
private String lambEarNumber;
/** 羔羊品种 */
@Excel(name = "羔羊品种")
private String lambBreed;
/** 羔羊品种ID */
@Excel(name = "羔羊品种ID")
private Integer lambBreed; // 改为Integer类型存储品种ID
/** 性别 */
@Excel(name = "性别")
private String gender;
private Integer gender;
/** 出生重量 */
@Excel(name = "出生重量")
@ -54,6 +56,23 @@ public class ScLambDetail extends BaseEntity
@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)
{
@ -85,22 +104,22 @@ public class ScLambDetail extends BaseEntity
return lambEarNumber;
}
public void setLambBreed(String lambBreed)
public void setLambBreed(Integer lambBreed) // 改为Integer类型
{
this.lambBreed = lambBreed;
}
public String getLambBreed()
public Integer getLambBreed() // 改为Integer类型
{
return lambBreed;
}
public void setGender(String gender)
public void setGender(Integer gender)
{
this.gender = gender;
}
public String getGender()
public Integer getGender()
{
return gender;
}
@ -145,6 +164,66 @@ public class ScLambDetail extends BaseEntity
return birthday;
}
public List<ScLambDetail> getLambDetails()
{
return lambDetails;
}
public void setLambDetails(List<ScLambDetail> lambDetails)
{
this.lambDetails = lambDetails;
}
public Long getMotherId()
{
return motherId;
}
public void setMotherId(Long motherId)
{
this.motherId = motherId;
}
public Long getFatherId()
{
return fatherId;
}
public void setFatherId(Long fatherId)
{
this.fatherId = fatherId;
}
public Integer getRanchId()
{
return ranchId;
}
public void setRanchId(Integer ranchId)
{
this.ranchId = ranchId;
}
public Integer getSheepfoldId()
{
return sheepfoldId;
}
public void setSheepfoldId(Integer sheepfoldId)
{
this.sheepfoldId = sheepfoldId;
}
public Integer getParity()
{
return parity;
}
public void setParity(Integer parity)
{
this.parity = parity;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -160,4 +239,4 @@ public class ScLambDetail extends BaseEntity
.append("createTime", getCreateTime())
.toString();
}
}
}

View File

@ -50,9 +50,9 @@ public class ScLambingRecord extends BaseEntity
private String comment;
/** 创建日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date createTme;
private Date createTime; // 改为 createTime
// ========== 关联查询字段简化版 ==========
@ -124,6 +124,8 @@ public class ScLambingRecord extends BaseEntity
/** 羔羊信息列表(从羊只信息表查询) */
private List<SheepLambInfo> lambInfoList;
private List<ScLambDetail> lambDetails;
// ========== 原有getter和setter方法 ==========
public void setId(Long id)
@ -206,14 +208,14 @@ public class ScLambingRecord extends BaseEntity
return comment;
}
public void setCreateTme(Date createTme)
public void setCreateTime(Date createTime)
{
this.createTme = createTme;
this.createTime = createTime;
}
public Date getCreateTme()
public Date getCreateTime()
{
return createTme;
return createTime;
}
// ========== 简化版关联字段的getter和setter方法 ==========
@ -282,6 +284,7 @@ public class ScLambingRecord extends BaseEntity
this.maleBreed = maleBreed;
}
public Integer getPregnancyDays() {
return pregnancyDays;
}
@ -354,6 +357,14 @@ public class ScLambingRecord extends BaseEntity
this.lambInfoList = lambInfoList;
}
public List<ScLambDetail> getLambDetails() {
return lambDetails;
}
public void setLambDetails(List<ScLambDetail> lambDetails) {
this.lambDetails = lambDetails;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -366,7 +377,7 @@ public class ScLambingRecord extends BaseEntity
.append("score", getScore())
.append("comment", getComment())
.append("createBy", getCreateBy())
.append("createTme", getCreateTme())
.append("createTime", getCreateTime()) // 改为 createTime
.append("femaleEarNumber", getFemaleEarNumber())
.append("femaleBreed", getFemaleBreed())
.append("farm", getFarm())
@ -380,7 +391,7 @@ public class ScLambingRecord extends BaseEntity
class SheepLambInfo {
private String lambEarNumber; // 羔羊耳号
private String lambBreed; // 羔羊品种
private String gender; // 性别
private Integer gender; // 性别
private Double birthWeight; // 出生重量
private Boolean isRetained; // 是否留养
private String lineage; // 家系

View File

@ -2,84 +2,62 @@ package com.zhyc.module.produce.breed.mapper;
import java.util.List;
import com.zhyc.module.produce.breed.domain.ScLambDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 羔羊详情Mapper接口
*
* @author ruoyi
* @date 2025-07-11
*/
public interface ScLambDetailMapper
{
/**
* 查询羔羊详情
*
* @param id 羔羊详情主键
* @return 羔羊详情
*/
public ScLambDetail selectScLambDetailById(Long id);
@Mapper
public interface ScLambDetailMapper {
/**
* 查询羔羊详情列表
*
* @param scLambDetail 羔羊详情
* @return 羔羊详情集合
*/
public List<ScLambDetail> selectScLambDetailList(ScLambDetail scLambDetail);
/**
* 根据产羔记录ID查询羔羊详情列表
*
* @param lambingRecordId 产羔记录ID
* @return 羔羊详情集合
*/
public List<ScLambDetail> selectScLambDetailByLambingRecordId(Long lambingRecordId);
/**
* 新增羔羊详情
*
* @param scLambDetail 羔羊详情
* @return 结果
*/
public int insertScLambDetail(ScLambDetail scLambDetail);
public int insertBasSheep(ScLambDetail scLambDetail);
/**
* 批量新增羔羊详情
*
* @param lambDetails 羔羊详情列表
* @return 结果
*/
public int insertScLambDetailBatch(List<ScLambDetail> lambDetails);
public int insertScLambDetailBatch(@Param("list") List<ScLambDetail> scLambDetailList);
public int insertBasSheepBatch(@Param("list") List<ScLambDetail> scLambDetailList);
/**
* 修改羔羊详情
*
* @param scLambDetail 羔羊详情
* @return 结果
*/
public int updateScLambDetail(ScLambDetail scLambDetail);
/**
* 删除羔羊详情
*
* @param id 羔羊详情主键
* @return 结果
*/
public int deleteScLambDetailById(Long id);
/**
* 批量删除羔羊详情
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteScLambDetailByIds(Long[] ids);
/**
* 根据产羔记录ID删除羔羊详情
*
* @param lambingRecordId 产羔记录ID
* @return 结果
*/
public int deleteScLambDetailByLambingRecordId(Long lambingRecordId);
/**
* 查询羔羊详情
*/
public ScLambDetail selectScLambDetailById(Long id);
/**
* 根据产羔记录ID查询羔羊详情列表
*/
public List<ScLambDetail> selectScLambDetailByLambingRecordId(Long lambingRecordId);
/**
* 检查羔羊耳号是否已存在
*/
public int checkLambEarNumberExists(@Param("lambEarNumber") String lambEarNumber, @Param("excludeId") Long excludeId);
}

View File

@ -6,81 +6,41 @@ import com.zhyc.module.produce.breed.domain.ScLambDetail;
/**
* 产羔记录Service接口
*
* @author ruoyi
* @date 2025-07-11
*/
public interface IScLambingRecordService
{
/**
* 查询产羔记录
*
* @param id 产羔记录主键
* @return 产羔记录
*/
public ScLambingRecord selectScLambingRecordById(Long id);
public interface IScLambingRecordService {
/**
* 查询产羔记录列表包含关联信息
*
* @param scLambingRecord 产羔记录
* @return 产羔记录集合
* 查询产羔记录列表
*/
public List<ScLambingRecord> selectScLambingRecordList(ScLambingRecord scLambingRecord);
/**
* 查询产羔记录详细信息包含关联信息
*
* @param id 产羔记录主键
* @return 产羔记录
*/
public ScLambingRecord selectScLambingRecordDetailById(Long id);
/**
* 新增产羔记录包含羔羊详情
*
* @param scLambingRecord 产羔记录
* @return 结果
*/
public int insertScLambingRecord(ScLambingRecord scLambingRecord);
/**
* 修改产羔记录
*
* @param scLambingRecord 产羔记录
* @return 结果
*/
public int updateScLambingRecord(ScLambingRecord scLambingRecord);
/**
* 批量删除产羔记录
*
* @param ids 需要删除的产羔记录主键集合
* @return 结果
*/
public int deleteScLambingRecordByIds(Long[] ids);
/**
* 删除产羔记录信息
*
* @param id 产羔记录主键
* @return 结果
*/
public int deleteScLambingRecordById(Long id);
/**
* 根据产羔记录ID查询羔羊详情列表
*
* @param lambingRecordId 产羔记录ID
* @return 羔羊详情列表
* 查询产羔记录
*/
public List<ScLambDetail> selectLambDetailByLambingRecordId(Long lambingRecordId);
public ScLambingRecord selectScLambingRecordById(Long id);
/**
* 批量新增羔羊详情
*
* @param lambDetails 羔羊详情列表
* @return 结果
* 查询羔羊详情
*/
public int insertLambDetailsBatch(List<ScLambDetail> lambDetails);
public List<ScLambDetail> selectLambDetailByLambingRecordId(Long lambingRecordId);
}

View File

@ -1,112 +1,192 @@
package com.zhyc.module.produce.breed.service.impl;
import java.math.BigDecimal;
import java.util.List;
import com.zhyc.module.produce.breed.domain.ScLambDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.zhyc.module.produce.breed.mapper.ScLambingRecordMapper;
import com.zhyc.module.produce.breed.mapper.ScLambDetailMapper;
import com.zhyc.module.produce.breed.domain.ScLambingRecord;
import com.zhyc.module.produce.breed.domain.ScLambDetail;
import com.zhyc.module.produce.breed.service.IScLambingRecordService;
import java.util.Collections;
/**
* 产羔记录Service业务层处理
*
* @author ruoyi
* @date 2025-07-11
*/
@Service
public class ScLambingRecordServiceImpl implements IScLambingRecordService
{
public class ScLambingRecordServiceImpl implements IScLambingRecordService {
@Autowired
private ScLambingRecordMapper scLambingRecordMapper;
/**
* 查询产羔记录
*
* @param id 产羔记录主键
* @return 产羔记录
*/
@Override
public ScLambingRecord selectScLambingRecordById(Long id)
{
return scLambingRecordMapper.selectScLambingRecordById(id);
}
@Autowired
private ScLambDetailMapper scLambDetailMapper;
/**
* 查询产羔记录列表
*
* @param scLambingRecord 产羔记录
* @return 产羔记录
*/
@Override
public List<ScLambingRecord> selectScLambingRecordList(ScLambingRecord scLambingRecord)
{
public List<ScLambingRecord> selectScLambingRecordList(ScLambingRecord scLambingRecord) {
return scLambingRecordMapper.selectScLambingRecordList(scLambingRecord);
}
/**
* 新增产羔记录包含羔羊详情
*/
@Override
public ScLambingRecord selectScLambingRecordDetailById(Long id) {
return null;
@Transactional
public int insertScLambingRecord(ScLambingRecord scLambingRecord) {
// 1. 插入产羔记录
int result = scLambingRecordMapper.insertScLambingRecord(scLambingRecord);
// 2. 如果有羔羊详情则批量插入羔羊详情
if (scLambingRecord.getLambDetails() != null && !scLambingRecord.getLambDetails().isEmpty()) {
insertLambDetails(scLambingRecord);
}
return result;
}
/**
* 新增产羔记录
*
* @param scLambingRecord 产羔记录
* @return 结果
* 批量插入羔羊详情
*/
@Override
public int insertScLambingRecord(ScLambingRecord scLambingRecord)
{
return scLambingRecordMapper.insertScLambingRecord(scLambingRecord);
private void insertLambDetails(ScLambingRecord scLambingRecord) {
// 遍历羔羊详情列表逐个插入
for (ScLambDetail lambDetail : scLambingRecord.getLambDetails()) {
// 设置产羔记录ID
lambDetail.setLambingRecordId(scLambingRecord.getId());
// 设置创建信息
lambDetail.setCreateBy(scLambingRecord.getCreateBy());
lambDetail.setCreateTime(scLambingRecord.getCreateTime());
// 数据验证和转换
validateAndConvertLambDetail(lambDetail);
// 插入羔羊详情
scLambDetailMapper.insertScLambDetail(lambDetail);
scLambDetailMapper.insertBasSheep(lambDetail);
}
}
/**
* 验证和转换羔羊详情
*/
/**
* 验证和转换羔羊详情
*/
private void validateAndConvertLambDetail(ScLambDetail lambDetail) {
// 验证必填字段
if (lambDetail.getLambEarNumber() == null || lambDetail.getLambEarNumber().trim().isEmpty()) {
throw new RuntimeException("羔羊耳号不能为空");
}
if (lambDetail.getGender() == null) { // 改为检查Integer类型
throw new RuntimeException("羔羊性别不能为空");
}
// 验证性别值的有效性假设0=母羊1=公羊
if (lambDetail.getGender() < 0 || lambDetail.getGender() > 1) {
throw new RuntimeException("羔羊性别值无效请使用0母羊或1公羊");
}
// 检查耳号是否已存在
int count = scLambDetailMapper.checkLambEarNumberExists(lambDetail.getLambEarNumber().trim(), null);
if (count > 0) {
throw new RuntimeException("羔羊耳号 [" + lambDetail.getLambEarNumber() + "] 已存在,请使用其他耳号");
}
// 设置默认值
if (lambDetail.getIsRetained() == null) {
lambDetail.setIsRetained(false);
}
if (lambDetail.getBirthday() == null) {
lambDetail.setBirthday(new java.util.Date());
}
// 处理体重前端可能传来的是number类型
if (lambDetail.getBirthWeight() == null) {
lambDetail.setBirthWeight(BigDecimal.ZERO);
}
// 验证品种ID
if (lambDetail.getLambBreed() == null) {
throw new RuntimeException("羔羊品种不能为空");
}
// 去除空格
lambDetail.setLambEarNumber(lambDetail.getLambEarNumber().trim());
if (lambDetail.getLineage() != null) {
lambDetail.setLineage(lambDetail.getLineage().trim());
}
}
/**
* 修改产羔记录
*
* @param scLambingRecord 产羔记录
* @return 结果
*/
@Override
public int updateScLambingRecord(ScLambingRecord scLambingRecord)
{
return scLambingRecordMapper.updateScLambingRecord(scLambingRecord);
@Transactional
public int updateScLambingRecord(ScLambingRecord scLambingRecord) {
// 更新产羔记录
int result = scLambingRecordMapper.updateScLambingRecord(scLambingRecord);
// 如果包含羔羊详情先删除原有的再插入新的
if (scLambingRecord.getLambDetails() != null) {
// 删除原有羔羊详情
scLambDetailMapper.deleteScLambDetailByLambingRecordId(scLambingRecord.getId());
// 插入新的羔羊详情
if (!scLambingRecord.getLambDetails().isEmpty()) {
insertLambDetails(scLambingRecord);
}
}
return result;
}
/**
* 批量删除产羔记录
*
* @param ids 需要删除的产羔记录主键
* @return 结果
*/
@Override
public int deleteScLambingRecordByIds(Long[] ids)
{
@Transactional
public int deleteScLambingRecordByIds(Long[] ids) {
// 先删除关联的羔羊详情
for (Long id : ids) {
scLambDetailMapper.deleteScLambDetailByLambingRecordId(id);
}
// 再删除产羔记录
return scLambingRecordMapper.deleteScLambingRecordByIds(ids);
}
/**
* 删除产羔记录信息
*
* @param id 产羔记录主键
* @return 结果
*/
@Override
public int deleteScLambingRecordById(Long id)
{
@Transactional
public int deleteScLambingRecordById(Long id) {
// 先删除关联的羔羊详情
scLambDetailMapper.deleteScLambDetailByLambingRecordId(id);
// 再删除产羔记录
return scLambingRecordMapper.deleteScLambingRecordById(id);
}
/**
* 查询产羔记录
*/
@Override
public ScLambingRecord selectScLambingRecordById(Long id) {
return scLambingRecordMapper.selectScLambingRecordById(id);
}
/**
* 查询羔羊详情
*/
@Override
public List<ScLambDetail> selectLambDetailByLambingRecordId(Long lambingRecordId) {
return Collections.emptyList();
return scLambDetailMapper.selectScLambDetailByLambingRecordId(lambingRecordId);
}
@Override
public int insertLambDetailsBatch(List<ScLambDetail> lambDetails) {
return 0;
}
}
}

View File

@ -0,0 +1,161 @@
package com.zhyc.module.produce.wean.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.produce.wean.domain.ScWeanRecord;
import com.zhyc.module.produce.wean.service.IScWeanRecordService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 断奶记录Controller
*
* @author zhyc
* @date 2024-01-01
*/
@RestController
@RequestMapping("/Weaning/weaning_record")
public class ScWeanRecordController extends BaseController {
@Autowired
private IScWeanRecordService scWeanRecordService;
/**
* 查询断奶记录列表
*/
@PreAuthorize("@ss.hasPermi('Weaning:weaning_record:list')")
@GetMapping("/list")
public TableDataInfo list(ScWeanRecord scWeanRecord) {
startPage();
List<ScWeanRecord> list = scWeanRecordService.selectScWeanRecordList(scWeanRecord);
return getDataTable(list);
}
/**
* 导出断奶记录列表
*/
@PreAuthorize("@ss.hasPermi('Weaning:weaning_record:export')")
@Log(title = "断奶记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScWeanRecord scWeanRecord) {
List<ScWeanRecord> list = scWeanRecordService.selectScWeanRecordList(scWeanRecord);
ExcelUtil<ScWeanRecord> util = new ExcelUtil<ScWeanRecord>(ScWeanRecord.class);
util.exportExcel(response, list, "断奶记录数据");
}
/**
* 获取断奶记录详细信息
*/
@PreAuthorize("@ss.hasPermi('Weaning:weaning_record:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(scWeanRecordService.selectScWeanRecordById(id));
}
/**
* 根据耳号查询羊只ID
*/
@PreAuthorize("@ss.hasPermi('Weaning:weaning_record:query')")
@GetMapping(value = "/sheepId/{earNumber}")
public AjaxResult getSheepIdByEarNumber(@PathVariable("earNumber") String earNumber) {
Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(earNumber);
if (sheepId != null) {
return success(sheepId);
} else {
return error("未找到对应的羊只信息");
}
}
/**
* 新增断奶记录
*/
@PreAuthorize("@ss.hasPermi('Weaning:weaning_record:add')")
@Log(title = "断奶记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ScWeanRecord scWeanRecord) {
// 验证耳号是否存在
if (scWeanRecord.getEarNumber() != null) {
Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
if (sheepId == null) {
return error("耳号不存在,请检查后重新输入");
}
scWeanRecord.setSheepId(sheepId);
}
// 验证必要字段
if (scWeanRecord.getSheepId() == null) {
return error("羊只信息不能为空");
}
if (scWeanRecord.getDatetime() == null) {
return error("断奶日期不能为空");
}
if (scWeanRecord.getWeight() == null) {
return error("断奶重量不能为空");
}
if (scWeanRecord.getStatus() == null) {
return error("是否留养不能为空");
}
scWeanRecord.setCreateBy(getUsername());
return toAjax(scWeanRecordService.insertScWeanRecord(scWeanRecord));
}
/**
* 修改断奶记录
*/
@PreAuthorize("@ss.hasPermi('Weaning:weaning_record:edit')")
@Log(title = "断奶记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ScWeanRecord scWeanRecord) {
// 验证耳号是否存在
if (scWeanRecord.getEarNumber() != null) {
Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
if (sheepId == null) {
return error("耳号不存在,请检查后重新输入");
}
scWeanRecord.setSheepId(sheepId);
}
// 验证必要字段
if (scWeanRecord.getId() == null) {
return error("记录ID不能为空");
}
if (scWeanRecord.getSheepId() == null) {
return error("羊只信息不能为空");
}
if (scWeanRecord.getDatetime() == null) {
return error("断奶日期不能为空");
}
if (scWeanRecord.getWeight() == null) {
return error("断奶重量不能为空");
}
if (scWeanRecord.getStatus() == null) {
return error("是否留养不能为空");
}
return toAjax(scWeanRecordService.updateScWeanRecord(scWeanRecord));
}
/**
* 删除断奶记录
*/
@PreAuthorize("@ss.hasPermi('Weaning:weaning_record:remove')")
@Log(title = "断奶记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(scWeanRecordService.deleteScWeanRecordByIds(ids));
}
}

View File

@ -0,0 +1,262 @@
package com.zhyc.module.produce.wean.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 断奶记录对象 sc_wean_record
*
* @author zhyc
* @date 2024-01-01
*/
public class ScWeanRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 羊只ID */
@Excel(name = "羊只ID")
private Long sheepId;
/** 断奶日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "断奶日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date datetime;
/** 断奶重量 */
@Excel(name = "断奶重量")
private BigDecimal weight;
/** 是否留养 */
@Excel(name = "是否留养")
private String status;
/** 技术员 */
@Excel(name = "技术员")
private String technician;
/** 备注 */
@Excel(name = "备注")
private String comment;
/** 电子耳号 */
@Excel(name = "电子耳号")
private String electronicTags;
// 关联查询字段
/** 耳号 */
@Excel(name = "耳号")
private String earNumber;
/** 品种 */
@Excel(name = "品种")
private String breed;
/** 事件类型 */
@Excel(name = "事件类型")
private String eventType;
/** 性别 */
@Excel(name = "性别")
private String gender;
/** 父号 */
@Excel(name = "父号")
private String fatherNumber;
/** 母号 */
@Excel(name = "母号")
private String motherNumber;
/** 月龄 */
@Excel(name = "月龄")
private Integer monthAge;
/** 出生重量 */
@Excel(name = "出生重量")
private BigDecimal birthWeight;
/** 羊舍 */
@Excel(name = "羊舍")
private String sheepPen;
/** 繁育状态 */
@Excel(name = "繁育状态")
private String breedingStatus;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setSheepId(Long sheepId) {
this.sheepId = sheepId;
}
public Long getSheepId() {
return sheepId;
}
public void setDatetime(Date datetime) {
this.datetime = datetime;
}
public Date getDatetime() {
return datetime;
}
public void setWeight(BigDecimal weight) {
this.weight = weight;
}
public BigDecimal getWeight() {
return weight;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public void setTechnician(String technician) {
this.technician = technician;
}
public String getTechnician() {
return technician;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getComment() {
return comment;
}
public void setElectronicTags(String electronicTags) {
this.electronicTags = electronicTags;
}
public String getElectronicTags() {
return electronicTags;
}
public void setEarNumber(String earNumber) {
this.earNumber = earNumber;
}
public String getEarNumber() {
return earNumber;
}
public void setBreed(String breed) {
this.breed = breed;
}
public String getBreed() {
return breed;
}
public void setEventType(String eventType) {
this.eventType = eventType;
}
public String getEventType() {
return eventType;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getGender() {
return gender;
}
public void setFatherNumber(String fatherNumber) {
this.fatherNumber = fatherNumber;
}
public String getFatherNumber() {
return fatherNumber;
}
public void setMotherNumber(String motherNumber) {
this.motherNumber = motherNumber;
}
public String getMotherNumber() {
return motherNumber;
}
public void setMonthAge(Integer monthAge) {
this.monthAge = monthAge;
}
public Integer getMonthAge() {
return monthAge;
}
public void setBirthWeight(BigDecimal birthWeight) {
this.birthWeight = birthWeight;
}
public BigDecimal getBirthWeight() {
return birthWeight;
}
public void setSheepPen(String sheepPen) {
this.sheepPen = sheepPen;
}
public String getSheepPen() {
return sheepPen;
}
public void setBreedingStatus(String breedingStatus) {
this.breedingStatus = breedingStatus;
}
public String getBreedingStatus() {
return breedingStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sheepId", getSheepId())
.append("datetime", getDatetime())
.append("weight", getWeight())
.append("status", getStatus())
.append("technician", getTechnician())
.append("comment", getComment())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("electronicTags", getElectronicTags())
.append("earNumber", getEarNumber())
.append("breed", getBreed())
.append("eventType", getEventType())
.append("gender", getGender())
.append("fatherNumber", getFatherNumber())
.append("motherNumber", getMotherNumber())
.append("monthAge", getMonthAge())
.append("birthWeight", getBirthWeight())
.append("sheepPen", getSheepPen())
.append("breedingStatus", getBreedingStatus())
.toString();
}
}

View File

@ -0,0 +1,68 @@
package com.zhyc.module.produce.wean.mapper;
import java.util.List;
import com.zhyc.module.produce.wean.domain.ScWeanRecord;
/**
* 断奶记录Mapper接口
*
* @author zhyc
* @date 2024-01-01
*/
public interface ScWeanRecordMapper {
/**
* 查询断奶记录
*
* @param id 断奶记录主键
* @return 断奶记录
*/
public ScWeanRecord selectScWeanRecordById(Long id);
/**
* 查询断奶记录列表
*
* @param scWeanRecord 断奶记录
* @return 断奶记录集合
*/
public List<ScWeanRecord> selectScWeanRecordList(ScWeanRecord scWeanRecord);
/**
* 新增断奶记录
*
* @param scWeanRecord 断奶记录
* @return 结果
*/
public int insertScWeanRecord(ScWeanRecord scWeanRecord);
/**
* 修改断奶记录
*
* @param scWeanRecord 断奶记录
* @return 结果
*/
public int updateScWeanRecord(ScWeanRecord scWeanRecord);
/**
* 删除断奶记录
*
* @param id 断奶记录主键
* @return 结果
*/
public int deleteScWeanRecordById(Long id);
/**
* 批量删除断奶记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteScWeanRecordByIds(Long[] ids);
/**
* 根据耳号查询羊只ID
*
* @param earNumber 耳号
* @return 羊只ID
*/
public Long selectSheepIdByEarNumber(String earNumber);
}

View File

@ -0,0 +1,68 @@
package com.zhyc.module.produce.wean.service;
import java.util.List;
import com.zhyc.module.produce.wean.domain.ScWeanRecord;
/**
* 断奶记录Service接口
*
* @author ruoyi
* @date 2025-07-13
*/
public interface IScWeanRecordService {
/**
* 查询断奶记录
*
* @param id 断奶记录主键
* @return 断奶记录
*/
public ScWeanRecord selectScWeanRecordById(Long id);
/**
* 查询断奶记录列表
*
* @param scWeanRecord 断奶记录
* @return 断奶记录集合
*/
public List<ScWeanRecord> selectScWeanRecordList(ScWeanRecord scWeanRecord);
/**
* 新增断奶记录
*
* @param scWeanRecord 断奶记录
* @return 结果
*/
public int insertScWeanRecord(ScWeanRecord scWeanRecord);
/**
* 修改断奶记录
*
* @param scWeanRecord 断奶记录
* @return 结果
*/
public int updateScWeanRecord(ScWeanRecord scWeanRecord);
/**
* 批量删除断奶记录
*
* @param ids 需要删除的断奶记录主键集合
* @return 结果
*/
public int deleteScWeanRecordByIds(Long[] ids);
/**
* 删除断奶记录信息
*
* @param id 断奶记录主键
* @return 结果
*/
public int deleteScWeanRecordById(Long id);
/**
* 根据耳号查询羊只ID
*
* @param earNumber 耳号
* @return 羊只ID
*/
public Long selectSheepIdByEarNumber(String earNumber);
}

View File

@ -0,0 +1,113 @@
package com.zhyc.module.produce.wean.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.produce.wean.mapper.ScWeanRecordMapper;
import com.zhyc.module.produce.wean.domain.ScWeanRecord;
import com.zhyc.module.produce.wean.service.IScWeanRecordService;
/**
* 断奶记录Service业务层处理
*
* @author ruoyi
* @date 2025-07-13
*/
@Service
public class ScWeanRecordServiceImpl implements IScWeanRecordService {
@Autowired
private ScWeanRecordMapper scWeanRecordMapper;
/**
* 查询断奶记录
*
* @param id 断奶记录主键
* @return 断奶记录
*/
@Override
public ScWeanRecord selectScWeanRecordById(Long id) {
return scWeanRecordMapper.selectScWeanRecordById(id);
}
/**
* 查询断奶记录列表
*
* @param scWeanRecord 断奶记录
* @return 断奶记录
*/
@Override
public List<ScWeanRecord> selectScWeanRecordList(ScWeanRecord scWeanRecord) {
return scWeanRecordMapper.selectScWeanRecordList(scWeanRecord);
}
/**
* 新增断奶记录
*
* @param scWeanRecord 断奶记录
* @return 结果
*/
@Override
public int insertScWeanRecord(ScWeanRecord scWeanRecord) {
// 如果前端传递的是耳号需要先获取羊只ID
if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) {
Long sheepId = scWeanRecordMapper.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
if (sheepId != null) {
scWeanRecord.setSheepId(sheepId);
}
}
scWeanRecord.setCreateTime(DateUtils.getNowDate());
return scWeanRecordMapper.insertScWeanRecord(scWeanRecord);
}
/**
* 修改断奶记录
*
* @param scWeanRecord 断奶记录
* @return 结果
*/
@Override
public int updateScWeanRecord(ScWeanRecord scWeanRecord) {
// 如果前端传递的是耳号需要先获取羊只ID
if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) {
Long sheepId = scWeanRecordMapper.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
if (sheepId != null) {
scWeanRecord.setSheepId(sheepId);
}
}
return scWeanRecordMapper.updateScWeanRecord(scWeanRecord);
}
/**
* 批量删除断奶记录
*
* @param ids 需要删除的断奶记录主键
* @return 结果
*/
@Override
public int deleteScWeanRecordByIds(Long[] ids) {
return scWeanRecordMapper.deleteScWeanRecordByIds(ids);
}
/**
* 删除断奶记录信息
*
* @param id 断奶记录主键
* @return 结果
*/
@Override
public int deleteScWeanRecordById(Long id) {
return scWeanRecordMapper.deleteScWeanRecordById(id);
}
/**
* 根据耳号查询羊只ID
*
* @param earNumber 耳号
* @return 羊只ID
*/
@Override
public Long selectSheepIdByEarNumber(String earNumber) {
return scWeanRecordMapper.selectSheepIdByEarNumber(earNumber);
}
}

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.wean.mapper.ScWeanRecordMapper">
<resultMap type="ScWeanRecord" id="ScWeanRecordResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="datetime" column="datetime" />
<result property="weight" column="weight" />
<result property="status" column="status" />
<result property="technician" column="technician" />
<result property="comment" column="comment" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="electronicTags" column="electronic_tags" />
<!-- 关联查询的字段 -->
<result property="earNumber" column="bs_manage_tags" />
<result property="breed" column="variety" />
<result property="eventType" column="event_type" />
<result property="gender" column="gender" />
<result property="fatherNumber" column="father_manage_tags" />
<result property="motherNumber" column="mother_manage_tags" />
<result property="monthAge" column="month_age" />
<result property="birthWeight" column="birth_weight" />
<result property="sheepPen" column="sheepfold_name" />
<result property="breedingStatus" column="breed" />
</resultMap>
<!-- 带关联查询的基础SQL -->
<sql id="selectScWeanRecordVo">
select
wr.id, wr.sheep_id, wr.datetime, wr.weight, wr.status, wr.technician,
wr.comment, wr.create_by, wr.create_time, wr.electronic_tags,
sf.bs_manage_tags, sf.variety, sf.gender, sf.father_manage_tags, sf.mother_manage_tags,
sf.birth_weight, sf.sheepfold_name, sf.breed, sf.month_age,
'断奶' as event_type
from sc_wean_record wr
left join sheep_file sf on wr.sheep_id = sf.id
</sql>
<!-- 查询断奶记录列表 -->
<select id="selectScWeanRecordList" parameterType="ScWeanRecord" resultMap="ScWeanRecordResult">
<include refid="selectScWeanRecordVo"/>
<where>
<if test="sheepId != null "> and wr.sheep_id = #{sheepId}</if>
<if test="earNumber != null and earNumber != ''"> and sf.bs_manage_tags like concat('%', #{earNumber}, '%')</if>
<if test="datetime != null "> and wr.datetime = #{datetime}</if>
<if test="weight != null "> and wr.weight = #{weight}</if>
<if test="status != null "> and wr.status = #{status}</if>
<if test="technician != null and technician != ''"> and wr.technician like concat('%', #{technician}, '%')</if>
<if test="comment != null and comment != ''"> and wr.comment like concat('%', #{comment}, '%')</if>
<if test="createBy != null and createBy != ''"> and wr.create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and wr.create_time = #{createTime}</if>
<if test="electronicTags != null and electronicTags != ''"> and wr.electronic_tags like concat('%', #{electronicTags}, '%')</if>
<if test="breed != null and breed != ''"> and sf.variety like concat('%', #{breed}, '%')</if>
<if test="gender != null and gender != ''"> and sf.gender = #{gender}</if>
<if test="fatherNumber != null and fatherNumber != ''"> and sf.father_manage_tags like concat('%', #{fatherNumber}, '%')</if>
<if test="motherNumber != null and motherNumber != ''"> and sf.mother_manage_tags like concat('%', #{motherNumber}, '%')</if>
<if test="sheepPen != null and sheepPen != ''"> and sf.sheepfold_name like concat('%', #{sheepPen}, '%')</if>
<if test="breedingStatus != null and breedingStatus != ''"> and sf.breed = #{breedingStatus}</if>
</where>
order by wr.create_time desc
</select>
<!-- 根据ID查询断奶记录 -->
<select id="selectScWeanRecordById" parameterType="Long" resultMap="ScWeanRecordResult">
<include refid="selectScWeanRecordVo"/>
where wr.id = #{id}
</select>
<!-- 根据耳号查询羊只ID -->
<select id="selectSheepIdByEarNumber" parameterType="String" resultType="Long">
select id from sheep_file where bs_manage_tags = #{earNumber}
</select>
<!-- 插入断奶记录 -->
<insert id="insertScWeanRecord" parameterType="ScWeanRecord" useGeneratedKeys="true" keyProperty="id">
insert into sc_wean_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="datetime != null">datetime,</if>
<if test="weight != null">weight,</if>
<if test="status != null">status,</if>
<if test="technician != null">technician,</if>
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="electronicTags != null">electronic_tags,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="datetime != null">#{datetime},</if>
<if test="weight != null">#{weight},</if>
<if test="status != null">#{status},</if>
<if test="technician != null">#{technician},</if>
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="electronicTags != null">#{electronicTags},</if>
</trim>
</insert>
<!-- 更新断奶记录 -->
<update id="updateScWeanRecord" parameterType="ScWeanRecord">
update sc_wean_record
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="datetime != null">datetime = #{datetime},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="status != null">status = #{status},</if>
<if test="technician != null">technician = #{technician},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="electronicTags != null">electronic_tags = #{electronicTags},</if>
</trim>
where id = #{id}
</update>
<!-- 删除断奶记录 -->
<delete id="deleteScWeanRecordById" parameterType="Long">
delete from sc_wean_record where id = #{id}
</delete>
<!-- 批量删除断奶记录 -->
<delete id="deleteScWeanRecordByIds" parameterType="String">
delete from sc_wean_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,56 @@
<?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.biosafety.mapper.QuarantineItemsMapper">
<resultMap type="QuarantineItems" id="QuarantineItemsResult">
<result property="id" column="id" />
<result property="name" column="name" />
</resultMap>
<sql id="selectQuarantineItemsVo">
select id, name from sw_quarantine_items
</sql>
<select id="selectQuarantineItemsList" parameterType="QuarantineItems" resultMap="QuarantineItemsResult">
<include refid="selectQuarantineItemsVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</where>
</select>
<select id="selectQuarantineItemsById" parameterType="Long" resultMap="QuarantineItemsResult">
<include refid="selectQuarantineItemsVo"/>
where id = #{id}
</select>
<insert id="insertQuarantineItems" parameterType="QuarantineItems" useGeneratedKeys="true" keyProperty="id">
insert into sw_quarantine_items
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
</trim>
</insert>
<update id="updateQuarantineItems" parameterType="QuarantineItems">
update sw_quarantine_items
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteQuarantineItemsById" parameterType="Long">
delete from sw_quarantine_items where id = #{id}
</delete>
<delete id="deleteQuarantineItemsByIds" parameterType="String">
delete from sw_quarantine_items where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,131 @@
<?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.biosafety.mapper.QuarantineReportMapper">
<resultMap type="QuarantineReport" id="QuarantineReportResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="sheepNo" column="sheep_no"/>
<result property="sheepType" column="sheep_type"/>
<result property="gender" column="gender"/>
<result property="monthAge" column="month_age"/>
<result property="parity" column="parity"/>
<result property="breed" column="breed"/>
<result property="datetime" column="datetime" />
<result property="quarItem" column="quar_item" />
<result property="itemName" column="item_name"/>
<result property="sample" column="sample" />
<result property="sampleType" column="sample_type" />
<result property="sampler" column="sampler" />
<result property="quarOfficer" column="quar_officer" />
<result property="result" column="result" />
<result property="status" column="status" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectQuarantineReportVo">
select sqr.id, sheep_type,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status,
sqr.update_by, sqr.update_time, sqr.create_by, sqr.create_time,
sqi.name as item_name,
sqs.name as sample,
sf.bs_manage_tags sheep_no,sf.gender,sf.parity,sf.breed,sf.month_age
from sw_quarantine_report sqr
left join sw_quarantine_items sqi on sqr.quar_item = sqi.id
left join sw_quarantine_sample sqs on sqr.sample_type = sqs.id
left join sheep_file sf on sqr.sheep_id = sf.id
</sql>
<select id="selectQuarantineReportList" parameterType="QuarantineReport" resultMap="QuarantineReportResult">
<include refid="selectQuarantineReportVo"/>
<where>
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test="quarItem != null "> and quar_item = #{quarItem}</if>
<if test="sampleType != null "> and sample_type = #{sampleType}</if>
<if test="sampler != null and sampler != ''"> and sampler = #{sampler}</if>
<if test="quarOfficer != null and quarOfficer != ''"> and quar_officer = #{quarOfficer}</if>
<if test="result != null "> and result = #{result}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectQuarantineReportById" parameterType="Long" resultMap="QuarantineReportResult">
select sqr.id, sheep_type,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status,
sqr.update_by, sqr.update_time, sqr.create_by, sqr.create_time,
sqi.name as item_name,
sqs.name as sample,
sf.bs_manage_tags sheep_no
from sw_quarantine_report sqr
left join sw_quarantine_items sqi on sqr.quar_item = sqi.id
left join sw_quarantine_sample sqs on sqr.sample_type = sqs.id
left join sheep_file sf on sqr.sheep_id = sf.id
where sqr.id = #{id}
</select>
<insert id="insertQuarantineReport" parameterType="QuarantineReport" useGeneratedKeys="true" keyProperty="id">
insert into sw_quarantine_report
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="datetime != null">datetime,</if>
<if test="quarItem != null">quar_item,</if>
<if test="sampleType != null">sample_type,</if>
<if test="sampler != null">sampler,</if>
<if test="quarOfficer != null">quar_officer,</if>
<if test="result != null">result,</if>
<if test="status != null">status,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="datetime != null">#{datetime},</if>
<if test="quarItem != null">#{quarItem},</if>
<if test="sampleType != null">#{sampleType},</if>
<if test="sampler != null">#{sampler},</if>
<if test="quarOfficer != null">#{quarOfficer},</if>
<if test="result != null">#{result},</if>
<if test="status != null">#{status},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateQuarantineReport" parameterType="QuarantineReport">
update sw_quarantine_report
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="datetime != null">datetime = #{datetime},</if>
<if test="quarItem != null">quar_item = #{quarItem},</if>
<if test="sampleType != null">sample_type = #{sampleType},</if>
<if test="sampler != null">sampler = #{sampler},</if>
<if test="quarOfficer != null">quar_officer = #{quarOfficer},</if>
<if test="result != null">result = #{result},</if>
<if test="status != null">status = #{status},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteQuarantineReportById" parameterType="Long">
delete from sw_quarantine_report where id = #{id}
</delete>
<delete id="deleteQuarantineReportByIds" parameterType="String">
delete from sw_quarantine_report where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,56 @@
<?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.biosafety.mapper.QuarantineSampleMapper">
<resultMap type="QuarantineSample" id="QuarantineSampleResult">
<result property="id" column="id" />
<result property="name" column="name" />
</resultMap>
<sql id="selectQuarantineSampleVo">
select id, name from sw_quarantine_sample
</sql>
<select id="selectQuarantineSampleList" parameterType="QuarantineSample" resultMap="QuarantineSampleResult">
<include refid="selectQuarantineSampleVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</where>
</select>
<select id="selectQuarantineSampleById" parameterType="Long" resultMap="QuarantineSampleResult">
<include refid="selectQuarantineSampleVo"/>
where id = #{id}
</select>
<insert id="insertQuarantineSample" parameterType="QuarantineSample" useGeneratedKeys="true" keyProperty="id">
insert into sw_quarantine_sample
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
</trim>
</insert>
<update id="updateQuarantineSample" parameterType="QuarantineSample">
update sw_quarantine_sample
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteQuarantineSampleById" parameterType="Long">
delete from sw_quarantine_sample where id = #{id}
</delete>
<delete id="deleteQuarantineSampleByIds" parameterType="String">
delete from sw_quarantine_sample where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,256 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.breed.mapper.ScLambDetailMapper">
<!-- 羔羊详情结果映射 -->
<resultMap type="ScLambDetail" id="ScLambDetailResult">
<result property="id" column="id" />
<result property="lambingRecordId" column="lambing_record_id" />
<result property="lambEarNumber" column="lamb_ear_number" />
<result property="lambBreed" column="lamb_breed" />
<result property="gender" column="gender" />
<result property="birthWeight" column="birth_weight" />
<result property="isRetained" column="is_retained" />
<result property="lineage" column="lineage" />
<result property="birthday" column="birthday" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<!-- 基础查询SQL -->
<sql id="selectScLambDetailVo">
select id, lambing_record_id, lamb_ear_number, lamb_breed, gender, birth_weight,
is_retained, lineage, birthday, create_by, create_time, update_by, update_time
from sc_lamb_detail
</sql>
<!-- 查询羔羊详情列表 -->
<select id="selectScLambDetailList" parameterType="ScLambDetail" resultMap="ScLambDetailResult">
<include refid="selectScLambDetailVo"/>
<where>
<if test="lambingRecordId != null"> and lambing_record_id = #{lambingRecordId}</if>
<if test="lambEarNumber != null and lambEarNumber != ''"> and lamb_ear_number like concat('%', #{lambEarNumber}, '%')</if>
<if test="lambBreed != null"> and lamb_breed = #{lambBreed}</if>
<if test="gender != null"> and gender = #{gender}</if>
<if test="isRetained != null"> and is_retained = #{isRetained}</if>
<if test="lineage != null and lineage != ''"> and lineage like concat('%', #{lineage}, '%')</if>
</where>
order by create_time desc
</select>
<!-- 查询羔羊详情 -->
<select id="selectScLambDetailById" parameterType="Long" resultMap="ScLambDetailResult">
<include refid="selectScLambDetailVo"/>
where id = #{id}
</select>
<!-- 根据产羔记录ID查询羔羊详情列表 -->
<select id="selectScLambDetailByLambingRecordId" parameterType="Long" resultMap="ScLambDetailResult">
<include refid="selectScLambDetailVo"/>
where lambing_record_id = #{lambingRecordId}
order by create_time asc
</select>
<!-- 检查羔羊耳号是否已存在 -->
<select id="checkLambEarNumberExists" resultType="int">
select count(*) from sc_lamb_detail
where lamb_ear_number = #{lambEarNumber}
<if test="excludeId != null">
and id != #{excludeId}
</if>
</select>
<!-- 新增羔羊详情同步录入到bas_sheep表 -->
<insert id="insertScLambDetail" parameterType="ScLambDetail" useGeneratedKeys="true" keyProperty="id">
<!-- 插入到sc_lamb_detail表 -->
insert into sc_lamb_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="lambingRecordId != null">lambing_record_id,</if>
<if test="lambEarNumber != null and lambEarNumber != ''">lamb_ear_number,</if>
<if test="lambBreed != null">lamb_breed,</if>
<if test="gender != null">gender,</if>
<if test="birthWeight != null">birth_weight,</if>
<if test="isRetained != null">is_retained,</if>
<if test="lineage != null">lineage,</if>
<if test="birthday != null">birthday,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="lambingRecordId != null">#{lambingRecordId},</if>
<if test="lambEarNumber != null and lambEarNumber != ''">#{lambEarNumber},</if>
<if test="lambBreed != null">#{lambBreed},</if>
<if test="gender != null ">#{gender},</if>
<if test="birthWeight != null">#{birthWeight},</if>
<if test="isRetained != null">#{isRetained},</if>
<if test="lineage != null">#{lineage},</if>
<if test="birthday != null">#{birthday},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<!-- 同步插入到bas_sheep表 -->
<insert id="insertBasSheep" parameterType="ScLambDetail">
insert into bas_sheep
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="lambEarNumber != null and lambEarNumber != ''">manage_tags,</if>
<if test="lambBreed != null">variety_id,</if>
<if test="gender != null">gender,</if>
<if test="birthday != null">birthday,</if>
<if test="birthWeight != null">birth_weight,</if>
<if test="lineage != null">family,</if>
<if test="motherId != null">mother_id,</if>
<if test="fatherId != null">father_id,</if>
<if test="ranchId != null">ranch_id,</if>
<if test="sheepfoldId != null">sheepfold_id,</if>
<if test="parity != null">parity,</if>
<if test="isRetained != null">status_id,</if>
type_id,
breed_status_id,
is_delete,
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="lambEarNumber != null and lambEarNumber != ''">#{lambEarNumber},</if>
<if test="lambBreed != null">#{lambBreed},</if>
<if test="gender != null">#{gender},</if>
<if test="birthday != null">#{birthday},</if>
<if test="birthWeight != null">#{birthWeight},</if>
<if test="lineage != null">#{lineage},</if>
<if test="motherId != null">#{motherId},</if>
<if test="fatherId != null">#{fatherId},</if>
<if test="ranchId != null">#{ranchId},</if>
<if test="sheepfoldId != null">#{sheepfoldId},</if>
<if test="parity != null">#{parity},</if>
<if test="isRetained != null">#{isRetained},</if>
3, <!-- type_id: 3表示羔羊 -->
1, <!-- breed_status_id: 1表示初始繁育状态 -->
0, <!-- is_delete: 0表示未删除 -->
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<!-- 批量新增羔羊详情同步录入到bas_sheep表 -->
<insert id="insertScLambDetailBatch" parameterType="java.util.List">
<!-- 批量插入到sc_lamb_detail表 -->
insert into sc_lamb_detail (lambing_record_id, lamb_ear_number, lamb_breed, gender, birth_weight,
is_retained, lineage, birthday, create_by, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.lambingRecordId}, #{item.lambEarNumber}, #{item.lambBreed}, #{item.gender},
#{item.birthWeight}, #{item.isRetained}, #{item.lineage}, #{item.birthday},
#{item.createBy}, #{item.createTime})
</foreach>
</insert>
<!-- 批量同步插入到bas_sheep表 -->
<insert id="insertBasSheepBatch" parameterType="java.util.List">
insert into bas_sheep (manage_tags, variety_id, gender, birthday, birth_weight, family,
mother_id, father_id, ranch_id, sheepfold_id, parity, status_id, type_id, breed_status_id, is_delete, create_by, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.lambEarNumber}, #{item.lambBreed}, #{item.gender}, #{item.birthday},
#{item.birthWeight}, #{item.lineage}, #{item.motherId}, #{item.fatherId},
#{item.ranchId}, #{item.sheepfoldId}, #{item.parity}, #{item.isRetained},
3, 1, 0, #{item.createBy}, #{item.createTime})
</foreach>
</insert>
<!-- 修改羔羊详情同步更新bas_sheep表 -->
<update id="updateScLambDetail" parameterType="ScLambDetail">
update sc_lamb_detail
<trim prefix="SET" suffixOverrides=",">
<if test="lambingRecordId != null">lambing_record_id = #{lambingRecordId},</if>
<if test="lambEarNumber != null and lambEarNumber != ''">lamb_ear_number = #{lambEarNumber},</if>
<if test="lambBreed != null">lamb_breed = #{lambBreed},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
<if test="isRetained != null">is_retained = #{isRetained},</if>
<if test="lineage != null">lineage = #{lineage},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<!-- 同步更新bas_sheep表 -->
<update id="updateBasSheep" parameterType="ScLambDetail">
update bas_sheep
<trim prefix="SET" suffixOverrides=",">
<if test="lambEarNumber != null and lambEarNumber != ''">manage_tags = #{lambEarNumber},</if>
<if test="lambBreed != null">variety_id = #{lambBreed},</if>
<if test="gender != null ">gender = #{gender},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
<if test="lineage != null">family = #{lineage},</if>
<if test="isRetained != null">status_id = #{isRetained},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where manage_tags = #{lambEarNumber} and is_delete = 0
</update>
<!-- 删除羔羊详情同步删除bas_sheep表 -->
<delete id="deleteScLambDetailById" parameterType="Long">
delete from sc_lamb_detail where id = #{id}
</delete>
<!-- 同步删除bas_sheep表中的羔羊记录 -->
<update id="deleteBasSheepByEarNumber" parameterType="String">
update bas_sheep set is_delete = 1 where manage_tags = #{lambEarNumber}
</update>
<!-- 批量删除羔羊详情同步删除bas_sheep表 -->
<delete id="deleteScLambDetailByIds" parameterType="String">
delete from sc_lamb_detail where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 批量同步删除bas_sheep表中的羔羊记录 -->
<update id="deleteBasSheepByEarNumbers" parameterType="String">
update bas_sheep set is_delete = 1 where manage_tags in
<foreach item="earNumber" collection="array" open="(" separator="," close=")">
#{earNumber}
</foreach>
</update>
<!-- 根据产羔记录ID删除羔羊详情同步删除bas_sheep表 -->
<delete id="deleteScLambDetailByLambingRecordId" parameterType="Long">
delete from sc_lamb_detail where lambing_record_id = #{lambingRecordId}
</delete>
<!-- 同步删除bas_sheep表中对应产羔记录的羔羊 -->
<update id="deleteBasSheepByLambingRecordId" parameterType="Long">
update bas_sheep set is_delete = 1
where manage_tags in (
select lamb_ear_number from sc_lamb_detail
where lambing_record_id = #{lambingRecordId}
)
</update>
<!-- 根据产羔记录获取母羊和父羊信息 -->
<select id="getParentInfoByLambingRecordId" parameterType="Long" resultType="java.util.Map">
SELECT
lr.sheep_id as motherId,
mother.ranch_id as ranchId,
mother.sheepfold_id as sheepfoldId,
mother.parity as parity,
father.id as fatherId
FROM sc_lambing_record lr
LEFT JOIN bas_sheep mother ON lr.sheep_id = mother.id
LEFT JOIN sc_breed_record br ON lr.sheep_id = br.ewe_id AND lr.parity = mother.parity
LEFT JOIN bas_sheep father ON br.ram_id = father.id
WHERE lr.id = #{lambingRecordId}
</select>
</mapper>

View File

@ -15,7 +15,7 @@
<result property="score" column="score" />
<result property="comment" column="comment" />
<result property="createBy" column="create_by" />
<result property="createTme" column="create_tme" />
<result property="createTime" column="create_tme" />
</resultMap>
<!-- 详细结果映射(包含关联信息) -->
@ -29,7 +29,7 @@
<result property="score" column="score" />
<result property="comment" column="comment" />
<result property="createBy" column="create_by" />
<result property="createTme" column="create_tme" />
<result property="createTime" column="create_tme" />
<!-- 母羊信息 -->
<result property="femaleEarNumber" column="female_ear_number" />
@ -110,7 +110,7 @@
<if test="score != null"> and lr.score = #{score}</if>
<if test="comment != null and comment != ''"> and lr.comment LIKE CONCAT('%', #{comment}, '%')</if>
<if test="createBy != null and createBy != ''"> and lr.create_by = #{createBy}</if>
<if test="createTme != null"> and DATE(lr.create_tme) = #{createTme}</if>
<if test="createTime != null"> and DATE(lr.create_tme) = #{createTime}</if>
<if test="params.beginBreedingDate != null and params.beginBreedingDate != ''"><!-- 配种日期开始 -->
and DATE(br.create_time) &gt;= #{params.beginBreedingDate}
</if>
@ -134,27 +134,23 @@
where lr.id = #{id} and mother.is_delete = 0
</select>
<!-- 查询羔羊详情(从bas_sheep表查询) -->
<select id="selectLambDetailByLambingRecordId" parameterType="Long" resultType="map">
<!-- 查询羔羊详情(从sc_lamb_detail表查询) -->
<select id="selectLambDetailByLambingRecordId" parameterType="Long" resultType="ScLambDetail">
SELECT
sheep.manage_tags as lambEarNumber,
sheep.variety_id as lambBreed,
CASE sheep.gender
WHEN 1 THEN 'male'
WHEN 0 THEN 'female'
ELSE 'unknown'
END as gender,
sheep.birth_weight as birthWeight,
CASE sheep.status_id
WHEN 1 THEN true
ELSE false
END as isRetained,
sheep.family as lineage,
sheep.birthday
FROM bas_sheep sheep
WHERE sheep.mother_id = (SELECT sheep_id FROM sc_lambing_record WHERE id = #{lambingRecordId})
AND sheep.is_delete = 0
ORDER BY sheep.birthday ASC
id,
lambing_record_id as lambingRecordId,
lamb_ear_number as lambEarNumber,
lamb_breed as lambBreed,
gender,
birth_weight as birthWeight,
is_retained as isRetained,
lineage,
birthday,
create_by as createBy,
create_time as createTime
FROM sc_lamb_detail
WHERE lambing_record_id = #{lambingRecordId}
ORDER BY create_time ASC
</select>
<!-- 新增产羔记录 -->
@ -169,7 +165,7 @@
<if test="score != null">score,</if>
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTme != null">create_tme,</if>
<if test="createTime != null">create_tme,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
@ -180,7 +176,7 @@
<if test="score != null">#{score},</if>
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTme != null">#{createTme},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
@ -196,7 +192,7 @@
<if test="score != null">score = #{score},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTme != null">create_tme = #{createTme},</if>
<if test="createTime != null">create_tme = #{createTime},</if>
</trim>
where id = #{id}
</update>

View File

@ -0,0 +1,85 @@
<?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.group_management.mapper.BasSheepGroupMapper">
<resultMap type="BasSheepGroup" id="BasSheepGroupResult">
<result property="groupId" column="group_id" />
<result property="parentId" column="parent_id" />
<result property="groupName" column="group_name" />
<result property="ancestors" column="ancestors" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectBasSheepGroupVo">
select group_id, parent_id, group_name, ancestors, status, create_by, create_time, update_by, update_time from bas_sheep_group
</sql>
<select id="selectBasSheepGroupList" parameterType="BasSheepGroup" resultMap="BasSheepGroupResult">
<include refid="selectBasSheepGroupVo"/>
<where>
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectBasSheepGroupByGroupId" parameterType="Long" resultMap="BasSheepGroupResult">
<include refid="selectBasSheepGroupVo"/>
where group_id = #{groupId}
</select>
<insert id="insertBasSheepGroup" parameterType="BasSheepGroup" useGeneratedKeys="true" keyProperty="groupId">
insert into bas_sheep_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="groupName != null and groupName != ''">group_name,</if>
<if test="ancestors != null">ancestors,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="groupName != null and groupName != ''">#{groupName},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateBasSheepGroup" parameterType="BasSheepGroup">
update bas_sheep_group
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where group_id = #{groupId}
</update>
<delete id="deleteBasSheepGroupByGroupId" parameterType="Long">
delete from bas_sheep_group where group_id = #{groupId}
</delete>
<delete id="deleteBasSheepGroupByGroupIds" parameterType="String">
delete from bas_sheep_group where group_id in
<foreach item="groupId" collection="array" open="(" separator="," close=")">
#{groupId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,56 @@
<?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.variety.mapper.BasSheepVarietyMapper">
<resultMap type="BasSheepVariety" id="BasSheepVarietyResult">
<result property="id" column="id" />
<result property="variety" column="variety" />
</resultMap>
<sql id="selectBasSheepVarietyVo">
select id, variety from bas_sheep_variety
</sql>
<select id="selectBasSheepVarietyList" parameterType="BasSheepVariety" resultMap="BasSheepVarietyResult">
<include refid="selectBasSheepVarietyVo"/>
<where>
<if test="variety != null and variety != ''"> and variety = #{variety}</if>
</where>
</select>
<select id="selectBasSheepVarietyById" parameterType="Long" resultMap="BasSheepVarietyResult">
<include refid="selectBasSheepVarietyVo"/>
where id = #{id}
</select>
<insert id="insertBasSheepVariety" parameterType="BasSheepVariety" useGeneratedKeys="true" keyProperty="id">
insert into bas_sheep_variety
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="variety != null">variety,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="variety != null">#{variety},</if>
</trim>
</insert>
<update id="updateBasSheepVariety" parameterType="BasSheepVariety">
update bas_sheep_variety
<trim prefix="SET" suffixOverrides=",">
<if test="variety != null">variety = #{variety},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBasSheepVarietyById" parameterType="Long">
delete from bas_sheep_variety where id = #{id}
</delete>
<delete id="deleteBasSheepVarietyByIds" parameterType="String">
delete from bas_sheep_variety where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>