From 5693ca46c0a28b3b7596d0391641a3a873e55f67 Mon Sep 17 00:00:00 2001
From: zyh <2066096076@qq.com>
Date: Thu, 5 Mar 2026 21:41:11 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E8=80=B3=E5=8F=B7=E6=A8=A1=E7=B3=8A?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../mapper/produce/bodyManage/ScBodyMeasureMapper.xml | 4 ++--
.../mapper/produce/bodyManage/ScBodyScoreMapper.xml | 4 ++--
.../mapper/produce/bodyManage/ScBreastRatingMapper.xml | 5 +++--
.../mapper/produce/manage_sheep/ScChangeCommentMapper.xml | 4 ++--
.../mapper/produce/manage_sheep/ScChangeEarMapper.xml | 4 ++--
.../mapper/produce/manage_sheep/ScChangeVarietyMapper.xml | 4 ++--
.../mapper/produce/manage_sheep/ScTransGroupMapper.xml | 4 ++--
.../mapper/produce/manage_sheep/ScTransitionInfoMapper.xml | 4 ++--
.../main/resources/mapper/produce/other/ScCastrateMapper.xml | 4 ++--
.../main/resources/mapper/produce/other/ScFixHoofMapper.xml | 4 ++--
10 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml
index 16b4bcf..1853455 100644
--- a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml
@@ -278,9 +278,9 @@
diff --git a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyScoreMapper.xml b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyScoreMapper.xml
index d11793d..99f72e4 100644
--- a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyScoreMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyScoreMapper.xml
@@ -143,9 +143,9 @@
\ No newline at end of file
diff --git a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBreastRatingMapper.xml b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBreastRatingMapper.xml
index 00e843d..dd8ff4e 100644
--- a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBreastRatingMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBreastRatingMapper.xml
@@ -155,11 +155,12 @@
#{id}
+
diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml
index 32748e5..d53d962 100644
--- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml
@@ -139,9 +139,9 @@
\ No newline at end of file
diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeEarMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeEarMapper.xml
index bde3d71..e58b6a7 100644
--- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeEarMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeEarMapper.xml
@@ -152,9 +152,9 @@
\ No newline at end of file
diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml
index 11bef91..3b2db21 100644
--- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml
@@ -139,9 +139,9 @@
\ No newline at end of file
diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml
index 49de8f1..fa9d610 100644
--- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml
@@ -163,9 +163,9 @@
\ No newline at end of file
diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml
index 8f39fa9..5991d29 100644
--- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml
@@ -187,9 +187,9 @@
\ No newline at end of file
diff --git a/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml b/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml
index fee83f9..6404861 100644
--- a/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml
@@ -137,9 +137,9 @@
\ No newline at end of file
diff --git a/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml b/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml
index c36f433..992464d 100644
--- a/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml
@@ -134,9 +134,9 @@
\ No newline at end of file
From e9e5e88a731697f738359f933b276b95cbb59585 Mon Sep 17 00:00:00 2001
From: ll <1079863556@qq.com>
Date: Fri, 6 Mar 2026 11:11:35 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E7=BE=8A=E5=8F=AA=E9=94=80=E5=94=AEBUg?=
=?UTF-8?q?=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controller/SxSheepSaleController.java | 21 ++-
.../zhyc/module/sale/domain/SxSheepSale.java | 32 +++++
.../module/sale/mapper/SxSheepSaleMapper.java | 10 +-
.../sale/service/ISxSheepSaleService.java | 10 +-
.../service/impl/SxSheepSaleServiceImpl.java | 126 ++++++++++++++----
.../mapper/sale/SxSheepSaleMapper.xml | 37 ++++-
6 files changed, 195 insertions(+), 41 deletions(-)
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
index 7f93c77..75558c4 100644
--- 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
@@ -134,15 +134,30 @@ public class SxSheepSaleController extends BaseController {
}
/**
- * 【新增】搜索耳号(模糊查询)
+ * 【修改】搜索耳号(模糊查询,支持羊舍过滤)
*/
@GetMapping("/searchEarNumbers")
- public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
+ public AjaxResult searchEarNumbers(
+ @RequestParam(value = "query", required = false) String query,
+ @RequestParam(value = "sheepfoldId", required = false) Long sheepfoldId) {
try {
- List earNumbers = sxSheepSaleService.searchEarNumbers(query);
+ List earNumbers = sxSheepSaleService.searchEarNumbers(query, sheepfoldId);
return success(earNumbers);
} catch (Exception e) {
return error("搜索耳号失败:" + e.getMessage());
}
}
+
+ /**
+ * 【新增】专门用于顶部查询条件:搜索列表中已销售的羊只耳号
+ */
+ @GetMapping("/searchSoldEarNumbers")
+ public AjaxResult searchSoldEarNumbers(@RequestParam(value = "query", required = false) String query) {
+ try {
+ List earNumbers = sxSheepSaleService.searchSoldEarNumbers(query);
+ return success(earNumbers);
+ } catch (Exception e) {
+ return error("搜索已销售耳号失败:" + e.getMessage());
+ }
+ }
}
\ 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
index e3e0908..2bff24e 100644
--- 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
@@ -192,6 +192,15 @@ public class SxSheepSale extends BaseEntity {
/** 【新增】非数据库字段:用于前端展示和选择羊舍后传递多个耳号 */
private List bsManageTagsList;
+ /** 【新增】非数据库字段:用于导出指定的记录ID集合 */
+ private List exportIds;
+
+ /** * 【修复】在子类中重新声明 remark 字段,并打上 @Excel 注解
+ * 解决 @Excel 不能作用于方法的问题,使得导出时能成功抓取备注列
+ */
+ @Excel(name = "备注")
+ private String remark;
+
public void setId(Long id) {
this.id = id;
}
@@ -552,6 +561,27 @@ public class SxSheepSale extends BaseEntity {
this.customerArea = customerArea;
}
+ public List getExportIds() {
+ return exportIds;
+ }
+
+ public void setExportIds(List exportIds) {
+ this.exportIds = exportIds;
+ }
+
+ /**
+ * 【修复】重写 get/set 方法,指向子类自身的 remark 字段
+ */
+ @Override
+ public String getRemark() {
+ return remark;
+ }
+
+ @Override
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -600,6 +630,8 @@ public class SxSheepSale extends BaseEntity {
.append("createdByName", getCreatedByName())
.append("sheepfoldName", getSheepfoldName())
.append("currentWeight", getCurrentWeight())
+ .append("exportIds", getExportIds())
+ .append("bsManageTagsList", getBsManageTagsList())
.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
index a619358..206502c 100644
--- 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
@@ -74,10 +74,16 @@ public interface SxSheepSaleMapper {
public List selectSheepTagsBySheepfoldId(Long sheepfoldId);
/**
- * 【新增】模糊查询羊只耳号列表(用于前端搜索补全)
+ * 【修改】模糊查询羊只耳号列表(支持传入羊舍ID过滤)
* @param query 查询关键字
+ * @param sheepfoldId 羊舍ID(可为空)
* @return 耳号列表
*/
- public List searchEarNumbers(@Param("query") String query);
+ public List searchEarNumbers(@Param("query") String query, @Param("sheepfoldId") Long sheepfoldId);
+
+ /**
+ * 【新增】查询已销售的原始耳号数据(含逗号分隔的字符串)
+ */
+ public List selectSoldEarNumbers(@Param("query") String query);
}
\ 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
index 7d647e0..1c0b1d0 100644
--- 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
@@ -70,10 +70,16 @@ public interface ISxSheepSaleService {
*/
public List selectSheepTagsBySheepfoldId(Long sheepfoldId);
+
/**
- * 【新增】模糊查询羊只耳号列表
+ * 【修改】模糊查询羊只耳号列表
+ */
+ public List searchEarNumbers(String query, Long sheepfoldId);
+
+ /**
+ * 【新增】查询已销售的单独耳号列表(拆分逗号并去重)
* @param query 查询关键字
* @return 耳号列表
*/
- public List searchEarNumbers(String query);
+ public List searchSoldEarNumbers(String query);
}
\ 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
index 97cfaae..14da098 100644
--- 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
@@ -1,6 +1,9 @@
package com.zhyc.module.sale.service.impl;
import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
import java.math.BigDecimal;
import java.math.RoundingMode;
import org.springframework.beans.factory.annotation.Autowired;
@@ -9,6 +12,9 @@ import com.zhyc.common.annotation.DataScope;
import com.zhyc.module.sale.mapper.SxSheepSaleMapper;
import com.zhyc.module.sale.domain.SxSheepSale;
import com.zhyc.module.sale.service.ISxSheepSaleService;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.beans.BeanUtils;
+import java.util.Arrays;
/**
* 羊只销售记录Service业务层处理
@@ -47,53 +53,93 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
}
/**
- * 新增羊只销售记录
- *
- * @param sxSheepSale 羊只销售记录
- * @return 结果
+ * 新增羊只销售记录(支持多选耳号自动拆分为单条记录)
*/
@Override
+ @Transactional(rollbackFor = Exception.class) // 增加事务注解,确保批量插入要么全成功,要么全失败
public int insertSxSheepSale(SxSheepSale sxSheepSale) {
// 1. 业务验证 (必填项校验、级联校验)
validateSalesFields(sxSheepSale);
- // 2. 自动计算逻辑 (价格、体重)
+ // 2. 获取标签列表
+ List tags = sxSheepSale.getBsManageTagsList();
+ if (tags == null || tags.isEmpty()) {
+ if (sxSheepSale.getBsManageTags() != null && !sxSheepSale.getBsManageTags().isEmpty()) {
+ tags = Arrays.asList(sxSheepSale.getBsManageTags().split(","));
+ } else {
+ throw new RuntimeException("耳号不能为空!");
+ }
+ }
+
+ // 3. 先计算出这批羊的总价、均价、均重(基于前端传来的总数量和总重量)
+ // 这里的 calculateSalesFields 会自动根据 tags 的数量算出 avgWeight 和 avgPricePerSheep
calculateSalesFields(sxSheepSale);
- // 3. 设置默认事件类型
- if (sxSheepSale.getEventType() == null) {
- sxSheepSale.setEventType("销售");
+ int rows = 0;
+
+ // 4. 遍历每个耳号,拆分为独立的记录进行保存
+ for (String tag : tags) {
+ SxSheepSale singleRecord = new SxSheepSale();
+ // 复制前端传来的公共基础属性(如日期、客户信息、销售人员等)
+ BeanUtils.copyProperties(sxSheepSale, singleRecord);
+
+ // 防御性清空主键,防止 MyBatis 主键回填导致重复主键冲突
+ singleRecord.setId(null);
+
+ // 覆盖为单个耳号
+ singleRecord.setBsManageTags(tag);
+ // 清空列表,避免后续影响
+ singleRecord.setBsManageTagsList(null);
+
+ // 5. 调整单条记录的价格和重量字段,使其符合“单只羊”的逻辑
+ if ("按个体".equals(singleRecord.getPricingMethod())) {
+ // 按个体卖:单只羊的总价就是单价
+ singleRecord.setTotalPrice(singleRecord.getUnitPrice());
+ singleRecord.setAvgPricePerSheep(singleRecord.getUnitPrice());
+ singleRecord.setTotalWeight(null);
+ singleRecord.setAvgWeight(null);
+ } else if ("按体重".equals(singleRecord.getPricingMethod())) {
+ // 按体重卖:单只羊的重量设为这批羊的平均重量,单只羊的价格设为平均价格
+ singleRecord.setTotalWeight(sxSheepSale.getAvgWeight());
+ singleRecord.setAvgWeight(sxSheepSale.getAvgWeight());
+ singleRecord.setTotalPrice(sxSheepSale.getAvgPricePerSheep());
+ singleRecord.setAvgPricePerSheep(sxSheepSale.getAvgPricePerSheep());
+ }
+
+ // 6. 设置默认事件类型
+ if (singleRecord.getEventType() == null) {
+ singleRecord.setEventType("销售");
+ }
+
+ // 7. 插入数据库
+ rows += sxSheepSaleMapper.insertSxSheepSale(singleRecord);
}
- // 4. 处理耳号列表(多个耳号用逗号分隔)
- if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) {
- sxSheepSale.setBsManageTags(String.join(",", sxSheepSale.getBsManageTagsList()));
- }
-
- // 5. 调用Mapper插入数据
- return sxSheepSaleMapper.insertSxSheepSale(sxSheepSale);
+ return rows;
}
/**
* 修改羊只销售记录
- *
- * @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()));
+ // 2. 限制修改时只能是单只羊
+ if (sxSheepSale.getBsManageTagsList() != null && sxSheepSale.getBsManageTagsList().size() > 1) {
+ throw new RuntimeException("修改单条记录时只能保留一个耳号。如需销售更多羊只,请使用新增功能!");
}
- // 4. 调用Mapper更新数据
+ // 3. 自动计算逻辑(此时只会按1只羊进行准确计算)
+ calculateSalesFields(sxSheepSale);
+
+ // 4. 处理耳号列表,确保保存的是单个字符串
+ if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) {
+ sxSheepSale.setBsManageTags(sxSheepSale.getBsManageTagsList().get(0));
+ }
+
+ // 5. 调用Mapper更新数据
return sxSheepSaleMapper.updateSxSheepSale(sxSheepSale);
}
@@ -136,10 +182,9 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
* 【新增】实现模糊查询耳号
*/
@Override
- public List searchEarNumbers(String query) {
- return sxSheepSaleMapper.searchEarNumbers(query);
+ public List searchEarNumbers(String query, Long sheepfoldId) {
+ return sxSheepSaleMapper.searchEarNumbers(query, sheepfoldId);
}
-
/**
* 自动计算总价、平均体重、平均单只价格
*/
@@ -226,4 +271,29 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
}
}
}
+
+ /**
+ * 【新增】实现查询已销售的耳号,并处理逗号分隔的问题
+ */
+ @Override
+ public List searchSoldEarNumbers(String query) {
+ // 获取包含关键字的原始字符串(可能包含逗号)
+ List rawTags = sxSheepSaleMapper.selectSoldEarNumbers(query);
+ Set uniqueTags = new HashSet<>();
+
+ for (String raw : rawTags) {
+ if (raw != null && !raw.isEmpty()) {
+ String[] tags = raw.split(",");
+ for (String tag : tags) {
+ // 再次进行精准包含判断(过滤掉连带查出的其他无辜耳号)
+ if (query == null || query.isEmpty() || tag.contains(query)) {
+ uniqueTags.add(tag);
+ }
+ }
+ }
+ }
+
+ // 转为列表,按字母排序提升体验,限制返回最多50条
+ return uniqueTags.stream().sorted().limit(50).collect(Collectors.toList());
+ }
}
\ No newline at end of file
diff --git a/zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml b/zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml
index b4c64a0..35f224d 100644
--- a/zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml
@@ -76,12 +76,20 @@
LEFT JOIN sys_user u_create ON s.created_by = u_create.user_id
LEFT JOIN da_sheepfold sf ON s.sheepfold_id = sf.id
-
- AND s.bs_manage_tags IN
-
- #{tag}
+
+ AND s.id IN
+
+ #{exportId}
+
+
+ AND (
+
+ FIND_IN_SET(#{tag}, s.bs_manage_tags)
+
+ )
+
AND s.bs_manage_tags LIKE CONCAT('%', #{bsManageTags}, '%')
@@ -166,9 +174,26 @@
+
+
From 73a6e881e3b17f1a06dd9fcd69654b240cd6017f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=BC=82=E6=B3=8A?= <1913856125@qq.com>
Date: Fri, 6 Mar 2026 15:51:30 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=86=E7=A6=BBbug?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/resources/application-druid.yml | 2 +-
.../controller/DaSheepfoldController.java | 1 +
.../base/controller/SheepFileController.java | 15 ++--
.../zhyc/module/base/domain/DaSheepfold.java | 80 -------------------
.../module/base/mapper/SheepFileMapper.java | 38 +++++----
.../base/service/ISheepFileService.java | 20 ++---
.../service/impl/DaSheepfoldServiceImpl.java | 4 +-
.../service/impl/SheepFileServiceImpl.java | 26 +++---
.../ScBreedPlanGenerateController.java | 5 +-
.../mapper/ScBreedPlanGenerateMapper.java | 5 +-
.../service/IScBreedPlanGenerateService.java | 6 +-
.../impl/ScBreedPlanGenerateServiceImpl.java | 13 +--
.../impl/ScPregnancyRecordServiceImpl.java | 1 +
.../resources/mapper/base/SheepFileMapper.xml | 30 +++----
.../breed/ScBreedPlanGenerateMapper.xml | 18 +++--
15 files changed, 98 insertions(+), 166 deletions(-)
diff --git a/zhyc-admin/src/main/resources/application-druid.yml b/zhyc-admin/src/main/resources/application-druid.yml
index 2351abb..0970b07 100644
--- a/zhyc-admin/src/main/resources/application-druid.yml
+++ b/zhyc-admin/src/main/resources/application-druid.yml
@@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
-# url: jdbc:mysql://146.56.214.124:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+# url: jdbc:mysql://localhost:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: zhyc
# password: zhyc1234
url: jdbc:mysql://118.182.97.76:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/controller/DaSheepfoldController.java b/zhyc-module/src/main/java/com/zhyc/module/base/controller/DaSheepfoldController.java
index 01463d0..f937d5a 100644
--- a/zhyc-module/src/main/java/com/zhyc/module/base/controller/DaSheepfoldController.java
+++ b/zhyc-module/src/main/java/com/zhyc/module/base/controller/DaSheepfoldController.java
@@ -50,6 +50,7 @@ public class DaSheepfoldController extends BaseController
/**
* 主表格:羊舍级别汇总列表
*/
+ @PreAuthorize("@ss.hasPermi('sheepfold_management:sheepfold_management:list')")
@GetMapping("/summaryList")
public TableDataInfo summaryList(DaSheepfold daSheepfold) {
startPage();
diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/controller/SheepFileController.java b/zhyc-module/src/main/java/com/zhyc/module/base/controller/SheepFileController.java
index f718ba3..e114931 100644
--- a/zhyc-module/src/main/java/com/zhyc/module/base/controller/SheepFileController.java
+++ b/zhyc-module/src/main/java/com/zhyc/module/base/controller/SheepFileController.java
@@ -8,6 +8,7 @@ import com.zhyc.common.core.page.TableDataInfo;
import com.zhyc.common.core.text.Convert;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.utils.poi.ExcelUtil;
+import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.service.ISheepFileService;
import org.apache.commons.lang3.StringUtils;
@@ -139,7 +140,7 @@ public class SheepFileController extends BaseController
PageHelper.startPage(pageNum, pageSize);
// 调用支持复杂查询的Service方法
- List list = sheepFileService.selectSheepFileListByCondition(customParams, sheepFile);
+ List list = sheepFileService.selectSheepFileListByCondition( sheepFile,customParams);
return getDataTable(list);
}
@@ -255,7 +256,7 @@ public class SheepFileController extends BaseController
}
// 3. 获取数据并执行行过滤
- List list = sheepFileService.selectSheepFileListByCondition(customParams, sheepFile);
+ List list = sheepFileService.selectSheepFileListByCondition(sheepFile,customParams);
if (StringUtils.isNotBlank(exportIdsStr)) {
List exportIdList = Arrays.asList(exportIdsStr.split(","));
list = list.stream()
@@ -332,28 +333,28 @@ public class SheepFileController extends BaseController
@GetMapping("/stat/sheepType")
public AjaxResult statSheepType() {
- return success(sheepFileService.countBySheepType());
+ return success(sheepFileService.countBySheepType(new SheepFile()));
}
@GetMapping("/stat/breedStatus")
public AjaxResult statBreedStatus() {
- return success(sheepFileService.countByBreedStatus());
+ return success(sheepFileService.countByBreedStatus(new SheepFile()));
}
@GetMapping("/stat/variety")
public AjaxResult statVariety() {
- return success(sheepFileService.countByVariety());
+ return success(sheepFileService.countByVariety(new SheepFile()));
}
@GetMapping("/stat/lactationParity")
public AjaxResult statLactationParity() {
- return success(sheepFileService.countParityOfLactation());
+ return success(sheepFileService.countParityOfLactation(new SheepFile()));
}
// 在群总数
@GetMapping("/stat/inGroupCount")
public AjaxResult inGroupCount() {
- return success(sheepFileService.countInGroup());
+ return success(sheepFileService.countInGroup(new SheepFile()));
}
/**
diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/DaSheepfold.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/DaSheepfold.java
index a5a0a27..3e6b23b 100644
--- a/zhyc-module/src/main/java/com/zhyc/module/base/domain/DaSheepfold.java
+++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/DaSheepfold.java
@@ -19,70 +19,6 @@ public class DaSheepfold extends BaseEntity
{
private static final long serialVersionUID = 1L;
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public Long getRanchId() {
- return ranchId;
- }
-
- public void setRanchId(Long ranchId) {
- this.ranchId = ranchId;
- }
-
- public String getSheepfoldName() {
- return sheepfoldName;
- }
-
- public void setSheepfoldName(String sheepfoldName) {
- this.sheepfoldName = sheepfoldName;
- }
-
- public Long getSheepfoldTypeId() {
- return sheepfoldTypeId;
- }
-
- public void setSheepfoldTypeId(Long sheepfoldTypeId) {
- this.sheepfoldTypeId = sheepfoldTypeId;
- }
-
- public String getSheepfoldNo() {
- return sheepfoldNo;
- }
-
- public void setSheepfoldNo(String sheepfoldNo) {
- this.sheepfoldNo = sheepfoldNo;
- }
-
- public String getRowNo() {
- return rowNo;
- }
-
- public void setRowNo(String rowNo) {
- this.rowNo = rowNo;
- }
-
- public String getColumns() {
- return columns;
- }
-
- public void setColumns(String columns) {
- this.columns = columns;
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
/** 羊舍id */
@Excel(name = "羊舍id")
private Long id;
@@ -127,20 +63,4 @@ public class DaSheepfold extends BaseEntity
/** 部门编号 */
private Long deptId;
-
- public Long getUserId() {
- return userId;
- }
-
- public void setUserId(Long userId) {
- this.userId = userId;
- }
-
- public Long getDeptId() {
- return deptId;
- }
-
- public void setDeptId(Long deptId) {
- this.deptId = deptId;
- }
}
diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/SheepFileMapper.java b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/SheepFileMapper.java
index 909955d..334eb5a 100644
--- a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/SheepFileMapper.java
+++ b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/SheepFileMapper.java
@@ -3,8 +3,6 @@ package com.zhyc.module.base.mapper;
import com.zhyc.module.base.domain.SheepFile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.ResultMap;
-import org.apache.ibatis.annotations.SelectProvider;
import java.util.List;
import java.util.Map;
@@ -50,19 +48,19 @@ public interface SheepFileMapper
SheepFile selectSheepByManageTags(String tags);
// 在群羊只总数
- Long countInGroup();
+ Long countInGroup(SheepFile sheep);
// 羊只类别分布(按 name 分组)
- List
- ${params.dataScope}
+
ORDER BY id ASC
diff --git a/zhyc-module/src/main/resources/mapper/produce/breed/ScBreedPlanGenerateMapper.xml b/zhyc-module/src/main/resources/mapper/produce/breed/ScBreedPlanGenerateMapper.xml
index e558ba0..e5d52e6 100644
--- a/zhyc-module/src/main/resources/mapper/produce/breed/ScBreedPlanGenerateMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/produce/breed/ScBreedPlanGenerateMapper.xml
@@ -61,7 +61,7 @@
-
+
+ SELECT DISTINCT bs.manage_tags
+ FROM sw_medicine_usage s
+ LEFT JOIN bas_sheep bs ON s.sheep = bs.id
+
+ bs.manage_tags IS NOT NULL AND bs.manage_tags != ''
+
+ and bs.manage_tags LIKE CONCAT('%', #{sheepNo}, '%')
+
+ ${params.dataScope}
+
+
+ ORDER BY bs.manage_tags ASC
+
insert into sw_medicine_usage
diff --git a/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml
index e9a045c..ee3d01c 100644
--- a/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml
+++ b/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml
@@ -105,6 +105,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select * from sw_treatment where sheep_id = #{sheepId} and status in (0, 1)
+
+ SELECT DISTINCT bs.manage_tags
+ FROM sw_treatment s
+ LEFT JOIN bas_sheep bs ON s.sheep_id = bs.id
+
+ bs.manage_tags IS NOT NULL AND bs.manage_tags != ''
+
+ and bs.manage_tags LIKE CONCAT('%', #{sheepNo}, '%')
+
+ ${params.dataScope}
+
+ ORDER BY bs.manage_tags ASC
+
insert into sw_treatment