Compare commits
3 Commits
c0fe74aca3
...
84bc894668
| Author | SHA1 | Date | |
|---|---|---|---|
| 84bc894668 | |||
| 3dd5d37076 | |||
| a04ccfa5cf |
@ -19,12 +19,13 @@ import com.zhyc.common.enums.BusinessType;
|
||||
import com.zhyc.module.dairyProducts.domain.XzParityCorrection;
|
||||
import com.zhyc.module.dairyProducts.service.IXzParityCorrectionService;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 胎次校正Controller
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-14
|
||||
* @date 2025-08-24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/parityCorrection/parityCorrection")
|
||||
@ -37,20 +38,12 @@ public class XzParityCorrectionController extends BaseController
|
||||
* 查询胎次校正列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('parityCorrection:parityCorrection:list')")
|
||||
// @GetMapping("/list")
|
||||
// public TableDataInfo list(XzParityCorrection xzParityCorrection)
|
||||
// {
|
||||
// startPage();
|
||||
// List<XzParityCorrection> list = xzParityCorrectionService.selectXzParityCorrectionList(xzParityCorrection);
|
||||
// return getDataTable(list);
|
||||
// }
|
||||
/**
|
||||
* 获取全部胎次校正(无需分页,供下拉/列表直接显示)
|
||||
*/
|
||||
@GetMapping("/listAll")
|
||||
public AjaxResult listAll(XzParityCorrection xzParityCorrection){
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(XzParityCorrection xzParityCorrection)
|
||||
{
|
||||
startPage();
|
||||
List<XzParityCorrection> list = xzParityCorrectionService.selectXzParityCorrectionList(xzParityCorrection);
|
||||
return success(list); // 直接返回数组
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,7 +96,7 @@ public class XzParityCorrectionController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('parityCorrection:parityCorrection:remove')")
|
||||
@Log(title = "胎次校正", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(xzParityCorrectionService.deleteXzParityCorrectionByIds(ids));
|
||||
|
||||
@ -1,20 +1,16 @@
|
||||
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;
|
||||
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;
|
||||
@ -30,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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,20 +2,18 @@ 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
|
||||
public interface XzParityCorrectionMapper
|
||||
{
|
||||
/**
|
||||
* 查询胎次校正
|
||||
*
|
||||
*
|
||||
* @param id 胎次校正主键
|
||||
* @return 胎次校正
|
||||
*/
|
||||
@ -23,7 +21,7 @@ public interface XzParityCorrectionMapper
|
||||
|
||||
/**
|
||||
* 查询胎次校正列表
|
||||
*
|
||||
*
|
||||
* @param xzParityCorrection 胎次校正
|
||||
* @return 胎次校正集合
|
||||
*/
|
||||
@ -31,7 +29,7 @@ public interface XzParityCorrectionMapper
|
||||
|
||||
/**
|
||||
* 新增胎次校正
|
||||
*
|
||||
*
|
||||
* @param xzParityCorrection 胎次校正
|
||||
* @return 结果
|
||||
*/
|
||||
@ -39,7 +37,7 @@ public interface XzParityCorrectionMapper
|
||||
|
||||
/**
|
||||
* 修改胎次校正
|
||||
*
|
||||
*
|
||||
* @param xzParityCorrection 胎次校正
|
||||
* @return 结果
|
||||
*/
|
||||
@ -47,7 +45,7 @@ public interface XzParityCorrectionMapper
|
||||
|
||||
/**
|
||||
* 删除胎次校正
|
||||
*
|
||||
*
|
||||
* @param id 胎次校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -55,7 +53,7 @@ public interface XzParityCorrectionMapper
|
||||
|
||||
/**
|
||||
* 批量删除胎次校正
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@ -1,20 +1,19 @@
|
||||
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
|
||||
public interface IXzParityCorrectionService
|
||||
{
|
||||
/**
|
||||
* 查询胎次校正
|
||||
*
|
||||
*
|
||||
* @param id 胎次校正主键
|
||||
* @return 胎次校正
|
||||
*/
|
||||
@ -22,7 +21,7 @@ public interface IXzParityCorrectionService
|
||||
|
||||
/**
|
||||
* 查询胎次校正列表
|
||||
*
|
||||
*
|
||||
* @param xzParityCorrection 胎次校正
|
||||
* @return 胎次校正集合
|
||||
*/
|
||||
@ -30,7 +29,7 @@ public interface IXzParityCorrectionService
|
||||
|
||||
/**
|
||||
* 新增胎次校正
|
||||
*
|
||||
*
|
||||
* @param xzParityCorrection 胎次校正
|
||||
* @return 结果
|
||||
*/
|
||||
@ -38,7 +37,7 @@ public interface IXzParityCorrectionService
|
||||
|
||||
/**
|
||||
* 修改胎次校正
|
||||
*
|
||||
*
|
||||
* @param xzParityCorrection 胎次校正
|
||||
* @return 结果
|
||||
*/
|
||||
@ -46,7 +45,7 @@ public interface IXzParityCorrectionService
|
||||
|
||||
/**
|
||||
* 批量删除胎次校正
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的胎次校正主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@ -54,7 +53,7 @@ public interface IXzParityCorrectionService
|
||||
|
||||
/**
|
||||
* 删除胎次校正信息
|
||||
*
|
||||
*
|
||||
* @param id 胎次校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@ -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<XzDryMatterCorrection> existingRecords = xzDryMatterCorrectionMapper.selectXzDryMatterCorrectionList(query);
|
||||
|
||||
// 如果是更新操作,需要排除当前记录
|
||||
if (xzDryMatterCorrection.getId() != null) {
|
||||
return existingRecords.stream()
|
||||
.anyMatch(record ->
|
||||
!record.getId().equals(xzDryMatterCorrection.getId())
|
||||
);
|
||||
}
|
||||
|
||||
// 如果是新增操作,只要存在记录就返回true
|
||||
return !existingRecords.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除干物质校正
|
||||
*
|
||||
|
||||
@ -1,28 +1,27 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 胎次校正Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-14
|
||||
* @date 2025-08-24
|
||||
*/
|
||||
@Service
|
||||
public class XzParityCorrectionServiceImpl implements IXzParityCorrectionService
|
||||
public class XzParityCorrectionServiceImpl implements IXzParityCorrectionService
|
||||
{
|
||||
@Autowired
|
||||
private XzParityCorrectionMapper xzParityCorrectionMapper;
|
||||
|
||||
/**
|
||||
* 查询胎次校正
|
||||
*
|
||||
*
|
||||
* @param id 胎次校正主键
|
||||
* @return 胎次校正
|
||||
*/
|
||||
@ -34,7 +33,7 @@ public class XzParityCorrectionServiceImpl implements IXzParityCorrectionService
|
||||
|
||||
/**
|
||||
* 查询胎次校正列表
|
||||
*
|
||||
*
|
||||
* @param xzParityCorrection 胎次校正
|
||||
* @return 胎次校正
|
||||
*/
|
||||
@ -46,7 +45,7 @@ public class XzParityCorrectionServiceImpl implements IXzParityCorrectionService
|
||||
|
||||
/**
|
||||
* 新增胎次校正
|
||||
*
|
||||
*
|
||||
* @param xzParityCorrection 胎次校正
|
||||
* @return 结果
|
||||
*/
|
||||
@ -58,7 +57,7 @@ public class XzParityCorrectionServiceImpl implements IXzParityCorrectionService
|
||||
|
||||
/**
|
||||
* 修改胎次校正
|
||||
*
|
||||
*
|
||||
* @param xzParityCorrection 胎次校正
|
||||
* @return 结果
|
||||
*/
|
||||
@ -70,7 +69,7 @@ public class XzParityCorrectionServiceImpl implements IXzParityCorrectionService
|
||||
|
||||
/**
|
||||
* 批量删除胎次校正
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的胎次校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -82,7 +81,7 @@ public class XzParityCorrectionServiceImpl implements IXzParityCorrectionService
|
||||
|
||||
/**
|
||||
* 删除胎次校正信息
|
||||
*
|
||||
*
|
||||
* @param id 胎次校正主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@ -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<XzWegihCorrection> 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);
|
||||
}
|
||||
|
||||
|
||||
@ -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<SxSheepSale> 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<SxSheepSale> list = sxSheepSaleService.selectSxSheepSaleList(sxSheepSale);
|
||||
ExcelUtil<SxSheepSale> util = new ExcelUtil<SxSheepSale>(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);
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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<String> 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<String> getBsManageTagsList() {
|
||||
return bsManageTagsList;
|
||||
}
|
||||
|
||||
public void setBsManageTagsList(List<String> 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();
|
||||
}
|
||||
}
|
||||
@ -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<SxSheepSale> 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);
|
||||
}
|
||||
@ -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<SxSheepSale> 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);
|
||||
}
|
||||
@ -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<SxSheepSale> 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("疾病类型为病残羊时,必须填写次要原因!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13,17 +13,18 @@
|
||||
<result property="coefficient" column="coefficient"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 修改SQL片段,系数保留两位小数 -->
|
||||
<sql id="selectXzDryMatterCorrectionVo">
|
||||
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, <!-- 设置默认值为18 -->
|
||||
CASE
|
||||
WHEN standard = 0 OR standard IS NULL THEN NULL
|
||||
ELSE ROUND(content / standard, 2) <!-- 系数保留两位小数 -->
|
||||
END AS coefficient
|
||||
FROM xz_dry_matter_correction
|
||||
</sql>
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.dairyProducts.mapper.XzParityCorrectionMapper">
|
||||
|
||||
|
||||
<resultMap type="XzParityCorrection" id="XzParityCorrectionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="parity" column="parity" />
|
||||
@ -16,12 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectXzParityCorrectionList" parameterType="XzParityCorrection" resultMap="XzParityCorrectionResult">
|
||||
<include refid="selectXzParityCorrectionVo"/>
|
||||
<where>
|
||||
<where>
|
||||
<if test="parity != null "> and parity = #{parity}</if>
|
||||
<if test="coef != null "> and coef = #{coef}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectXzParityCorrectionById" parameterType="Long" resultMap="XzParityCorrectionResult">
|
||||
<include refid="selectXzParityCorrectionVo"/>
|
||||
where id = #{id}
|
||||
@ -32,11 +32,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="coef != null">coef,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="coef != null">#{coef},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateXzParityCorrection" parameterType="XzParityCorrection">
|
||||
@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteXzParityCorrectionByIds" parameterType="String">
|
||||
delete from xz_parity_correction where id in
|
||||
delete from xz_parity_correction where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
207
zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml
Normal file
207
zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml
Normal file
@ -0,0 +1,207 @@
|
||||
<?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.sale.mapper.SxSheepSaleMapper">
|
||||
|
||||
<resultMap type="SxSheepSale" id="SxSheepSaleResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="bsManageTags" column="bs_manage_tags" />
|
||||
<result property="sheepfoldId" column="sheepfold_id" />
|
||||
<result property="variety" column="variety" />
|
||||
<result property="sheepName" column="sheep_name" />
|
||||
<result property="gender" column="gender" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="breed" column="breed" />
|
||||
<result property="postLambingDay" column="post_lambing_day" />
|
||||
<result property="lactationDay" column="lactation_day" />
|
||||
<result property="lambingDay" column="lambing_day" />
|
||||
<result property="eventType" column="event_type" />
|
||||
<result property="saleDate" column="sale_date" />
|
||||
<result property="pricingMethod" column="pricing_method" />
|
||||
<result property="unitPrice" column="unit_price" />
|
||||
<result property="totalPrice" column="total_price" />
|
||||
<result property="totalWeight" column="total_weight" />
|
||||
<result property="avgWeight" column="avg_weight" />
|
||||
<result property="avgPricePerSheep" column="avg_price_per_sheep" />
|
||||
<result property="saleType" column="sale_type" />
|
||||
<result property="diseaseType" column="disease_type" />
|
||||
<result property="secondaryReason" column="secondary_reason" />
|
||||
<result property="groupCode" column="group_code" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="salesPersonId" column="sales_person_id" />
|
||||
<result property="quarantineNo" column="quarantine_no" />
|
||||
<result property="approvalNo" column="approval_no" />
|
||||
<result property="technicianId" column="technician_id" />
|
||||
<result property="handlerId" column="handler_id" />
|
||||
<result property="createdBy" column="created_by" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSxSheepSaleVo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<!-- 【新增】根据耳号查询羊只信息的SQL片段 -->
|
||||
<sql id="selectSheepFileVo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<!-- 【新增】根据耳号查询羊只信息 -->
|
||||
<select id="selectSheepInfoByTag" parameterType="String" resultMap="SxSheepSaleResult">
|
||||
<include refid="selectSheepFileVo"/>
|
||||
where bs_manage_tags = #{bsManageTags}
|
||||
</select>
|
||||
|
||||
<select id="selectSxSheepSaleList" parameterType="SxSheepSale" resultMap="SxSheepSaleResult">
|
||||
<include refid="selectSxSheepSaleVo"/>
|
||||
<where>
|
||||
<if test="bsManageTags != null and bsManageTags != ''"> and bs_manage_tags = #{bsManageTags}</if>
|
||||
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="variety != null and variety != ''"> and variety = #{variety}</if>
|
||||
<if test="sheepName != null and sheepName != ''"> and sheep_name = #{sheepName}</if>
|
||||
<if test="saleDate != null"> and sale_date = #{saleDate}</if>
|
||||
<if test="saleType != null and saleType != ''"> and sale_type = #{saleType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSxSheepSaleById" parameterType="Long" resultMap="SxSheepSaleResult">
|
||||
<include refid="selectSxSheepSaleVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSxSheepSale" parameterType="SxSheepSale" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sx_sheep_sale
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="bsManageTags != null and bsManageTags != ''">bs_manage_tags,</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||
<if test="variety != null and variety != ''">variety,</if>
|
||||
<if test="sheepName != null and sheepName != ''">sheep_name,</if>
|
||||
<if test="gender != null and gender != ''">gender,</if>
|
||||
<if test="monthAge != null">month_age,</if>
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="breed != null and breed != ''">breed,</if>
|
||||
<if test="postLambingDay != null">post_lambing_day,</if>
|
||||
<if test="lactationDay != null">lactation_day,</if>
|
||||
<if test="lambingDay != null">lambing_day,</if>
|
||||
<if test="eventType != null and eventType != ''">event_type,</if>
|
||||
<if test="saleDate != null">sale_date,</if>
|
||||
<if test="pricingMethod != null and pricingMethod != ''">pricing_method,</if>
|
||||
<if test="unitPrice != null">unit_price,</if>
|
||||
<if test="totalPrice != null">total_price,</if>
|
||||
<if test="totalWeight != null">total_weight,</if>
|
||||
<if test="avgWeight != null">avg_weight,</if>
|
||||
<if test="avgPricePerSheep != null">avg_price_per_sheep,</if>
|
||||
<if test="saleType != null and saleType != ''">sale_type,</if>
|
||||
<if test="diseaseType != null and diseaseType != ''">disease_type,</if>
|
||||
<if test="secondaryReason != null and secondaryReason != ''">secondary_reason,</if>
|
||||
<if test="groupCode != null and groupCode != ''">group_code,</if>
|
||||
<if test="customerId != null">customer_id,</if>
|
||||
<if test="salesPersonId != null">sales_person_id,</if>
|
||||
<if test="quarantineNo != null and quarantineNo != ''">quarantine_no,</if>
|
||||
<if test="approvalNo != null and approvalNo != ''">approval_no,</if>
|
||||
<if test="technicianId != null">technician_id,</if>
|
||||
<if test="handlerId != null">handler_id,</if>
|
||||
<if test="createdBy != null">created_by,</if>
|
||||
<if test="createdAt != null">created_at,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="bsManageTags != null and bsManageTags != ''">#{bsManageTags},</if>
|
||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||
<if test="variety != null and variety != ''">#{variety},</if>
|
||||
<if test="sheepName != null and sheepName != ''">#{sheepName},</if>
|
||||
<if test="gender != null and gender != ''">#{gender},</if>
|
||||
<if test="monthAge != null">#{monthAge},</if>
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="breed != null and breed != ''">#{breed},</if>
|
||||
<if test="postLambingDay != null">#{postLambingDay},</if>
|
||||
<if test="lactationDay != null">#{lactationDay},</if>
|
||||
<if test="lambingDay != null">#{lambingDay},</if>
|
||||
<if test="eventType != null and eventType != ''">#{eventType},</if>
|
||||
<if test="saleDate != null">#{saleDate},</if>
|
||||
<if test="pricingMethod != null and pricingMethod != ''">#{pricingMethod},</if>
|
||||
<if test="unitPrice != null">#{unitPrice},</if>
|
||||
<if test="totalPrice != null">#{totalPrice},</if>
|
||||
<if test="totalWeight != null">#{totalWeight},</if>
|
||||
<if test="avgWeight != null">#{avgWeight},</if>
|
||||
<if test="avgPricePerSheep != null">#{avgPricePerSheep},</if>
|
||||
<if test="saleType != null and saleType != ''">#{saleType},</if>
|
||||
<if test="diseaseType != null and diseaseType != ''">#{diseaseType},</if>
|
||||
<if test="secondaryReason != null and secondaryReason != ''">#{secondaryReason},</if>
|
||||
<if test="groupCode != null and groupCode != ''">#{groupCode},</if>
|
||||
<if test="customerId != null">#{customerId},</if>
|
||||
<if test="salesPersonId != null">#{salesPersonId},</if>
|
||||
<if test="quarantineNo != null and quarantineNo != ''">#{quarantineNo},</if>
|
||||
<if test="approvalNo != null and approvalNo != ''">#{approvalNo},</if>
|
||||
<if test="technicianId != null">#{technicianId},</if>
|
||||
<if test="handlerId != null">#{handlerId},</if>
|
||||
<if test="createdBy != null">#{createdBy},</if>
|
||||
<if test="createdAt != null">#{createdAt},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSxSheepSale" parameterType="SxSheepSale">
|
||||
update sx_sheep_sale
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="bsManageTags != null and bsManageTags != ''">bs_manage_tags = #{bsManageTags},</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
||||
<if test="variety != null and variety != ''">variety = #{variety},</if>
|
||||
<if test="sheepName != null and sheepName != ''">sheep_name = #{sheepName},</if>
|
||||
<if test="gender != null and gender != ''">gender = #{gender},</if>
|
||||
<if test="monthAge != null">month_age = #{monthAge},</if>
|
||||
<if test="parity != null">parity = #{parity},</if>
|
||||
<if test="breed != null and breed != ''">breed = #{breed},</if>
|
||||
<if test="postLambingDay != null">post_lambing_day = #{postLambingDay},</if>
|
||||
<if test="lactationDay != null">lactation_day = #{lactationDay},</if>
|
||||
<if test="lambingDay != null">lambing_day = #{lambingDay},</if>
|
||||
<if test="eventType != null and eventType != ''">event_type = #{eventType},</if>
|
||||
<if test="saleDate != null">sale_date = #{saleDate},</if>
|
||||
<if test="pricingMethod != null and pricingMethod != ''">pricing_method = #{pricingMethod},</if>
|
||||
<if test="unitPrice != null">unit_price = #{unitPrice},</if>
|
||||
<if test="totalPrice != null">total_price = #{totalPrice},</if>
|
||||
<if test="totalWeight != null">total_weight = #{totalWeight},</if>
|
||||
<if test="avgWeight != null">avg_weight = #{avgWeight},</if>
|
||||
<if test="avgPricePerSheep != null">avg_price_per_sheep = #{avgPricePerSheep},</if>
|
||||
<if test="saleType != null and saleType != ''">sale_type = #{saleType},</if>
|
||||
<if test="diseaseType != null and diseaseType != ''">disease_type = #{diseaseType},</if>
|
||||
<if test="secondaryReason != null and secondaryReason != ''">secondary_reason = #{secondaryReason},</if>
|
||||
<if test="groupCode != null and groupCode != ''">group_code = #{groupCode},</if>
|
||||
<if test="customerId != null">customer_id = #{customerId},</if>
|
||||
<if test="salesPersonId != null">sales_person_id = #{salesPersonId},</if>
|
||||
<if test="quarantineNo != null and quarantineNo != ''">quarantine_no = #{quarantineNo},</if>
|
||||
<if test="approvalNo != null and approvalNo != ''">approval_no = #{approvalNo},</if>
|
||||
<if test="technicianId != null">technician_id = #{technicianId},</if>
|
||||
<if test="handlerId != null">handler_id = #{handlerId},</if>
|
||||
<if test="createdBy != null">created_by = #{createdBy},</if>
|
||||
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSxSheepSaleById" parameterType="Long">
|
||||
delete from sx_sheep_sale where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSxSheepSaleByIds" parameterType="String">
|
||||
delete from sx_sheep_sale where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user