From a04ccfa5cf89189a41683175c5bd4fe2caa3e72d Mon Sep 17 00:00:00 2001 From: ll <1079863556@qq.com> Date: Mon, 25 Aug 2025 16:33:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XzParityCorrectionController.java | 20 +- .../domain/XzParityCorrection.java | 46 +- .../mapper/XzParityCorrectionMapper.java | 4 +- .../service/IXzParityCorrectionService.java | 3 +- .../XzDryMatterCorrectionServiceImpl.java | 49 +- .../impl/XzParityCorrectionServiceImpl.java | 5 +- .../impl/XzWegihCorrectionServiceImpl.java | 48 +- .../controller/SxSheepSaleController.java | 117 ++++ .../module/sale/domain/SxCustomerExport.java | 49 ++ .../zhyc/module/sale/domain/SxSheepSale.java | 545 ++++++++++++++++++ .../module/sale/mapper/SxSheepSaleMapper.java | 68 +++ .../sale/service/ISxSheepSaleService.java | 67 +++ .../service/impl/SxSheepSaleServiceImpl.java | 194 +++++++ .../XzDryMatterCorrectionMapper.xml | 19 +- .../mapper/sale/SxSheepSaleMapper.xml | 207 +++++++ 15 files changed, 1389 insertions(+), 52 deletions(-) create mode 100644 zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxSheepSaleController.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomerExport.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxSheepSale.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/sale/mapper/SxSheepSaleMapper.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/sale/service/ISxSheepSaleService.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/sale/service/impl/SxSheepSaleServiceImpl.java create mode 100644 zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/controller/XzParityCorrectionController.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/controller/XzParityCorrectionController.java index ee52381..8b1869f 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/controller/XzParityCorrectionController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/controller/XzParityCorrectionController.java @@ -25,7 +25,7 @@ import com.zhyc.common.core.page.TableDataInfo; * 胎次校正Controller * * @author ruoyi - * @date 2025-07-14 + * @date 2025-08-24 */ @RestController @RequestMapping("/parityCorrection/parityCorrection") @@ -38,20 +38,12 @@ public class XzParityCorrectionController extends BaseController * 查询胎次校正列表 */ @PreAuthorize("@ss.hasPermi('parityCorrection:parityCorrection:list')") -// @GetMapping("/list") -// public TableDataInfo list(XzParityCorrection xzParityCorrection) -// { -// startPage(); -// List list = xzParityCorrectionService.selectXzParityCorrectionList(xzParityCorrection); -// return getDataTable(list); -// } - /** - * 获取全部胎次校正(无需分页,供下拉/列表直接显示) - */ - @GetMapping("/listAll") - public AjaxResult listAll(XzParityCorrection xzParityCorrection){ + @GetMapping("/list") + public TableDataInfo list(XzParityCorrection xzParityCorrection) + { + startPage(); List list = xzParityCorrectionService.selectXzParityCorrectionList(xzParityCorrection); - return success(list); // 直接返回数组 + return getDataTable(list); } /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzParityCorrection.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzParityCorrection.java index d1a93e6..9d803a6 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzParityCorrection.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzParityCorrection.java @@ -1,8 +1,5 @@ package com.zhyc.module.dairyProducts.domain; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.zhyc.common.annotation.Excel; @@ -12,11 +9,8 @@ import com.zhyc.common.core.domain.BaseEntity; * 胎次校正对象 xz_parity_correction * * @author ruoyi - * @date 2025-07-14 + * @date 2025-08-24 */ -@Data -@NoArgsConstructor -@AllArgsConstructor public class XzParityCorrection extends BaseEntity { private static final long serialVersionUID = 1L; @@ -32,4 +26,42 @@ public class XzParityCorrection extends BaseEntity @Excel(name = "系数") private Double coef; + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setParity(Integer parity) + { + this.parity = parity; + } + + public Integer getParity() + { + return parity; + } + + public void setCoef(Double coef) + { + this.coef = coef; + } + + public Double getCoef() + { + return coef; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("parity", getParity()) + .append("coef", getCoef()) + .toString(); + } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzParityCorrectionMapper.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzParityCorrectionMapper.java index d2f4654..f6d1f12 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzParityCorrectionMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzParityCorrectionMapper.java @@ -2,15 +2,13 @@ package com.zhyc.module.dairyProducts.mapper; import java.util.List; import com.zhyc.module.dairyProducts.domain.XzParityCorrection; -import org.apache.ibatis.annotations.Mapper; /** * 胎次校正Mapper接口 * * @author ruoyi - * @date 2025-07-14 + * @date 2025-08-24 */ -@Mapper public interface XzParityCorrectionMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/IXzParityCorrectionService.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/IXzParityCorrectionService.java index d5c9ce2..f7acf95 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/IXzParityCorrectionService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/IXzParityCorrectionService.java @@ -1,14 +1,13 @@ package com.zhyc.module.dairyProducts.service; import java.util.List; - import com.zhyc.module.dairyProducts.domain.XzParityCorrection; /** * 胎次校正Service接口 * * @author ruoyi - * @date 2025-07-14 + * @date 2025-08-24 */ public interface IXzParityCorrectionService { diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzDryMatterCorrectionServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzDryMatterCorrectionServiceImpl.java index 4bf9fb2..88894c8 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzDryMatterCorrectionServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzDryMatterCorrectionServiceImpl.java @@ -44,29 +44,62 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS } /** - * 新增干物质校正 - * - * @param xzDryMatterCorrection 干物质校正 - * @return 结果 + * 新增干物质校正 - 添加默认值和重复校验 */ @Override public int insertXzDryMatterCorrection(XzDryMatterCorrection xzDryMatterCorrection) { + // 设置干物质标准默认值为18(如果未提供) + if (xzDryMatterCorrection.getStandard() == null) { + xzDryMatterCorrection.setStandard(18.0); + } + + // 检查同年月同厂区是否已存在 + if (isDuplicateRecord(xzDryMatterCorrection)) { + throw new RuntimeException("该厂区在同一年月已存在记录,不能重复添加"); + } + return xzDryMatterCorrectionMapper.insertXzDryMatterCorrection(xzDryMatterCorrection); } /** - * 修改干物质校正 - * - * @param xzDryMatterCorrection 干物质校正 - * @return 结果 + * 修改干物质校正 - 添加重复校验 */ @Override public int updateXzDryMatterCorrection(XzDryMatterCorrection xzDryMatterCorrection) { + // 检查同年月同厂区是否已存在(排除当前记录) + if (isDuplicateRecord(xzDryMatterCorrection)) { + throw new RuntimeException("该厂区在同一年月已存在记录,不能重复添加"); + } + return xzDryMatterCorrectionMapper.updateXzDryMatterCorrection(xzDryMatterCorrection); } + + /** + * 检查是否存在重复记录(同年月同厂区) + */ + private boolean isDuplicateRecord(XzDryMatterCorrection xzDryMatterCorrection) { + // 查询相同年月和厂区的记录 + XzDryMatterCorrection query = new XzDryMatterCorrection(); + query.setDatetime(xzDryMatterCorrection.getDatetime()); + query.setFactory(xzDryMatterCorrection.getFactory()); + + List existingRecords = xzDryMatterCorrectionMapper.selectXzDryMatterCorrectionList(query); + + // 如果是更新操作,需要排除当前记录 + if (xzDryMatterCorrection.getId() != null) { + return existingRecords.stream() + .anyMatch(record -> + !record.getId().equals(xzDryMatterCorrection.getId()) + ); + } + + // 如果是新增操作,只要存在记录就返回true + return !existingRecords.isEmpty(); + } + /** * 批量删除干物质校正 * diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzParityCorrectionServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzParityCorrectionServiceImpl.java index 49f5731..40f4d3f 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzParityCorrectionServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzParityCorrectionServiceImpl.java @@ -1,10 +1,9 @@ package com.zhyc.module.dairyProducts.service.impl; import java.util.List; - -import com.zhyc.module.dairyProducts.mapper.XzParityCorrectionMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.zhyc.module.dairyProducts.mapper.XzParityCorrectionMapper; import com.zhyc.module.dairyProducts.domain.XzParityCorrection; import com.zhyc.module.dairyProducts.service.IXzParityCorrectionService; @@ -12,7 +11,7 @@ import com.zhyc.module.dairyProducts.service.IXzParityCorrectionService; * 胎次校正Service业务层处理 * * @author ruoyi - * @date 2025-07-14 + * @date 2025-08-24 */ @Service public class XzParityCorrectionServiceImpl implements IXzParityCorrectionService diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzWegihCorrectionServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzWegihCorrectionServiceImpl.java index 7869c42..c27e6df 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzWegihCorrectionServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/service/impl/XzWegihCorrectionServiceImpl.java @@ -1,7 +1,10 @@ package com.zhyc.module.dairyProducts.service.impl; +import java.util.Date; import java.util.List; +import java.util.stream.Collectors; +import com.zhyc.common.exception.ServiceException; import com.zhyc.module.dairyProducts.domain.XzWegihCorrection; import com.zhyc.module.dairyProducts.mapper.XzWegihCorrectionMapper; import com.zhyc.module.dairyProducts.service.IXzWegihCorrectionService; @@ -44,27 +47,60 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService return xzWegihCorrectionMapper.selectXzWegihCorrectionList(xzWegihCorrection); } + /** + * 检查是否已存在相同日期和厂区的记录 + * @param datetime 日期 + * @param factory 厂区 + * @param excludeId 需要排除的ID(用于更新操作时排除自身) + * @return 如果存在返回true,否则返回false + */ + private boolean existsSameDateAndFactory(Date datetime, String factory, Long excludeId) { + // 创建一个查询条件对象 + XzWegihCorrection query = new XzWegihCorrection(); + query.setDatetime(datetime); + query.setFactory(factory); + + // 查询符合条件的记录 + List existingRecords = xzWegihCorrectionMapper.selectXzWegihCorrectionList(query); + + // 如果有需要排除的ID(更新操作),则过滤掉自身 + if (excludeId != null) { + existingRecords = existingRecords.stream() + .filter(record -> !record.getId().equals(excludeId)) + .collect(Collectors.toList()); + } + + // 如果找到记录,返回true + return !existingRecords.isEmpty(); + } + /** * 新增称重校正 - * - * @param xzWegihCorrection 称重校正 - * @return 结果 */ @Override public int insertXzWegihCorrection(XzWegihCorrection xzWegihCorrection) { + // 新增前检查是否已存在相同日期和厂区的记录 + if (existsSameDateAndFactory(xzWegihCorrection.getDatetime(), xzWegihCorrection.getFactory(), null)) { + // 抛出异常,提示用户已存在相同记录 + throw new ServiceException("已存在相同日期和厂区的记录,请勿重复添加"); + } + return xzWegihCorrectionMapper.insertXzWegihCorrection(xzWegihCorrection); } /** * 修改称重校正 - * - * @param xzWegihCorrection 称重校正 - * @return 结果 */ @Override public int updateXzWegihCorrection(XzWegihCorrection xzWegihCorrection) { + // 更新前检查是否已存在相同日期和厂区的记录(排除自身) + if (existsSameDateAndFactory(xzWegihCorrection.getDatetime(), xzWegihCorrection.getFactory(), xzWegihCorrection.getId())) { + // 抛出异常,提示用户已存在相同记录 + throw new ServiceException("已存在相同日期和厂区的记录,无法修改"); + } + return xzWegihCorrectionMapper.updateXzWegihCorrection(xzWegihCorrection); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxSheepSaleController.java b/zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxSheepSaleController.java new file mode 100644 index 0000000..307ac92 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/controller/SxSheepSaleController.java @@ -0,0 +1,117 @@ +package com.zhyc.module.sale.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.RequestParam; +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.sale.domain.SxSheepSale; +import com.zhyc.module.sale.service.ISxSheepSaleService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 羊只销售记录Controller + * + * @author ruoyi + * @date 2025-08-19 + */ +@RestController +@RequestMapping("/saleRecord/saleRecord") +public class SxSheepSaleController extends BaseController { + @Autowired + private ISxSheepSaleService sxSheepSaleService; + + /** + * 查询羊只销售记录列表 + */ + @PreAuthorize("@ss.hasPermi('saleRecord:saleRecord:list')") + @GetMapping("/list") + public TableDataInfo list(SxSheepSale sxSheepSale) { + startPage(); + List list = sxSheepSaleService.selectSxSheepSaleList(sxSheepSale); + return getDataTable(list); + } + + /** + * 导出羊只销售记录列表 + */ + @PreAuthorize("@ss.hasPermi('saleRecord:saleRecord:export')") + @Log(title = "羊只销售记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SxSheepSale sxSheepSale) { + List list = sxSheepSaleService.selectSxSheepSaleList(sxSheepSale); + ExcelUtil util = new ExcelUtil(SxSheepSale.class); + util.exportExcel(response, list, "羊只销售记录数据"); + } + + /** + * 获取羊只销售记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('saleRecord:saleRecord:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + SxSheepSale sxSheepSale = sxSheepSaleService.selectSxSheepSaleById(id); + // 将数据库中的逗号分隔的耳号字符串转换为列表 + if (sxSheepSale.getBsManageTags() != null && !sxSheepSale.getBsManageTags().isEmpty()) { + sxSheepSale.setBsManageTagsList(java.util.Arrays.asList(sxSheepSale.getBsManageTags().split(","))); + } + return success(sxSheepSale); + } + + /** + * 新增羊只销售记录 + */ + @PreAuthorize("@ss.hasPermi('saleRecord:saleRecord:add')") + @Log(title = "羊只销售记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SxSheepSale sxSheepSale) { + return toAjax(sxSheepSaleService.insertSxSheepSale(sxSheepSale)); + } + + /** + * 修改羊只销售记录 + */ + @PreAuthorize("@ss.hasPermi('saleRecord:saleRecord:edit')") + @Log(title = "羊只销售记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SxSheepSale sxSheepSale) { + return toAjax(sxSheepSaleService.updateSxSheepSale(sxSheepSale)); + } + + /** + * 删除羊只销售记录 + */ + @PreAuthorize("@ss.hasPermi('saleRecord:saleRecord:remove')") + @Log(title = "羊只销售记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(sxSheepSaleService.deleteSxSheepSaleByIds(ids)); + } + + /** + * 【新增】根据耳号查询羊只信息 + */ + @PreAuthorize("@ss.hasPermi('saleRecord:saleRecord:add')" + "|| @ss.hasPermi('saleRecord:saleRecord:edit')") + @GetMapping("/getSheepInfo") + public AjaxResult getSheepInfo(@RequestParam String bsManageTags) { + // 调用Service方法查询信息 + SxSheepSale sheepInfo = sxSheepSaleService.selectSheepInfoByTag(bsManageTags); + if (sheepInfo == null) { + return AjaxResult.error("未找到耳号为 [" + bsManageTags + "] 的羊只信息"); + } + return AjaxResult.success(sheepInfo); + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomerExport.java b/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomerExport.java new file mode 100644 index 0000000..a7d8833 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxCustomerExport.java @@ -0,0 +1,49 @@ +package com.zhyc.module.sale.domain; + +import com.zhyc.common.annotation.Excel; + +public class SxCustomerExport { + @Excel(name = "客户名称") + private String name; + + @Excel(name = "客户电话") + private String phone; + + @Excel(name = "客户地址") + private String fullAddress; + + @Excel(name = "备注") + private String remark; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getFullAddress() { + return fullAddress; + } + + public void setFullAddress(String fullAddress) { + this.fullAddress = fullAddress; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxSheepSale.java b/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxSheepSale.java new file mode 100644 index 0000000..aab27dc --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/domain/SxSheepSale.java @@ -0,0 +1,545 @@ +package com.zhyc.module.sale.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; +import com.zhyc.common.annotation.Excel; +import com.zhyc.common.core.domain.BaseEntity; + +/** + * 羊只销售记录对象 sx_sheep_sale + * + * @author ruoyi + * @date 2025-08-19 + */ +public class SxSheepSale extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 耳号 */ + @Excel(name = "耳号") + private String bsManageTags; + + /** 羊舍ID(当时销售的羊舍) */ + @Excel(name = "羊舍ID", readConverterExp = "当=时销售的羊舍") + private Long sheepfoldId; + + /** 品种快照 */ + @Excel(name = "品种快照") + private String variety; + + /** 羊只类别快照 */ + @Excel(name = "羊只类别快照") + private String sheepName; + + /** 性别快照 */ + @Excel(name = "性别快照") + private String gender; + + /** 月龄快照 */ + @Excel(name = "月龄快照") + private Long monthAge; + + /** 胎次快照 */ + @Excel(name = "胎次快照") + private Long parity; + + /** 繁育状态快照 */ + @Excel(name = "繁育状态快照") + private String breed; + + /** 产后天数快照 */ + @Excel(name = "产后天数快照") + private Long postLambingDay; + + /** 泌乳天数快照 */ + @Excel(name = "泌乳天数快照") + private Long lactationDay; + + /** 怀孕天数快照 */ + @Excel(name = "怀孕天数快照") + private Long lambingDay; + + /** 事件类型 */ + @Excel(name = "事件类型") + private String eventType; + + /** 销售日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "销售日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date saleDate; + + /** 计价方式 */ + @Excel(name = "计价方式") + private String pricingMethod; + + /** 单价 */ + @Excel(name = "单价") + private BigDecimal unitPrice; + + /** 总价(自动计算) */ + @Excel(name = "总价", readConverterExp = "自=动计算") + private BigDecimal totalPrice; + + /** 总体重(按体重时输入) */ + @Excel(name = "总体重", readConverterExp = "按=体重时输入") + private BigDecimal totalWeight; + + /** 平均体重(自动) */ + @Excel(name = "平均体重", readConverterExp = "自=动") + private BigDecimal avgWeight; + + /** 平均单只价格(自动) */ + @Excel(name = "平均单只价格", readConverterExp = "自=动") + private BigDecimal avgPricePerSheep; + + /** 销售类别(dict_type = sale_type) */ + @Excel(name = "销售类别", readConverterExp = "d=ict_type,==,s=ale_type") + private String saleType; + + /** 疾病类型(dict_type = disea_type) */ + @Excel(name = "疾病类型", readConverterExp = "d=ict_type,==,d=isea_type") + private String diseaseType; + + /** 次要原因 */ + @Excel(name = "次要原因") + private String secondaryReason; + + /** 班组(dict_type = group) */ + @Excel(name = "班组", readConverterExp = "d=ict_type,==,g=roup") + private String groupCode; + + /** 客户ID(sx_customer.id) */ + @Excel(name = "客户ID", readConverterExp = "s=x_customer.id") + private Long customerId; + + /** 销售人员ID(sys_user.id) */ + @Excel(name = "销售人员ID", readConverterExp = "s=ys_user.id") + private Long salesPersonId; + + /** 检疫证号 */ + @Excel(name = "检疫证号") + private String quarantineNo; + + /** 审批编号 */ + @Excel(name = "审批编号") + private String approvalNo; + + /** 技术员ID(sys_user.id) */ + @Excel(name = "技术员ID", readConverterExp = "s=ys_user.id") + private Long technicianId; + + /** 处理人ID(sys_user.id) */ + @Excel(name = "处理人ID", readConverterExp = "s=ys_user.id") + private Long handlerId; + + /** 创建人ID(sys_user.id) */ + @Excel(name = "创建人ID", readConverterExp = "s=ys_user.id") + private Long createdBy; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdAt; + + // 【新增】非数据库字段:用于前端展示和选择羊舍后传递多个耳号 + private List bsManageTagsList; + + // 【新增】非数据库字段:客户名称(从客户表查询) + private String customerName; + // 【新增】非数据库字段:客户电话 + private String customerPhone; + // 【新增】非数据库字段:客户地址 + private String customerAddress; + // 【新增】非数据库字段:销售人员姓名 + private String salesPersonName; + // 【新增】非数据库字段:技术员姓名 + private String technicianName; + // 【新增】非数据库字段:处理人姓名 + private String handlerName; + // 【新增】非数据库字段:创建人姓名 + private String createdByName; + // 【新增】非数据库字段:羊舍名称 + private String sheepfoldName; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setBsManageTags(String bsManageTags) { + this.bsManageTags = bsManageTags; + } + + public String getBsManageTags() { + return bsManageTags; + } + + public void setSheepfoldId(Long sheepfoldId) { + this.sheepfoldId = sheepfoldId; + } + + public Long getSheepfoldId() { + return sheepfoldId; + } + + public void setVariety(String variety) { + this.variety = variety; + } + + public String getVariety() { + return variety; + } + + public void setSheepName(String sheepName) { + this.sheepName = sheepName; + } + + public String getSheepName() { + return sheepName; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public String getGender() { + return gender; + } + + public void setMonthAge(Long monthAge) { + this.monthAge = monthAge; + } + + public Long getMonthAge() { + return monthAge; + } + + public void setParity(Long parity) { + this.parity = parity; + } + + public Long getParity() { + return parity; + } + + public void setBreed(String breed) { + this.breed = breed; + } + + public String getBreed() { + return breed; + } + + public void setPostLambingDay(Long postLambingDay) { + this.postLambingDay = postLambingDay; + } + + public Long getPostLambingDay() { + return postLambingDay; + } + + public void setLactationDay(Long lactationDay) { + this.lactationDay = lactationDay; + } + + public Long getLactationDay() { + return lactationDay; + } + + public void setLambingDay(Long lambingDay) { + this.lambingDay = lambingDay; + } + + public Long getLambingDay() { + return lambingDay; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public String getEventType() { + return eventType; + } + + public void setSaleDate(Date saleDate) { + this.saleDate = saleDate; + } + + public Date getSaleDate() { + return saleDate; + } + + public void setPricingMethod(String pricingMethod) { + this.pricingMethod = pricingMethod; + } + + public String getPricingMethod() { + return pricingMethod; + } + + public void setUnitPrice(BigDecimal unitPrice) { + this.unitPrice = unitPrice; + } + + public BigDecimal getUnitPrice() { + return unitPrice; + } + + public void setTotalPrice(BigDecimal totalPrice) { + this.totalPrice = totalPrice; + } + + public BigDecimal getTotalPrice() { + return totalPrice; + } + + public void setTotalWeight(BigDecimal totalWeight) { + this.totalWeight = totalWeight; + } + + public BigDecimal getTotalWeight() { + return totalWeight; + } + + public void setAvgWeight(BigDecimal avgWeight) { + this.avgWeight = avgWeight; + } + + public BigDecimal getAvgWeight() { + return avgWeight; + } + + public void setAvgPricePerSheep(BigDecimal avgPricePerSheep) { + this.avgPricePerSheep = avgPricePerSheep; + } + + public BigDecimal getAvgPricePerSheep() { + return avgPricePerSheep; + } + + public void setSaleType(String saleType) { + this.saleType = saleType; + } + + public String getSaleType() { + return saleType; + } + + public void setDiseaseType(String diseaseType) { + this.diseaseType = diseaseType; + } + + public String getDiseaseType() { + return diseaseType; + } + + public void setSecondaryReason(String secondaryReason) { + this.secondaryReason = secondaryReason; + } + + public String getSecondaryReason() { + return secondaryReason; + } + + public void setGroupCode(String groupCode) { + this.groupCode = groupCode; + } + + public String getGroupCode() { + return groupCode; + } + + public void setCustomerId(Long customerId) { + this.customerId = customerId; + } + + public Long getCustomerId() { + return customerId; + } + + public void setSalesPersonId(Long salesPersonId) { + this.salesPersonId = salesPersonId; + } + + public Long getSalesPersonId() { + return salesPersonId; + } + + public void setQuarantineNo(String quarantineNo) { + this.quarantineNo = quarantineNo; + } + + public String getQuarantineNo() { + return quarantineNo; + } + + public void setApprovalNo(String approvalNo) { + this.approvalNo = approvalNo; + } + + public String getApprovalNo() { + return approvalNo; + } + + public void setTechnicianId(Long technicianId) { + this.technicianId = technicianId; + } + + public Long getTechnicianId() { + return technicianId; + } + + public void setHandlerId(Long handlerId) { + this.handlerId = handlerId; + } + + public Long getHandlerId() { + return handlerId; + } + + public void setCreatedBy(Long createdBy) { + this.createdBy = createdBy; + } + + public Long getCreatedBy() { + return createdBy; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getCreatedAt() { + return createdAt; + } + + // 【新增】getter 和 setter 方法 + public List getBsManageTagsList() { + return bsManageTagsList; + } + + public void setBsManageTagsList(List bsManageTagsList) { + this.bsManageTagsList = bsManageTagsList; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public String getCustomerPhone() { + return customerPhone; + } + + public void setCustomerPhone(String customerPhone) { + this.customerPhone = customerPhone; + } + + public String getCustomerAddress() { + return customerAddress; + } + + public void setCustomerAddress(String customerAddress) { + this.customerAddress = customerAddress; + } + + public String getSalesPersonName() { + return salesPersonName; + } + + public void setSalesPersonName(String salesPersonName) { + this.salesPersonName = salesPersonName; + } + + public String getTechnicianName() { + return technicianName; + } + + public void setTechnicianName(String technicianName) { + this.technicianName = technicianName; + } + + public String getHandlerName() { + return handlerName; + } + + public void setHandlerName(String handlerName) { + this.handlerName = handlerName; + } + + public String getCreatedByName() { + return createdByName; + } + + public void setCreatedByName(String createdByName) { + this.createdByName = createdByName; + } + + public String getSheepfoldName() { + return sheepfoldName; + } + + public void setSheepfoldName(String sheepfoldName) { + this.sheepfoldName = sheepfoldName; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("bsManageTags", getBsManageTags()) + .append("sheepfoldId", getSheepfoldId()) + .append("variety", getVariety()) + .append("sheepName", getSheepName()) + .append("gender", getGender()) + .append("monthAge", getMonthAge()) + .append("parity", getParity()) + .append("breed", getBreed()) + .append("postLambingDay", getPostLambingDay()) + .append("lactationDay", getLactationDay()) + .append("lambingDay", getLambingDay()) + .append("eventType", getEventType()) + .append("saleDate", getSaleDate()) + .append("pricingMethod", getPricingMethod()) + .append("unitPrice", getUnitPrice()) + .append("totalPrice", getTotalPrice()) + .append("totalWeight", getTotalWeight()) + .append("avgWeight", getAvgWeight()) + .append("avgPricePerSheep", getAvgPricePerSheep()) + .append("saleType", getSaleType()) + .append("diseaseType", getDiseaseType()) + .append("secondaryReason", getSecondaryReason()) + .append("groupCode", getGroupCode()) + .append("customerId", getCustomerId()) + .append("salesPersonId", getSalesPersonId()) + .append("quarantineNo", getQuarantineNo()) + .append("approvalNo", getApprovalNo()) + .append("technicianId", getTechnicianId()) + .append("handlerId", getHandlerId()) + .append("createdBy", getCreatedBy()) + .append("createdAt", getCreatedAt()) + .append("remark", getRemark()) + .append("customerName", getCustomerName()) + .append("customerPhone", getCustomerPhone()) + .append("customerAddress", getCustomerAddress()) + .append("salesPersonName", getSalesPersonName()) + .append("technicianName", getTechnicianName()) + .append("handlerName", getHandlerName()) + .append("createdByName", getCreatedByName()) + .append("sheepfoldName", getSheepfoldName()) + .toString(); + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/mapper/SxSheepSaleMapper.java b/zhyc-module/src/main/java/com/zhyc/module/sale/mapper/SxSheepSaleMapper.java new file mode 100644 index 0000000..8b6788f --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/mapper/SxSheepSaleMapper.java @@ -0,0 +1,68 @@ +package com.zhyc.module.sale.mapper; + +import java.util.List; +import com.zhyc.module.sale.domain.SxSheepSale; +import org.apache.ibatis.annotations.Param; + +/** + * 羊只销售记录Mapper接口 + * + * @author ruoyi + * @date 2025-08-19 + */ +public interface SxSheepSaleMapper { + /** + * 查询羊只销售记录 + * + * @param id 羊只销售记录主键 + * @return 羊只销售记录 + */ + public SxSheepSale selectSxSheepSaleById(Long id); + + /** + * 查询羊只销售记录列表 + * + * @param sxSheepSale 羊只销售记录 + * @return 羊只销售记录集合 + */ + public List selectSxSheepSaleList(SxSheepSale sxSheepSale); + + /** + * 新增羊只销售记录 + * + * @param sxSheepSale 羊只销售记录 + * @return 结果 + */ + public int insertSxSheepSale(SxSheepSale sxSheepSale); + + /** + * 修改羊只销售记录 + * + * @param sxSheepSale 羊只销售记录 + * @return 结果 + */ + public int updateSxSheepSale(SxSheepSale sxSheepSale); + + /** + * 删除羊只销售记录 + * + * @param id 羊只销售记录主键 + * @return 结果 + */ + public int deleteSxSheepSaleById(Long id); + + /** + * 批量删除羊只销售记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSxSheepSaleByIds(Long[] ids); + + /** + * 【新增】从sheep_file视图查询羊只信息 + * @param bsManageTags 耳号 + * @return 羊只信息 (只包含视图中的字段) + */ + public SxSheepSale selectSheepInfoByTag(@Param("bsManageTags") String bsManageTags); +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/service/ISxSheepSaleService.java b/zhyc-module/src/main/java/com/zhyc/module/sale/service/ISxSheepSaleService.java new file mode 100644 index 0000000..bbdc73a --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/service/ISxSheepSaleService.java @@ -0,0 +1,67 @@ +package com.zhyc.module.sale.service; + +import java.util.List; +import com.zhyc.module.sale.domain.SxSheepSale; + +/** + * 羊只销售记录Service接口 + * + * @author ruoyi + * @date 2025-08-19 + */ +public interface ISxSheepSaleService { + /** + * 查询羊只销售记录 + * + * @param id 羊只销售记录主键 + * @return 羊只销售记录 + */ + public SxSheepSale selectSxSheepSaleById(Long id); + + /** + * 查询羊只销售记录列表 + * + * @param sxSheepSale 羊只销售记录 + * @return 羊只销售记录集合 + */ + public List selectSxSheepSaleList(SxSheepSale sxSheepSale); + + /** + * 新增羊只销售记录 + * + * @param sxSheepSale 羊只销售记录 + * @return 结果 + */ + public int insertSxSheepSale(SxSheepSale sxSheepSale); + + /** + * 修改羊只销售记录 + * + * @param sxSheepSale 羊只销售记录 + * @return 结果 + */ + public int updateSxSheepSale(SxSheepSale sxSheepSale); + + /** + * 批量删除羊只销售记录 + * + * @param ids 需要删除的羊只销售记录主键集合 + * @return 结果 + */ + public int deleteSxSheepSaleByIds(Long[] ids); + + /** + * 删除羊只销售记录信息 + * + * @param id 羊只销售记录主键 + * @return 结果 + */ + public int deleteSxSheepSaleById(Long id); + + /** + * 【新增】根据耳号查询羊只信息 + * @param bsManageTags 耳号 + * @return 羊只信息 + */ + public SxSheepSale selectSheepInfoByTag(String bsManageTags); +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/sale/service/impl/SxSheepSaleServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/sale/service/impl/SxSheepSaleServiceImpl.java new file mode 100644 index 0000000..2c47d5c --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/sale/service/impl/SxSheepSaleServiceImpl.java @@ -0,0 +1,194 @@ +package com.zhyc.module.sale.service.impl; + +import java.util.List; +import java.math.BigDecimal; +import java.math.RoundingMode; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.sale.mapper.SxSheepSaleMapper; +import com.zhyc.module.sale.domain.SxSheepSale; +import com.zhyc.module.sale.service.ISxSheepSaleService; + +/** + * 羊只销售记录Service业务层处理 + * + * @author ruoyi + * @date 2025-08-19 + */ +@Service +public class SxSheepSaleServiceImpl implements ISxSheepSaleService { + @Autowired + private SxSheepSaleMapper sxSheepSaleMapper; + + /** + * 查询羊只销售记录 + * + * @param id 羊只销售记录主键 + * @return 羊只销售记录 + */ + @Override + public SxSheepSale selectSxSheepSaleById(Long id) { + return sxSheepSaleMapper.selectSxSheepSaleById(id); + } + + /** + * 查询羊只销售记录列表 + * + * @param sxSheepSale 羊只销售记录 + * @return 羊只销售记录 + */ + @Override + public List selectSxSheepSaleList(SxSheepSale sxSheepSale) { + return sxSheepSaleMapper.selectSxSheepSaleList(sxSheepSale); + } + + /** + * 新增羊只销售记录 + * + * @param sxSheepSale 羊只销售记录 + * @return 结果 + */ + @Override + public int insertSxSheepSale(SxSheepSale sxSheepSale) { + // 1. 业务验证 (例如:销售日期不能为空,淘汰销售必须填写疾病类型等) + validateSalesFields(sxSheepSale); + + // 2. 自动计算逻辑 + calculateSalesFields(sxSheepSale); + + // 3. 设置默认事件类型 + if (sxSheepSale.getEventType() == null) { + sxSheepSale.setEventType("销售"); + } + + // 4. 处理耳号列表(多个耳号用逗号分隔) + if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) { + sxSheepSale.setBsManageTags(String.join(",", sxSheepSale.getBsManageTagsList())); + } + + // 5. 调用Mapper插入数据 + return sxSheepSaleMapper.insertSxSheepSale(sxSheepSale); + } + + /** + * 修改羊只销售记录 + * + * @param sxSheepSale 羊只销售记录 + * @return 结果 + */ + @Override + public int updateSxSheepSale(SxSheepSale sxSheepSale) { + // 1. 业务验证 + validateSalesFields(sxSheepSale); + + // 2. 自动计算逻辑 + calculateSalesFields(sxSheepSale); + + // 3. 处理耳号列表(多个耳号用逗号分隔) + if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) { + sxSheepSale.setBsManageTags(String.join(",", sxSheepSale.getBsManageTagsList())); + } + + // 4. 调用Mapper更新数据 + return sxSheepSaleMapper.updateSxSheepSale(sxSheepSale); + } + + /** + * 批量删除羊只销售记录 + * + * @param ids 需要删除的羊只销售记录主键 + * @return 结果 + */ + @Override + public int deleteSxSheepSaleByIds(Long[] ids) { + return sxSheepSaleMapper.deleteSxSheepSaleByIds(ids); + } + + /** + * 删除羊只销售记录信息 + * + * @param id 羊只销售记录主键 + * @return 结果 + */ + @Override + public int deleteSxSheepSaleById(Long id) { + return sxSheepSaleMapper.deleteSxSheepSaleById(id); + } + + /** + * 【新增】根据耳号查询羊只信息 + */ + @Override + public SxSheepSale selectSheepInfoByTag(String bsManageTags) { + return sxSheepSaleMapper.selectSheepInfoByTag(bsManageTags); + } + + /** + * 【新增】自动计算总价、平均体重、平均单只价格 + */ + private void calculateSalesFields(SxSheepSale sxSheepSale) { + String pricingMethod = sxSheepSale.getPricingMethod(); + BigDecimal unitPrice = sxSheepSale.getUnitPrice(); + + // 获取羊只数量 + int sheepCount = 1; + if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) { + sheepCount = sxSheepSale.getBsManageTagsList().size(); + } else if (sxSheepSale.getBsManageTags() != null && !sxSheepSale.getBsManageTags().isEmpty()) { + // 如果前端没有传递列表,但有逗号分隔的字符串,也计算数量 + sheepCount = sxSheepSale.getBsManageTags().split(",").length; + } + + if ("按个体".equals(pricingMethod)) { + // 总价 = 单价 * 数量 + if (unitPrice != null) { + sxSheepSale.setTotalPrice(unitPrice.multiply(new BigDecimal(sheepCount))); + } + // 平均单只价格就是单价 + sxSheepSale.setAvgPricePerSheep(unitPrice); + + } else if ("按体重".equals(pricingMethod)) { + BigDecimal totalWeight = sxSheepSale.getTotalWeight(); + // 总价 = 单价 * 总重量 + if (unitPrice != null && totalWeight != null) { + sxSheepSale.setTotalPrice(unitPrice.multiply(totalWeight)); + } + // 平均体重 = 总重量 / 数量 + if (totalWeight != null && sheepCount > 0) { + sxSheepSale.setAvgWeight(totalWeight.divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP)); + } + // 平均单只价格 = 总价 / 数量 + if (sxSheepSale.getTotalPrice() != null && sheepCount > 0) { + sxSheepSale.setAvgPricePerSheep(sxSheepSale.getTotalPrice().divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP)); + } + } + // 可以添加其他计价方式的逻辑 + } + + /** + * 【新增】业务字段验证 + */ + private void validateSalesFields(SxSheepSale sxSheepSale) { + // 验证销售日期不能为空 + if (sxSheepSale.getSaleDate() == null) { + throw new RuntimeException("销售日期不能为空!"); + } + + String saleType = sxSheepSale.getSaleType(); + // 如果销售类别是"淘汰销售"或"淘汰屠宰",则疾病类型和班组不能为空 + if ("淘汰销售".equals(saleType) || "淘汰屠宰".equals(saleType)) { + if (sxSheepSale.getDiseaseType() == null) { + throw new RuntimeException("淘汰销售或淘汰屠宰必须选择疾病类型!"); + } + if (sxSheepSale.getGroupCode() == null) { + throw new RuntimeException("淘汰销售或淘汰屠宰必须选择班组!"); + } + } + // 如果疾病类型是"病残羊",则次要原因不能为空 + if ("病残羊".equals(sxSheepSale.getDiseaseType())) { + if (sxSheepSale.getSecondaryReason() == null || sxSheepSale.getSecondaryReason().trim().isEmpty()) { + throw new RuntimeException("疾病类型为病残羊时,必须填写次要原因!"); + } + } + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/dairyProducts/XzDryMatterCorrectionMapper.xml b/zhyc-module/src/main/resources/mapper/dairyProducts/XzDryMatterCorrectionMapper.xml index eb20ee1..0fd5b29 100644 --- a/zhyc-module/src/main/resources/mapper/dairyProducts/XzDryMatterCorrectionMapper.xml +++ b/zhyc-module/src/main/resources/mapper/dairyProducts/XzDryMatterCorrectionMapper.xml @@ -13,17 +13,18 @@ + SELECT - id, - datetime, - factory, - content, - standard, - CASE - WHEN standard = 0 OR standard IS NULL THEN NULL - ELSE content / standard - END AS coefficient + id, + datetime, + factory, + content, + COALESCE(standard, 18) as standard, + CASE + WHEN standard = 0 OR standard IS NULL THEN NULL + ELSE ROUND(content / standard, 2) + END AS coefficient FROM xz_dry_matter_correction diff --git a/zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml b/zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml new file mode 100644 index 0000000..00ac0da --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, bs_manage_tags, sheepfold_id, variety, sheep_name, gender, month_age, parity, breed, post_lambing_day, lactation_day, lambing_day, event_type, sale_date, pricing_method, unit_price, total_price, total_weight, avg_weight, avg_price_per_sheep, sale_type, disease_type, secondary_reason, group_code, customer_id, sales_person_id, quarantine_no, approval_no, technician_id, handler_id, created_by, created_at, remark from sx_sheep_sale + + + + + select + bs_manage_tags, + variety, + name as sheep_name, + gender, + month_age, + parity, + breed, + post_lambing_day, + lactation_day, + lambing_day, + sheepfold_id + from sheep_file + + + + + + + + + + + insert into sx_sheep_sale + + bs_manage_tags, + sheepfold_id, + variety, + sheep_name, + gender, + month_age, + parity, + breed, + post_lambing_day, + lactation_day, + lambing_day, + event_type, + sale_date, + pricing_method, + unit_price, + total_price, + total_weight, + avg_weight, + avg_price_per_sheep, + sale_type, + disease_type, + secondary_reason, + group_code, + customer_id, + sales_person_id, + quarantine_no, + approval_no, + technician_id, + handler_id, + created_by, + created_at, + remark, + + + #{bsManageTags}, + #{sheepfoldId}, + #{variety}, + #{sheepName}, + #{gender}, + #{monthAge}, + #{parity}, + #{breed}, + #{postLambingDay}, + #{lactationDay}, + #{lambingDay}, + #{eventType}, + #{saleDate}, + #{pricingMethod}, + #{unitPrice}, + #{totalPrice}, + #{totalWeight}, + #{avgWeight}, + #{avgPricePerSheep}, + #{saleType}, + #{diseaseType}, + #{secondaryReason}, + #{groupCode}, + #{customerId}, + #{salesPersonId}, + #{quarantineNo}, + #{approvalNo}, + #{technicianId}, + #{handlerId}, + #{createdBy}, + #{createdAt}, + #{remark}, + + + + + update sx_sheep_sale + + bs_manage_tags = #{bsManageTags}, + sheepfold_id = #{sheepfoldId}, + variety = #{variety}, + sheep_name = #{sheepName}, + gender = #{gender}, + month_age = #{monthAge}, + parity = #{parity}, + breed = #{breed}, + post_lambing_day = #{postLambingDay}, + lactation_day = #{lactationDay}, + lambing_day = #{lambingDay}, + event_type = #{eventType}, + sale_date = #{saleDate}, + pricing_method = #{pricingMethod}, + unit_price = #{unitPrice}, + total_price = #{totalPrice}, + total_weight = #{totalWeight}, + avg_weight = #{avgWeight}, + avg_price_per_sheep = #{avgPricePerSheep}, + sale_type = #{saleType}, + disease_type = #{diseaseType}, + secondary_reason = #{secondaryReason}, + group_code = #{groupCode}, + customer_id = #{customerId}, + sales_person_id = #{salesPersonId}, + quarantine_no = #{quarantineNo}, + approval_no = #{approvalNo}, + technician_id = #{technicianId}, + handler_id = #{handlerId}, + created_by = #{createdBy}, + created_at = #{createdAt}, + remark = #{remark}, + + where id = #{id} + + + + delete from sx_sheep_sale where id = #{id} + + + + delete from sx_sheep_sale where id in + + #{id} + + + + \ No newline at end of file