Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
package com.zhyc.module.base.controller;
|
package com.zhyc.module.base.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
import java.util.stream.Collectors;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.zhyc.module.base.domain.BasSheep;
|
import com.zhyc.module.base.domain.BasSheep;
|
||||||
@@ -110,20 +108,61 @@ public class BasSheepController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据耳号查询
|
* 批量查询羊只耳号状态
|
||||||
*/
|
*/
|
||||||
@GetMapping("/byManageTags/{manageTags}")
|
@GetMapping("/byManageTags/{manageTags}")
|
||||||
public AjaxResult byManageTags(@PathVariable String manageTags) {
|
public AjaxResult byManageTags(@PathVariable String manageTags) {
|
||||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
|
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||||
if (sheep == null) {
|
return error("管理耳号不能为空");
|
||||||
return error("未找到对应的羊只");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 补品种名称
|
// 批量查询模式 - 使用空格或逗号分割
|
||||||
BasSheepVariety variety = basSheepVarietyService.selectBasSheepVarietyById(sheep.getVarietyId());
|
String[] tags = manageTags.split("[\\s,,]+");
|
||||||
sheep.setVarietyName(variety == null ? "" : variety.getVariety());
|
|
||||||
|
|
||||||
return success(sheep);
|
try {
|
||||||
|
// 过滤掉空值并去重
|
||||||
|
List<String> validTags = Arrays.stream(tags)
|
||||||
|
.map(String::trim)
|
||||||
|
.filter(tag -> !tag.isEmpty())
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (validTags.isEmpty()) {
|
||||||
|
return error("有效的耳号不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询所有存在的羊只
|
||||||
|
List<BasSheep> existingSheep = basSheepService.selectBasSheepByManageTagsList(validTags);
|
||||||
|
|
||||||
|
Set<String> existingTagSet = existingSheep.stream()
|
||||||
|
.map(BasSheep::getManageTags)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// 分别统计在羊群和不在羊群的耳号
|
||||||
|
List<String> inHerd = new ArrayList<>();
|
||||||
|
List<String> notInHerd = new ArrayList<>();
|
||||||
|
|
||||||
|
for (String tag : validTags) {
|
||||||
|
if (existingTagSet.contains(tag)) {
|
||||||
|
inHerd.add(tag);
|
||||||
|
} else {
|
||||||
|
notInHerd.add(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
result.put("inHerd", inHerd);
|
||||||
|
result.put("notInHerd", notInHerd);
|
||||||
|
result.put("total", validTags.size());
|
||||||
|
result.put("inHerdCount", inHerd.size());
|
||||||
|
result.put("notInHerdCount", notInHerd.size());
|
||||||
|
result.put("sheepDetails", existingSheep);
|
||||||
|
|
||||||
|
return success(result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("批量查询羊只状态异常", e);
|
||||||
|
return error("批量查询失败:" + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,23 +10,18 @@ import com.zhyc.common.enums.BusinessType;
|
|||||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||||
import com.zhyc.module.base.domain.SheepFile;
|
import com.zhyc.module.base.domain.SheepFile;
|
||||||
import com.zhyc.module.base.service.ISheepFileService;
|
import com.zhyc.module.base.service.ISheepFileService;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 羊只档案Controller
|
* 羊只档案Controller
|
||||||
*
|
* * @author wyt
|
||||||
* @author wyt
|
|
||||||
* @date 2025-07-13
|
* @date 2025-07-13
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@@ -52,7 +47,7 @@ public class SheepFileController extends BaseController
|
|||||||
Integer pageSize = 10;
|
Integer pageSize = 10;
|
||||||
|
|
||||||
if (queryParams != null && !queryParams.isEmpty()) {
|
if (queryParams != null && !queryParams.isEmpty()) {
|
||||||
// 提取分页参数
|
// ------------------ 1. 处理分页参数 ------------------
|
||||||
if (queryParams.containsKey("pageNum") && queryParams.get("pageNum") != null) {
|
if (queryParams.containsKey("pageNum") && queryParams.get("pageNum") != null) {
|
||||||
try {
|
try {
|
||||||
pageNum = Integer.parseInt(queryParams.get("pageNum").toString());
|
pageNum = Integer.parseInt(queryParams.get("pageNum").toString());
|
||||||
@@ -60,7 +55,6 @@ public class SheepFileController extends BaseController
|
|||||||
// 使用默认值
|
// 使用默认值
|
||||||
}
|
}
|
||||||
} else if (queryParams.containsKey("page") && queryParams.get("page") != null) {
|
} else if (queryParams.containsKey("page") && queryParams.get("page") != null) {
|
||||||
// 如果 pageNum 不存在,则尝试使用 page
|
|
||||||
try {
|
try {
|
||||||
pageNum = Integer.parseInt(queryParams.get("page").toString());
|
pageNum = Integer.parseInt(queryParams.get("page").toString());
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
@@ -68,15 +62,13 @@ public class SheepFileController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (queryParams.containsKey("pageSize") && queryParams.get("pageSize") != null) {
|
if (queryParams.containsKey("pageSize") && queryParams.get("pageSize") != null) {
|
||||||
try {
|
try {
|
||||||
pageSize = Integer.parseInt(queryParams.get("pageSize").toString());
|
pageSize = Integer.parseInt(queryParams.get("pageSize").toString());
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
// 使用默认值
|
// 使用默认值
|
||||||
}
|
}
|
||||||
}else if (queryParams.containsKey("limit") && queryParams.get("limit") != null) {
|
} else if (queryParams.containsKey("limit") && queryParams.get("limit") != null) {
|
||||||
// 如果 pageSize 不存在,则尝试使用 limit
|
|
||||||
try {
|
try {
|
||||||
pageSize = Integer.parseInt(queryParams.get("limit").toString());
|
pageSize = Integer.parseInt(queryParams.get("limit").toString());
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
@@ -84,7 +76,25 @@ public class SheepFileController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提取常规查询参数到 SheepFile 对象
|
// ------------------ 2. 核心修复:处理 List 多选参数 ------------------
|
||||||
|
// 使用 parseList 方法兼容处理 List、Array、逗号分隔字符串
|
||||||
|
sheepFile.setAllEarNumbers(parseList(queryParams.get("allEarNumbers")));
|
||||||
|
sheepFile.setAllEleEarNumbers(parseList(queryParams.get("allEleEarNumbers")));
|
||||||
|
sheepFile.setAllBreedingStatus(parseList(queryParams.get("allBreedingStatus")));
|
||||||
|
sheepFile.setAllSheepTypes(parseList(queryParams.get("allSheepTypes")));
|
||||||
|
|
||||||
|
// 性别处理 (需要将 String/Integer 转为 Long)
|
||||||
|
List<String> genderStrs = parseList(queryParams.get("allGenders"));
|
||||||
|
if (genderStrs != null && !genderStrs.isEmpty()) {
|
||||||
|
List<Long> genderLongs = new ArrayList<>();
|
||||||
|
for (String s : genderStrs) {
|
||||||
|
Long v = convertToLong(s);
|
||||||
|
if(v != null) genderLongs.add(v);
|
||||||
|
}
|
||||||
|
sheepFile.setAllGenders(genderLongs);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------ 3. 处理常规单值参数 ------------------
|
||||||
if (queryParams.containsKey("bsManageTags") && queryParams.get("bsManageTags") != null) {
|
if (queryParams.containsKey("bsManageTags") && queryParams.get("bsManageTags") != null) {
|
||||||
sheepFile.setBsManageTags(queryParams.get("bsManageTags").toString());
|
sheepFile.setBsManageTags(queryParams.get("bsManageTags").toString());
|
||||||
}
|
}
|
||||||
@@ -110,23 +120,17 @@ public class SheepFileController extends BaseController
|
|||||||
sheepFile.setBreed(queryParams.get("breed").toString());
|
sheepFile.setBreed(queryParams.get("breed").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 移除已经处理的参数,剩下的作为自定义筛选参数
|
// ------------------ 4. 提取自定义参数 (排除已处理的键) ------------------
|
||||||
|
// 定义需要跳过的key,防止重复处理
|
||||||
|
Set<String> processedKeys = new HashSet<>(Arrays.asList(
|
||||||
|
"pageNum", "pageSize", "page", "limit",
|
||||||
|
"bsManageTags", "electronicTags", "drRanch", "variety", "name", "gender", "statusId", "breed",
|
||||||
|
"allEarNumbers", "allEleEarNumbers", "allGenders", "allBreedingStatus", "allSheepTypes"
|
||||||
|
));
|
||||||
|
|
||||||
for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
|
for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
|
||||||
String key = entry.getKey();
|
if (!processedKeys.contains(entry.getKey()) && entry.getValue() != null) {
|
||||||
Object value = entry.getValue();
|
customParams.put(entry.getKey(), entry.getValue());
|
||||||
|
|
||||||
// 跳过常规参数和分页参数
|
|
||||||
if ("bsManageTags".equals(key) || "electronicTags".equals(key) ||
|
|
||||||
"drRanch".equals(key) || "variety".equals(key) ||
|
|
||||||
"name".equals(key) || "gender".equals(key) ||
|
|
||||||
"statusId".equals(key) || "breed".equals(key) ||
|
|
||||||
"pageNum".equals(key) || "pageSize".equals(key)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加到自定义参数中
|
|
||||||
if (value != null) {
|
|
||||||
customParams.put(key, value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,6 +143,41 @@ public class SheepFileController extends BaseController
|
|||||||
|
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 辅助方法:统一解析各种格式的数组参数
|
||||||
|
* 支持:List, String[] (数组), Object[] (数组), "A,B" (逗号分隔字符串)
|
||||||
|
*/
|
||||||
|
private List<String> parseList(Object obj) {
|
||||||
|
if (obj == null) return null;
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
|
||||||
|
if (obj instanceof List) {
|
||||||
|
// JSON 传来的通常是 List
|
||||||
|
for (Object o : (List<?>) obj) {
|
||||||
|
if (o != null) result.add(o.toString());
|
||||||
|
}
|
||||||
|
} else if (obj.getClass().isArray()) {
|
||||||
|
// 如果是数组
|
||||||
|
if (obj instanceof Object[]) {
|
||||||
|
for (Object o : (Object[]) obj) {
|
||||||
|
if (o != null) result.add(o.toString());
|
||||||
|
}
|
||||||
|
} else if (obj instanceof String[]) {
|
||||||
|
Collections.addAll(result, (String[]) obj);
|
||||||
|
}
|
||||||
|
} else if (obj instanceof String) {
|
||||||
|
// 如果是逗号分隔字符串
|
||||||
|
String s = (String) obj;
|
||||||
|
if (StringUtils.isNotBlank(s)) {
|
||||||
|
String[] split = s.split(",");
|
||||||
|
Collections.addAll(result, split);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.isEmpty() ? null : result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换对象为Long类型
|
* 转换对象为Long类型
|
||||||
*/
|
*/
|
||||||
@@ -186,6 +225,7 @@ public class SheepFileController extends BaseController
|
|||||||
|
|
||||||
// 使用若依框架的工具方法处理参数
|
// 使用若依框架的工具方法处理参数
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
// --- 单值参数 ---
|
||||||
case "bsManageTags":
|
case "bsManageTags":
|
||||||
sheepFile.setBsManageTags(convertToString(value));
|
sheepFile.setBsManageTags(convertToString(value));
|
||||||
break;
|
break;
|
||||||
@@ -210,6 +250,30 @@ public class SheepFileController extends BaseController
|
|||||||
case "breed":
|
case "breed":
|
||||||
sheepFile.setBreed(convertToString(value));
|
sheepFile.setBreed(convertToString(value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// --- 新增:处理多选数组参数 ---
|
||||||
|
// request.getParameterMap 中的值本身就是 String[],可以直接使用
|
||||||
|
case "allEarNumbers":
|
||||||
|
sheepFile.setAllEarNumbers(new ArrayList<>(Arrays.asList(values)));
|
||||||
|
break;
|
||||||
|
case "allEleEarNumbers":
|
||||||
|
sheepFile.setAllEleEarNumbers(new ArrayList<>(Arrays.asList(values)));
|
||||||
|
break;
|
||||||
|
case "allBreedingStatus":
|
||||||
|
sheepFile.setAllBreedingStatus(new ArrayList<>(Arrays.asList(values)));
|
||||||
|
break;
|
||||||
|
case "allSheepTypes":
|
||||||
|
sheepFile.setAllSheepTypes(new ArrayList<>(Arrays.asList(values)));
|
||||||
|
break;
|
||||||
|
case "allGenders":
|
||||||
|
List<Long> genderList = new ArrayList<>();
|
||||||
|
for(String v : values){
|
||||||
|
Long l = Convert.toLong(v);
|
||||||
|
if(l != null) genderList.add(l);
|
||||||
|
}
|
||||||
|
sheepFile.setAllGenders(genderList);
|
||||||
|
break;
|
||||||
|
|
||||||
case "pageNum":
|
case "pageNum":
|
||||||
case "pageSize":
|
case "pageSize":
|
||||||
// 忽略分页参数
|
// 忽略分页参数
|
||||||
@@ -230,6 +294,14 @@ public class SheepFileController extends BaseController
|
|||||||
util.exportExcel(response, list, "羊只档案数据");
|
util.exportExcel(response, list, "羊只档案数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增:模糊搜索耳号接口 (用于前端下拉框远程搜索)
|
||||||
|
*/
|
||||||
|
@GetMapping("/searchEarNumbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query)
|
||||||
|
{
|
||||||
|
return success(sheepFileService.searchEarNumbers(query));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字符串转换工具方法
|
* 字符串转换工具方法
|
||||||
@@ -252,15 +324,14 @@ public class SheepFileController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 根据耳号查询是否存在羊舍
|
* 根据耳号查询是否存在羊舍
|
||||||
* */
|
* */
|
||||||
@GetMapping("/byNo/{manageTags}")
|
@GetMapping("/byNo/{manageTags}")
|
||||||
public AjaxResult byManageTags(@PathVariable String manageTags){
|
public AjaxResult byManageTags(@PathVariable String manageTags){
|
||||||
SheepFile sheep=sheepFileService.selectBasSheepByManageTags(manageTags.trim());
|
SheepFile sheep=sheepFileService.selectBasSheepByManageTags(manageTags.trim());
|
||||||
return success(sheep);
|
return success(sheep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/stat/sheepType")
|
@GetMapping("/stat/sheepType")
|
||||||
public AjaxResult statSheepType() {
|
public AjaxResult statSheepType() {
|
||||||
return success(sheepFileService.countBySheepType());
|
return success(sheepFileService.countBySheepType());
|
||||||
@@ -289,43 +360,18 @@ public class SheepFileController extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增API:获取字段的唯一值列表
|
* 新增API:获取字段的唯一值列表
|
||||||
*
|
|
||||||
* 这个API为前端自定义筛选功能提供数据支持
|
|
||||||
* 当用户选择某个字段进行筛选时,前端调用此接口获取该字段的所有可能值
|
|
||||||
*
|
|
||||||
* @param fieldName 字段名(数据库列名)
|
|
||||||
* @return AjaxResult 包含字段值列表的响应结果
|
|
||||||
*
|
|
||||||
* 接口地址:GET /sheep_file/sheep_file/field/{fieldName}
|
|
||||||
*
|
|
||||||
* 使用示例:
|
|
||||||
* 前端请求:GET /sheep_file/sheep_file/field/bs_manage_tags
|
|
||||||
* 后端返回:{ "code": 200, "msg": "操作成功", "data": ["AF00001", "AF00002", "AF00003"] }
|
|
||||||
*
|
|
||||||
* 安全说明:
|
|
||||||
* - 使用白名单机制防止SQL注入
|
|
||||||
* - 只有预定义的字段名可以被查询
|
|
||||||
*/
|
*/
|
||||||
@GetMapping("/field/{fieldName}")
|
@GetMapping("/field/{fieldName}")
|
||||||
public AjaxResult getFieldValues(@PathVariable String fieldName) {
|
public AjaxResult getFieldValues(@PathVariable String fieldName) {
|
||||||
try {
|
try {
|
||||||
// 调用Service层获取字段唯一值
|
// 调用Service层获取字段唯一值
|
||||||
List<String> fieldValues = sheepFileService.getFieldValues(fieldName);
|
List<String> fieldValues = sheepFileService.getFieldValues(fieldName);
|
||||||
|
|
||||||
// 返回成功响应,包含字段值列表
|
|
||||||
return AjaxResult.success("获取字段值成功", fieldValues);
|
return AjaxResult.success("获取字段值成功", fieldValues);
|
||||||
|
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// 处理字段名不合法的异常
|
|
||||||
// 这种情况通常是因为前端传入了不在白名单中的字段名
|
|
||||||
return AjaxResult.error("请求的字段名不合法: " + e.getMessage());
|
return AjaxResult.error("请求的字段名不合法: " + e.getMessage());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 处理其他未知异常
|
|
||||||
// 记录日志并返回友好的错误信息
|
|
||||||
logger.error("获取字段值失败,字段名: " + fieldName, e);
|
logger.error("获取字段值失败,字段名: " + fieldName, e);
|
||||||
return AjaxResult.error("系统错误,获取字段值失败");
|
return AjaxResult.error("系统错误,获取字段值失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package com.zhyc.module.base.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.zhyc.module.base.util.SheepPedigreeExcelUtils;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.zhyc.common.annotation.Log;
|
||||||
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
|
import com.zhyc.common.enums.BusinessType;
|
||||||
|
import com.zhyc.module.base.domain.SheepPedigree;
|
||||||
|
import com.zhyc.module.base.service.ISheepPedigreeService;
|
||||||
|
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||||
|
import com.zhyc.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIEWController
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-02-04
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/pedigree")
|
||||||
|
public class SheepPedigreeController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISheepPedigreeService sheepPedigreeService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询VIEW列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:pedigree:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SheepPedigree sheepPedigree)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SheepPedigree> list = sheepPedigreeService.selectSheepPedigreeList(sheepPedigree);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出VIEW列表
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 在Controller/Service中注入工具类
|
||||||
|
@Autowired
|
||||||
|
private SheepPedigreeExcelUtils sheepPedigreeExcelUtils;
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:pedigree:export')")
|
||||||
|
@Log(title = "VIEW", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SheepPedigree sheepPedigree) throws Exception {
|
||||||
|
List<SheepPedigree> dataList = sheepPedigreeService.selectSheepPedigreeList(sheepPedigree);
|
||||||
|
// 调用实例方法(而非静态方法)
|
||||||
|
sheepPedigreeExcelUtils.export(response, dataList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取VIEW详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:pedigree:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(sheepPedigreeService.selectSheepPedigreeById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增VIEW
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:pedigree:add')")
|
||||||
|
@Log(title = "VIEW", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody SheepPedigree sheepPedigree)
|
||||||
|
{
|
||||||
|
return toAjax(sheepPedigreeService.insertSheepPedigree(sheepPedigree));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改VIEW
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:pedigree:edit')")
|
||||||
|
@Log(title = "VIEW", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody SheepPedigree sheepPedigree)
|
||||||
|
{
|
||||||
|
return toAjax(sheepPedigreeService.updateSheepPedigree(sheepPedigree));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除VIEW
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:pedigree:remove')")
|
||||||
|
@Log(title = "VIEW", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(sheepPedigreeService.deleteSheepPedigreeByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,11 +8,11 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 羊只档案对象 sheep_file
|
* 羊只档案对象 sheep_file
|
||||||
*
|
* * @author wyt
|
||||||
* @author wyt
|
|
||||||
* @date 2025-07-13
|
* @date 2025-07-13
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@@ -29,6 +29,10 @@ public class SheepFile extends BaseEntity
|
|||||||
@Excel(name = "管理耳号")
|
@Excel(name = "管理耳号")
|
||||||
private String bsManageTags;
|
private String bsManageTags;
|
||||||
|
|
||||||
|
/** ================= 新增:多选查询字段 ================= */
|
||||||
|
/** 耳号集合(多选/模糊查询用) */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
/** 牧场id */
|
/** 牧场id */
|
||||||
// @Excel(name = "牧场id")
|
// @Excel(name = "牧场id")
|
||||||
private Long ranchId;
|
private Long ranchId;
|
||||||
@@ -49,6 +53,10 @@ public class SheepFile extends BaseEntity
|
|||||||
@Excel(name = "电子耳号")
|
@Excel(name = "电子耳号")
|
||||||
private String electronicTags;
|
private String electronicTags;
|
||||||
|
|
||||||
|
/** ================= 新增:多选查询字段 ================= */
|
||||||
|
/** 电子耳号集合(多选查询用) */
|
||||||
|
private List<String> allEleEarNumbers;
|
||||||
|
|
||||||
/** 品种id */
|
/** 品种id */
|
||||||
// @Excel(name = "品种id")
|
// @Excel(name = "品种id")
|
||||||
private Long varietyId;
|
private Long varietyId;
|
||||||
@@ -65,14 +73,22 @@ public class SheepFile extends BaseEntity
|
|||||||
@Excel(name = "羊只类型")
|
@Excel(name = "羊只类型")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/** ================= 新增:多选查询字段 ================= */
|
||||||
|
/** 羊只类型集合(多选查询用) */
|
||||||
|
private List<String> allSheepTypes;
|
||||||
|
|
||||||
// /** 性别 */
|
// /** 性别 */
|
||||||
//// @Excel(name = "性别")
|
//// @Excel(name = "性别")
|
||||||
// private Long gender;
|
// private Long gender;
|
||||||
|
|
||||||
/** 性别 - 使用字典转换 */
|
/** 性别 - 使用字典转换 */
|
||||||
@Excel(name = "性别", dictType = "sheep_gender") // 添加 dictType
|
@Excel(name = "性别", dictType = "sheep_gender")
|
||||||
private Long gender;
|
private Long gender;
|
||||||
|
|
||||||
|
/** ================= 新增:多选查询字段 ================= */
|
||||||
|
/** 性别集合(多选查询用) */
|
||||||
|
private List<Long> allGenders;
|
||||||
|
|
||||||
/** 出生日期 */
|
/** 出生日期 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "出生日期", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "出生日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
@@ -103,7 +119,6 @@ public class SheepFile extends BaseEntity
|
|||||||
@Excel(name = "羊只状态", dictType = "sheep_status")
|
@Excel(name = "羊只状态", dictType = "sheep_status")
|
||||||
private Long statusId;
|
private Long statusId;
|
||||||
|
|
||||||
|
|
||||||
/** 断奶体重 */
|
/** 断奶体重 */
|
||||||
@Excel(name = "断奶体重")
|
@Excel(name = "断奶体重")
|
||||||
private Double weaningWeight;
|
private Double weaningWeight;
|
||||||
@@ -129,6 +144,10 @@ public class SheepFile extends BaseEntity
|
|||||||
@Excel(name = "繁殖状态")
|
@Excel(name = "繁殖状态")
|
||||||
private String breed;
|
private String breed;
|
||||||
|
|
||||||
|
/** ================= 新增:多选查询字段 ================= */
|
||||||
|
/** 繁殖状态集合(多选查询用) */
|
||||||
|
private List<String> allBreedingStatus;
|
||||||
|
|
||||||
/** 父号id */
|
/** 父号id */
|
||||||
// @Excel(name = "父号id")
|
// @Excel(name = "父号id")
|
||||||
private Long bsFatherId;
|
private Long bsFatherId;
|
||||||
@@ -300,6 +319,4 @@ public class SheepFile extends BaseEntity
|
|||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,996 @@
|
|||||||
|
package com.zhyc.module.base.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIEW对象 sheep_pedigree
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-02-04
|
||||||
|
*/
|
||||||
|
public class SheepPedigree extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 管理耳号 */
|
||||||
|
@Excel(name = "管理耳号")
|
||||||
|
private String bsManageTags;
|
||||||
|
|
||||||
|
/** 牧场id */
|
||||||
|
@Excel(name = "牧场id")
|
||||||
|
private Long ranchId;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String drRanch;
|
||||||
|
|
||||||
|
/** 羊舍id */
|
||||||
|
@Excel(name = "羊舍id")
|
||||||
|
private Long sheepfoldId;
|
||||||
|
|
||||||
|
/** 羊舍名称 */
|
||||||
|
@Excel(name = "羊舍名称")
|
||||||
|
private String sheepfoldName;
|
||||||
|
|
||||||
|
/** 电子耳号 */
|
||||||
|
@Excel(name = "电子耳号")
|
||||||
|
private String electronicTags;
|
||||||
|
|
||||||
|
/** 品种id */
|
||||||
|
@Excel(name = "品种id")
|
||||||
|
private Long varietyId;
|
||||||
|
|
||||||
|
/** 品种 */
|
||||||
|
@Excel(name = "品种")
|
||||||
|
private String variety;
|
||||||
|
|
||||||
|
/** 家系 */
|
||||||
|
@Excel(name = "家系")
|
||||||
|
private String family;
|
||||||
|
|
||||||
|
/** 羊只类型 */
|
||||||
|
@Excel(name = "羊只类型")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 性别 */
|
||||||
|
@Excel(name = "性别")
|
||||||
|
private Long gender;
|
||||||
|
|
||||||
|
/** 出生日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "出生日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date birthday;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private Long dayAge;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private Long monthAge;
|
||||||
|
|
||||||
|
/** 胎次 */
|
||||||
|
@Excel(name = "胎次")
|
||||||
|
private Long parity;
|
||||||
|
|
||||||
|
/** 出生体重 */
|
||||||
|
@Excel(name = "出生体重")
|
||||||
|
private Long birthWeight;
|
||||||
|
|
||||||
|
/** 断奶日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "断奶日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date weaningDate;
|
||||||
|
|
||||||
|
/** 羊只状态 */
|
||||||
|
@Excel(name = "羊只状态")
|
||||||
|
private Long statusId;
|
||||||
|
|
||||||
|
/** 断奶体重 */
|
||||||
|
@Excel(name = "断奶体重")
|
||||||
|
private Long weaningWeight;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private Long weaningDayAge;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private BigDecimal weaningDailyGain;
|
||||||
|
|
||||||
|
/** 当前体重 */
|
||||||
|
@Excel(name = "当前体重")
|
||||||
|
private Long currentWeight;
|
||||||
|
|
||||||
|
/** 繁育状态id */
|
||||||
|
@Excel(name = "繁育状态id")
|
||||||
|
private Long breedStatusId;
|
||||||
|
|
||||||
|
/** 繁殖状态 */
|
||||||
|
@Excel(name = "繁殖状态")
|
||||||
|
private String breed;
|
||||||
|
|
||||||
|
/** 父号id */
|
||||||
|
@Excel(name = "父号id")
|
||||||
|
private Long bsFatherId;
|
||||||
|
|
||||||
|
/** 管理耳号 */
|
||||||
|
@Excel(name = "管理耳号")
|
||||||
|
private String fatherManageTags;
|
||||||
|
|
||||||
|
/** 母号id */
|
||||||
|
@Excel(name = "母号id")
|
||||||
|
private Long bsMotherId;
|
||||||
|
|
||||||
|
/** 管理耳号 */
|
||||||
|
@Excel(name = "管理耳号")
|
||||||
|
private String motherManageTags;
|
||||||
|
|
||||||
|
/** 受体id */
|
||||||
|
@Excel(name = "受体id")
|
||||||
|
private Long receptorId;
|
||||||
|
|
||||||
|
/** 管理耳号 */
|
||||||
|
@Excel(name = "管理耳号")
|
||||||
|
private String receptorManageTags;
|
||||||
|
|
||||||
|
/** 父号id */
|
||||||
|
@Excel(name = "父号id")
|
||||||
|
private Long fatherFatherId;
|
||||||
|
|
||||||
|
/** 管理耳号 */
|
||||||
|
@Excel(name = "祖父管理耳号")
|
||||||
|
private String grandfatherManageTags;
|
||||||
|
|
||||||
|
/** 母号id */
|
||||||
|
@Excel(name = "母号id")
|
||||||
|
private Long fatherMotherId;
|
||||||
|
|
||||||
|
/** 管理耳号 */
|
||||||
|
@Excel(name = "祖母管理耳号")
|
||||||
|
private String grandmotherManageTags;
|
||||||
|
|
||||||
|
/** 父号id */
|
||||||
|
@Excel(name = "父号id")
|
||||||
|
private Long fatherId;
|
||||||
|
|
||||||
|
/** 管理耳号 */
|
||||||
|
@Excel(name = "管理耳号")
|
||||||
|
private String maternalGrandfatherManageTags;
|
||||||
|
|
||||||
|
/** 母号id */
|
||||||
|
@Excel(name = "母号id")
|
||||||
|
private Long motherId;
|
||||||
|
|
||||||
|
/** 管理耳号 */
|
||||||
|
@Excel(name = "管理耳号")
|
||||||
|
private String maternalGrandmotherManageTags;
|
||||||
|
|
||||||
|
/** 配种日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "配种日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date matingDate;
|
||||||
|
|
||||||
|
/** 配种类型 */
|
||||||
|
@Excel(name = "配种类型")
|
||||||
|
private Long matingTypeId;
|
||||||
|
|
||||||
|
/** 孕检日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "孕检日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date pregDate;
|
||||||
|
|
||||||
|
/** 产羔日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "产羔日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date lambingDate;
|
||||||
|
|
||||||
|
/** 产羔时怀孕天数 */
|
||||||
|
@Excel(name = "产羔时怀孕天数")
|
||||||
|
private Long lambingDay;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private Long matingDay;
|
||||||
|
|
||||||
|
/** 怀孕天数 */
|
||||||
|
@Excel(name = "怀孕天数")
|
||||||
|
private Long gestationDay;
|
||||||
|
|
||||||
|
/** 预产日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "预产日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date expectedDate;
|
||||||
|
|
||||||
|
/** 产后天数 */
|
||||||
|
@Excel(name = "产后天数")
|
||||||
|
private Long postLambingDay;
|
||||||
|
|
||||||
|
/** 泌乳天数 */
|
||||||
|
@Excel(name = "泌乳天数")
|
||||||
|
private Long lactationDay;
|
||||||
|
|
||||||
|
/** 空怀天数 */
|
||||||
|
@Excel(name = "空怀天数")
|
||||||
|
private Long anestrousDay;
|
||||||
|
|
||||||
|
/** 配种次数 */
|
||||||
|
@Excel(name = "配种次数")
|
||||||
|
private Long matingCounts;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private Long matingTotal;
|
||||||
|
|
||||||
|
/** 累计流产次数 */
|
||||||
|
@Excel(name = "累计流产次数")
|
||||||
|
private Long miscarriageCounts;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
/** 是否性控 */
|
||||||
|
@Excel(name = "是否性控")
|
||||||
|
private Long controlled;
|
||||||
|
|
||||||
|
/** 体况评分 */
|
||||||
|
@Excel(name = "体况评分")
|
||||||
|
private Long body;
|
||||||
|
|
||||||
|
/** 乳房评分 */
|
||||||
|
@Excel(name = "乳房评分")
|
||||||
|
private Long breast;
|
||||||
|
|
||||||
|
/** 入群来源 */
|
||||||
|
@Excel(name = "入群来源")
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
/** 入群日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "入群日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date sourceDate;
|
||||||
|
|
||||||
|
/** 来源牧场id */
|
||||||
|
@Excel(name = "来源牧场id")
|
||||||
|
private Long sourceRanchId;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "来源牧场", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String sourceRanch;
|
||||||
|
|
||||||
|
/** 是否删除 */
|
||||||
|
@Excel(name = "是否删除")
|
||||||
|
private Long isDelete;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "毛色", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String sheepColor;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "等级", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
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 setRanchId(Long ranchId)
|
||||||
|
{
|
||||||
|
this.ranchId = ranchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRanchId()
|
||||||
|
{
|
||||||
|
return ranchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDrRanch(String drRanch)
|
||||||
|
{
|
||||||
|
this.drRanch = drRanch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDrRanch()
|
||||||
|
{
|
||||||
|
return drRanch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSheepfoldId(Long sheepfoldId)
|
||||||
|
{
|
||||||
|
this.sheepfoldId = sheepfoldId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSheepfoldId()
|
||||||
|
{
|
||||||
|
return sheepfoldId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSheepfoldName(String sheepfoldName)
|
||||||
|
{
|
||||||
|
this.sheepfoldName = sheepfoldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSheepfoldName()
|
||||||
|
{
|
||||||
|
return sheepfoldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setElectronicTags(String electronicTags)
|
||||||
|
{
|
||||||
|
this.electronicTags = electronicTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getElectronicTags()
|
||||||
|
{
|
||||||
|
return electronicTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVarietyId(Long varietyId)
|
||||||
|
{
|
||||||
|
this.varietyId = varietyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVarietyId()
|
||||||
|
{
|
||||||
|
return varietyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVariety(String variety)
|
||||||
|
{
|
||||||
|
this.variety = variety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVariety()
|
||||||
|
{
|
||||||
|
return variety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFamily(String family)
|
||||||
|
{
|
||||||
|
this.family = family;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFamily()
|
||||||
|
{
|
||||||
|
return family;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(Long gender)
|
||||||
|
{
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getGender()
|
||||||
|
{
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBirthday(Date birthday)
|
||||||
|
{
|
||||||
|
this.birthday = birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getBirthday()
|
||||||
|
{
|
||||||
|
return birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDayAge(Long dayAge)
|
||||||
|
{
|
||||||
|
this.dayAge = dayAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDayAge()
|
||||||
|
{
|
||||||
|
return dayAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 setBirthWeight(Long birthWeight)
|
||||||
|
{
|
||||||
|
this.birthWeight = birthWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBirthWeight()
|
||||||
|
{
|
||||||
|
return birthWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeaningDate(Date weaningDate)
|
||||||
|
{
|
||||||
|
this.weaningDate = weaningDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getWeaningDate()
|
||||||
|
{
|
||||||
|
return weaningDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatusId(Long statusId)
|
||||||
|
{
|
||||||
|
this.statusId = statusId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getStatusId()
|
||||||
|
{
|
||||||
|
return statusId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeaningWeight(Long weaningWeight)
|
||||||
|
{
|
||||||
|
this.weaningWeight = weaningWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getWeaningWeight()
|
||||||
|
{
|
||||||
|
return weaningWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeaningDayAge(Long weaningDayAge)
|
||||||
|
{
|
||||||
|
this.weaningDayAge = weaningDayAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getWeaningDayAge()
|
||||||
|
{
|
||||||
|
return weaningDayAge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeaningDailyGain(BigDecimal weaningDailyGain)
|
||||||
|
{
|
||||||
|
this.weaningDailyGain = weaningDailyGain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getWeaningDailyGain()
|
||||||
|
{
|
||||||
|
return weaningDailyGain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentWeight(Long currentWeight)
|
||||||
|
{
|
||||||
|
this.currentWeight = currentWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCurrentWeight()
|
||||||
|
{
|
||||||
|
return currentWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBreedStatusId(Long breedStatusId)
|
||||||
|
{
|
||||||
|
this.breedStatusId = breedStatusId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBreedStatusId()
|
||||||
|
{
|
||||||
|
return breedStatusId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBreed(String breed)
|
||||||
|
{
|
||||||
|
this.breed = breed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBreed()
|
||||||
|
{
|
||||||
|
return breed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBsFatherId(Long bsFatherId)
|
||||||
|
{
|
||||||
|
this.bsFatherId = bsFatherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBsFatherId()
|
||||||
|
{
|
||||||
|
return bsFatherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFatherManageTags(String fatherManageTags)
|
||||||
|
{
|
||||||
|
this.fatherManageTags = fatherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFatherManageTags()
|
||||||
|
{
|
||||||
|
return fatherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBsMotherId(Long bsMotherId)
|
||||||
|
{
|
||||||
|
this.bsMotherId = bsMotherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBsMotherId()
|
||||||
|
{
|
||||||
|
return bsMotherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotherManageTags(String motherManageTags)
|
||||||
|
{
|
||||||
|
this.motherManageTags = motherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMotherManageTags()
|
||||||
|
{
|
||||||
|
return motherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceptorId(Long receptorId)
|
||||||
|
{
|
||||||
|
this.receptorId = receptorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getReceptorId()
|
||||||
|
{
|
||||||
|
return receptorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceptorManageTags(String receptorManageTags)
|
||||||
|
{
|
||||||
|
this.receptorManageTags = receptorManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReceptorManageTags()
|
||||||
|
{
|
||||||
|
return receptorManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFatherFatherId(Long fatherFatherId)
|
||||||
|
{
|
||||||
|
this.fatherFatherId = fatherFatherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getFatherFatherId()
|
||||||
|
{
|
||||||
|
return fatherFatherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrandfatherManageTags(String grandfatherManageTags)
|
||||||
|
{
|
||||||
|
this.grandfatherManageTags = grandfatherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGrandfatherManageTags()
|
||||||
|
{
|
||||||
|
return grandfatherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFatherMotherId(Long fatherMotherId)
|
||||||
|
{
|
||||||
|
this.fatherMotherId = fatherMotherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getFatherMotherId()
|
||||||
|
{
|
||||||
|
return fatherMotherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrandmotherManageTags(String grandmotherManageTags)
|
||||||
|
{
|
||||||
|
this.grandmotherManageTags = grandmotherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGrandmotherManageTags()
|
||||||
|
{
|
||||||
|
return grandmotherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFatherId(Long fatherId)
|
||||||
|
{
|
||||||
|
this.fatherId = fatherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getFatherId()
|
||||||
|
{
|
||||||
|
return fatherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaternalGrandfatherManageTags(String maternalGrandfatherManageTags)
|
||||||
|
{
|
||||||
|
this.maternalGrandfatherManageTags = maternalGrandfatherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaternalGrandfatherManageTags()
|
||||||
|
{
|
||||||
|
return maternalGrandfatherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotherId(Long motherId)
|
||||||
|
{
|
||||||
|
this.motherId = motherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMotherId()
|
||||||
|
{
|
||||||
|
return motherId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaternalGrandmotherManageTags(String maternalGrandmotherManageTags)
|
||||||
|
{
|
||||||
|
this.maternalGrandmotherManageTags = maternalGrandmotherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaternalGrandmotherManageTags()
|
||||||
|
{
|
||||||
|
return maternalGrandmotherManageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatingDate(Date matingDate)
|
||||||
|
{
|
||||||
|
this.matingDate = matingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getMatingDate()
|
||||||
|
{
|
||||||
|
return matingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatingTypeId(Long matingTypeId)
|
||||||
|
{
|
||||||
|
this.matingTypeId = matingTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMatingTypeId()
|
||||||
|
{
|
||||||
|
return matingTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPregDate(Date pregDate)
|
||||||
|
{
|
||||||
|
this.pregDate = pregDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getPregDate()
|
||||||
|
{
|
||||||
|
return pregDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLambingDate(Date lambingDate)
|
||||||
|
{
|
||||||
|
this.lambingDate = lambingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLambingDate()
|
||||||
|
{
|
||||||
|
return lambingDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLambingDay(Long lambingDay)
|
||||||
|
{
|
||||||
|
this.lambingDay = lambingDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getLambingDay()
|
||||||
|
{
|
||||||
|
return lambingDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatingDay(Long matingDay)
|
||||||
|
{
|
||||||
|
this.matingDay = matingDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMatingDay()
|
||||||
|
{
|
||||||
|
return matingDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGestationDay(Long gestationDay)
|
||||||
|
{
|
||||||
|
this.gestationDay = gestationDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getGestationDay()
|
||||||
|
{
|
||||||
|
return gestationDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpectedDate(Date expectedDate)
|
||||||
|
{
|
||||||
|
this.expectedDate = expectedDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getExpectedDate()
|
||||||
|
{
|
||||||
|
return expectedDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 setAnestrousDay(Long anestrousDay)
|
||||||
|
{
|
||||||
|
this.anestrousDay = anestrousDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAnestrousDay()
|
||||||
|
{
|
||||||
|
return anestrousDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatingCounts(Long matingCounts)
|
||||||
|
{
|
||||||
|
this.matingCounts = matingCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMatingCounts()
|
||||||
|
{
|
||||||
|
return matingCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatingTotal(Long matingTotal)
|
||||||
|
{
|
||||||
|
this.matingTotal = matingTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMatingTotal()
|
||||||
|
{
|
||||||
|
return matingTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMiscarriageCounts(Long miscarriageCounts)
|
||||||
|
{
|
||||||
|
this.miscarriageCounts = miscarriageCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMiscarriageCounts()
|
||||||
|
{
|
||||||
|
return miscarriageCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment)
|
||||||
|
{
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComment()
|
||||||
|
{
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setControlled(Long controlled)
|
||||||
|
{
|
||||||
|
this.controlled = controlled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getControlled()
|
||||||
|
{
|
||||||
|
return controlled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(Long body)
|
||||||
|
{
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBody()
|
||||||
|
{
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBreast(Long breast)
|
||||||
|
{
|
||||||
|
this.breast = breast;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBreast()
|
||||||
|
{
|
||||||
|
return breast;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(String source)
|
||||||
|
{
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSource()
|
||||||
|
{
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceDate(Date sourceDate)
|
||||||
|
{
|
||||||
|
this.sourceDate = sourceDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getSourceDate()
|
||||||
|
{
|
||||||
|
return sourceDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceRanchId(Long sourceRanchId)
|
||||||
|
{
|
||||||
|
this.sourceRanchId = sourceRanchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSourceRanchId()
|
||||||
|
{
|
||||||
|
return sourceRanchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceRanch(String sourceRanch)
|
||||||
|
{
|
||||||
|
this.sourceRanch = sourceRanch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSourceRanch()
|
||||||
|
{
|
||||||
|
return sourceRanch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDelete(Long isDelete)
|
||||||
|
{
|
||||||
|
this.isDelete = isDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getIsDelete()
|
||||||
|
{
|
||||||
|
return isDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSheepColor(String sheepColor)
|
||||||
|
{
|
||||||
|
this.sheepColor = sheepColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSheepColor()
|
||||||
|
{
|
||||||
|
return sheepColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupName(String groupName)
|
||||||
|
{
|
||||||
|
this.groupName = groupName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupName()
|
||||||
|
{
|
||||||
|
return groupName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("bsManageTags", getBsManageTags())
|
||||||
|
.append("ranchId", getRanchId())
|
||||||
|
.append("drRanch", getDrRanch())
|
||||||
|
.append("sheepfoldId", getSheepfoldId())
|
||||||
|
.append("sheepfoldName", getSheepfoldName())
|
||||||
|
.append("electronicTags", getElectronicTags())
|
||||||
|
.append("varietyId", getVarietyId())
|
||||||
|
.append("variety", getVariety())
|
||||||
|
.append("family", getFamily())
|
||||||
|
.append("name", getName())
|
||||||
|
.append("gender", getGender())
|
||||||
|
.append("birthday", getBirthday())
|
||||||
|
.append("dayAge", getDayAge())
|
||||||
|
.append("monthAge", getMonthAge())
|
||||||
|
.append("parity", getParity())
|
||||||
|
.append("birthWeight", getBirthWeight())
|
||||||
|
.append("weaningDate", getWeaningDate())
|
||||||
|
.append("statusId", getStatusId())
|
||||||
|
.append("weaningWeight", getWeaningWeight())
|
||||||
|
.append("weaningDayAge", getWeaningDayAge())
|
||||||
|
.append("weaningDailyGain", getWeaningDailyGain())
|
||||||
|
.append("currentWeight", getCurrentWeight())
|
||||||
|
.append("breedStatusId", getBreedStatusId())
|
||||||
|
.append("breed", getBreed())
|
||||||
|
.append("bsFatherId", getBsFatherId())
|
||||||
|
.append("fatherManageTags", getFatherManageTags())
|
||||||
|
.append("bsMotherId", getBsMotherId())
|
||||||
|
.append("motherManageTags", getMotherManageTags())
|
||||||
|
.append("receptorId", getReceptorId())
|
||||||
|
.append("receptorManageTags", getReceptorManageTags())
|
||||||
|
.append("fatherFatherId", getFatherFatherId())
|
||||||
|
.append("grandfatherManageTags", getGrandfatherManageTags())
|
||||||
|
.append("fatherMotherId", getFatherMotherId())
|
||||||
|
.append("grandmotherManageTags", getGrandmotherManageTags())
|
||||||
|
.append("fatherId", getFatherId())
|
||||||
|
.append("maternalGrandfatherManageTags", getMaternalGrandfatherManageTags())
|
||||||
|
.append("motherId", getMotherId())
|
||||||
|
.append("maternalGrandmotherManageTags", getMaternalGrandmotherManageTags())
|
||||||
|
.append("matingDate", getMatingDate())
|
||||||
|
.append("matingTypeId", getMatingTypeId())
|
||||||
|
.append("pregDate", getPregDate())
|
||||||
|
.append("lambingDate", getLambingDate())
|
||||||
|
.append("lambingDay", getLambingDay())
|
||||||
|
.append("matingDay", getMatingDay())
|
||||||
|
.append("gestationDay", getGestationDay())
|
||||||
|
.append("expectedDate", getExpectedDate())
|
||||||
|
.append("postLambingDay", getPostLambingDay())
|
||||||
|
.append("lactationDay", getLactationDay())
|
||||||
|
.append("anestrousDay", getAnestrousDay())
|
||||||
|
.append("matingCounts", getMatingCounts())
|
||||||
|
.append("matingTotal", getMatingTotal())
|
||||||
|
.append("miscarriageCounts", getMiscarriageCounts())
|
||||||
|
.append("comment", getComment())
|
||||||
|
.append("controlled", getControlled())
|
||||||
|
.append("body", getBody())
|
||||||
|
.append("breast", getBreast())
|
||||||
|
.append("source", getSource())
|
||||||
|
.append("sourceDate", getSourceDate())
|
||||||
|
.append("sourceRanchId", getSourceRanchId())
|
||||||
|
.append("sourceRanch", getSourceRanch())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("isDelete", getIsDelete())
|
||||||
|
.append("sheepColor", getSheepColor())
|
||||||
|
.append("groupName", getGroupName())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.zhyc.module.base.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
import com.zhyc.module.base.domain.BasSheep;
|
import com.zhyc.module.base.domain.BasSheep;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -73,10 +74,10 @@ public interface BasSheepMapper
|
|||||||
/**
|
/**
|
||||||
* 模糊查询母羊耳号列表
|
* 模糊查询母羊耳号列表
|
||||||
*
|
*
|
||||||
* @param query 查询关键字
|
* @param sheep 查询关键字
|
||||||
* @return 耳号列表
|
* @return 耳号列表
|
||||||
*/
|
*/
|
||||||
List<String> searchEarNumbers(@Param("query") String query);
|
List<String> searchEarNumbers(BasSheep sheep);
|
||||||
|
|
||||||
|
|
||||||
List<BasSheep> selectBasSheepBySheepfold(String id);
|
List<BasSheep> selectBasSheepBySheepfold(String id);
|
||||||
@@ -91,4 +92,5 @@ public interface BasSheepMapper
|
|||||||
int existsByElectronicTag(@Param("tag") String tag);
|
int existsByElectronicTag(@Param("tag") String tag);
|
||||||
|
|
||||||
|
|
||||||
|
List<BasSheep> selectBasSheepByManageTagsList(@Param("manageTagsList") List<String> manageTagsList, @Param("sheep")BasSheep sheep);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,13 +27,19 @@ public interface SheepFileMapper
|
|||||||
public SheepFile selectSheepFileById(Long id);
|
public SheepFile selectSheepFileById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询羊只档案列表
|
* 查询羊只档案列表 (基础查询)
|
||||||
*
|
*
|
||||||
* @param sheepFile 羊只档案
|
* @param sheepFile 羊只档案
|
||||||
* @return 羊只档案集合
|
* @return 羊只档案集合
|
||||||
*/
|
*/
|
||||||
public List<SheepFile> selectSheepFileList(SheepFile sheepFile);
|
public List<SheepFile> selectSheepFileList(SheepFile sheepFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增:模糊查询耳号列表(用于下拉框远程搜索)
|
||||||
|
* @param query 搜索关键字
|
||||||
|
* @return 匹配的耳号列表
|
||||||
|
*/
|
||||||
|
List<String> searchEarNumbers(@Param("query") String query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据管理耳号查询
|
* 根据管理耳号查询
|
||||||
@@ -43,11 +49,9 @@ public interface SheepFileMapper
|
|||||||
*/
|
*/
|
||||||
SheepFile selectSheepByManageTags(String tags);
|
SheepFile selectSheepByManageTags(String tags);
|
||||||
|
|
||||||
|
|
||||||
// 在群羊只总数
|
// 在群羊只总数
|
||||||
Long countInGroup();
|
Long countInGroup();
|
||||||
|
|
||||||
|
|
||||||
// 羊只类别分布(按 name 分组)
|
// 羊只类别分布(按 name 分组)
|
||||||
List<Map<String,Object>> countBySheepType();
|
List<Map<String,Object>> countBySheepType();
|
||||||
|
|
||||||
@@ -60,52 +64,34 @@ public interface SheepFileMapper
|
|||||||
// 泌乳羊胎次分布(name = '泌乳羊' 时按 parity 分组)
|
// 泌乳羊胎次分布(name = '泌乳羊' 时按 parity 分组)
|
||||||
List<Map<String,Object>> countParityOfLactation();
|
List<Map<String,Object>> countParityOfLactation();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增方法:获取指定字段的唯一值列表
|
* 获取指定字段的唯一值列表 (配合 XML 中的 selectFieldValues)
|
||||||
*
|
|
||||||
* 这个方法用于查询数据库中某个字段的所有不重复的值
|
|
||||||
* 主要用于前端筛选条件中的下拉选项数据
|
|
||||||
*
|
|
||||||
* @param fieldName 字段名(数据库表中的列名)
|
|
||||||
* @return 该字段的所有唯一值列表,按字母顺序排序
|
|
||||||
*
|
|
||||||
* 使用场景示例:
|
|
||||||
* - 用户选择"耳号"字段时,返回所有不重复的耳号
|
|
||||||
* - 用户选择"品种"字段时,返回所有不重复的品种名称
|
|
||||||
*/
|
*/
|
||||||
List<String> selectFieldValues(String fieldName);
|
List<String> selectFieldValues(@Param("fieldName") String fieldName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据复杂条件查询羊只档案列表
|
* 核心修复:根据复杂条件查询羊只档案列表
|
||||||
*
|
* 对应 XML 中的 <select id="selectSheepFileListByCondition">
|
||||||
* @param params 查询参数映射
|
* 必须使用 @Param 注解以便 XML 能正确识别两个参数
|
||||||
* @param sheepFile 原有的查询条件(保持兼容)
|
|
||||||
* @return 羊只档案列表
|
|
||||||
*/
|
*/
|
||||||
List<SheepFile> selectSheepFileListByCondition(
|
List<SheepFile> selectSheepFileListByCondition(
|
||||||
@Param("params") Map<String, Object> params,
|
@Param("params") Map<String, Object> params,
|
||||||
@Param("sheepFile") SheepFile sheepFile
|
@Param("sheepFile") SheepFile sheepFile
|
||||||
);
|
);
|
||||||
|
|
||||||
// 修改:使用 @SelectProvider 并指定 ResultMap
|
/**
|
||||||
|
* 保留原有 Provider 方法 (若项目其他地方有用到)
|
||||||
|
*/
|
||||||
@SelectProvider(type = SheepFileSqlProvider.class, method = "selectByCondition")
|
@SelectProvider(type = SheepFileSqlProvider.class, method = "selectByCondition")
|
||||||
@ResultMap("SheepFileResult") // 重要:指定使用 XML 中定义的 ResultMap
|
@ResultMap("SheepFileResult")
|
||||||
List<SheepFile> selectByCondition(
|
List<SheepFile> selectByCondition(
|
||||||
@Param("sheepFile") SheepFile sheepFile,
|
@Param("sheepFile") SheepFile sheepFile,
|
||||||
@Param("conditions") Map<String, Object> conditions
|
@Param("conditions") Map<String, Object> conditions
|
||||||
);
|
);
|
||||||
|
|
||||||
// 修改:获取字段值的方法
|
|
||||||
@SelectProvider(type = SheepFileSqlProvider.class, method = "selectFieldValues")
|
@SelectProvider(type = SheepFileSqlProvider.class, method = "selectFieldValues")
|
||||||
List<String> selectFieldValuesByProvider(@Param("fieldName") String fieldName);
|
List<String> selectFieldValuesByProvider(@Param("fieldName") String fieldName);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有公羊(gender=2)
|
|
||||||
*
|
|
||||||
* @return 公羊列表
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* 查询所有公羊(gender=2)
|
* 查询所有公羊(gender=2)
|
||||||
* @return 公羊列表
|
* @return 公羊列表
|
||||||
@@ -118,4 +104,24 @@ public interface SheepFileMapper
|
|||||||
* @return 羊只信息
|
* @return 羊只信息
|
||||||
*/
|
*/
|
||||||
SheepFile selectSheepFileByManageTags(String manageTags);
|
SheepFile selectSheepFileByManageTags(String manageTags);
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* 新增羊只档案 (对应 XML 中的 insert)
|
||||||
|
*/
|
||||||
|
public int insertSheepFile(SheepFile sheepFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改羊只档案 (对应 XML 中的 update)
|
||||||
|
*/
|
||||||
|
public int updateSheepFile(SheepFile sheepFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除羊只档案 (对应 XML 中的 delete)
|
||||||
|
*/
|
||||||
|
public int deleteSheepFileById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除羊只档案 (对应 XML 中的 delete)
|
||||||
|
*/
|
||||||
|
public int deleteSheepFileByIds(Long[] ids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.zhyc.module.base.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.module.base.domain.SheepPedigree;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIEWMapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-02-04
|
||||||
|
*/
|
||||||
|
public interface SheepPedigreeMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询VIEW
|
||||||
|
*
|
||||||
|
* @param id VIEW主键
|
||||||
|
* @return VIEW
|
||||||
|
*/
|
||||||
|
public SheepPedigree selectSheepPedigreeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询VIEW列表
|
||||||
|
*
|
||||||
|
* @param sheepPedigree VIEW
|
||||||
|
* @return VIEW集合
|
||||||
|
*/
|
||||||
|
public List<SheepPedigree> selectSheepPedigreeList(SheepPedigree sheepPedigree);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增VIEW
|
||||||
|
*
|
||||||
|
* @param sheepPedigree VIEW
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSheepPedigree(SheepPedigree sheepPedigree);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改VIEW
|
||||||
|
*
|
||||||
|
* @param sheepPedigree VIEW
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSheepPedigree(SheepPedigree sheepPedigree);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除VIEW
|
||||||
|
*
|
||||||
|
* @param id VIEW主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSheepPedigreeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除VIEW
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSheepPedigreeByIds(Long[] ids);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据int类型id查询繁育状态名称
|
||||||
|
* @param id 主键id(int类型)
|
||||||
|
* @return 繁育状态名称(breed列的值)
|
||||||
|
*/
|
||||||
|
String selectBreedNameById(@Param("id") Long id);
|
||||||
|
}
|
||||||
@@ -71,6 +71,12 @@ public interface IBasSheepService
|
|||||||
* 根据羊只耳号获取羊只
|
* 根据羊只耳号获取羊只
|
||||||
*/
|
*/
|
||||||
BasSheep selectBasSheepByManageTags(String trim);
|
BasSheep selectBasSheepByManageTags(String trim);
|
||||||
|
/**
|
||||||
|
* 根据管理耳号列表批量查询羊只
|
||||||
|
*/
|
||||||
|
List<BasSheep> selectBasSheepByManageTagsList(List<String> manageTagsList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据牧场ID获取羊只列表
|
* 根据牧场ID获取羊只列表
|
||||||
|
|||||||
@@ -8,28 +8,29 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 羊只档案Service接口
|
* 羊只档案Service接口
|
||||||
*
|
* * @author wyt
|
||||||
* @author wyt
|
|
||||||
* @date 2025-07-13
|
* @date 2025-07-13
|
||||||
*/
|
*/
|
||||||
public interface ISheepFileService
|
public interface ISheepFileService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 查询羊只档案
|
* 查询羊只档案
|
||||||
*
|
* * @param id 羊只档案主键
|
||||||
* @param id 羊只档案主键
|
|
||||||
* @return 羊只档案
|
* @return 羊只档案
|
||||||
*/
|
*/
|
||||||
public SheepFile selectSheepFileById(Long id);
|
public SheepFile selectSheepFileById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询羊只档案列表
|
* 查询羊只档案列表
|
||||||
*
|
* * @param sheepFile 羊只档案
|
||||||
* @param sheepFile 羊只档案
|
|
||||||
* @return 羊只档案集合
|
* @return 羊只档案集合
|
||||||
*/
|
*/
|
||||||
public List<SheepFile> selectSheepFileList(SheepFile sheepFile);
|
public List<SheepFile> selectSheepFileList(SheepFile sheepFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增:搜索耳号接口
|
||||||
|
*/
|
||||||
|
List<String> searchEarNumbers(String query);
|
||||||
|
|
||||||
SheepFile selectBasSheepByManageTags(String trim);
|
SheepFile selectBasSheepByManageTags(String trim);
|
||||||
|
|
||||||
@@ -41,27 +42,14 @@ public interface ISheepFileService
|
|||||||
List<Map<String,Object>> countParityOfLactation();
|
List<Map<String,Object>> countParityOfLactation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增方法:获取指定字段的唯一值列表
|
* 获取指定字段的唯一值列表
|
||||||
*
|
|
||||||
* 这个方法为前端筛选功能提供数据支持
|
|
||||||
* 当用户选择某个字段进行筛选时,调用此方法获取该字段的所有可能值
|
|
||||||
*
|
|
||||||
* @param fieldName 字段名(需要是数据库表中的列名)
|
|
||||||
* @return 该字段的所有唯一值列表
|
|
||||||
* @throws IllegalArgumentException 当字段名不在白名单中时抛出异常
|
|
||||||
*
|
|
||||||
* 示例用法:
|
|
||||||
* List<String> earTags = getFieldValues("bs_manage_tags");
|
|
||||||
* // 返回结果可能是:["AF00001", "AF00002", "AF00003", ...]
|
|
||||||
*/
|
*/
|
||||||
List<String> getFieldValues(String fieldName);
|
List<String> getFieldValues(String fieldName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据复杂条件查询羊只档案列表
|
* 根据复杂条件查询羊只档案列表
|
||||||
*
|
* @param params 自定义参数Map (用于动态SQL)
|
||||||
* @param params 查询参数映射
|
* @param sheepFile 包含List筛选条件的实体对象
|
||||||
* @param sheepFile 原有的查询条件
|
|
||||||
* @return 羊只档案列表
|
|
||||||
*/
|
*/
|
||||||
List<SheepFile> selectSheepFileListByCondition(
|
List<SheepFile> selectSheepFileListByCondition(
|
||||||
Map<String, Object> params,
|
Map<String, Object> params,
|
||||||
@@ -73,4 +61,4 @@ public interface ISheepFileService
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
int updateSheepFile(SheepFile sheepFile);
|
int updateSheepFile(SheepFile sheepFile);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.zhyc.module.base.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.module.base.domain.SheepPedigree;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIEWService接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-02-04
|
||||||
|
*/
|
||||||
|
public interface ISheepPedigreeService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询VIEW
|
||||||
|
*
|
||||||
|
* @param id VIEW主键
|
||||||
|
* @return VIEW
|
||||||
|
*/
|
||||||
|
public SheepPedigree selectSheepPedigreeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询VIEW列表
|
||||||
|
*
|
||||||
|
* @param sheepPedigree VIEW
|
||||||
|
* @return VIEW集合
|
||||||
|
*/
|
||||||
|
public List<SheepPedigree> selectSheepPedigreeList(SheepPedigree sheepPedigree);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增VIEW
|
||||||
|
*
|
||||||
|
* @param sheepPedigree VIEW
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSheepPedigree(SheepPedigree sheepPedigree);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改VIEW
|
||||||
|
*
|
||||||
|
* @param sheepPedigree VIEW
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSheepPedigree(SheepPedigree sheepPedigree);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除VIEW
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的VIEW主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSheepPedigreeByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除VIEW信息
|
||||||
|
*
|
||||||
|
* @param id VIEW主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSheepPedigreeById(Long id);
|
||||||
|
|
||||||
|
public String getBreedNameById(Long id);
|
||||||
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.zhyc.module.base.service.impl;
|
package com.zhyc.module.base.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.zhyc.common.annotation.DataScope;
|
import com.zhyc.common.annotation.DataScope;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
import com.zhyc.common.utils.DateUtils;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
import com.zhyc.module.base.domain.BasSheep;
|
import com.zhyc.module.base.domain.BasSheep;
|
||||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||||
@@ -53,10 +55,22 @@ public class BasSheepServiceImpl implements IBasSheepService
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "b", userAlias = "b")
|
@DataScope(deptAlias = "s", userAlias = "s")
|
||||||
public List<String> searchEarNumbers(String query) {
|
public List<String> searchEarNumbers(String query) {
|
||||||
return basSheepMapper.searchEarNumbers(query);
|
BasSheep basSheep = new BasSheep();
|
||||||
|
basSheep.setManageTags(query);
|
||||||
|
return basSheepMapper.searchEarNumbers(basSheep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataScope(deptAlias = "s", userAlias = "s")
|
||||||
|
public List<BasSheep> selectBasSheepByManageTagsList(List<String> manageTagsList) {
|
||||||
|
if (manageTagsList == null || manageTagsList.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return basSheepMapper.selectBasSheepByManageTagsList(manageTagsList,new BasSheep());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增羊只基本信息
|
* 新增羊只基本信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;import java.util.Map;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 羊只档案Service业务层处理
|
* 羊只档案Service业务层处理
|
||||||
*
|
* * @author wyt
|
||||||
* @author wyt
|
|
||||||
* @date 2025-07-13
|
* @date 2025-07-13
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@@ -24,11 +24,11 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SheepFileMapper sheepFileMapper;
|
private SheepFileMapper sheepFileMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBreedRamFileService breedRamFileService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询羊只档案
|
* 查询羊只档案
|
||||||
*
|
|
||||||
* @param id 羊只档案主键
|
|
||||||
* @return 羊只档案
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SheepFile selectSheepFileById(Long id) {
|
public SheepFile selectSheepFileById(Long id) {
|
||||||
@@ -37,21 +37,25 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询羊只档案列表
|
* 查询羊只档案列表
|
||||||
*
|
|
||||||
* @param sheepFile 羊只档案
|
|
||||||
* @return 羊只档案
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SheepFile> selectSheepFileList(SheepFile sheepFile) {
|
public List<SheepFile> selectSheepFileList(SheepFile sheepFile) {
|
||||||
return sheepFileMapper.selectSheepFileList(sheepFile);
|
return sheepFileMapper.selectSheepFileList(sheepFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增:模糊搜索耳号实现
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<String> searchEarNumbers(String query) {
|
||||||
|
return sheepFileMapper.searchEarNumbers(query);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SheepFile selectBasSheepByManageTags(String tags) {
|
public SheepFile selectBasSheepByManageTags(String tags) {
|
||||||
return sheepFileMapper.selectSheepByManageTags(tags);
|
return sheepFileMapper.selectSheepByManageTags(tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> countBySheepType() {
|
public List<Map<String, Object>> countBySheepType() {
|
||||||
return sheepFileMapper.countBySheepType();
|
return sheepFileMapper.countBySheepType();
|
||||||
@@ -71,6 +75,7 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
public List<Map<String, Object>> countParityOfLactation() {
|
public List<Map<String, Object>> countParityOfLactation() {
|
||||||
return sheepFileMapper.countParityOfLactation();
|
return sheepFileMapper.countParityOfLactation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long countInGroup() { return sheepFileMapper.countInGroup(); }
|
public Long countInGroup() { return sheepFileMapper.countInGroup(); }
|
||||||
|
|
||||||
@@ -84,31 +89,42 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
throw new IllegalArgumentException("非法的字段名: " + fieldName + ",请检查字段名是否正确");
|
throw new IllegalArgumentException("非法的字段名: " + fieldName + ",请检查字段名是否正确");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 第二步:调用新的 Provider 方法
|
// 调用Mapper
|
||||||
// 注意:这里调用的是 selectFieldValuesByProvider,不是 selectFieldValues
|
// 注意:这里假设 Mapper 中有 selectFieldValues 方法
|
||||||
return sheepFileMapper.selectFieldValuesByProvider(fieldName);
|
// 如果你的 Mapper XML 中 id 是 selectFieldValues,请确保 Mapper 接口一致
|
||||||
|
return sheepFileMapper.selectFieldValues(fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核心修复:复杂条件查询
|
||||||
|
* 必须调用 Mapper 中对应的 XML 方法 (selectSheepFileListByCondition)
|
||||||
|
* 并且传递 sheepFile 对象以启用 <foreach> 列表查询
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SheepFile> selectSheepFileListByCondition(Map<String, Object> params, SheepFile sheepFile) {
|
public List<SheepFile> selectSheepFileListByCondition(Map<String, Object> params, SheepFile sheepFile) {
|
||||||
// 验证并处理参数
|
// 1. 验证并处理自定义参数 (驼峰转下划线、安全检查)
|
||||||
Map<String, Object> safeConditions = processConditions(params);
|
Map<String, Object> safeConditions = processConditions(params);
|
||||||
|
|
||||||
// 调用新的 Provider 方法
|
// 2. 调用 Mapper
|
||||||
List<SheepFile> result = sheepFileMapper.selectByCondition(sheepFile, safeConditions);
|
// 这里必须使用与 XML 中 <select id="selectSheepFileListByCondition"> 对应的方法
|
||||||
|
return sheepFileMapper.selectSheepFileListByCondition(safeConditions, sheepFile);
|
||||||
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int insertSheepFile(SheepFile sheepFile) {
|
public int insertSheepFile(SheepFile sheepFile) {
|
||||||
|
// int rows = sheepFileMapper.insertSheepFile(sheepFile);
|
||||||
|
// if (rows > 0) { syncToBreedRamFile(sheepFile); }
|
||||||
|
// return rows;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int updateSheepFile(SheepFile sheepFile) {
|
public int updateSheepFile(SheepFile sheepFile) {
|
||||||
|
// int rows = sheepFileMapper.updateSheepFile(sheepFile);
|
||||||
|
// if (rows > 0) { syncToBreedRamFile(sheepFile); }
|
||||||
|
// return rows;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,12 +142,13 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
String fieldName = entry.getKey();
|
String fieldName = entry.getKey();
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
|
|
||||||
// 将前端字段名转换为数据库字段名
|
// 将前端字段名转换为数据库字段名 (例如: fatherManageTags -> father_manage_tags)
|
||||||
|
// 这对于 XML 中的 ${key} = #{value} 至关重要
|
||||||
String dbFieldName = convertToDbFieldName(fieldName);
|
String dbFieldName = convertToDbFieldName(fieldName);
|
||||||
|
|
||||||
// 验证字段名是否安全
|
// 验证字段名是否安全
|
||||||
if (isValidFieldName(dbFieldName)) {
|
if (isValidFieldName(dbFieldName)) {
|
||||||
// 处理值,确保不是 Character 类型
|
// 处理值
|
||||||
Object safeValue = value;
|
Object safeValue = value;
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
String strValue = value.toString();
|
String strValue = value.toString();
|
||||||
@@ -140,23 +157,17 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
if (strValue.startsWith("GT:") || strValue.startsWith("LT:") ||
|
if (strValue.startsWith("GT:") || strValue.startsWith("LT:") ||
|
||||||
strValue.startsWith("GE:") || strValue.startsWith("LE:")) {
|
strValue.startsWith("GE:") || strValue.startsWith("LE:")) {
|
||||||
String numPart = strValue.substring(3);
|
String numPart = strValue.substring(3);
|
||||||
// 验证数字部分是否安全(防止 SQL 注入)
|
// 验证数字部分是否安全
|
||||||
if (isNumeric(numPart)) {
|
if (isNumeric(numPart)) {
|
||||||
safeValue = strValue;
|
safeValue = strValue;
|
||||||
} else {
|
} else {
|
||||||
// 如果不是数字,忽略这个条件
|
|
||||||
System.out.println("警告:范围条件的值不是数字: " + fieldName + " = " + strValue);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 其他值直接使用字符串
|
|
||||||
safeValue = strValue;
|
safeValue = strValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
safeParams.put(dbFieldName, safeValue);
|
safeParams.put(dbFieldName, safeValue);
|
||||||
} else {
|
|
||||||
// 记录日志
|
|
||||||
System.out.println("警告:忽略非法字段名: " + fieldName + " -> " + dbFieldName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,61 +202,17 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
* 扩展字段名白名单验证
|
* 扩展字段名白名单验证
|
||||||
*/
|
*/
|
||||||
private boolean isValidFieldName(String fieldName) {
|
private boolean isValidFieldName(String fieldName) {
|
||||||
// 扩展允许查询的字段白名单
|
// 字段白名单
|
||||||
String[] allowedFields = {
|
String[] allowedFields = {
|
||||||
"id",
|
"id", "bs_manage_tags", "electronic_tags", "dr_ranch", "sheepfold_name", "variety", "family",
|
||||||
"bs_manage_tags", // 管理耳号
|
"name", "gender", "birthday", "day_age", "month_age", "parity", "birth_weight", "weaning_date",
|
||||||
"electronic_tags", // 电子耳号
|
"status_id", "weaning_weight", "current_weight", "weaning_day_age", "weaning_daily_gain", "breed",
|
||||||
"dr_ranch", // 牧场名称
|
"father_manage_tags", "mother_manage_tags", "receptor_manage_tags", "grandfather_manage_tags",
|
||||||
"sheepfold_name", // 羊舍名称
|
"grandmother_manage_tags", "maternal_grandfather_manage_tags", "maternal_grandmother_manage_tags",
|
||||||
"variety", // 品种
|
"mating_date", "mating_type_id", "preg_date", "lambing_date", "lambing_day", "mating_day",
|
||||||
"family", // 家系
|
"gestation_day", "expected_date", "post_lambing_day", "lactation_day", "anestrous_day",
|
||||||
"name", // 羊只类型
|
"mating_counts", "mating_total", "miscarriage_counts", "comment", "controlled", "body", "breast",
|
||||||
"gender", // 性别
|
"source", "source_date", "source_ranch", "update_by", "update_time", "create_by", "create_time"
|
||||||
"birthday", // 出生日期
|
|
||||||
"day_age", // 日龄
|
|
||||||
"month_age", // 月龄
|
|
||||||
"parity", // 胎次
|
|
||||||
"birth_weight", // 出生体重
|
|
||||||
"weaning_date", // 断奶日期
|
|
||||||
"status_id", // 羊只状态
|
|
||||||
"weaning_weight", // 断奶体重
|
|
||||||
"current_weight", // 当前体重
|
|
||||||
"weaning_day_age", // 断奶日龄
|
|
||||||
"weaning_daily_gain", // 断奶日增重
|
|
||||||
"breed", // 繁殖状态
|
|
||||||
"father_manage_tags", // 父亲耳号
|
|
||||||
"mother_manage_tags", // 母亲耳号
|
|
||||||
"receptor_manage_tags", // 受体耳号
|
|
||||||
"grandfather_manage_tags", // 祖父耳号
|
|
||||||
"grandmother_manage_tags", // 祖母耳号
|
|
||||||
"maternal_grandfather_manage_tags", // 外祖父耳号
|
|
||||||
"maternal_grandmother_manage_tags", // 外祖母耳号
|
|
||||||
"mating_date", // 配种日期
|
|
||||||
"mating_type_id", // 配种类型
|
|
||||||
"preg_date", // 孕检日期
|
|
||||||
"lambing_date", // 产羔日期
|
|
||||||
"lambing_day", // 产羔时怀孕天数
|
|
||||||
"mating_day", // 配后天数
|
|
||||||
"gestation_day", // 怀孕天数
|
|
||||||
"expected_date", // 预产日期
|
|
||||||
"post_lambing_day", // 产后天数
|
|
||||||
"lactation_day", // 泌乳天数
|
|
||||||
"anestrous_day", // 空怀天数
|
|
||||||
"mating_counts", // 配种次数
|
|
||||||
"mating_total", // 累计配种次数
|
|
||||||
"miscarriage_counts", // 累计流产次数
|
|
||||||
"comment", // 备注
|
|
||||||
"controlled", // 是否性控
|
|
||||||
"body", // 体况评分
|
|
||||||
"breast", // 乳房评分
|
|
||||||
"source", // 入群来源
|
|
||||||
"source_date", // 入群日期
|
|
||||||
"source_ranch", // 来源牧场
|
|
||||||
"update_by", // 修改人
|
|
||||||
"update_time", // 修改日期
|
|
||||||
"create_by", // 创建人
|
|
||||||
"create_time" // 创建日期
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (String allowedField : allowedFields) {
|
for (String allowedField : allowedFields) {
|
||||||
@@ -257,45 +224,32 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IBreedRamFileService breedRamFileService; // 注入种公羊服务
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增羊只档案
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步公羊数据到种公羊档案表
|
* 同步公羊数据到种公羊档案表
|
||||||
*/
|
*/
|
||||||
private void syncToBreedRamFile(SheepFile sheepFile) {
|
private void syncToBreedRamFile(SheepFile sheepFile) {
|
||||||
try {
|
try {
|
||||||
// 检查是否已存在
|
|
||||||
BreedRamFile existingRam = breedRamFileService.selectBreedRamFileByOrdinaryEarNumber(
|
BreedRamFile existingRam = breedRamFileService.selectBreedRamFileByOrdinaryEarNumber(
|
||||||
sheepFile.getBsManageTags()
|
sheepFile.getBsManageTags()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (existingRam != null) {
|
if (existingRam != null) {
|
||||||
// 已存在,更新
|
|
||||||
BreedRamFile updateRam = convertToBreedRamFile(sheepFile);
|
BreedRamFile updateRam = convertToBreedRamFile(sheepFile);
|
||||||
updateRam.setId(existingRam.getId());
|
updateRam.setId(existingRam.getId());
|
||||||
breedRamFileService.updateBreedRamFile(updateRam);
|
breedRamFileService.updateBreedRamFile(updateRam);
|
||||||
} else {
|
} else {
|
||||||
// 不存在,新增
|
|
||||||
BreedRamFile newRam = convertToBreedRamFile(sheepFile);
|
BreedRamFile newRam = convertToBreedRamFile(sheepFile);
|
||||||
breedRamFileService.insertBreedRamFile(newRam);
|
breedRamFileService.insertBreedRamFile(newRam);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 记录日志,但不影响主流
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 将SheepFile转换为BreedRamFile
|
|
||||||
*/
|
|
||||||
private BreedRamFile convertToBreedRamFile(SheepFile sheepFile) {
|
private BreedRamFile convertToBreedRamFile(SheepFile sheepFile) {
|
||||||
BreedRamFile breedRamFile = new BreedRamFile();
|
BreedRamFile breedRamFile = new BreedRamFile();
|
||||||
|
|
||||||
// 基本信息
|
|
||||||
breedRamFile.setOrdinaryEarNumber(sheepFile.getBsManageTags());
|
breedRamFile.setOrdinaryEarNumber(sheepFile.getBsManageTags());
|
||||||
breedRamFile.setRanchId(sheepFile.getRanchId());
|
breedRamFile.setRanchId(sheepFile.getRanchId());
|
||||||
breedRamFile.setRanchName(sheepFile.getDrRanch());
|
breedRamFile.setRanchName(sheepFile.getDrRanch());
|
||||||
@@ -307,15 +261,13 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
breedRamFile.setSheepCategory(sheepFile.getName());
|
breedRamFile.setSheepCategory(sheepFile.getName());
|
||||||
breedRamFile.setBirthday(sheepFile.getBirthday());
|
breedRamFile.setBirthday(sheepFile.getBirthday());
|
||||||
|
|
||||||
// 体重相关
|
if (sheepFile.getBirthWeight() != null) breedRamFile.setBirthWeight(BigDecimal.valueOf(sheepFile.getBirthWeight()));
|
||||||
breedRamFile.setBirthWeight(BigDecimal.valueOf(sheepFile.getBirthWeight()));
|
|
||||||
breedRamFile.setWeaningDate(sheepFile.getWeaningDate());
|
breedRamFile.setWeaningDate(sheepFile.getWeaningDate());
|
||||||
breedRamFile.setWeaningDayAge(sheepFile.getWeaningDayAge());
|
breedRamFile.setWeaningDayAge(sheepFile.getWeaningDayAge());
|
||||||
breedRamFile.setWeaningWeight(BigDecimal.valueOf(sheepFile.getWeaningWeight()));
|
if (sheepFile.getWeaningWeight() != null) breedRamFile.setWeaningWeight(BigDecimal.valueOf(sheepFile.getWeaningWeight()));
|
||||||
breedRamFile.setWeaningDailyGain(BigDecimal.valueOf(sheepFile.getWeaningDailyGain()));
|
if (sheepFile.getWeaningDailyGain() != null) breedRamFile.setWeaningDailyGain(BigDecimal.valueOf(sheepFile.getWeaningDailyGain()));
|
||||||
breedRamFile.setCurrentWeight(BigDecimal.valueOf(sheepFile.getCurrentWeight()));
|
if (sheepFile.getCurrentWeight() != null) breedRamFile.setCurrentWeight(BigDecimal.valueOf(sheepFile.getCurrentWeight()));
|
||||||
|
|
||||||
// 家系信息
|
|
||||||
breedRamFile.setFatherNumber(sheepFile.getFatherManageTags());
|
breedRamFile.setFatherNumber(sheepFile.getFatherManageTags());
|
||||||
breedRamFile.setMotherNumber(sheepFile.getMotherManageTags());
|
breedRamFile.setMotherNumber(sheepFile.getMotherManageTags());
|
||||||
breedRamFile.setGrandfatherNumber(sheepFile.getGrandfatherManageTags());
|
breedRamFile.setGrandfatherNumber(sheepFile.getGrandfatherManageTags());
|
||||||
@@ -323,7 +275,6 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
breedRamFile.setMaternalGrandfatherNumber(sheepFile.getMaternalGrandfatherManageTags());
|
breedRamFile.setMaternalGrandfatherNumber(sheepFile.getMaternalGrandfatherManageTags());
|
||||||
breedRamFile.setMaternalGrandmotherNumber(sheepFile.getMaternalGrandmotherManageTags());
|
breedRamFile.setMaternalGrandmotherNumber(sheepFile.getMaternalGrandmotherManageTags());
|
||||||
|
|
||||||
// 审计信息
|
|
||||||
breedRamFile.setCreateBy(sheepFile.getCreateBy());
|
breedRamFile.setCreateBy(sheepFile.getCreateBy());
|
||||||
breedRamFile.setCreateTime(sheepFile.getCreateTime());
|
breedRamFile.setCreateTime(sheepFile.getCreateTime());
|
||||||
breedRamFile.setUpdateBy(sheepFile.getUpdateBy());
|
breedRamFile.setUpdateBy(sheepFile.getUpdateBy());
|
||||||
@@ -332,5 +283,4 @@ public class SheepFileServiceImpl implements ISheepFileService {
|
|||||||
|
|
||||||
return breedRamFile;
|
return breedRamFile;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.zhyc.module.base.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.zhyc.common.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.zhyc.module.base.mapper.SheepPedigreeMapper;
|
||||||
|
import com.zhyc.module.base.domain.SheepPedigree;
|
||||||
|
import com.zhyc.module.base.service.ISheepPedigreeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VIEWService业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-02-04
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SheepPedigreeServiceImpl implements ISheepPedigreeService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private SheepPedigreeMapper sheepPedigreeMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询VIEW
|
||||||
|
*
|
||||||
|
* @param id VIEW主键
|
||||||
|
* @return VIEW
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SheepPedigree selectSheepPedigreeById(Long id)
|
||||||
|
{
|
||||||
|
return sheepPedigreeMapper.selectSheepPedigreeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询VIEW列表
|
||||||
|
*
|
||||||
|
* @param sheepPedigree VIEW
|
||||||
|
* @return VIEW
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SheepPedigree> selectSheepPedigreeList(SheepPedigree sheepPedigree)
|
||||||
|
{
|
||||||
|
return sheepPedigreeMapper.selectSheepPedigreeList(sheepPedigree);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增VIEW
|
||||||
|
*
|
||||||
|
* @param sheepPedigree VIEW
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertSheepPedigree(SheepPedigree sheepPedigree)
|
||||||
|
{
|
||||||
|
sheepPedigree.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return sheepPedigreeMapper.insertSheepPedigree(sheepPedigree);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改VIEW
|
||||||
|
*
|
||||||
|
* @param sheepPedigree VIEW
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateSheepPedigree(SheepPedigree sheepPedigree)
|
||||||
|
{
|
||||||
|
sheepPedigree.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return sheepPedigreeMapper.updateSheepPedigree(sheepPedigree);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除VIEW
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的VIEW主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSheepPedigreeByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return sheepPedigreeMapper.deleteSheepPedigreeByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除VIEW信息
|
||||||
|
*
|
||||||
|
* @param id VIEW主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSheepPedigreeById(Long id)
|
||||||
|
{
|
||||||
|
return sheepPedigreeMapper.deleteSheepPedigreeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBreedNameById(Long id) {
|
||||||
|
if (id == null) { // int类型id为空直接返回空
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return sheepPedigreeMapper.selectBreedNameById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,511 @@
|
|||||||
|
package com.zhyc.module.base.util;
|
||||||
|
|
||||||
|
import com.zhyc.module.base.domain.SheepPedigree;
|
||||||
|
import com.zhyc.module.base.service.ISheepPedigreeService;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import com.zhyc.common.utils.DictUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 羊只系谱自定义Excel导出工具(适配羊只系谱表(2)样式)
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class SheepPedigreeExcelUtils {
|
||||||
|
// 日期格式化
|
||||||
|
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
|
// 注入Service接口
|
||||||
|
@Autowired
|
||||||
|
private ISheepPedigreeService sheepPedigreeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出指定bsManageTags的羊只系谱(符合羊只系谱表(2)样式)
|
||||||
|
*/
|
||||||
|
public void export(HttpServletResponse response, List<SheepPedigree> dataList) throws Exception {
|
||||||
|
// 1. 创建Excel工作簿和工作表
|
||||||
|
Workbook workbook = new XSSFWorkbook();
|
||||||
|
Sheet sheet = workbook.createSheet("羊只系谱");
|
||||||
|
// 设置列宽(6列,索引0-5)
|
||||||
|
sheet.setColumnWidth(0, 15 * 256); // 第1列
|
||||||
|
sheet.setColumnWidth(1, 15 * 256); // 第2列
|
||||||
|
sheet.setColumnWidth(2, 15 * 256); // 第3列
|
||||||
|
sheet.setColumnWidth(3, 15 * 256); // 第4列
|
||||||
|
sheet.setColumnWidth(4, 15 * 256); // 第5列
|
||||||
|
sheet.setColumnWidth(5, 15 * 256); // 第6列
|
||||||
|
|
||||||
|
// 2. 定义样式(新增:通用边框样式,所有单元格都应用)
|
||||||
|
CellStyle titleStyle = createTitleStyle(workbook);
|
||||||
|
CellStyle blockTitleStyle = createBlockTitleStyle(workbook);
|
||||||
|
CellStyle contentStyle = createContentStyle(workbook);
|
||||||
|
CellStyle borderStyle = createBorderStyle(workbook); // 纯边框样式,用于空单元格
|
||||||
|
|
||||||
|
int rowNum = 0;
|
||||||
|
// 遍历数据
|
||||||
|
for (SheepPedigree pedigree : dataList) {
|
||||||
|
// ========== 1. 大标题:羊只系谱 ==========
|
||||||
|
Row titleRow = sheet.createRow(rowNum++);
|
||||||
|
titleRow.setHeightInPoints(25);
|
||||||
|
Cell titleCell = titleRow.createCell(0);
|
||||||
|
titleCell.setCellValue("羊只系谱");
|
||||||
|
titleCell.setCellStyle(titleStyle);
|
||||||
|
// 给标题行所有列应用边框
|
||||||
|
fillRowWithBorder(titleRow, 0, 5, borderStyle);
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 0, 5));
|
||||||
|
|
||||||
|
// ========== 2. 基础信息区块 ==========
|
||||||
|
// 普通耳号
|
||||||
|
Row earTagRow = sheet.createRow(rowNum++);
|
||||||
|
earTagRow.setHeightInPoints(20);
|
||||||
|
Cell earTagLabelCell = earTagRow.createCell(0);
|
||||||
|
earTagLabelCell.setCellValue("普通耳号");
|
||||||
|
earTagLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
String earTagContent = pedigree.getBsManageTags() != null ? pedigree.getBsManageTags() : "";
|
||||||
|
Cell earTagValueCell = earTagRow.createCell(1);
|
||||||
|
earTagValueCell.setCellValue(earTagContent);
|
||||||
|
earTagValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
// 给当前行所有列填充边框
|
||||||
|
fillRowWithBorder(earTagRow, 0, 5, borderStyle);
|
||||||
|
CellRangeAddress earTagMerge = new CellRangeAddress(
|
||||||
|
rowNum - 1,
|
||||||
|
rowNum - 1,
|
||||||
|
1,
|
||||||
|
5
|
||||||
|
);
|
||||||
|
sheet.addMergedRegion(earTagMerge);
|
||||||
|
|
||||||
|
// 品种 + 类别
|
||||||
|
Row varietyRow = sheet.createRow(rowNum++);
|
||||||
|
varietyRow.setHeightInPoints(20);
|
||||||
|
Cell varietyLabelCell = varietyRow.createCell(0);
|
||||||
|
varietyLabelCell.setCellValue("品种");
|
||||||
|
varietyLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
String varietyContent = pedigree.getVariety() != null ? pedigree.getVariety() : "";
|
||||||
|
Cell varietyValueCell = varietyRow.createCell(1);
|
||||||
|
varietyValueCell.setCellValue(varietyContent);
|
||||||
|
varietyValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell categoryLabelCell = varietyRow.createCell(2);
|
||||||
|
categoryLabelCell.setCellValue("类别");
|
||||||
|
categoryLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
String categoryContent = pedigree.getName() != null ? pedigree.getName() : "";
|
||||||
|
Cell categoryValueCell = varietyRow.createCell(3);
|
||||||
|
categoryValueCell.setCellValue(categoryContent);
|
||||||
|
categoryValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
// 填充边框
|
||||||
|
fillRowWithBorder(varietyRow, 0, 5, borderStyle);
|
||||||
|
CellRangeAddress categoryMerge = new CellRangeAddress(
|
||||||
|
rowNum - 1,
|
||||||
|
rowNum - 1,
|
||||||
|
3,
|
||||||
|
5
|
||||||
|
);
|
||||||
|
sheet.addMergedRegion(categoryMerge);
|
||||||
|
|
||||||
|
// 性别 + 出生重量 + 出生日期
|
||||||
|
Row genderRow = sheet.createRow(rowNum++);
|
||||||
|
genderRow.setHeightInPoints(20);
|
||||||
|
Cell genderLabelCell = genderRow.createCell(0);
|
||||||
|
genderLabelCell.setCellValue("性别");
|
||||||
|
genderLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell genderValueCell = genderRow.createCell(1);
|
||||||
|
genderValueCell.setCellValue(getGenderText(pedigree.getGender()));
|
||||||
|
genderValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell birthWeightLabelCell = genderRow.createCell(2);
|
||||||
|
birthWeightLabelCell.setCellValue("出生重量");
|
||||||
|
birthWeightLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell birthWeightValueCell = genderRow.createCell(3);
|
||||||
|
String birthWeightContent = pedigree.getBirthWeight() != null ? pedigree.getBirthWeight() + "kg" : "";
|
||||||
|
birthWeightValueCell.setCellValue(birthWeightContent);
|
||||||
|
birthWeightValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell birthDateLabelCell = genderRow.createCell(4);
|
||||||
|
birthDateLabelCell.setCellValue("出生日期");
|
||||||
|
birthDateLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell birthDateValueCell = genderRow.createCell(5);
|
||||||
|
String birthDate = pedigree.getBirthday() != null ? DATE_FORMAT.format(pedigree.getBirthday()) : "";
|
||||||
|
birthDateValueCell.setCellValue(birthDate);
|
||||||
|
birthDateValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
// 填充边框
|
||||||
|
fillRowWithBorder(genderRow, 0, 5, borderStyle);
|
||||||
|
|
||||||
|
// 毛色 + 月龄 + 状态
|
||||||
|
Row furColorRow = sheet.createRow(rowNum++);
|
||||||
|
furColorRow.setHeightInPoints(20);
|
||||||
|
Cell furColorLabelCell = furColorRow.createCell(0);
|
||||||
|
furColorLabelCell.setCellValue("毛色");
|
||||||
|
furColorLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell furColorValueCell = furColorRow.createCell(1);
|
||||||
|
String furColorContent = pedigree.getSheepColor() != null ? pedigree.getSheepColor() : "";
|
||||||
|
furColorValueCell.setCellValue(furColorContent);
|
||||||
|
furColorValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell monthAgeLabelCell = furColorRow.createCell(2);
|
||||||
|
monthAgeLabelCell.setCellValue("月龄");
|
||||||
|
monthAgeLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell monthAgeValueCell = furColorRow.createCell(3);
|
||||||
|
String monthAgeContent = pedigree.getMonthAge() != null ? pedigree.getMonthAge() + "月" : "";
|
||||||
|
monthAgeValueCell.setCellValue(monthAgeContent);
|
||||||
|
monthAgeValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell statusLabelCell = furColorRow.createCell(4);
|
||||||
|
statusLabelCell.setCellValue("状态");
|
||||||
|
statusLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Map<Object, String> statusDict = new HashMap<>();
|
||||||
|
statusDict.put(1L, "在群");
|
||||||
|
statusDict.put(2L, "不在群");
|
||||||
|
statusDict.put(null, "");
|
||||||
|
|
||||||
|
Object statusId = pedigree.getStatusId();
|
||||||
|
String statusContent = statusDict.getOrDefault(statusId, "未知状态");
|
||||||
|
|
||||||
|
Cell statusValueCell = furColorRow.createCell(5);
|
||||||
|
statusValueCell.setCellValue(statusContent);
|
||||||
|
statusValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
// 填充边框
|
||||||
|
fillRowWithBorder(furColorRow, 0, 5, borderStyle);
|
||||||
|
|
||||||
|
// 繁育状态 + 来源
|
||||||
|
Row breedStatusRow = sheet.createRow(rowNum++);
|
||||||
|
breedStatusRow.setHeightInPoints(20);
|
||||||
|
int currentRow = rowNum - 1;
|
||||||
|
|
||||||
|
Cell breedStatusLabelCell = breedStatusRow.createCell(0);
|
||||||
|
breedStatusLabelCell.setCellValue("繁育状态");
|
||||||
|
breedStatusLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell breedStatusValueCell = breedStatusRow.createCell(1);
|
||||||
|
String breedStatusContent = "";
|
||||||
|
try {
|
||||||
|
Object breedObj = pedigree.getBreed();
|
||||||
|
if (breedObj != null) {
|
||||||
|
breedStatusContent = breedObj.toString().trim();
|
||||||
|
}
|
||||||
|
if (breedStatusContent == null || breedStatusContent.isEmpty()) {
|
||||||
|
breedStatusContent = "";
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
breedStatusContent = "";
|
||||||
|
}
|
||||||
|
breedStatusValueCell.setCellValue(breedStatusContent);
|
||||||
|
breedStatusValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell sourceLabelCell = breedStatusRow.createCell(2);
|
||||||
|
sourceLabelCell.setCellValue("来源");
|
||||||
|
sourceLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell sourceValueCell = breedStatusRow.createCell(3);
|
||||||
|
String sourceCode = pedigree.getSource() != null ? pedigree.getSource().toString() : "";
|
||||||
|
String sourceContent = "";
|
||||||
|
try {
|
||||||
|
sourceContent = DictUtils.getDictLabel("source", sourceCode, "");
|
||||||
|
} catch (Exception e) {
|
||||||
|
sourceContent = "";
|
||||||
|
System.err.println("来源字典映射失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
sourceValueCell.setCellValue(sourceContent);
|
||||||
|
sourceValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
// 填充边框
|
||||||
|
fillRowWithBorder(breedStatusRow, 0, 5, borderStyle);
|
||||||
|
CellRangeAddress sourceMerge = new CellRangeAddress(
|
||||||
|
currentRow,
|
||||||
|
currentRow,
|
||||||
|
3,
|
||||||
|
5
|
||||||
|
);
|
||||||
|
sheet.addMergedRegion(sourceMerge);
|
||||||
|
|
||||||
|
// 等级 + 家系
|
||||||
|
Row levelRow = sheet.createRow(rowNum++);
|
||||||
|
levelRow.setHeightInPoints(20);
|
||||||
|
int currentLevelRow = rowNum - 1;
|
||||||
|
|
||||||
|
Cell levelLabelCell = levelRow.createCell(0);
|
||||||
|
levelLabelCell.setCellValue("等级");
|
||||||
|
levelLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell levelValueCell = levelRow.createCell(1);
|
||||||
|
String levelContent = pedigree.getGroupName() != null ? pedigree.getGroupName() : "";
|
||||||
|
levelValueCell.setCellValue(levelContent);
|
||||||
|
levelValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell familyLabelCell = levelRow.createCell(2);
|
||||||
|
familyLabelCell.setCellValue("家系");
|
||||||
|
familyLabelCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
Cell familyValueCell = levelRow.createCell(3);
|
||||||
|
String familyContent = pedigree.getFamily() != null ? pedigree.getFamily() : "";
|
||||||
|
familyValueCell.setCellValue(familyContent);
|
||||||
|
familyValueCell.setCellStyle(contentStyle);
|
||||||
|
|
||||||
|
// 填充边框
|
||||||
|
fillRowWithBorder(levelRow, 0, 5, borderStyle);
|
||||||
|
CellRangeAddress familyMerge = new CellRangeAddress(
|
||||||
|
currentLevelRow,
|
||||||
|
currentLevelRow,
|
||||||
|
3,
|
||||||
|
5
|
||||||
|
);
|
||||||
|
sheet.addMergedRegion(familyMerge);
|
||||||
|
|
||||||
|
// ========== 3. 系谱信息区块(最终修复版) ==========
|
||||||
|
Row pedigreeTitleRow = sheet.createRow(rowNum++);
|
||||||
|
pedigreeTitleRow.setHeightInPoints(25); // 区块标题行高
|
||||||
|
Cell pedigreeTitleCell = pedigreeTitleRow.createCell(0);
|
||||||
|
pedigreeTitleCell.setCellValue("系谱信息");
|
||||||
|
pedigreeTitleCell.setCellStyle(blockTitleStyle);
|
||||||
|
// 填充标题行边框
|
||||||
|
fillRowWithBorder(pedigreeTitleRow, 0, 5, borderStyle);
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 0, 5));
|
||||||
|
|
||||||
|
// 系谱区块起始行(此时rowNum是系谱内容第1行)
|
||||||
|
int pedigreeStartRow = rowNum;
|
||||||
|
int pedigreeTotalRows = 12;
|
||||||
|
// 统一设置系谱12行的行高+填充边框
|
||||||
|
for (int i = 0; i < pedigreeTotalRows; i++) {
|
||||||
|
Row tempRow = sheet.createRow(pedigreeStartRow + i);
|
||||||
|
tempRow.setHeightInPoints(20);
|
||||||
|
// 给每行的0-5列都填充边框样式
|
||||||
|
fillRowWithBorder(tempRow, 0, 5, borderStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 1. 羊只列:第1列合并12行 ==========
|
||||||
|
Row sheepRow = sheet.getRow(pedigreeStartRow);
|
||||||
|
Cell sheepCell = sheepRow.createCell(0);
|
||||||
|
String sheepValue = pedigree.getBsManageTags() != null && !pedigree.getBsManageTags().isEmpty()
|
||||||
|
? "羊只:" + pedigree.getBsManageTags()
|
||||||
|
: "羊只:无";
|
||||||
|
sheepCell.setCellValue(sheepValue);
|
||||||
|
sheepCell.setCellStyle(contentStyle); // 覆盖为内容样式(带边框+字体)
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(
|
||||||
|
pedigreeStartRow,
|
||||||
|
pedigreeStartRow + 11,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
));
|
||||||
|
|
||||||
|
// ========== 2. 父耳号:第2-3列合并前6行 ==========
|
||||||
|
Row fatherRow = sheet.getRow(pedigreeStartRow);
|
||||||
|
Cell fatherCell = fatherRow.createCell(1);
|
||||||
|
String fatherValue = pedigree.getFatherManageTags() != null && !pedigree.getFatherManageTags().isEmpty()
|
||||||
|
? "父耳号:" + pedigree.getFatherManageTags()
|
||||||
|
: "父耳号:无";
|
||||||
|
fatherCell.setCellValue(fatherValue);
|
||||||
|
fatherCell.setCellStyle(contentStyle);
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(
|
||||||
|
pedigreeStartRow,
|
||||||
|
pedigreeStartRow + 5,
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
));
|
||||||
|
|
||||||
|
// ========== 3. 母耳号:第2-3列合并后6行 ==========
|
||||||
|
Row motherRow = sheet.getRow(pedigreeStartRow + 6);
|
||||||
|
Cell motherCell = motherRow.createCell(1);
|
||||||
|
String motherValue = pedigree.getMotherManageTags() != null && !pedigree.getMotherManageTags().isEmpty()
|
||||||
|
? "母耳号:" + pedigree.getMotherManageTags()
|
||||||
|
: "母耳号:无";
|
||||||
|
motherCell.setCellValue(motherValue);
|
||||||
|
motherCell.setCellStyle(contentStyle);
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(
|
||||||
|
pedigreeStartRow + 6,
|
||||||
|
pedigreeStartRow + 11,
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
));
|
||||||
|
|
||||||
|
// ========== 4. 祖父耳号:第4-6列合并1-3行 ==========
|
||||||
|
Row grandFatherRow = sheet.getRow(pedigreeStartRow);
|
||||||
|
Cell grandFatherCell = grandFatherRow.createCell(3);
|
||||||
|
String grandFatherValue = pedigree.getGrandfatherManageTags() != null && !pedigree.getGrandfatherManageTags().isEmpty()
|
||||||
|
? "祖父耳号:" + pedigree.getGrandfatherManageTags()
|
||||||
|
: "祖父耳号:无";
|
||||||
|
grandFatherCell.setCellValue(grandFatherValue);
|
||||||
|
grandFatherCell.setCellStyle(contentStyle);
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(
|
||||||
|
pedigreeStartRow,
|
||||||
|
pedigreeStartRow + 2,
|
||||||
|
3,
|
||||||
|
5
|
||||||
|
));
|
||||||
|
|
||||||
|
// ========== 5. 祖母耳号:第4-6列合并4-6行 ==========
|
||||||
|
Row grandMotherRow = sheet.getRow(pedigreeStartRow + 3);
|
||||||
|
Cell grandMotherCell = grandMotherRow.createCell(3);
|
||||||
|
String grandMotherValue = pedigree.getGrandmotherManageTags() != null && !pedigree.getGrandmotherManageTags().isEmpty()
|
||||||
|
? "祖母耳号:" + pedigree.getGrandmotherManageTags()
|
||||||
|
: "祖母耳号:无";
|
||||||
|
grandMotherCell.setCellValue(grandMotherValue);
|
||||||
|
grandMotherCell.setCellStyle(contentStyle);
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(
|
||||||
|
pedigreeStartRow + 3,
|
||||||
|
pedigreeStartRow + 5,
|
||||||
|
3,
|
||||||
|
5
|
||||||
|
));
|
||||||
|
|
||||||
|
// ========== 6. 外祖父耳号:第4-6列合并7-9行 ==========
|
||||||
|
Row maternalGrandFatherRow = sheet.getRow(pedigreeStartRow + 6);
|
||||||
|
Cell maternalGrandFatherCell = maternalGrandFatherRow.createCell(3);
|
||||||
|
String maternalGrandFatherValue = pedigree.getMaternalGrandfatherManageTags() != null && !pedigree.getMaternalGrandfatherManageTags().isEmpty()
|
||||||
|
? "外祖父耳号:" + pedigree.getMaternalGrandfatherManageTags()
|
||||||
|
: "外祖父耳号:无";
|
||||||
|
maternalGrandFatherCell.setCellValue(maternalGrandFatherValue);
|
||||||
|
maternalGrandFatherCell.setCellStyle(contentStyle);
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(
|
||||||
|
pedigreeStartRow + 6,
|
||||||
|
pedigreeStartRow + 8,
|
||||||
|
3,
|
||||||
|
5
|
||||||
|
));
|
||||||
|
|
||||||
|
// ========== 7. 外祖母耳号:第4-6列合并10-12行 ==========
|
||||||
|
Row maternalGrandMotherRow = sheet.getRow(pedigreeStartRow + 9);
|
||||||
|
Cell maternalGrandMotherCell = maternalGrandMotherRow.createCell(3);
|
||||||
|
String maternalGrandMotherValue = pedigree.getMaternalGrandmotherManageTags() != null && !pedigree.getMaternalGrandmotherManageTags().isEmpty()
|
||||||
|
? "外祖母耳号:" + pedigree.getMaternalGrandmotherManageTags()
|
||||||
|
: "外祖母耳号:无";
|
||||||
|
maternalGrandMotherCell.setCellValue(maternalGrandMotherValue);
|
||||||
|
maternalGrandMotherCell.setCellStyle(contentStyle);
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(
|
||||||
|
pedigreeStartRow + 9,
|
||||||
|
pedigreeStartRow + 11,
|
||||||
|
3,
|
||||||
|
5
|
||||||
|
));
|
||||||
|
|
||||||
|
// 更新rowNum到系谱区块结束行+1
|
||||||
|
rowNum = pedigreeStartRow + pedigreeTotalRows;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 4. 输出Excel ==========
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
String fileName = URLEncoder.encode("羊只系谱_" + System.currentTimeMillis(), "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||||
|
|
||||||
|
OutputStream os = response.getOutputStream();
|
||||||
|
workbook.write(os);
|
||||||
|
os.flush();
|
||||||
|
os.close();
|
||||||
|
workbook.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 新增:填充整行边框的工具方法 ==========
|
||||||
|
private void fillRowWithBorder(Row row, int startCol, int endCol, CellStyle borderStyle) {
|
||||||
|
for (int col = startCol; col <= endCol; col++) {
|
||||||
|
Cell cell = row.getCell(col);
|
||||||
|
if (cell == null) {
|
||||||
|
cell = row.createCell(col);
|
||||||
|
}
|
||||||
|
// 仅当单元格无样式时设置边框样式(避免覆盖已有内容样式)
|
||||||
|
if (cell.getCellStyle() == null || cell.getCellStyle().getBorderTop() == BorderStyle.NONE) {
|
||||||
|
cell.setCellStyle(borderStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 样式定义 ==========
|
||||||
|
private static CellStyle createTitleStyle(Workbook workbook) {
|
||||||
|
CellStyle style = workbook.createCellStyle();
|
||||||
|
Font font = workbook.createFont();
|
||||||
|
font.setFontName("微软雅黑");
|
||||||
|
font.setFontHeightInPoints((short) 16);
|
||||||
|
font.setBold(true);
|
||||||
|
style.setFont(font);
|
||||||
|
style.setAlignment(HorizontalAlignment.CENTER);
|
||||||
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
// 标题样式带完整边框
|
||||||
|
style.setBorderTop(BorderStyle.THIN);
|
||||||
|
style.setBorderBottom(BorderStyle.THIN);
|
||||||
|
style.setBorderLeft(BorderStyle.THIN);
|
||||||
|
style.setBorderRight(BorderStyle.THIN);
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CellStyle createBlockTitleStyle(Workbook workbook) {
|
||||||
|
CellStyle style = workbook.createCellStyle();
|
||||||
|
Font font = workbook.createFont();
|
||||||
|
font.setFontName("微软雅黑");
|
||||||
|
font.setFontHeightInPoints((short) 14);
|
||||||
|
font.setBold(true);
|
||||||
|
style.setFont(font);
|
||||||
|
style.setAlignment(HorizontalAlignment.CENTER);
|
||||||
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
||||||
|
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||||
|
// 区块标题带完整边框
|
||||||
|
style.setBorderTop(BorderStyle.THIN);
|
||||||
|
style.setBorderBottom(BorderStyle.THIN);
|
||||||
|
style.setBorderLeft(BorderStyle.THIN);
|
||||||
|
style.setBorderRight(BorderStyle.THIN);
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CellStyle createContentStyle(Workbook workbook) {
|
||||||
|
CellStyle style = workbook.createCellStyle();
|
||||||
|
Font font = workbook.createFont();
|
||||||
|
font.setFontName("微软雅黑");
|
||||||
|
font.setFontHeightInPoints((short) 12);
|
||||||
|
style.setFont(font);
|
||||||
|
style.setAlignment(HorizontalAlignment.LEFT);
|
||||||
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
// 内容样式带完整边框
|
||||||
|
style.setBorderTop(BorderStyle.THIN);
|
||||||
|
style.setBorderBottom(BorderStyle.THIN);
|
||||||
|
style.setBorderLeft(BorderStyle.THIN);
|
||||||
|
style.setBorderRight(BorderStyle.THIN);
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增:纯边框样式(用于空单元格)
|
||||||
|
private static CellStyle createBorderStyle(Workbook workbook) {
|
||||||
|
CellStyle style = workbook.createCellStyle();
|
||||||
|
// 仅设置边框,无字体/背景色(避免覆盖内容样式)
|
||||||
|
style.setBorderTop(BorderStyle.THIN);
|
||||||
|
style.setBorderBottom(BorderStyle.THIN);
|
||||||
|
style.setBorderLeft(BorderStyle.THIN);
|
||||||
|
style.setBorderRight(BorderStyle.THIN);
|
||||||
|
style.setAlignment(HorizontalAlignment.LEFT);
|
||||||
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 性别数字转文字
|
||||||
|
private static String getGenderText(Long gender) {
|
||||||
|
if (gender == null) return "";
|
||||||
|
switch (gender.intValue()) {
|
||||||
|
case 1: return "母";
|
||||||
|
case 2: return "公";
|
||||||
|
case 3: return "阉羊";
|
||||||
|
case 4: return "兼性";
|
||||||
|
default: return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,6 +42,12 @@ public class QuarantineReport extends BaseEntity
|
|||||||
/** 全部羊耳号列表(用于多耳号查询) */
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
private List<String> allEarNumbers;
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
@Excel(name = "品种")
|
||||||
|
private String variety;
|
||||||
|
/** 检疫日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "检疫日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date datetime;
|
||||||
|
|
||||||
@Excel(name = "羊只类别")
|
@Excel(name = "羊只类别")
|
||||||
private String sheepType;
|
private String sheepType;
|
||||||
@@ -56,10 +62,7 @@ public class QuarantineReport extends BaseEntity
|
|||||||
private String breed;
|
private String breed;
|
||||||
|
|
||||||
|
|
||||||
/** 检疫日期 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@Excel(name = "检疫日期", width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
private Date datetime;
|
|
||||||
|
|
||||||
/** 检疫项目 */
|
/** 检疫项目 */
|
||||||
|
|
||||||
@@ -103,7 +106,17 @@ public class QuarantineReport extends BaseEntity
|
|||||||
|
|
||||||
public void setGender(String gender) {
|
public void setGender(String gender) {
|
||||||
this.gender = gender;
|
this.gender = gender;
|
||||||
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
|
if (gender != null && !gender.trim().isEmpty()) {
|
||||||
|
try {
|
||||||
|
Integer genderCode = Integer.valueOf(gender.trim());
|
||||||
|
this.genderName = Gender.getDescByCode(genderCode);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// 如果转换失败,设置为空或默认值
|
||||||
|
this.genderName = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.genderName = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 排序查询
|
// 排序查询
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
|
|||||||
BeanUtils.copyProperties(quarantineReport, quarantine);
|
BeanUtils.copyProperties(quarantineReport, quarantine);
|
||||||
quarantine.setSheepId(sheepFile.getId());
|
quarantine.setSheepId(sheepFile.getId());
|
||||||
quarantine.setSheepNo(sheepFile.getElectronicTags());
|
quarantine.setSheepNo(sheepFile.getElectronicTags());
|
||||||
|
quarantine.setVariety(sheepFile.getVariety() != null ? sheepFile.getVariety() : "");
|
||||||
quarantine.setSheepType(sheepFile.getName());
|
quarantine.setSheepType(sheepFile.getName());
|
||||||
|
|
||||||
// 性别前端处理
|
// 性别前端处理
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 鲜奶生产,成品检验记录Controller
|
* 鲜奶生产,成品检验记录Controller
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-18
|
* @date 2025-07-18
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@@ -77,6 +76,11 @@ public class NpFreshMilkInspController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody NpFreshMilkInsp npFreshMilkInsp)
|
public AjaxResult add(@RequestBody NpFreshMilkInsp npFreshMilkInsp)
|
||||||
{
|
{
|
||||||
|
// === 修改开始:注入当前用户和部门ID ===
|
||||||
|
npFreshMilkInsp.setUserId(getUserId());
|
||||||
|
npFreshMilkInsp.setDeptId(getDeptId());
|
||||||
|
// === 修改结束 ===
|
||||||
|
|
||||||
return toAjax(npFreshMilkInspService.insertNpFreshMilkInsp(npFreshMilkInsp));
|
return toAjax(npFreshMilkInspService.insertNpFreshMilkInsp(npFreshMilkInsp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,9 +100,9 @@ public class NpFreshMilkInspController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('freshMilkTest:freshMilkTest:remove')")
|
@PreAuthorize("@ss.hasPermi('freshMilkTest:freshMilkTest:remove')")
|
||||||
@Log(title = "鲜奶生产,成品检验记录", businessType = BusinessType.DELETE)
|
@Log(title = "鲜奶生产,成品检验记录", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
return toAjax(npFreshMilkInspService.deleteNpFreshMilkInspByIds(ids));
|
return toAjax(npFreshMilkInspService.deleteNpFreshMilkInspByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,11 +28,10 @@ public class NpMilkProdClassesController extends BaseController {
|
|||||||
public TableDataInfo list(
|
public TableDataInfo list(
|
||||||
@RequestParam(required = false) Date datetimeStart,
|
@RequestParam(required = false) Date datetimeStart,
|
||||||
@RequestParam(required = false) Date datetimeEnd,
|
@RequestParam(required = false) Date datetimeEnd,
|
||||||
@RequestParam(required = false) List<String> allEarNumbers, // 修改处:接收多耳号数组
|
@RequestParam(required = false) List<String> allEarNumbers,
|
||||||
@RequestParam(required = false) String factory,
|
@RequestParam(required = false) String factory,
|
||||||
@RequestParam(required = false) Integer classes) {
|
@RequestParam(required = false) Integer classes) {
|
||||||
startPage();
|
startPage();
|
||||||
// 修改处:将参数封装进实体,以便 Service 和 Mapper 统一处理
|
|
||||||
NpMilkProdClasses params = new NpMilkProdClasses();
|
NpMilkProdClasses params = new NpMilkProdClasses();
|
||||||
params.setAllEarNumbers(allEarNumbers);
|
params.setAllEarNumbers(allEarNumbers);
|
||||||
params.setFactory(factory);
|
params.setFactory(factory);
|
||||||
@@ -43,9 +42,6 @@ public class NpMilkProdClassesController extends BaseController {
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改处:新增耳号模糊查询接口
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('milkProdclasses:milkProdclasses:list')")
|
@PreAuthorize("@ss.hasPermi('milkProdclasses:milkProdclasses:list')")
|
||||||
@GetMapping("/search_ear_numbers")
|
@GetMapping("/search_ear_numbers")
|
||||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||||
@@ -64,6 +60,16 @@ public class NpMilkProdClassesController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
ExcelUtil<NpMilkProdClasses> util = new ExcelUtil<>(NpMilkProdClasses.class);
|
ExcelUtil<NpMilkProdClasses> util = new ExcelUtil<>(NpMilkProdClasses.class);
|
||||||
List<NpMilkProdClasses> list = util.importExcel(file.getInputStream());
|
List<NpMilkProdClasses> list = util.importExcel(file.getInputStream());
|
||||||
|
|
||||||
|
// === 修改开始:循环注入当前用户和部门ID ===
|
||||||
|
Long userId = getUserId();
|
||||||
|
Long deptId = getDeptId();
|
||||||
|
for (NpMilkProdClasses item : list) {
|
||||||
|
item.setUserId(userId);
|
||||||
|
item.setDeptId(deptId);
|
||||||
|
}
|
||||||
|
// === 修改结束 ===
|
||||||
|
|
||||||
int rows = npMilkProdClassesService.importMilkProdClasses(list);
|
int rows = npMilkProdClassesService.importMilkProdClasses(list);
|
||||||
return success("成功导入 " + rows + " 行数据");
|
return success("成功导入 " + rows + " 行数据");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -77,7 +83,7 @@ public class NpMilkProdClassesController extends BaseController {
|
|||||||
public void export(HttpServletResponse response,
|
public void export(HttpServletResponse response,
|
||||||
@RequestParam(required = false) Date datetimeStart,
|
@RequestParam(required = false) Date datetimeStart,
|
||||||
@RequestParam(required = false) Date datetimeEnd,
|
@RequestParam(required = false) Date datetimeEnd,
|
||||||
@RequestParam(required = false) List<String> allEarNumbers, // 修改处:接收多耳号
|
@RequestParam(required = false) List<String> allEarNumbers,
|
||||||
@RequestParam(required = false) String factory,
|
@RequestParam(required = false) String factory,
|
||||||
@RequestParam(required = false) Integer classes) {
|
@RequestParam(required = false) Integer classes) {
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 生乳检验记录Controller
|
* 生乳检验记录Controller
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-15
|
* @date 2025-07-15
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@@ -78,6 +77,11 @@ public class NpRawMilkInspeController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody NpRawMilkInspe npRawMilkInspe)
|
public AjaxResult add(@RequestBody NpRawMilkInspe npRawMilkInspe)
|
||||||
{
|
{
|
||||||
|
// === 修改开始:注入当前用户和部门ID ===
|
||||||
|
npRawMilkInspe.setUserId(getUserId());
|
||||||
|
npRawMilkInspe.setDeptId(getDeptId());
|
||||||
|
// === 修改结束 ===
|
||||||
|
|
||||||
return toAjax(npRawMilkInspeService.insertNpRawMilkInspe(npRawMilkInspe));
|
return toAjax(npRawMilkInspeService.insertNpRawMilkInspe(npRawMilkInspe));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,9 +101,9 @@ public class NpRawMilkInspeController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('rawMilkTest:rawMilkTest:remove')")
|
@PreAuthorize("@ss.hasPermi('rawMilkTest:rawMilkTest:remove')")
|
||||||
@Log(title = "生乳检验记录", businessType = BusinessType.DELETE)
|
@Log(title = "生乳检验记录", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
return toAjax(npRawMilkInspeService.deleteNpRawMilkInspeByIds(ids));
|
return toAjax(npRawMilkInspeService.deleteNpRawMilkInspeByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,8 +24,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 酸奶生产,成品检疫记录Controller
|
* 酸奶生产,成品检疫记录Controller
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-17
|
* @date 2025-07-17
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@@ -78,6 +77,11 @@ public class NpYogurtInspController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody NpYogurtInsp npYogurtInsp)
|
public AjaxResult add(@RequestBody NpYogurtInsp npYogurtInsp)
|
||||||
{
|
{
|
||||||
|
// === 修改开始:注入当前用户和部门ID ===
|
||||||
|
npYogurtInsp.setUserId(getUserId());
|
||||||
|
npYogurtInsp.setDeptId(getDeptId());
|
||||||
|
// === 修改结束 ===
|
||||||
|
|
||||||
return toAjax(npYogurtInspService.insertNpYogurtInsp(npYogurtInsp));
|
return toAjax(npYogurtInspService.insertNpYogurtInsp(npYogurtInsp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,9 +101,9 @@ public class NpYogurtInspController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:remove')")
|
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:remove')")
|
||||||
@Log(title = "酸奶生产,成品检疫记录", businessType = BusinessType.DELETE)
|
@Log(title = "酸奶生产,成品检疫记录", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
return toAjax(npYogurtInspService.deleteNpYogurtInspByIds(ids));
|
return toAjax(npYogurtInspService.deleteNpYogurtInspByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,8 +23,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 干物质校正Controller
|
* 干物质校正Controller
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-12
|
* @date 2025-07-12
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@@ -77,6 +76,9 @@ public class XzDryMatterCorrectionController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody XzDryMatterCorrection xzDryMatterCorrection)
|
public AjaxResult add(@RequestBody XzDryMatterCorrection xzDryMatterCorrection)
|
||||||
{
|
{
|
||||||
|
// 自动填充用户ID和部门ID
|
||||||
|
xzDryMatterCorrection.setUserId(getUserId());
|
||||||
|
xzDryMatterCorrection.setDeptId(getDeptId());
|
||||||
return toAjax(xzDryMatterCorrectionService.insertXzDryMatterCorrection(xzDryMatterCorrection));
|
return toAjax(xzDryMatterCorrectionService.insertXzDryMatterCorrection(xzDryMatterCorrection));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,9 +98,9 @@ public class XzDryMatterCorrectionController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('dryMatterCorrection:dryMatterCorrection:remove')")
|
@PreAuthorize("@ss.hasPermi('dryMatterCorrection:dryMatterCorrection:remove')")
|
||||||
@Log(title = "干物质校正", businessType = BusinessType.DELETE)
|
@Log(title = "干物质校正", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
return toAjax(xzDryMatterCorrectionService.deleteXzDryMatterCorrectionByIds(ids));
|
return toAjax(xzDryMatterCorrectionService.deleteXzDryMatterCorrectionByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,8 +24,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 称重校正Controller
|
* 称重校正Controller
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-12
|
* @date 2025-07-12
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@@ -78,6 +77,9 @@ public class XzWegihCorrectionController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody XzWegihCorrection xzWegihCorrection)
|
public AjaxResult add(@RequestBody XzWegihCorrection xzWegihCorrection)
|
||||||
{
|
{
|
||||||
|
// 自动填充用户ID和部门ID
|
||||||
|
xzWegihCorrection.setUserId(getUserId());
|
||||||
|
xzWegihCorrection.setDeptId(getDeptId());
|
||||||
return toAjax(xzWegihCorrectionService.insertXzWegihCorrection(xzWegihCorrection));
|
return toAjax(xzWegihCorrectionService.insertXzWegihCorrection(xzWegihCorrection));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,9 +99,9 @@ public class XzWegihCorrectionController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('weightCorrection:weightCorrection:remove')")
|
@PreAuthorize("@ss.hasPermi('weightCorrection:weightCorrection:remove')")
|
||||||
@Log(title = "称重校正", businessType = BusinessType.DELETE)
|
@Log(title = "称重校正", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
return toAjax(xzWegihCorrectionService.deleteXzWegihCorrectionByIds(ids));
|
return toAjax(xzWegihCorrectionService.deleteXzWegihCorrectionByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,8 +10,7 @@ import com.zhyc.common.core.domain.BaseEntity;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 鲜奶生产,成品检验记录对象 np_fresh_milk_insp
|
* 鲜奶生产,成品检验记录对象 np_fresh_milk_insp
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-18
|
* @date 2025-07-18
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@@ -85,4 +84,12 @@ public class NpFreshMilkInsp extends BaseEntity
|
|||||||
@Excel(name = "备注")
|
@Excel(name = "备注")
|
||||||
private String commnet;
|
private String commnet;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,14 @@ public class NpMilkInOutStore extends BaseEntity {
|
|||||||
@Excel(name = "爱特退回酸奶")
|
@Excel(name = "爱特退回酸奶")
|
||||||
private BigDecimal returnYogurt;
|
private BigDecimal returnYogurt;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
// --- getters and setters ---
|
// --- getters and setters ---
|
||||||
public Integer getId() { return id; }
|
public Integer getId() { return id; }
|
||||||
public void setId(Integer id) { this.id = id; }
|
public void setId(Integer id) { this.id = id; }
|
||||||
@@ -125,4 +133,10 @@ public class NpMilkInOutStore extends BaseEntity {
|
|||||||
|
|
||||||
public BigDecimal getReturnYogurt() { return returnYogurt; }
|
public BigDecimal getReturnYogurt() { return returnYogurt; }
|
||||||
public void setReturnYogurt(BigDecimal returnYogurt) { this.returnYogurt = returnYogurt; }
|
public void setReturnYogurt(BigDecimal returnYogurt) { this.returnYogurt = returnYogurt; }
|
||||||
|
|
||||||
|
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; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.zhyc.module.dairyProducts.domain;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List; // 引入 List
|
import java.util.List;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.zhyc.common.annotation.Excel;
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
|
||||||
@@ -40,11 +40,19 @@ public class NpMilkProdClasses implements Serializable {
|
|||||||
|
|
||||||
private String sheepId;
|
private String sheepId;
|
||||||
|
|
||||||
// 修改处:新增字段用于多耳号查询
|
|
||||||
/** 全部羊耳号列表(用于多耳号查询) */
|
/** 全部羊耳号列表(用于多耳号查询) */
|
||||||
private List<String> allEarNumbers;
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
// Getters and Setters
|
/** 用户ID */
|
||||||
|
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
// --- Getters and Setters ---
|
||||||
|
|
||||||
public List<String> getAllEarNumbers() {
|
public List<String> getAllEarNumbers() {
|
||||||
return allEarNumbers;
|
return allEarNumbers;
|
||||||
}
|
}
|
||||||
@@ -88,4 +96,10 @@ public class NpMilkProdClasses implements Serializable {
|
|||||||
|
|
||||||
public String getSheepId() { return sheepId; }
|
public String getSheepId() { return sheepId; }
|
||||||
public void setSheepId(String sheepId) { this.sheepId = sheepId; }
|
public void setSheepId(String sheepId) { this.sheepId = sheepId; }
|
||||||
|
|
||||||
|
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; }
|
||||||
}
|
}
|
||||||
@@ -451,4 +451,12 @@ public class NpRawMilkInspe extends BaseEntity
|
|||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,8 +10,7 @@ import com.zhyc.common.core.domain.BaseEntity;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 酸奶生产,成品检疫记录对象 np_yogurt_insp
|
* 酸奶生产,成品检疫记录对象 np_yogurt_insp
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-17
|
* @date 2025-07-17
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@@ -42,7 +41,7 @@ public class NpYogurtInsp extends BaseEntity
|
|||||||
private Double protein;
|
private Double protein;
|
||||||
|
|
||||||
/** 非脂g/100g
|
/** 非脂g/100g
|
||||||
*/
|
*/
|
||||||
@Excel(name = "非脂g/100g")
|
@Excel(name = "非脂g/100g")
|
||||||
private Double nonFat;
|
private Double nonFat;
|
||||||
|
|
||||||
@@ -86,4 +85,12 @@ public class NpYogurtInsp extends BaseEntity
|
|||||||
@Excel(name = "备注")
|
@Excel(name = "备注")
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
}
|
/** 用户ID */
|
||||||
|
@Excel(name = "用户编号", type = Excel.Type.IMPORT)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -32,4 +32,9 @@ public class XzDryMatterCorrection extends BaseEntity {
|
|||||||
@Excel(name = "干物质系数")
|
@Excel(name = "干物质系数")
|
||||||
private Double coefficient;
|
private Double coefficient;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
@@ -45,5 +45,9 @@ public class XzWegihCorrection extends BaseEntity
|
|||||||
@Excel(name = "称重系数")
|
@Excel(name = "称重系数")
|
||||||
private Double coefficient;
|
private Double coefficient;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
@@ -8,16 +8,49 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface NpMilkInOutStoreMapper {
|
public interface NpMilkInOutStoreMapper {
|
||||||
|
/**
|
||||||
|
* 动态列查询
|
||||||
|
*/
|
||||||
List<Map<String,Object>> selectWithColumns(
|
List<Map<String,Object>> selectWithColumns(
|
||||||
@Param("start") Date start, @Param("end") Date end,
|
@Param("start") Date start, @Param("end") Date end,
|
||||||
@Param("feedSources") List<String> feedSources,
|
@Param("feedSources") List<String> feedSources,
|
||||||
@Param("saleDestinations") List<String> saleDestinations
|
@Param("saleDestinations") List<String> saleDestinations
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入主表
|
||||||
|
*/
|
||||||
int insertStore(NpMilkInOutStore store);
|
int insertStore(NpMilkInOutStore store);
|
||||||
void insertFeedRecord(@Param("storeId") Integer storeId, @Param("source") String source, @Param("amount") java.math.BigDecimal amount);
|
|
||||||
void insertSaleRecord(@Param("storeId") Integer storeId, @Param("destination") String dest, @Param("amount") java.math.BigDecimal amount);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入饲喂子表(已修正:增加 userId 和 deptId 参数)
|
||||||
|
*/
|
||||||
|
void insertFeedRecord(
|
||||||
|
@Param("storeId") Integer storeId,
|
||||||
|
@Param("source") String source,
|
||||||
|
@Param("amount") java.math.BigDecimal amount,
|
||||||
|
@Param("userId") Long userId,
|
||||||
|
@Param("deptId") Long deptId
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入销售子表(已修正:增加 userId 和 deptId 参数)
|
||||||
|
*/
|
||||||
|
void insertSaleRecord(
|
||||||
|
@Param("storeId") Integer storeId,
|
||||||
|
@Param("destination") String dest,
|
||||||
|
@Param("amount") java.math.BigDecimal amount,
|
||||||
|
@Param("userId") Long userId,
|
||||||
|
@Param("deptId") Long deptId
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取饲喂来源列表(用于动态列头)
|
||||||
|
*/
|
||||||
List<String> selectFeedSources();
|
List<String> selectFeedSources();
|
||||||
List<String> selectSaleDestinations();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取销售去向列表(用于动态列头)
|
||||||
|
*/
|
||||||
|
List<String> selectSaleDestinations();
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.zhyc.common.utils.DateUtils;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.zhyc.module.dairyProducts.mapper.NpFreshMilkInspMapper;
|
import com.zhyc.module.dairyProducts.mapper.NpFreshMilkInspMapper;
|
||||||
@@ -10,20 +11,18 @@ import com.zhyc.module.dairyProducts.service.INpFreshMilkInspService;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 鲜奶生产,成品检验记录Service业务层处理
|
* 鲜奶生产,成品检验记录Service业务层处理
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-18
|
* @date 2025-07-18
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private NpFreshMilkInspMapper npFreshMilkInspMapper;
|
private NpFreshMilkInspMapper npFreshMilkInspMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询鲜奶生产,成品检验记录
|
* 查询鲜奶生产,成品检验记录
|
||||||
*
|
* * @param id 鲜奶生产,成品检验记录主键
|
||||||
* @param id 鲜奶生产,成品检验记录主键
|
|
||||||
* @return 鲜奶生产,成品检验记录
|
* @return 鲜奶生产,成品检验记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -34,11 +33,11 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询鲜奶生产,成品检验记录列表
|
* 查询鲜奶生产,成品检验记录列表
|
||||||
*
|
* * @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||||
* @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
|
||||||
* @return 鲜奶生产,成品检验记录
|
* @return 鲜奶生产,成品检验记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "a", userAlias = "a")
|
||||||
public List<NpFreshMilkInsp> selectNpFreshMilkInspList(NpFreshMilkInsp npFreshMilkInsp)
|
public List<NpFreshMilkInsp> selectNpFreshMilkInspList(NpFreshMilkInsp npFreshMilkInsp)
|
||||||
{
|
{
|
||||||
return npFreshMilkInspMapper.selectNpFreshMilkInspList(npFreshMilkInsp);
|
return npFreshMilkInspMapper.selectNpFreshMilkInspList(npFreshMilkInsp);
|
||||||
@@ -46,8 +45,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增鲜奶生产,成品检验记录
|
* 新增鲜奶生产,成品检验记录
|
||||||
*
|
* * @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||||
* @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -59,8 +57,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改鲜奶生产,成品检验记录
|
* 修改鲜奶生产,成品检验记录
|
||||||
*
|
* * @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
||||||
* @param npFreshMilkInsp 鲜奶生产,成品检验记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -71,8 +68,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除鲜奶生产,成品检验记录
|
* 批量删除鲜奶生产,成品检验记录
|
||||||
*
|
* * @param ids 需要删除的鲜奶生产,成品检验记录主键
|
||||||
* @param ids 需要删除的鲜奶生产,成品检验记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -83,8 +79,7 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除鲜奶生产,成品检验记录信息
|
* 删除鲜奶生产,成品检验记录信息
|
||||||
*
|
* * @param id 鲜奶生产,成品检验记录主键
|
||||||
* @param id 鲜奶生产,成品检验记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -92,4 +87,4 @@ public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
|
|||||||
{
|
{
|
||||||
return npFreshMilkInspMapper.deleteNpFreshMilkInspById(id);
|
return npFreshMilkInspMapper.deleteNpFreshMilkInspById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.zhyc.module.dairyProducts.service.impl;
|
package com.zhyc.module.dairyProducts.service.impl;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
|
import com.zhyc.common.utils.SecurityUtils;
|
||||||
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
|
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
|
||||||
import com.zhyc.module.dairyProducts.mapper.NpMilkInOutStoreMapper;
|
import com.zhyc.module.dairyProducts.mapper.NpMilkInOutStoreMapper;
|
||||||
import com.zhyc.module.dairyProducts.service.INpMilkInOutStoreService;
|
import com.zhyc.module.dairyProducts.service.INpMilkInOutStoreService;
|
||||||
@@ -19,6 +21,7 @@ public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
|
|||||||
private NpMilkInOutStoreMapper mapper;
|
private NpMilkInOutStoreMapper mapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "s", userAlias = "s")
|
||||||
public List<Map<String, Object>> selectWithDynamicColumns(Date start, Date end) {
|
public List<Map<String, Object>> selectWithDynamicColumns(Date start, Date end) {
|
||||||
List<String> feed = mapper.selectFeedSources();
|
List<String> feed = mapper.selectFeedSources();
|
||||||
List<String> sale = mapper.selectSaleDestinations();
|
List<String> sale = mapper.selectSaleDestinations();
|
||||||
@@ -58,25 +61,46 @@ public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchInsertFromRows(List<Map<String, Object>> rows) throws Exception {
|
public void batchInsertFromRows(List<Map<String, Object>> rows) throws Exception {
|
||||||
|
// === 修改开始:获取当前用户和部门ID ===
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
Long deptId = SecurityUtils.getDeptId();
|
||||||
|
// === 修改结束 ===
|
||||||
|
|
||||||
for (Map<String,Object> row : rows) {
|
for (Map<String,Object> row : rows) {
|
||||||
// 提取主表字段
|
// 提取主表字段
|
||||||
NpMilkInOutStore store = new NpMilkInOutStore();
|
NpMilkInOutStore store = new NpMilkInOutStore();
|
||||||
|
// 这里假设 Excel 中的"日期"格式是标准的 yyyy-MM-dd,如果格式不对可能会报错,建议加 try-catch 或格式化处理
|
||||||
store.setDatetime(java.sql.Date.valueOf(row.get("日期").toString()));
|
store.setDatetime(java.sql.Date.valueOf(row.get("日期").toString()));
|
||||||
store.setNum(Integer.valueOf(row.get("羊数").toString()));
|
store.setNum(Integer.valueOf(row.get("羊数").toString()));
|
||||||
// ... 设置其它固定字段 ...
|
|
||||||
|
// 手动填充其它主表字段,这里省略了具体的 get 调用,请根据您的 Excel 列名自行补充
|
||||||
|
// store.setColostSheep(...);
|
||||||
|
|
||||||
|
// === 修改开始:给主表实体注入用户和部门ID ===
|
||||||
|
store.setUserId(userId);
|
||||||
|
store.setDeptId(deptId);
|
||||||
|
// === 修改结束 ===
|
||||||
|
|
||||||
mapper.insertStore(store);
|
mapper.insertStore(store);
|
||||||
Integer sid = store.getId();
|
Integer sid = store.getId();
|
||||||
|
|
||||||
// 其余列为动态饲喂或销售,根据字典决定分类:
|
// 其余列为动态饲喂或销售,根据字典决定分类:
|
||||||
for (Map.Entry<String,Object> ent: row.entrySet()) {
|
for (Map.Entry<String,Object> ent: row.entrySet()) {
|
||||||
String col = ent.getKey();
|
String col = ent.getKey();
|
||||||
|
// 跳过固定列
|
||||||
|
if (col.equals("日期") || col.equals("羊数") || col.equals("id")) continue;
|
||||||
|
if (ent.getValue() == null || "".equals(ent.getValue().toString())) continue;
|
||||||
|
|
||||||
BigDecimal amt = new BigDecimal(ent.getValue().toString());
|
BigDecimal amt = new BigDecimal(ent.getValue().toString());
|
||||||
|
|
||||||
if (mapper.selectFeedSources().contains(col)) {
|
if (mapper.selectFeedSources().contains(col)) {
|
||||||
mapper.insertFeedRecord(sid, col, amt);
|
// === 修改开始:插入饲喂子表时传入 userId 和 deptId ===
|
||||||
|
mapper.insertFeedRecord(sid, col, amt, userId, deptId);
|
||||||
} else if (mapper.selectSaleDestinations().contains(col)) {
|
} else if (mapper.selectSaleDestinations().contains(col)) {
|
||||||
mapper.insertSaleRecord(sid, col, amt);
|
// === 修改开始:插入销售子表时传入 userId 和 deptId ===
|
||||||
|
mapper.insertSaleRecord(sid, col, amt, userId, deptId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zhyc.module.dairyProducts.service.impl;
|
package com.zhyc.module.dairyProducts.service.impl;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
import com.zhyc.module.dairyProducts.domain.NpMilkProdClasses;
|
import com.zhyc.module.dairyProducts.domain.NpMilkProdClasses;
|
||||||
import com.zhyc.module.dairyProducts.mapper.NpMilkProdClassesMapper;
|
import com.zhyc.module.dairyProducts.mapper.NpMilkProdClassesMapper;
|
||||||
import com.zhyc.module.dairyProducts.service.INpMilkProdClassesService;
|
import com.zhyc.module.dairyProducts.service.INpMilkProdClassesService;
|
||||||
@@ -16,6 +17,7 @@ public class NpMilkProdClassesServiceImpl implements INpMilkProdClassesService {
|
|||||||
private NpMilkProdClassesMapper mapper;
|
private NpMilkProdClassesMapper mapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "mpc", userAlias = "mpc")
|
||||||
public List<NpMilkProdClasses> selectNpMilkProdClassesList(NpMilkProdClasses npMilkProdClasses, Date datetimeStart, Date datetimeEnd) {
|
public List<NpMilkProdClasses> selectNpMilkProdClassesList(NpMilkProdClasses npMilkProdClasses, Date datetimeStart, Date datetimeEnd) {
|
||||||
// 修改处:传递实体对象
|
// 修改处:传递实体对象
|
||||||
return mapper.selectNpMilkProdClassesList(npMilkProdClasses, datetimeStart, datetimeEnd);
|
return mapper.selectNpMilkProdClassesList(npMilkProdClasses, datetimeStart, datetimeEnd);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.zhyc.common.utils.DateUtils;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.zhyc.module.dairyProducts.mapper.NpRawMilkInspeMapper;
|
import com.zhyc.module.dairyProducts.mapper.NpRawMilkInspeMapper;
|
||||||
@@ -10,20 +11,18 @@ import com.zhyc.module.dairyProducts.service.INpRawMilkInspeService;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 生乳检验记录Service业务层处理
|
* 生乳检验记录Service业务层处理
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-15
|
* @date 2025-07-15
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private NpRawMilkInspeMapper npRawMilkInspeMapper;
|
private NpRawMilkInspeMapper npRawMilkInspeMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询生乳检验记录
|
* 查询生乳检验记录
|
||||||
*
|
* * @param id 生乳检验记录主键
|
||||||
* @param id 生乳检验记录主键
|
|
||||||
* @return 生乳检验记录
|
* @return 生乳检验记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -34,11 +33,11 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询生乳检验记录列表
|
* 查询生乳检验记录列表
|
||||||
*
|
* * @param npRawMilkInspe 生乳检验记录
|
||||||
* @param npRawMilkInspe 生乳检验记录
|
|
||||||
* @return 生乳检验记录
|
* @return 生乳检验记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "a", userAlias = "a")
|
||||||
public List<NpRawMilkInspe> selectNpRawMilkInspeList(NpRawMilkInspe npRawMilkInspe)
|
public List<NpRawMilkInspe> selectNpRawMilkInspeList(NpRawMilkInspe npRawMilkInspe)
|
||||||
{
|
{
|
||||||
return npRawMilkInspeMapper.selectNpRawMilkInspeList(npRawMilkInspe);
|
return npRawMilkInspeMapper.selectNpRawMilkInspeList(npRawMilkInspe);
|
||||||
@@ -46,8 +45,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增生乳检验记录
|
* 新增生乳检验记录
|
||||||
*
|
* * @param npRawMilkInspe 生乳检验记录
|
||||||
* @param npRawMilkInspe 生乳检验记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -59,8 +57,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改生乳检验记录
|
* 修改生乳检验记录
|
||||||
*
|
* * @param npRawMilkInspe 生乳检验记录
|
||||||
* @param npRawMilkInspe 生乳检验记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -71,8 +68,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除生乳检验记录
|
* 批量删除生乳检验记录
|
||||||
*
|
* * @param ids 需要删除的生乳检验记录主键
|
||||||
* @param ids 需要删除的生乳检验记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -83,8 +79,7 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除生乳检验记录信息
|
* 删除生乳检验记录信息
|
||||||
*
|
* * @param id 生乳检验记录主键
|
||||||
* @param id 生乳检验记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -92,4 +87,4 @@ public class NpRawMilkInspeServiceImpl implements INpRawMilkInspeService
|
|||||||
{
|
{
|
||||||
return npRawMilkInspeMapper.deleteNpRawMilkInspeById(id);
|
return npRawMilkInspeMapper.deleteNpRawMilkInspeById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.zhyc.common.utils.DateUtils;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
import com.zhyc.module.dairyProducts.domain.NpYogurtInsp;
|
import com.zhyc.module.dairyProducts.domain.NpYogurtInsp;
|
||||||
import com.zhyc.module.dairyProducts.mapper.NpYogurtInspMapper;
|
import com.zhyc.module.dairyProducts.mapper.NpYogurtInspMapper;
|
||||||
import com.zhyc.module.dairyProducts.service.INpYogurtInspService;
|
import com.zhyc.module.dairyProducts.service.INpYogurtInspService;
|
||||||
@@ -10,8 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 酸奶生产,成品检疫记录Service业务层处理
|
* 酸奶生产,成品检疫记录Service业务层处理
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-17
|
* @date 2025-07-17
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@@ -22,8 +22,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询酸奶生产,成品检疫记录
|
* 查询酸奶生产,成品检疫记录
|
||||||
*
|
* * @param id 酸奶生产,成品检疫记录主键
|
||||||
* @param id 酸奶生产,成品检疫记录主键
|
|
||||||
* @return 酸奶生产,成品检疫记录
|
* @return 酸奶生产,成品检疫记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -34,11 +33,11 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询酸奶生产,成品检疫记录列表
|
* 查询酸奶生产,成品检疫记录列表
|
||||||
*
|
* * @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||||
* @param npYogurtInsp 酸奶生产,成品检疫记录
|
|
||||||
* @return 酸奶生产,成品检疫记录
|
* @return 酸奶生产,成品检疫记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "a", userAlias = "a")
|
||||||
public List<NpYogurtInsp> selectNpYogurtInspList(NpYogurtInsp npYogurtInsp)
|
public List<NpYogurtInsp> selectNpYogurtInspList(NpYogurtInsp npYogurtInsp)
|
||||||
{
|
{
|
||||||
return npYogurtInspMapper.selectNpYogurtInspList(npYogurtInsp);
|
return npYogurtInspMapper.selectNpYogurtInspList(npYogurtInsp);
|
||||||
@@ -46,8 +45,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增酸奶生产,成品检疫记录
|
* 新增酸奶生产,成品检疫记录
|
||||||
*
|
* * @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||||
* @param npYogurtInsp 酸奶生产,成品检疫记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -59,8 +57,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改酸奶生产,成品检疫记录
|
* 修改酸奶生产,成品检疫记录
|
||||||
*
|
* * @param npYogurtInsp 酸奶生产,成品检疫记录
|
||||||
* @param npYogurtInsp 酸奶生产,成品检疫记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -71,8 +68,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除酸奶生产,成品检疫记录
|
* 批量删除酸奶生产,成品检疫记录
|
||||||
*
|
* * @param ids 需要删除的酸奶生产,成品检疫记录主键
|
||||||
* @param ids 需要删除的酸奶生产,成品检疫记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -83,8 +79,7 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除酸奶生产,成品检疫记录信息
|
* 删除酸奶生产,成品检疫记录信息
|
||||||
*
|
* * @param id 酸奶生产,成品检疫记录主键
|
||||||
* @param id 酸奶生产,成品检疫记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -92,4 +87,4 @@ public class NpYogurtInspServiceImpl implements INpYogurtInspService
|
|||||||
{
|
{
|
||||||
return npYogurtInspMapper.deleteNpYogurtInspById(id);
|
return npYogurtInspMapper.deleteNpYogurtInspById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,23 +6,22 @@ import org.springframework.stereotype.Service;
|
|||||||
import com.zhyc.module.dairyProducts.mapper.XzDryMatterCorrectionMapper;
|
import com.zhyc.module.dairyProducts.mapper.XzDryMatterCorrectionMapper;
|
||||||
import com.zhyc.module.dairyProducts.domain.XzDryMatterCorrection;
|
import com.zhyc.module.dairyProducts.domain.XzDryMatterCorrection;
|
||||||
import com.zhyc.module.dairyProducts.service.IXzDryMatterCorrectionService;
|
import com.zhyc.module.dairyProducts.service.IXzDryMatterCorrectionService;
|
||||||
|
import com.zhyc.common.annotation.DataScope; // 引入数据权限注解
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 干物质校正Service业务层处理
|
* 干物质校正Service业务层处理
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-12
|
* @date 2025-07-12
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionService
|
public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private XzDryMatterCorrectionMapper xzDryMatterCorrectionMapper;
|
private XzDryMatterCorrectionMapper xzDryMatterCorrectionMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询干物质校正
|
* 查询干物质校正
|
||||||
*
|
* * @param id 干物质校正主键
|
||||||
* @param id 干物质校正主键
|
|
||||||
* @return 干物质校正
|
* @return 干物质校正
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -33,11 +32,11 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询干物质校正列表
|
* 查询干物质校正列表
|
||||||
*
|
* * @param xzDryMatterCorrection 干物质校正
|
||||||
* @param xzDryMatterCorrection 干物质校正
|
|
||||||
* @return 干物质校正
|
* @return 干物质校正
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "d", userAlias = "d") // 添加数据权限注解
|
||||||
public List<XzDryMatterCorrection> selectXzDryMatterCorrectionList(XzDryMatterCorrection xzDryMatterCorrection)
|
public List<XzDryMatterCorrection> selectXzDryMatterCorrectionList(XzDryMatterCorrection xzDryMatterCorrection)
|
||||||
{
|
{
|
||||||
return xzDryMatterCorrectionMapper.selectXzDryMatterCorrectionList(xzDryMatterCorrection);
|
return xzDryMatterCorrectionMapper.selectXzDryMatterCorrectionList(xzDryMatterCorrection);
|
||||||
@@ -102,8 +101,7 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除干物质校正
|
* 批量删除干物质校正
|
||||||
*
|
* * @param ids 需要删除的干物质校正主键
|
||||||
* @param ids 需要删除的干物质校正主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -114,8 +112,7 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除干物质校正信息
|
* 删除干物质校正信息
|
||||||
*
|
* * @param id 干物质校正主键
|
||||||
* @param id 干物质校正主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -123,4 +120,4 @@ public class XzDryMatterCorrectionServiceImpl implements IXzDryMatterCorrectionS
|
|||||||
{
|
{
|
||||||
return xzDryMatterCorrectionMapper.deleteXzDryMatterCorrectionById(id);
|
return xzDryMatterCorrectionMapper.deleteXzDryMatterCorrectionById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,13 +8,13 @@ import com.zhyc.common.exception.ServiceException;
|
|||||||
import com.zhyc.module.dairyProducts.domain.XzWegihCorrection;
|
import com.zhyc.module.dairyProducts.domain.XzWegihCorrection;
|
||||||
import com.zhyc.module.dairyProducts.mapper.XzWegihCorrectionMapper;
|
import com.zhyc.module.dairyProducts.mapper.XzWegihCorrectionMapper;
|
||||||
import com.zhyc.module.dairyProducts.service.IXzWegihCorrectionService;
|
import com.zhyc.module.dairyProducts.service.IXzWegihCorrectionService;
|
||||||
|
import com.zhyc.common.annotation.DataScope; // 引入数据权限注解
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 称重校正Service业务层处理
|
* 称重校正Service业务层处理
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-12
|
* @date 2025-07-12
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@@ -25,8 +25,7 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询称重校正
|
* 查询称重校正
|
||||||
*
|
* * @param id 称重校正主键
|
||||||
* @param id 称重校正主键
|
|
||||||
* @return 称重校正
|
* @return 称重校正
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -37,11 +36,11 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询称重校正列表
|
* 查询称重校正列表
|
||||||
*
|
* * @param xzWegihCorrection 称重校正
|
||||||
* @param xzWegihCorrection 称重校正
|
|
||||||
* @return 称重校正
|
* @return 称重校正
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "w", userAlias = "w") // 添加数据权限注解
|
||||||
public List<XzWegihCorrection> selectXzWegihCorrectionList(XzWegihCorrection xzWegihCorrection)
|
public List<XzWegihCorrection> selectXzWegihCorrectionList(XzWegihCorrection xzWegihCorrection)
|
||||||
{
|
{
|
||||||
return xzWegihCorrectionMapper.selectXzWegihCorrectionList(xzWegihCorrection);
|
return xzWegihCorrectionMapper.selectXzWegihCorrectionList(xzWegihCorrection);
|
||||||
@@ -106,8 +105,7 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除称重校正
|
* 批量删除称重校正
|
||||||
*
|
* * @param ids 需要删除的称重校正主键
|
||||||
* @param ids 需要删除的称重校正主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -118,8 +116,7 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除称重校正信息
|
* 删除称重校正信息
|
||||||
*
|
* * @param id 称重校正主键
|
||||||
* @param id 称重校正主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -127,4 +124,4 @@ public class XzWegihCorrectionServiceImpl implements IXzWegihCorrectionService
|
|||||||
{
|
{
|
||||||
return xzWegihCorrectionMapper.deleteXzWegihCorrectionById(id);
|
return xzWegihCorrectionMapper.deleteXzWegihCorrectionById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
package com.zhyc.module.produce.breed.controller;
|
package com.zhyc.module.produce.breed.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.ArrayList;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -29,8 +28,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 干奶记录Controller
|
* 干奶记录Controller
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-15
|
* @date 2025-07-15
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@@ -51,24 +49,55 @@ public class ScDryMilkController extends BaseController
|
|||||||
public TableDataInfo list(ScDryMilk scDryMilk)
|
public TableDataInfo list(ScDryMilk scDryMilk)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// 添加调试日志
|
// 处理耳号多选:将逗号/空格分隔的字符串转为List
|
||||||
if (scDryMilk.getManageTags() != null && !scDryMilk.getManageTags().trim().isEmpty()) {
|
if (scDryMilk.getManageTags() != null && !scDryMilk.getManageTags().trim().isEmpty()) {
|
||||||
logger.info("搜索耳号参数: [{}]", scDryMilk.getManageTags());
|
if (scDryMilk.getManageTagsList() == null) {
|
||||||
scDryMilk.setManageTags(scDryMilk.getManageTags().trim());
|
scDryMilk.setManageTagsList(new ArrayList<>());
|
||||||
|
}
|
||||||
|
String[] tags = scDryMilk.getManageTags().trim().split("[,,\\s]+");
|
||||||
|
scDryMilk.getManageTagsList().addAll(Arrays.asList(tags));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理技术员多选:将逗号分隔的字符串转为List
|
||||||
|
if (scDryMilk.getTecahnician() != null && !scDryMilk.getTecahnician().trim().isEmpty()) {
|
||||||
|
if (scDryMilk.getTechnicianList() == null) {
|
||||||
|
scDryMilk.setTechnicianList(new ArrayList<>());
|
||||||
|
}
|
||||||
|
String[] techs = scDryMilk.getTecahnician().trim().split("[,,\\s]+");
|
||||||
|
scDryMilk.getTechnicianList().addAll(Arrays.asList(techs));
|
||||||
}
|
}
|
||||||
|
|
||||||
startPage();
|
startPage();
|
||||||
List<ScDryMilk> list = scDryMilkService.selectScDryMilkList(scDryMilk);
|
List<ScDryMilk> list = scDryMilkService.selectScDryMilkList(scDryMilk);
|
||||||
|
|
||||||
logger.info("查询到干奶记录数量: {}", list.size());
|
|
||||||
|
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("查询干奶记录列表失败", e);
|
logger.error("查询干奶记录列表失败", e);
|
||||||
return getDataTable(new java.util.ArrayList<>());
|
return getDataTable(new ArrayList<>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程搜索耳号列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/searchEarNumbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam(value = "query", required = false) String query)
|
||||||
|
{
|
||||||
|
if (query == null) query = "";
|
||||||
|
List<String> list = scDryMilkService.selectSheepEarNumberList(query);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程搜索技术员列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/searchTechnicians")
|
||||||
|
public AjaxResult searchTechnicians(@RequestParam(value = "query", required = false) String query)
|
||||||
|
{
|
||||||
|
if (query == null) query = "";
|
||||||
|
List<String> list = scDryMilkService.selectTechnicianList(query);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出干奶记录列表
|
* 导出干奶记录列表
|
||||||
*/
|
*/
|
||||||
@@ -78,8 +107,14 @@ public class ScDryMilkController extends BaseController
|
|||||||
public void export(HttpServletResponse response, ScDryMilk scDryMilk)
|
public void export(HttpServletResponse response, ScDryMilk scDryMilk)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
// 导出也需要支持多选查询
|
||||||
if (scDryMilk.getManageTags() != null) {
|
if (scDryMilk.getManageTags() != null) {
|
||||||
scDryMilk.setManageTags(scDryMilk.getManageTags().trim());
|
String[] tags = scDryMilk.getManageTags().trim().split("[,,\\s]+");
|
||||||
|
scDryMilk.setManageTagsList(Arrays.asList(tags));
|
||||||
|
}
|
||||||
|
if (scDryMilk.getTecahnician() != null) {
|
||||||
|
String[] techs = scDryMilk.getTecahnician().trim().split("[,,\\s]+");
|
||||||
|
scDryMilk.setTechnicianList(Arrays.asList(techs));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ScDryMilk> list = scDryMilkService.selectScDryMilkList(scDryMilk);
|
List<ScDryMilk> list = scDryMilkService.selectScDryMilkList(scDryMilk);
|
||||||
@@ -97,90 +132,21 @@ public class ScDryMilkController extends BaseController
|
|||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
try {
|
return success(scDryMilkService.selectScDryMilkById(id));
|
||||||
if (id == null) {
|
|
||||||
return error("记录ID不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
ScDryMilk result = scDryMilkService.selectScDryMilkById(id);
|
|
||||||
if (result == null) {
|
|
||||||
return error("记录不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
return success(result);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("获取干奶记录详细信息失败,ID: " + id, e);
|
|
||||||
return error("获取记录详细信息失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据耳号查询羊只ID - 新增耳号验证功能
|
* 获取羊舍列表
|
||||||
*/
|
|
||||||
@GetMapping("/validateEarTag")
|
|
||||||
public AjaxResult validateEarTag(@RequestParam("manageTags") String manageTags)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
|
||||||
return error("耳号不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
String cleanTag = manageTags.trim();
|
|
||||||
logger.info("验证耳号: [{}]", cleanTag);
|
|
||||||
|
|
||||||
Long sheepId = scDryMilkService.selectSheepIdByManageTags(cleanTag);
|
|
||||||
if (sheepId == null) {
|
|
||||||
logger.warn("耳号 [{}] 不存在", cleanTag);
|
|
||||||
return error("该耳号不存在,请检查输入");
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info("验证耳号成功,羊只ID: {}", sheepId);
|
|
||||||
return AjaxResult.success("耳号验证通过", sheepId);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("验证耳号失败,耳号: " + manageTags, e);
|
|
||||||
return error("验证耳号时出错: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据耳号查询羊只ID
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:query')")
|
|
||||||
@GetMapping(value = "/sheep/{manageTags}")
|
|
||||||
public AjaxResult getSheepIdByManageTags(@PathVariable("manageTags") String manageTags)
|
|
||||||
{
|
|
||||||
Long sheepId = scDryMilkService.selectSheepIdByManageTags(manageTags);
|
|
||||||
return success(sheepId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取羊舍列表 - 用于嵌套选择
|
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sheepfoldList")
|
@GetMapping("/sheepfoldList")
|
||||||
public AjaxResult getSheepfoldList(@RequestParam(value = "ranchId", required = false) Long ranchId,
|
public AjaxResult getSheepfoldList(DaSheepfold daSheepfold)
|
||||||
@RequestParam(value = "sheepfoldTypeId", required = false) Long sheepfoldTypeId)
|
|
||||||
{
|
{
|
||||||
try {
|
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldList(daSheepfold);
|
||||||
DaSheepfold query = new DaSheepfold();
|
return success(list);
|
||||||
if (ranchId != null) {
|
|
||||||
query.setRanchId(ranchId);
|
|
||||||
}
|
|
||||||
if (sheepfoldTypeId != null) {
|
|
||||||
query.setSheepfoldTypeId(sheepfoldTypeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<DaSheepfold> sheepfoldList = daSheepfoldService.selectDaSheepfoldList(query);
|
|
||||||
logger.info("查询羊舍列表,牧场ID: {}, 类型ID: {}, 结果数量: {}", ranchId, sheepfoldTypeId, sheepfoldList.size());
|
|
||||||
|
|
||||||
return success(sheepfoldList);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("获取羊舍列表失败", e);
|
|
||||||
return error("获取羊舍列表失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增干奶记录
|
* 新增干奶记录 (支持批量录入)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:add')")
|
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:add')")
|
||||||
@Log(title = "干奶记录", businessType = BusinessType.INSERT)
|
@Log(title = "干奶记录", businessType = BusinessType.INSERT)
|
||||||
@@ -188,43 +154,41 @@ public class ScDryMilkController extends BaseController
|
|||||||
public AjaxResult add(@RequestBody ScDryMilk scDryMilk)
|
public AjaxResult add(@RequestBody ScDryMilk scDryMilk)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// 基础参数校验
|
if (scDryMilk == null || scDryMilk.getManageTags() == null) {
|
||||||
if (scDryMilk == null) {
|
|
||||||
return error("请求参数不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scDryMilk.getManageTags() == null || scDryMilk.getManageTags().trim().isEmpty()) {
|
|
||||||
return error("耳号不能为空");
|
return error("耳号不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scDryMilk.getDatetime() == null) {
|
// 批量解析耳号
|
||||||
return error("干奶日期不能为空");
|
String[] tags = scDryMilk.getManageTags().trim().split("[\\s,,\n]+");
|
||||||
|
int successCount = 0;
|
||||||
|
StringBuilder errorMsg = new StringBuilder();
|
||||||
|
|
||||||
|
for (String tag : tags) {
|
||||||
|
if (tag.isEmpty()) continue;
|
||||||
|
|
||||||
|
Long sheepId = scDryMilkService.selectSheepIdByManageTags(tag);
|
||||||
|
if (sheepId == null) {
|
||||||
|
errorMsg.append(tag).append("不存在; ");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ScDryMilk newItem = new ScDryMilk();
|
||||||
|
newItem.setSheepId(String.valueOf(sheepId));
|
||||||
|
newItem.setDatetime(scDryMilk.getDatetime());
|
||||||
|
newItem.setStatus(scDryMilk.getStatus());
|
||||||
|
newItem.setSheepfold(scDryMilk.getSheepfold());
|
||||||
|
newItem.setTecahnician(scDryMilk.getTecahnician());
|
||||||
|
newItem.setComment(scDryMilk.getComment());
|
||||||
|
newItem.setCreateBy(getUsername());
|
||||||
|
|
||||||
|
scDryMilkService.insertScDryMilk(newItem);
|
||||||
|
successCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scDryMilk.getStatus() == null) {
|
if (errorMsg.length() > 0) {
|
||||||
return error("请选择是否使用乳头封闭剂");
|
return warn("成功录入 " + successCount + " 条。失败详情:" + errorMsg.toString());
|
||||||
}
|
|
||||||
|
|
||||||
// 清理输入参数
|
|
||||||
scDryMilk.setManageTags(scDryMilk.getManageTags().trim());
|
|
||||||
if (scDryMilk.getTecahnician() != null) {
|
|
||||||
scDryMilk.setTecahnician(scDryMilk.getTecahnician().trim());
|
|
||||||
}
|
|
||||||
if (scDryMilk.getComment() != null) {
|
|
||||||
scDryMilk.setComment(scDryMilk.getComment().trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info("新增干奶记录,耳号: {}", scDryMilk.getManageTags());
|
|
||||||
|
|
||||||
int result = scDryMilkService.insertScDryMilk(scDryMilk);
|
|
||||||
if (result > 0) {
|
|
||||||
// 重新查询插入的记录,包含自动生成的创建时间
|
|
||||||
ScDryMilk insertedRecord = scDryMilkService.selectScDryMilkById(scDryMilk.getId());
|
|
||||||
logger.info("新增干奶记录成功,记录ID: {}", scDryMilk.getId());
|
|
||||||
return success(insertedRecord);
|
|
||||||
} else {
|
|
||||||
return error("新增失败");
|
|
||||||
}
|
}
|
||||||
|
return success("成功录入 " + successCount + " 条记录");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("新增干奶记录失败", e);
|
logger.error("新增干奶记录失败", e);
|
||||||
return error("新增失败: " + e.getMessage());
|
return error("新增失败: " + e.getMessage());
|
||||||
@@ -239,39 +203,7 @@ public class ScDryMilkController extends BaseController
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody ScDryMilk scDryMilk)
|
public AjaxResult edit(@RequestBody ScDryMilk scDryMilk)
|
||||||
{
|
{
|
||||||
try {
|
return toAjax(scDryMilkService.updateScDryMilk(scDryMilk));
|
||||||
if (scDryMilk == null) {
|
|
||||||
return error("请求参数不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scDryMilk.getId() == null) {
|
|
||||||
return error("记录ID不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 清理输入参数
|
|
||||||
if (scDryMilk.getManageTags() != null) {
|
|
||||||
scDryMilk.setManageTags(scDryMilk.getManageTags().trim());
|
|
||||||
}
|
|
||||||
if (scDryMilk.getTecahnician() != null) {
|
|
||||||
scDryMilk.setTecahnician(scDryMilk.getTecahnician().trim());
|
|
||||||
}
|
|
||||||
if (scDryMilk.getComment() != null) {
|
|
||||||
scDryMilk.setComment(scDryMilk.getComment().trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info("修改干奶记录,ID: {}", scDryMilk.getId());
|
|
||||||
|
|
||||||
int result = scDryMilkService.updateScDryMilk(scDryMilk);
|
|
||||||
if (result > 0) {
|
|
||||||
logger.info("修改干奶记录成功");
|
|
||||||
return success("修改成功");
|
|
||||||
} else {
|
|
||||||
return error("修改失败,记录可能不存在");
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("修改干奶记录失败", e);
|
|
||||||
return error("修改失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -282,71 +214,6 @@ public class ScDryMilkController extends BaseController
|
|||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
try {
|
return toAjax(scDryMilkService.deleteScDryMilkByIds(ids));
|
||||||
if (ids == null || ids.length == 0) {
|
|
||||||
return error("删除的记录ID不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info("删除干奶记录,IDs: {}", java.util.Arrays.toString(ids));
|
|
||||||
|
|
||||||
int result = scDryMilkService.deleteScDryMilkByIds(ids);
|
|
||||||
if (result > 0) {
|
|
||||||
logger.info("删除干奶记录成功,删除数量: {}", result);
|
|
||||||
return success("删除成功");
|
|
||||||
} else {
|
|
||||||
return error("删除失败,记录可能不存在");
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("删除干奶记录失败", e);
|
|
||||||
return error("删除失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('drymilk:drymilk:quary')")
|
|
||||||
@GetMapping("/search_ear_numbers")
|
|
||||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
|
||||||
try {
|
|
||||||
List<String> earNumbers = scDryMilkService.searchEarNumbers(query);
|
|
||||||
return success(earNumbers);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("搜索耳号异常", e);
|
|
||||||
return error("搜索耳号失败:" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量验证耳号
|
|
||||||
*/
|
|
||||||
@GetMapping("/validateBatchEarTags")
|
|
||||||
public AjaxResult validateBatchEarTags(@RequestParam("manageTags") String manageTags) {
|
|
||||||
try {
|
|
||||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
|
||||||
return error("耳号不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 支持多种分隔符
|
|
||||||
String[] earTagArray = manageTags.split("[\\s,,]+");
|
|
||||||
List<Map<String, Object>> results = new ArrayList<>();
|
|
||||||
|
|
||||||
for (String earTag : earTagArray) {
|
|
||||||
String cleanTag = earTag.trim();
|
|
||||||
if (cleanTag.isEmpty()) continue;
|
|
||||||
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
result.put("earTag", cleanTag);
|
|
||||||
|
|
||||||
Long sheepId = scDryMilkService.selectSheepIdByManageTags(cleanTag);
|
|
||||||
result.put("exists", sheepId != null);
|
|
||||||
result.put("sheepId", sheepId);
|
|
||||||
|
|
||||||
results.add(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return success(results);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("批量验证耳号失败", e);
|
|
||||||
return error("验证失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,12 +5,19 @@ import java.util.Map;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
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.annotation.Log;
|
||||||
import com.zhyc.common.core.controller.BaseController;
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
import com.zhyc.common.core.domain.AjaxResult;
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
import com.zhyc.common.enums.BusinessType;
|
import com.zhyc.common.enums.BusinessType;
|
||||||
import com.zhyc.common.exception.ServiceException;
|
|
||||||
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
||||||
import com.zhyc.module.produce.breed.service.IScSheepDeathService;
|
import com.zhyc.module.produce.breed.service.IScSheepDeathService;
|
||||||
import com.zhyc.module.biosafety.service.ISwDiseaseService;
|
import com.zhyc.module.biosafety.service.ISwDiseaseService;
|
||||||
@@ -41,19 +48,35 @@ public class ScSheepDeathController extends BaseController
|
|||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(ScSheepDeath scSheepDeath)
|
public TableDataInfo list(ScSheepDeath scSheepDeath)
|
||||||
{
|
{
|
||||||
try {
|
startPage();
|
||||||
startPage();
|
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
||||||
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
return getDataTable(list);
|
||||||
return getDataTable(list);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("查询羊只死淘记录列表失败", e);
|
|
||||||
return getDataTable(new java.util.ArrayList<>());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据管理耳号查询羊只信息
|
* 搜索管理耳号(用于下拉提示)
|
||||||
*/
|
*/
|
||||||
|
@GetMapping("/search/earNo")
|
||||||
|
public AjaxResult searchEarNo(@RequestParam("query") String query) {
|
||||||
|
return success(scSheepDeathService.selectDistinctManageTags(query == null ? "" : query));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索技术员(用于下拉提示)
|
||||||
|
*/
|
||||||
|
@GetMapping("/search/technician")
|
||||||
|
public AjaxResult searchTechnician(@RequestParam("query") String query) {
|
||||||
|
return success(scSheepDeathService.selectDistinctTechnician(query == null ? "" : query));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索处理人(用于下拉提示)
|
||||||
|
*/
|
||||||
|
@GetMapping("/search/handler")
|
||||||
|
public AjaxResult searchHandler(@RequestParam("query") String query) {
|
||||||
|
return success(scSheepDeathService.selectDistinctHandler(query == null ? "" : query));
|
||||||
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:query')")
|
@PreAuthorize("@ss.hasPermi('sheep_death:death:query')")
|
||||||
@GetMapping("/sheepInfo/{manageTags}")
|
@GetMapping("/sheepInfo/{manageTags}")
|
||||||
public AjaxResult getSheepInfo(@PathVariable("manageTags") String manageTags)
|
public AjaxResult getSheepInfo(@PathVariable("manageTags") String manageTags)
|
||||||
@@ -62,7 +85,6 @@ public class ScSheepDeathController extends BaseController
|
|||||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||||
return error("管理耳号不能为空");
|
return error("管理耳号不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> sheepInfo = scSheepDeathService.selectSheepFileByManageTags(manageTags.trim());
|
Map<String, Object> sheepInfo = scSheepDeathService.selectSheepFileByManageTags(manageTags.trim());
|
||||||
if (sheepInfo != null) {
|
if (sheepInfo != null) {
|
||||||
return success(sheepInfo);
|
return success(sheepInfo);
|
||||||
@@ -70,187 +92,63 @@ public class ScSheepDeathController extends BaseController
|
|||||||
return error("未找到该耳号对应的羊只信息");
|
return error("未找到该耳号对应的羊只信息");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("查询羊只信息失败,管理耳号: " + manageTags, e);
|
|
||||||
return error("查询羊只信息失败: " + e.getMessage());
|
return error("查询羊只信息失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取疾病树形列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:query')")
|
@PreAuthorize("@ss.hasPermi('sheep_death:death:query')")
|
||||||
@GetMapping("/disease/tree")
|
@GetMapping("/disease/tree")
|
||||||
public AjaxResult getDiseaseTree()
|
public AjaxResult getDiseaseTree()
|
||||||
{
|
{
|
||||||
try {
|
List<SwDisease> diseaseList = swDiseaseService.selectSwDiseaseList(new SwDisease());
|
||||||
List<SwDisease> diseaseList = swDiseaseService.selectSwDiseaseList(new SwDisease());
|
return success(diseaseList);
|
||||||
return success(diseaseList);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("获取疾病树形列表失败", e);
|
|
||||||
return error("获取疾病列表失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出羊只死淘记录列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:export')")
|
@PreAuthorize("@ss.hasPermi('sheep_death:death:export')")
|
||||||
@Log(title = "羊只死淘记录", businessType = BusinessType.EXPORT)
|
@Log(title = "羊只死淘记录", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, ScSheepDeath scSheepDeath)
|
public void export(HttpServletResponse response, ScSheepDeath scSheepDeath)
|
||||||
{
|
{
|
||||||
try {
|
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
||||||
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
ExcelUtil<ScSheepDeath> util = new ExcelUtil<ScSheepDeath>(ScSheepDeath.class);
|
||||||
ExcelUtil<ScSheepDeath> util = new ExcelUtil<ScSheepDeath>(ScSheepDeath.class);
|
util.exportExcel(response, list, "羊只死淘记录数据");
|
||||||
util.exportExcel(response, list, "羊只死淘记录数据");
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("导出羊只死淘记录失败", e);
|
|
||||||
// 可以在这里返回错误响应
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取羊只死淘记录详细信息
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:query')")
|
@PreAuthorize("@ss.hasPermi('sheep_death:death:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
try {
|
return success(scSheepDeathService.selectScSheepDeathById(id));
|
||||||
if (id == null) {
|
|
||||||
return error("记录ID不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
ScSheepDeath result = scSheepDeathService.selectScSheepDeathById(id);
|
|
||||||
if (result == null) {
|
|
||||||
return error("记录不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
return success(result);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("获取羊只死淘记录详细信息失败,ID: " + id, e);
|
|
||||||
return error("获取记录详细信息失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增羊只死淘记录
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:add')")
|
@PreAuthorize("@ss.hasPermi('sheep_death:death:add')")
|
||||||
@Log(title = "羊只死淘记录", businessType = BusinessType.INSERT)
|
@Log(title = "羊只死淘记录", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ScSheepDeath scSheepDeath)
|
public AjaxResult add(@RequestBody ScSheepDeath scSheepDeath)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// 基础参数校验
|
if (scSheepDeath == null || scSheepDeath.getManageTags() == null || scSheepDeath.getManageTags().trim().isEmpty()) {
|
||||||
if (scSheepDeath == null) {
|
|
||||||
return error("请求参数不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scSheepDeath.getManageTags() == null || scSheepDeath.getManageTags().trim().isEmpty()) {
|
|
||||||
return error("管理耳号不能为空");
|
return error("管理耳号不能为空");
|
||||||
}
|
}
|
||||||
|
return toAjax(scSheepDeathService.insertScSheepDeath(scSheepDeath));
|
||||||
if (scSheepDeath.getDeathDate() == null) {
|
|
||||||
return error("死淘日期不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
int result = scSheepDeathService.insertScSheepDeath(scSheepDeath);
|
|
||||||
if (result > 0) {
|
|
||||||
return success("新增成功");
|
|
||||||
} else {
|
|
||||||
return error("新增失败");
|
|
||||||
}
|
|
||||||
} catch (ServiceException e) {
|
|
||||||
logger.warn("新增羊只死淘记录业务异常: " + e.getMessage());
|
|
||||||
return error(e.getMessage());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("新增羊只死淘记录失败", e);
|
|
||||||
return error("新增失败: " + e.getMessage());
|
return error("新增失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改羊只死淘记录
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:edit')")
|
@PreAuthorize("@ss.hasPermi('sheep_death:death:edit')")
|
||||||
@Log(title = "羊只死淘记录", businessType = BusinessType.UPDATE)
|
@Log(title = "羊只死淘记录", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody ScSheepDeath scSheepDeath)
|
public AjaxResult edit(@RequestBody ScSheepDeath scSheepDeath)
|
||||||
{
|
{
|
||||||
try {
|
return toAjax(scSheepDeathService.updateScSheepDeath(scSheepDeath));
|
||||||
// 基础参数校验
|
|
||||||
if (scSheepDeath == null) {
|
|
||||||
return error("请求参数不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scSheepDeath.getId() == null) {
|
|
||||||
return error("记录ID不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scSheepDeath.getManageTags() == null || scSheepDeath.getManageTags().trim().isEmpty()) {
|
|
||||||
return error("管理耳号不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scSheepDeath.getDeathDate() == null) {
|
|
||||||
return error("死淘日期不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
int result = scSheepDeathService.updateScSheepDeath(scSheepDeath);
|
|
||||||
if (result > 0) {
|
|
||||||
return success("修改成功");
|
|
||||||
} else {
|
|
||||||
return error("修改失败,记录可能不存在");
|
|
||||||
}
|
|
||||||
} catch (ServiceException e) {
|
|
||||||
logger.warn("修改羊只死淘记录业务异常: " + e.getMessage());
|
|
||||||
return error(e.getMessage());
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("修改羊只死淘记录失败", e);
|
|
||||||
return error("修改失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除羊只死淘记录
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:remove')")
|
@PreAuthorize("@ss.hasPermi('sheep_death:death:remove')")
|
||||||
@Log(title = "羊只死淘记录", businessType = BusinessType.DELETE)
|
@Log(title = "羊只死淘记录", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
try {
|
return toAjax(scSheepDeathService.deleteScSheepDeathByIds(ids));
|
||||||
if (ids == null || ids.length == 0) {
|
|
||||||
return error("删除的记录ID不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
int result = scSheepDeathService.deleteScSheepDeathByIds(ids);
|
|
||||||
if (result > 0) {
|
|
||||||
return success("删除成功");
|
|
||||||
} else {
|
|
||||||
return error("删除失败,记录可能不存在");
|
|
||||||
}
|
|
||||||
} catch (ServiceException e) {
|
|
||||||
logger.warn("删除羊只死淘记录业务异常: " + e.getMessage());
|
|
||||||
return error(e.getMessage());
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("删除羊只死淘记录失败", e);
|
|
||||||
return error("删除失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模糊查询母羊耳号列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
|
|
||||||
@GetMapping("/search_ear_numbers")
|
|
||||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
|
||||||
try {
|
|
||||||
List<String> earNumbers = scSheepDeathService.searchEarNumbers(query);
|
|
||||||
return success(earNumbers);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("搜索耳号异常", e);
|
|
||||||
return error("搜索耳号失败:" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.controller;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.zhyc.common.utils.StringUtils;
|
||||||
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -17,9 +18,6 @@ import com.zhyc.common.core.page.TableDataInfo;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 断奶记录Controller
|
* 断奶记录Controller
|
||||||
*
|
|
||||||
* @author zhyc
|
|
||||||
* @date 2024-01-01
|
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/Weaning/weaning_record")
|
@RequestMapping("/Weaning/weaning_record")
|
||||||
@@ -38,6 +36,16 @@ public class ScWeanRecordController extends BaseController {
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【新增】模糊查询耳号列表 (用于前端下拉框远程搜索)
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('Weaning:weaning_record:list')")
|
||||||
|
@GetMapping("/search_ear_numbers")
|
||||||
|
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||||
|
List<String> list = scWeanRecordService.searchEarNumbers(query);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出断奶记录列表
|
* 导出断奶记录列表
|
||||||
*/
|
*/
|
||||||
@@ -80,7 +88,6 @@ public class ScWeanRecordController extends BaseController {
|
|||||||
@Log(title = "断奶记录", businessType = BusinessType.INSERT)
|
@Log(title = "断奶记录", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ScWeanRecord scWeanRecord) {
|
public AjaxResult add(@RequestBody ScWeanRecord scWeanRecord) {
|
||||||
// 验证耳号是否存在
|
|
||||||
if (scWeanRecord.getEarNumber() != null) {
|
if (scWeanRecord.getEarNumber() != null) {
|
||||||
Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
|
Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
|
||||||
if (sheepId == null) {
|
if (sheepId == null) {
|
||||||
@@ -88,20 +95,10 @@ public class ScWeanRecordController extends BaseController {
|
|||||||
}
|
}
|
||||||
scWeanRecord.setSheepId(sheepId);
|
scWeanRecord.setSheepId(sheepId);
|
||||||
}
|
}
|
||||||
|
if (scWeanRecord.getSheepId() == null) return error("羊只信息不能为空");
|
||||||
// 验证必要字段
|
if (scWeanRecord.getDatetime() == null) return error("断奶日期不能为空");
|
||||||
if (scWeanRecord.getSheepId() == null) {
|
if (scWeanRecord.getWeight() == null) return error("断奶重量不能为空");
|
||||||
return error("羊只信息不能为空");
|
if (scWeanRecord.getStatus() == null) return error("是否留养不能为空");
|
||||||
}
|
|
||||||
if (scWeanRecord.getDatetime() == null) {
|
|
||||||
return error("断奶日期不能为空");
|
|
||||||
}
|
|
||||||
if (scWeanRecord.getWeight() == null) {
|
|
||||||
return error("断奶重量不能为空");
|
|
||||||
}
|
|
||||||
if (scWeanRecord.getStatus() == null) {
|
|
||||||
return error("是否留养不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
scWeanRecord.setCreateBy(getUsername());
|
scWeanRecord.setCreateBy(getUsername());
|
||||||
return toAjax(scWeanRecordService.insertScWeanRecord(scWeanRecord));
|
return toAjax(scWeanRecordService.insertScWeanRecord(scWeanRecord));
|
||||||
@@ -114,32 +111,11 @@ public class ScWeanRecordController extends BaseController {
|
|||||||
@Log(title = "断奶记录", businessType = BusinessType.UPDATE)
|
@Log(title = "断奶记录", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody ScWeanRecord scWeanRecord) {
|
public AjaxResult edit(@RequestBody ScWeanRecord scWeanRecord) {
|
||||||
// 验证耳号是否存在
|
|
||||||
if (scWeanRecord.getEarNumber() != null) {
|
if (scWeanRecord.getEarNumber() != null) {
|
||||||
Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
|
Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
|
||||||
if (sheepId == null) {
|
if (sheepId == null) return error("耳号不存在");
|
||||||
return error("耳号不存在,请检查后重新输入");
|
|
||||||
}
|
|
||||||
scWeanRecord.setSheepId(sheepId);
|
scWeanRecord.setSheepId(sheepId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证必要字段
|
|
||||||
if (scWeanRecord.getId() == null) {
|
|
||||||
return error("记录ID不能为空");
|
|
||||||
}
|
|
||||||
if (scWeanRecord.getSheepId() == null) {
|
|
||||||
return error("羊只信息不能为空");
|
|
||||||
}
|
|
||||||
if (scWeanRecord.getDatetime() == null) {
|
|
||||||
return error("断奶日期不能为空");
|
|
||||||
}
|
|
||||||
if (scWeanRecord.getWeight() == null) {
|
|
||||||
return error("断奶重量不能为空");
|
|
||||||
}
|
|
||||||
if (scWeanRecord.getStatus() == null) {
|
|
||||||
return error("是否留养不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
return toAjax(scWeanRecordService.updateScWeanRecord(scWeanRecord));
|
return toAjax(scWeanRecordService.updateScWeanRecord(scWeanRecord));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,18 +130,4 @@ public class ScWeanRecordController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模糊查询母羊耳号列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
|
|
||||||
@GetMapping("/search_ear_numbers")
|
|
||||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
|
||||||
try {
|
|
||||||
List<String> earNumbers = scWeanRecordService.searchEarNumbers(query);
|
|
||||||
return success(earNumbers);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("搜索耳号异常", e);
|
|
||||||
return error("搜索耳号失败:" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -2,11 +2,9 @@ package com.zhyc.module.produce.breed.domain;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.AllArgsConstructor;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import lombok.Data;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import com.zhyc.common.annotation.Excel;
|
import com.zhyc.common.annotation.Excel;
|
||||||
import com.zhyc.common.core.domain.BaseEntity;
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
@@ -16,9 +14,6 @@ import com.zhyc.common.core.domain.BaseEntity;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
* @date 2025-07-15
|
* @date 2025-07-15
|
||||||
*/
|
*/
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class ScDryMilk extends BaseEntity
|
public class ScDryMilk extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -35,8 +30,8 @@ public class ScDryMilk extends BaseEntity
|
|||||||
@Excel(name = "干奶日期", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "干奶日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date datetime;
|
private Date datetime;
|
||||||
|
|
||||||
/** 是否使用乳头封闭剂 */
|
/** 是否使用乳头封闭剂 (1:是 0:否) */
|
||||||
@Excel(name = "是否使用乳头封闭剂")
|
@Excel(name = "是否使用乳头封闭剂", readConverterExp = "0=否,1=是")
|
||||||
private Long status;
|
private Long status;
|
||||||
|
|
||||||
/** 转入羊舍id */
|
/** 转入羊舍id */
|
||||||
@@ -51,12 +46,15 @@ public class ScDryMilk extends BaseEntity
|
|||||||
@Excel(name = "备注")
|
@Excel(name = "备注")
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
// 以下为联表查询字段,不存储在sc_dry_milk表中
|
// --- 联表查询及辅助字段 ---
|
||||||
|
|
||||||
/** 管理耳号 */
|
/** 管理耳号 (单个,用于接收前端传参或导出显示) */
|
||||||
@Excel(name = "耳号")
|
@Excel(name = "耳号")
|
||||||
private String manageTags;
|
private String manageTags;
|
||||||
|
|
||||||
|
/** 多耳号查询列表 (用于MyBatis IN查询) */
|
||||||
|
private List<String> manageTagsList;
|
||||||
|
|
||||||
/** 品种 */
|
/** 品种 */
|
||||||
@Excel(name = "品种")
|
@Excel(name = "品种")
|
||||||
private String variety;
|
private String variety;
|
||||||
@@ -69,15 +67,136 @@ public class ScDryMilk extends BaseEntity
|
|||||||
@Excel(name = "事件类型")
|
@Excel(name = "事件类型")
|
||||||
private String eventType;
|
private String eventType;
|
||||||
|
|
||||||
/** 全部羊耳号列表(用于多耳号查询) */
|
/** 技术员多选列表 (新增:用于MyBatis IN查询) */
|
||||||
private List<String> allEarNumbers;
|
private List<String> technicianList;
|
||||||
|
|
||||||
public List<String> getAllEarNumbers() {
|
public void setId(Long id)
|
||||||
return allEarNumbers;
|
{
|
||||||
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAllEarNumbers(List<String> allEarNumbers) {
|
public Long getId()
|
||||||
this.allEarNumbers = allEarNumbers;
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setSheepId(String sheepId)
|
||||||
|
{
|
||||||
|
this.sheepId = sheepId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSheepId()
|
||||||
|
{
|
||||||
|
return sheepId;
|
||||||
|
}
|
||||||
|
public void setDatetime(Date datetime)
|
||||||
|
{
|
||||||
|
this.datetime = datetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDatetime()
|
||||||
|
{
|
||||||
|
return datetime;
|
||||||
|
}
|
||||||
|
public void setStatus(Long status)
|
||||||
|
{
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getStatus()
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
public void setSheepfold(Long sheepfold)
|
||||||
|
{
|
||||||
|
this.sheepfold = sheepfold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSheepfold()
|
||||||
|
{
|
||||||
|
return sheepfold;
|
||||||
|
}
|
||||||
|
public void setTecahnician(String tecahnician)
|
||||||
|
{
|
||||||
|
this.tecahnician = tecahnician;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTecahnician()
|
||||||
|
{
|
||||||
|
return tecahnician;
|
||||||
|
}
|
||||||
|
public void setComment(String comment)
|
||||||
|
{
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComment()
|
||||||
|
{
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getManageTags() {
|
||||||
|
return manageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManageTags(String manageTags) {
|
||||||
|
this.manageTags = manageTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getManageTagsList() {
|
||||||
|
return manageTagsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManageTagsList(List<String> manageTagsList) {
|
||||||
|
this.manageTagsList = manageTagsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVariety() {
|
||||||
|
return variety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVariety(String variety) {
|
||||||
|
this.variety = variety;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSheepfoldName() {
|
||||||
|
return sheepfoldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSheepfoldName(String sheepfoldName) {
|
||||||
|
this.sheepfoldName = sheepfoldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEventType() {
|
||||||
|
return eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventType(String eventType) {
|
||||||
|
this.eventType = eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getTechnicianList() {
|
||||||
|
return technicianList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTechnicianList(List<String> technicianList) {
|
||||||
|
this.technicianList = technicianList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("sheepId", getSheepId())
|
||||||
|
.append("datetime", getDatetime())
|
||||||
|
.append("status", getStatus())
|
||||||
|
.append("sheepfold", getSheepfold())
|
||||||
|
.append("tecahnician", getTecahnician())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("comment", getComment())
|
||||||
|
.append("manageTags", getManageTags())
|
||||||
|
.append("variety", getVariety())
|
||||||
|
.append("sheepfoldName", getSheepfoldName())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ package com.zhyc.module.produce.breed.domain;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
@@ -75,22 +74,28 @@ public class ScSheepDeath extends BaseEntity
|
|||||||
/** 品种 */
|
/** 品种 */
|
||||||
private String variety;
|
private String variety;
|
||||||
|
|
||||||
/** 死亡时羊只类别 */
|
/** 羊只类型 (原事假类型改为羊只类型查询) */
|
||||||
|
@Excel(name = "羊只类型")
|
||||||
private String sheepType;
|
private String sheepType;
|
||||||
|
|
||||||
/** 性别 */
|
/** 性别 */
|
||||||
|
@Excel(name = "性别", readConverterExp = "1=母,2=公")
|
||||||
private Integer gender;
|
private Integer gender;
|
||||||
|
|
||||||
/** 日龄 */
|
/** 日龄 */
|
||||||
|
@Excel(name = "日龄")
|
||||||
private Long dayAge;
|
private Long dayAge;
|
||||||
|
|
||||||
/** 胎次 */
|
/** 胎次 */
|
||||||
|
@Excel(name = "胎次")
|
||||||
private Integer parity;
|
private Integer parity;
|
||||||
|
|
||||||
/** 羊舍 */
|
/** 羊舍 */
|
||||||
|
@Excel(name = "羊舍")
|
||||||
private String sheepfoldName;
|
private String sheepfoldName;
|
||||||
|
|
||||||
/** 繁育状态 */
|
/** 繁育状态 */
|
||||||
|
@Excel(name = "繁育状态")
|
||||||
private String breedStatus;
|
private String breedStatus;
|
||||||
|
|
||||||
/** 死亡时产后天数 */
|
/** 死亡时产后天数 */
|
||||||
@@ -102,236 +107,117 @@ public class ScSheepDeath extends BaseEntity
|
|||||||
/** 死亡时怀孕天数 */
|
/** 死亡时怀孕天数 */
|
||||||
private Integer gestationDay;
|
private Integer gestationDay;
|
||||||
|
|
||||||
public void setId(Long id)
|
// 疾病名称
|
||||||
{
|
private String diseaseTypeName;
|
||||||
this.id = id;
|
private String diseaseSubtypeName;
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
// --- 多选查询条件 ---
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSheepId(Long sheepId)
|
/** 多选管理耳号列表 */
|
||||||
{
|
private List<String> manageTagsList;
|
||||||
this.sheepId = sheepId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getSheepId()
|
/** 多选羊只类型列表 */
|
||||||
{
|
private List<String> sheepTypeList;
|
||||||
return sheepId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setManageTags(String manageTags)
|
/** 多选技术员列表 */
|
||||||
{
|
private List<String> technicianList;
|
||||||
this.manageTags = manageTags;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getManageTags()
|
/** 多选处理人列表 */
|
||||||
{
|
private List<String> handlerList;
|
||||||
return manageTags;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEventType(String eventType)
|
/** 多选班组列表 */
|
||||||
{
|
private List<String> workGroupList;
|
||||||
this.eventType = eventType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEventType()
|
// Getter & Setter
|
||||||
{
|
public void setId(Long id) { this.id = id; }
|
||||||
return eventType;
|
public Long getId() { return id; }
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeathDate(Date deathDate)
|
public void setSheepId(Long sheepId) { this.sheepId = sheepId; }
|
||||||
{
|
public Long getSheepId() { return sheepId; }
|
||||||
this.deathDate = deathDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDeathDate()
|
public void setManageTags(String manageTags) { this.manageTags = manageTags; }
|
||||||
{
|
public String getManageTags() { return manageTags; }
|
||||||
return deathDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDiseaseTypeId(Long diseaseTypeId)
|
public void setEventType(String eventType) { this.eventType = eventType; }
|
||||||
{
|
public String getEventType() { return eventType; }
|
||||||
this.diseaseTypeId = diseaseTypeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getDiseaseTypeId()
|
public void setDeathDate(Date deathDate) { this.deathDate = deathDate; }
|
||||||
{
|
public Date getDeathDate() { return deathDate; }
|
||||||
return diseaseTypeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDiseaseSubtypeId(Long diseaseSubtypeId)
|
public void setDiseaseTypeId(Long diseaseTypeId) { this.diseaseTypeId = diseaseTypeId; }
|
||||||
{
|
public Long getDiseaseTypeId() { return diseaseTypeId; }
|
||||||
this.diseaseSubtypeId = diseaseSubtypeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getDiseaseSubtypeId()
|
public void setDiseaseSubtypeId(Long diseaseSubtypeId) { this.diseaseSubtypeId = diseaseSubtypeId; }
|
||||||
{
|
public Long getDiseaseSubtypeId() { return diseaseSubtypeId; }
|
||||||
return diseaseSubtypeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDisposalDirection(String disposalDirection)
|
public void setDisposalDirection(String disposalDirection) { this.disposalDirection = disposalDirection; }
|
||||||
{
|
public String getDisposalDirection() { return disposalDirection; }
|
||||||
this.disposalDirection = disposalDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisposalDirection()
|
public void setTechnician(String technician) { this.technician = technician; }
|
||||||
{
|
public String getTechnician() { return technician; }
|
||||||
return disposalDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTechnician(String technician)
|
public void setHandler(String handler) { this.handler = handler; }
|
||||||
{
|
public String getHandler() { return handler; }
|
||||||
this.technician = technician;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTechnician()
|
public void setWorkGroup(String workGroup) { this.workGroup = workGroup; }
|
||||||
{
|
public String getWorkGroup() { return workGroup; }
|
||||||
return technician;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHandler(String handler)
|
public void setComment(String comment) { this.comment = comment; }
|
||||||
{
|
public String getComment() { return comment; }
|
||||||
this.handler = handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHandler()
|
public void setIsDelete(Long isDelete) { this.isDelete = isDelete; }
|
||||||
{
|
public Long getIsDelete() { return isDelete; }
|
||||||
return handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWorkGroup(String workGroup)
|
public void setVariety(String variety) { this.variety = variety; }
|
||||||
{
|
public String getVariety() { return variety; }
|
||||||
this.workGroup = workGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWorkGroup()
|
public void setSheepType(String sheepType) { this.sheepType = sheepType; }
|
||||||
{
|
public String getSheepType() { return sheepType; }
|
||||||
return workGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment)
|
public void setGender(Integer gender) { this.gender = gender; }
|
||||||
{
|
public Integer getGender() { return gender; }
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment()
|
public void setDayAge(Long dayAge) { this.dayAge = dayAge; }
|
||||||
{
|
public Long getDayAge() { return dayAge; }
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsDelete(Long isDelete)
|
public void setParity(Integer parity) { this.parity = parity; }
|
||||||
{
|
public Integer getParity() { return parity; }
|
||||||
this.isDelete = isDelete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getIsDelete()
|
public void setSheepfoldName(String sheepfoldName) { this.sheepfoldName = sheepfoldName; }
|
||||||
{
|
public String getSheepfoldName() { return sheepfoldName; }
|
||||||
return isDelete;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 以下为仅用于显示的字段的getter/setter
|
public void setBreedStatus(String breedStatus) { this.breedStatus = breedStatus; }
|
||||||
public void setVariety(String variety)
|
public String getBreedStatus() { return breedStatus; }
|
||||||
{
|
|
||||||
this.variety = variety;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVariety()
|
public void setPostLambingDay(Integer postLambingDay) { this.postLambingDay = postLambingDay; }
|
||||||
{
|
public Integer getPostLambingDay() { return postLambingDay; }
|
||||||
return variety;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSheepType(String sheepType)
|
public void setLactationDay(Integer lactationDay) { this.lactationDay = lactationDay; }
|
||||||
{
|
public Integer getLactationDay() { return lactationDay; }
|
||||||
this.sheepType = sheepType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSheepType()
|
public void setGestationDay(Integer gestationDay) { this.gestationDay = gestationDay; }
|
||||||
{
|
public Integer getGestationDay() { return gestationDay; }
|
||||||
return sheepType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGender(Integer gender)
|
public String getDiseaseTypeName() { return diseaseTypeName; }
|
||||||
{
|
public void setDiseaseTypeName(String diseaseTypeName) { this.diseaseTypeName = diseaseTypeName; }
|
||||||
this.gender = gender;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getGender()
|
public String getDiseaseSubtypeName() { return diseaseSubtypeName; }
|
||||||
{
|
public void setDiseaseSubtypeName(String diseaseSubtypeName) { this.diseaseSubtypeName = diseaseSubtypeName; }
|
||||||
return gender;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDayAge(Long dayAge)
|
public List<String> getManageTagsList() { return manageTagsList; }
|
||||||
{
|
public void setManageTagsList(List<String> manageTagsList) { this.manageTagsList = manageTagsList; }
|
||||||
this.dayAge = dayAge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getDayAge()
|
public List<String> getSheepTypeList() { return sheepTypeList; }
|
||||||
{
|
public void setSheepTypeList(List<String> sheepTypeList) { this.sheepTypeList = sheepTypeList; }
|
||||||
return dayAge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParity(Integer parity)
|
public List<String> getTechnicianList() { return technicianList; }
|
||||||
{
|
public void setTechnicianList(List<String> technicianList) { this.technicianList = technicianList; }
|
||||||
this.parity = parity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getParity()
|
public List<String> getHandlerList() { return handlerList; }
|
||||||
{
|
public void setHandlerList(List<String> handlerList) { this.handlerList = handlerList; }
|
||||||
return parity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSheepfoldName(String sheepfoldName)
|
public List<String> getWorkGroupList() { return workGroupList; }
|
||||||
{
|
public void setWorkGroupList(List<String> workGroupList) { this.workGroupList = workGroupList; }
|
||||||
this.sheepfoldName = sheepfoldName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSheepfoldName()
|
|
||||||
{
|
|
||||||
return sheepfoldName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBreedStatus(String breedStatus)
|
|
||||||
{
|
|
||||||
this.breedStatus = breedStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBreedStatus()
|
|
||||||
{
|
|
||||||
return breedStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPostLambingDay(Integer postLambingDay)
|
|
||||||
{
|
|
||||||
this.postLambingDay = postLambingDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPostLambingDay()
|
|
||||||
{
|
|
||||||
return postLambingDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLactationDay(Integer lactationDay)
|
|
||||||
{
|
|
||||||
this.lactationDay = lactationDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getLactationDay()
|
|
||||||
{
|
|
||||||
return lactationDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGestationDay(Integer gestationDay)
|
|
||||||
{
|
|
||||||
this.gestationDay = gestationDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getGestationDay()
|
|
||||||
{
|
|
||||||
return gestationDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.zhyc.module.produce.breed.domain;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.zhyc.common.annotation.Excel;
|
import com.zhyc.common.annotation.Excel;
|
||||||
import com.zhyc.common.core.domain.BaseEntity;
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
@@ -13,9 +12,6 @@ import lombok.NoArgsConstructor;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 断奶记录对象 sc_wean_record
|
* 断奶记录对象 sc_wean_record
|
||||||
*
|
|
||||||
* @author zhyc
|
|
||||||
* @date 2024-01-01
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@@ -55,8 +51,19 @@ public class ScWeanRecord extends BaseEntity {
|
|||||||
@Excel(name = "电子耳号")
|
@Excel(name = "电子耳号")
|
||||||
private String electronicTags;
|
private String electronicTags;
|
||||||
|
|
||||||
// 关联查询字段
|
// --- 新增查询字段 ---
|
||||||
/** 耳号 */
|
|
||||||
|
/** 多耳号查询列表 */
|
||||||
|
private List<String> allEarNumbers;
|
||||||
|
|
||||||
|
/** 是否在群 (1是 0否) */
|
||||||
|
private String isInHerd;
|
||||||
|
|
||||||
|
/** 羊只类别 (对应 sheep_file 的 breed 字段) */
|
||||||
|
private String sheepCategory;
|
||||||
|
|
||||||
|
// --- 关联查询显示字段 ---
|
||||||
|
|
||||||
@Excel(name = "耳号")
|
@Excel(name = "耳号")
|
||||||
private String earNumber;
|
private String earNumber;
|
||||||
|
|
||||||
@@ -95,16 +102,4 @@ public class ScWeanRecord extends BaseEntity {
|
|||||||
/** 繁育状态 */
|
/** 繁育状态 */
|
||||||
@Excel(name = "繁育状态")
|
@Excel(name = "繁育状态")
|
||||||
private String breedingStatus;
|
private String breedingStatus;
|
||||||
|
|
||||||
/** 全部羊耳号列表(用于多耳号查询) */
|
|
||||||
private List<String> allEarNumbers;
|
|
||||||
|
|
||||||
public List<String> getAllEarNumbers() {
|
|
||||||
return allEarNumbers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAllEarNumbers(List<String> allEarNumbers) {
|
|
||||||
this.allEarNumbers = allEarNumbers;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,8 +7,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 干奶记录Mapper接口
|
* 干奶记录Mapper接口
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-15
|
* @date 2025-07-15
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -16,65 +15,58 @@ public interface ScDryMilkMapper
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 查询干奶记录
|
* 查询干奶记录
|
||||||
*
|
* * @param id 干奶记录主键
|
||||||
* @param id 干奶记录主键
|
|
||||||
* @return 干奶记录
|
* @return 干奶记录
|
||||||
*/
|
*/
|
||||||
public ScDryMilk selectScDryMilkById(Long id);
|
public ScDryMilk selectScDryMilkById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询干奶记录列表
|
* 查询干奶记录列表
|
||||||
*
|
* * @param scDryMilk 干奶记录
|
||||||
* @param scDryMilk 干奶记录
|
|
||||||
* @return 干奶记录集合
|
* @return 干奶记录集合
|
||||||
*/
|
*/
|
||||||
public List<ScDryMilk> selectScDryMilkList(ScDryMilk scDryMilk);
|
public List<ScDryMilk> selectScDryMilkList(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据耳号查询羊只ID
|
|
||||||
*
|
|
||||||
* @param manageTags 管理耳号
|
|
||||||
* @return 羊只ID
|
|
||||||
*/
|
|
||||||
public Long selectSheepIdByManageTags(String manageTags);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增干奶记录
|
* 新增干奶记录
|
||||||
*
|
* * @param scDryMilk 干奶记录
|
||||||
* @param scDryMilk 干奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertScDryMilk(ScDryMilk scDryMilk);
|
public int insertScDryMilk(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改干奶记录
|
* 修改干奶记录
|
||||||
*
|
* * @param scDryMilk 干奶记录
|
||||||
* @param scDryMilk 干奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateScDryMilk(ScDryMilk scDryMilk);
|
public int updateScDryMilk(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除干奶记录
|
* 删除干奶记录
|
||||||
*
|
* * @param id 干奶记录主键
|
||||||
* @param id 干奶记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScDryMilkById(Long id);
|
public int deleteScDryMilkById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除干奶记录
|
* 批量删除干奶记录
|
||||||
*
|
* * @param ids 需要删除的数据主键集合
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScDryMilkByIds(Long[] ids);
|
public int deleteScDryMilkByIds(String[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模糊查询母羊耳号列表
|
* 根据耳号查询羊只ID
|
||||||
*
|
|
||||||
* @param query 查询关键字
|
|
||||||
* @return 耳号列表
|
|
||||||
*/
|
*/
|
||||||
List<String> searchEarNumbers(@Param("query") String query);
|
public Long selectSheepIdByManageTags(String manageTags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程搜索耳号列表
|
||||||
|
*/
|
||||||
|
public List<String> selectSheepEarNumberList(@Param("query") String query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程搜索技术员列表
|
||||||
|
*/
|
||||||
|
public List<String> searchTechnicianList(@Param("query") String query);
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,8 @@ package com.zhyc.module.produce.breed.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 羊只死淘记录Mapper接口
|
* 羊只死淘记录Mapper接口
|
||||||
@@ -29,14 +29,6 @@ public interface ScSheepDeathMapper
|
|||||||
*/
|
*/
|
||||||
public List<ScSheepDeath> selectScSheepDeathList(ScSheepDeath scSheepDeath);
|
public List<ScSheepDeath> selectScSheepDeathList(ScSheepDeath scSheepDeath);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据管理耳号查询sheep_file视图信息
|
|
||||||
*
|
|
||||||
* @param manageTags 管理耳号
|
|
||||||
* @return 羊只信息
|
|
||||||
*/
|
|
||||||
public Map<String, Object> selectSheepFileByManageTags(String manageTags);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增羊只死淘记录
|
* 新增羊只死淘记录
|
||||||
*
|
*
|
||||||
@@ -70,28 +62,27 @@ public interface ScSheepDeathMapper
|
|||||||
public int deleteScSheepDeathByIds(Long[] ids);
|
public int deleteScSheepDeathByIds(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新羊只繁育状态
|
* 根据管理耳号查询sheep_file视图信息
|
||||||
*
|
|
||||||
* @param sheepId 羊只ID
|
|
||||||
* @param status 繁育状态
|
|
||||||
* @return 更新结果
|
|
||||||
*/
|
*/
|
||||||
public int updateSheepFileStatus(@Param("sheepId") Long sheepId, @Param("status") String status);
|
public Map<String, Object> selectSheepFileByManageTags(@Param("manageTags") String manageTags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增:更新羊只在群状态
|
* 更新羊只在群状态
|
||||||
*
|
|
||||||
* @param sheepId 羊只ID
|
|
||||||
* @param status 在群状态(1-在群,2-不在群)
|
|
||||||
* @return 更新结果
|
|
||||||
*/
|
*/
|
||||||
public int updateSheepStatus(@Param("sheepId") Long sheepId, @Param("status") String status);
|
public int updateSheepStatus(@Param("sheepId") Long sheepId, @Param("status") String status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模糊查询母羊耳号列表
|
* 远程搜索:管理耳号
|
||||||
*
|
|
||||||
* @param query 查询关键字
|
|
||||||
* @return 耳号列表
|
|
||||||
*/
|
*/
|
||||||
List<String> searchEarNumbers(@Param("query") String query);
|
public List<String> selectDistinctManageTags(@Param("query") String query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程搜索:技术员
|
||||||
|
*/
|
||||||
|
public List<String> selectDistinctTechnician(@Param("query") String query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程搜索:处理人
|
||||||
|
*/
|
||||||
|
public List<String> selectDistinctHandler(@Param("query") String query);
|
||||||
}
|
}
|
||||||
@@ -2,86 +2,75 @@ package com.zhyc.module.produce.breed.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 断奶记录Mapper接口
|
* 断奶记录Mapper接口
|
||||||
*
|
* * @author zhyc
|
||||||
* @author zhyc
|
|
||||||
* @date 2024-01-01
|
* @date 2024-01-01
|
||||||
*/
|
*/
|
||||||
@Mapper
|
public interface ScWeanRecordMapper
|
||||||
public interface ScWeanRecordMapper {
|
{
|
||||||
/**
|
/**
|
||||||
* 查询断奶记录
|
* 查询断奶记录
|
||||||
*
|
* * @param id 断奶记录主键
|
||||||
* @param id 断奶记录主键
|
|
||||||
* @return 断奶记录
|
* @return 断奶记录
|
||||||
*/
|
*/
|
||||||
public ScWeanRecord selectScWeanRecordById(Long id);
|
public ScWeanRecord selectScWeanRecordById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询断奶记录列表
|
* 查询断奶记录列表
|
||||||
*
|
* * @param scWeanRecord 断奶记录
|
||||||
* @param scWeanRecord 断奶记录
|
|
||||||
* @return 断奶记录集合
|
* @return 断奶记录集合
|
||||||
*/
|
*/
|
||||||
public List<ScWeanRecord> selectScWeanRecordList(ScWeanRecord scWeanRecord);
|
public List<ScWeanRecord> selectScWeanRecordList(ScWeanRecord scWeanRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增断奶记录
|
* 新增断奶记录
|
||||||
*
|
* * @param scWeanRecord 断奶记录
|
||||||
* @param scWeanRecord 断奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertScWeanRecord(ScWeanRecord scWeanRecord);
|
public int insertScWeanRecord(ScWeanRecord scWeanRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改断奶记录
|
* 修改断奶记录
|
||||||
*
|
* * @param scWeanRecord 断奶记录
|
||||||
* @param scWeanRecord 断奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateScWeanRecord(ScWeanRecord scWeanRecord);
|
public int updateScWeanRecord(ScWeanRecord scWeanRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除断奶记录
|
* 删除断奶记录
|
||||||
*
|
* * @param id 断奶记录主键
|
||||||
* @param id 断奶记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScWeanRecordById(Long id);
|
public int deleteScWeanRecordById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除断奶记录
|
* 批量删除断奶记录
|
||||||
*
|
* * @param ids 需要删除的数据主键集合
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScWeanRecordByIds(Long[] ids);
|
public int deleteScWeanRecordByIds(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据耳号查询羊只ID
|
* 根据耳号查询羊只ID
|
||||||
*
|
|
||||||
* @param earNumber 耳号
|
* @param earNumber 耳号
|
||||||
* @return 羊只ID
|
* @return 羊只ID
|
||||||
*/
|
*/
|
||||||
public Long selectSheepIdByEarNumber(String earNumber);
|
public Long selectSheepIdByEarNumber(String earNumber);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据耳号更新bas_sheep表中的断奶信息
|
* 更新基础羊只表的断奶信息 (对应XML中的updateBasSheepWeaningInfo)
|
||||||
*
|
* @param scWeanRecord 断奶信息
|
||||||
* @param scWeanRecord 断奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateBasSheepWeaningInfo(ScWeanRecord scWeanRecord);
|
public int updateBasSheepWeaningInfo(ScWeanRecord scWeanRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模糊查询母羊耳号列表
|
* 【新增】模糊查询耳号列表 (用于前端远程搜索)
|
||||||
*
|
|
||||||
* @param query 查询关键字
|
* @param query 查询关键字
|
||||||
* @return 耳号列表
|
* @return 耳号列表
|
||||||
*/
|
*/
|
||||||
List<String> searchEarNumbers(@Param("query") String query);
|
public List<String> searchEarNumbers(@Param("query") String query);
|
||||||
}
|
}
|
||||||
@@ -5,67 +5,65 @@ import com.zhyc.module.produce.breed.domain.ScDryMilk;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 干奶记录Service接口
|
* 干奶记录Service接口
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-15
|
* @date 2025-07-15
|
||||||
*/
|
*/
|
||||||
public interface IScDryMilkService
|
public interface IScDryMilkService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 查询干奶记录
|
* 查询干奶记录
|
||||||
*
|
* * @param id 干奶记录主键
|
||||||
* @param id 干奶记录主键
|
|
||||||
* @return 干奶记录
|
* @return 干奶记录
|
||||||
*/
|
*/
|
||||||
public ScDryMilk selectScDryMilkById(Long id);
|
public ScDryMilk selectScDryMilkById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询干奶记录列表
|
* 查询干奶记录列表
|
||||||
*
|
* * @param scDryMilk 干奶记录
|
||||||
* @param scDryMilk 干奶记录
|
|
||||||
* @return 干奶记录集合
|
* @return 干奶记录集合
|
||||||
*/
|
*/
|
||||||
public List<ScDryMilk> selectScDryMilkList(ScDryMilk scDryMilk);
|
public List<ScDryMilk> selectScDryMilkList(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
Long selectSheepIdByManageTags(String manageTags);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增干奶记录
|
* 新增干奶记录
|
||||||
*
|
* * @param scDryMilk 干奶记录
|
||||||
* @param scDryMilk 干奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertScDryMilk(ScDryMilk scDryMilk);
|
public int insertScDryMilk(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改干奶记录
|
* 修改干奶记录
|
||||||
*
|
* * @param scDryMilk 干奶记录
|
||||||
* @param scDryMilk 干奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateScDryMilk(ScDryMilk scDryMilk);
|
public int updateScDryMilk(ScDryMilk scDryMilk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除干奶记录
|
* 批量删除干奶记录
|
||||||
*
|
* * @param ids 需要删除的干奶记录主键集合
|
||||||
* @param ids 需要删除的干奶记录主键集合
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScDryMilkByIds(Long[] ids);
|
public int deleteScDryMilkByIds(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除干奶记录信息
|
* 删除干奶记录信息
|
||||||
*
|
* * @param id 干奶记录主键
|
||||||
* @param id 干奶记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScDryMilkById(Long id);
|
public int deleteScDryMilkById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模糊查询母羊耳号列表
|
* 根据耳号查询羊只ID
|
||||||
*
|
|
||||||
* @param query 查询关键字
|
|
||||||
* @return 耳号列表
|
|
||||||
*/
|
*/
|
||||||
public List<String> searchEarNumbers(String query);
|
public Long selectSheepIdByManageTags(String manageTags);
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* 远程搜索耳号列表
|
||||||
|
*/
|
||||||
|
public List<String> selectSheepEarNumberList(String query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程搜索技术员列表
|
||||||
|
*/
|
||||||
|
public List<String> selectTechnicianList(String query);
|
||||||
|
}
|
||||||
@@ -28,14 +28,6 @@ public interface IScSheepDeathService
|
|||||||
*/
|
*/
|
||||||
public List<ScSheepDeath> selectScSheepDeathList(ScSheepDeath scSheepDeath);
|
public List<ScSheepDeath> selectScSheepDeathList(ScSheepDeath scSheepDeath);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据管理耳号查询sheep_file视图信息
|
|
||||||
*
|
|
||||||
* @param manageTags 管理耳号
|
|
||||||
* @return 羊只信息
|
|
||||||
*/
|
|
||||||
public Map<String, Object> selectSheepFileByManageTags(String manageTags);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增羊只死淘记录
|
* 新增羊只死淘记录
|
||||||
*
|
*
|
||||||
@@ -69,10 +61,25 @@ public interface IScSheepDeathService
|
|||||||
public int deleteScSheepDeathById(Long id);
|
public int deleteScSheepDeathById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模糊查询母羊耳号列表
|
* 根据管理耳号查询sheep_file视图信息
|
||||||
*
|
*
|
||||||
* @param query 查询关键字
|
* @param manageTags 管理耳号
|
||||||
* @return 耳号列表
|
* @return 羊只信息
|
||||||
*/
|
*/
|
||||||
public List<String> searchEarNumbers(String query);
|
public Map<String, Object> selectSheepFileByManageTags(String manageTags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程搜索:管理耳号
|
||||||
|
*/
|
||||||
|
public List<String> selectDistinctManageTags(String query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程搜索:技术员
|
||||||
|
*/
|
||||||
|
public List<String> selectDistinctTechnician(String query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程搜索:处理人
|
||||||
|
*/
|
||||||
|
public List<String> selectDistinctHandler(String query);
|
||||||
}
|
}
|
||||||
@@ -6,70 +6,62 @@ import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 断奶记录Service接口
|
* 断奶记录Service接口
|
||||||
*
|
* * @author zhyc
|
||||||
* @author ruoyi
|
* @date 2024-01-01
|
||||||
* @date 2025-07-13
|
|
||||||
*/
|
*/
|
||||||
public interface IScWeanRecordService {
|
public interface IScWeanRecordService
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* 查询断奶记录
|
* 查询断奶记录
|
||||||
*
|
* * @param id 断奶记录主键
|
||||||
* @param id 断奶记录主键
|
|
||||||
* @return 断奶记录
|
* @return 断奶记录
|
||||||
*/
|
*/
|
||||||
public ScWeanRecord selectScWeanRecordById(Long id);
|
public ScWeanRecord selectScWeanRecordById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询断奶记录列表
|
* 查询断奶记录列表
|
||||||
*
|
* * @param scWeanRecord 断奶记录
|
||||||
* @param scWeanRecord 断奶记录
|
|
||||||
* @return 断奶记录集合
|
* @return 断奶记录集合
|
||||||
*/
|
*/
|
||||||
public List<ScWeanRecord> selectScWeanRecordList(ScWeanRecord scWeanRecord);
|
public List<ScWeanRecord> selectScWeanRecordList(ScWeanRecord scWeanRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增断奶记录
|
* 新增断奶记录
|
||||||
*
|
* * @param scWeanRecord 断奶记录
|
||||||
* @param scWeanRecord 断奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertScWeanRecord(ScWeanRecord scWeanRecord);
|
public int insertScWeanRecord(ScWeanRecord scWeanRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改断奶记录
|
* 修改断奶记录
|
||||||
*
|
* * @param scWeanRecord 断奶记录
|
||||||
* @param scWeanRecord 断奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateScWeanRecord(ScWeanRecord scWeanRecord);
|
public int updateScWeanRecord(ScWeanRecord scWeanRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除断奶记录
|
* 批量删除断奶记录
|
||||||
*
|
* * @param ids 需要删除的断奶记录主键集合
|
||||||
* @param ids 需要删除的断奶记录主键集合
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScWeanRecordByIds(Long[] ids);
|
public int deleteScWeanRecordByIds(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除断奶记录信息
|
* 删除断奶记录信息
|
||||||
*
|
* * @param id 断奶记录主键
|
||||||
* @param id 断奶记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteScWeanRecordById(Long id);
|
public int deleteScWeanRecordById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据耳号查询羊只ID
|
* 根据耳号查询羊只ID
|
||||||
*
|
|
||||||
* @param earNumber 耳号
|
* @param earNumber 耳号
|
||||||
* @return 羊只ID
|
* @return 羊只ID
|
||||||
*/
|
*/
|
||||||
public Long selectSheepIdByEarNumber(String earNumber);
|
public Long selectSheepIdByEarNumber(String earNumber);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模糊查询母羊耳号列表
|
* 【新增】模糊查询耳号列表
|
||||||
*
|
|
||||||
* @param query 查询关键字
|
* @param query 查询关键字
|
||||||
* @return 耳号列表
|
* @return 耳号列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
package com.zhyc.module.produce.breed.service.impl;
|
package com.zhyc.module.produce.breed.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Date;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.zhyc.module.produce.breed.mapper.ScDryMilkMapper;
|
import com.zhyc.module.produce.breed.mapper.ScDryMilkMapper;
|
||||||
import com.zhyc.module.produce.breed.domain.ScDryMilk;
|
import com.zhyc.module.produce.breed.domain.ScDryMilk;
|
||||||
import com.zhyc.module.produce.breed.service.IScDryMilkService;
|
import com.zhyc.module.produce.breed.service.IScDryMilkService;
|
||||||
import com.zhyc.common.utils.StringUtils;
|
|
||||||
import com.zhyc.common.utils.DateUtils;
|
|
||||||
import com.zhyc.common.exception.ServiceException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 干奶记录Service业务层处理
|
* 干奶记录Service业务层处理
|
||||||
*
|
* * @author ruoyi
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-15
|
* @date 2025-07-15
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@@ -25,8 +21,7 @@ public class ScDryMilkServiceImpl implements IScDryMilkService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询干奶记录
|
* 查询干奶记录
|
||||||
*
|
* * @param id 干奶记录主键
|
||||||
* @param id 干奶记录主键
|
|
||||||
* @return 干奶记录
|
* @return 干奶记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -37,8 +32,7 @@ public class ScDryMilkServiceImpl implements IScDryMilkService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询干奶记录列表
|
* 查询干奶记录列表
|
||||||
*
|
* * @param scDryMilk 干奶记录
|
||||||
* @param scDryMilk 干奶记录
|
|
||||||
* @return 干奶记录
|
* @return 干奶记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -47,90 +41,47 @@ public class ScDryMilkServiceImpl implements IScDryMilkService
|
|||||||
return scDryMilkMapper.selectScDryMilkList(scDryMilk);
|
return scDryMilkMapper.selectScDryMilkList(scDryMilk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据耳号查询羊只ID
|
|
||||||
*
|
|
||||||
* @param manageTags 管理耳号
|
|
||||||
* @return 羊只ID
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Long selectSheepIdByManageTags(String manageTags)
|
|
||||||
{
|
|
||||||
return scDryMilkMapper.selectSheepIdByManageTags(manageTags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增干奶记录
|
* 新增干奶记录
|
||||||
*
|
* * @param scDryMilk 干奶记录
|
||||||
* @param scDryMilk 干奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertScDryMilk(ScDryMilk scDryMilk)
|
public int insertScDryMilk(ScDryMilk scDryMilk)
|
||||||
{
|
{
|
||||||
// 如果传入的是耳号,需要转换为羊只ID
|
|
||||||
if (StringUtils.isNotEmpty(scDryMilk.getManageTags()) && StringUtils.isEmpty(scDryMilk.getSheepId()))
|
|
||||||
{
|
|
||||||
Long sheepId = scDryMilkMapper.selectSheepIdByManageTags(scDryMilk.getManageTags());
|
|
||||||
if (sheepId == null)
|
|
||||||
{
|
|
||||||
throw new ServiceException("未找到对应耳号的羊只信息");
|
|
||||||
}
|
|
||||||
scDryMilk.setSheepId(String.valueOf(sheepId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 自动设置创建时间(精确到分钟)
|
|
||||||
scDryMilk.setCreateTime(DateUtils.getNowDate());
|
scDryMilk.setCreateTime(DateUtils.getNowDate());
|
||||||
// 如果有获取当前用户的方法,可以设置创建人
|
|
||||||
// scDryMilk.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
|
|
||||||
return scDryMilkMapper.insertScDryMilk(scDryMilk);
|
return scDryMilkMapper.insertScDryMilk(scDryMilk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改干奶记录
|
* 修改干奶记录
|
||||||
*
|
* * @param scDryMilk 干奶记录
|
||||||
* @param scDryMilk 干奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateScDryMilk(ScDryMilk scDryMilk)
|
public int updateScDryMilk(ScDryMilk scDryMilk)
|
||||||
{
|
{
|
||||||
// 如果传入的是耳号,需要转换为羊只ID
|
|
||||||
if (StringUtils.isNotEmpty(scDryMilk.getManageTags()) && StringUtils.isEmpty(scDryMilk.getSheepId()))
|
|
||||||
{
|
|
||||||
Long sheepId = scDryMilkMapper.selectSheepIdByManageTags(scDryMilk.getManageTags());
|
|
||||||
if (sheepId == null)
|
|
||||||
{
|
|
||||||
throw new ServiceException("未找到对应耳号的羊只信息");
|
|
||||||
}
|
|
||||||
scDryMilk.setSheepId(String.valueOf(sheepId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置更新时间
|
|
||||||
scDryMilk.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
// 如果有获取当前用户的方法,可以设置更新人
|
|
||||||
// scDryMilk.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
|
|
||||||
return scDryMilkMapper.updateScDryMilk(scDryMilk);
|
return scDryMilkMapper.updateScDryMilk(scDryMilk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除干奶记录
|
* 批量删除干奶记录
|
||||||
*
|
* * @param ids 需要删除的干奶记录主键
|
||||||
* @param ids 需要删除的干奶记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteScDryMilkByIds(Long[] ids)
|
public int deleteScDryMilkByIds(Long[] ids)
|
||||||
{
|
{
|
||||||
return scDryMilkMapper.deleteScDryMilkByIds(ids);
|
String[] strIds = new String[ids.length];
|
||||||
|
for(int i=0; i<ids.length; i++){
|
||||||
|
strIds[i] = String.valueOf(ids[i]);
|
||||||
|
}
|
||||||
|
return scDryMilkMapper.deleteScDryMilkByIds(strIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除干奶记录信息
|
* 删除干奶记录信息
|
||||||
*
|
* * @param id 干奶记录主键
|
||||||
* @param id 干奶记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -139,11 +90,18 @@ public class ScDryMilkServiceImpl implements IScDryMilkService
|
|||||||
return scDryMilkMapper.deleteScDryMilkById(id);
|
return scDryMilkMapper.deleteScDryMilkById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScLambingRecordServiceImpl.java 添加方法
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> searchEarNumbers(String query) {
|
public Long selectSheepIdByManageTags(String manageTags) {
|
||||||
return scDryMilkMapper.searchEarNumbers(query);
|
return scDryMilkMapper.selectSheepIdByManageTags(manageTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> selectSheepEarNumberList(String query) {
|
||||||
|
return scDryMilkMapper.selectSheepEarNumberList(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> selectTechnicianList(String query) {
|
||||||
|
return scDryMilkMapper.searchTechnicianList(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.service.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import com.zhyc.common.utils.DateUtils;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
|
import com.zhyc.common.utils.bean.BeanUtils;
|
||||||
import com.zhyc.module.biosafety.domain.Diagnosis;
|
import com.zhyc.module.biosafety.domain.Diagnosis;
|
||||||
import com.zhyc.module.biosafety.domain.Treatment;
|
import com.zhyc.module.biosafety.domain.Treatment;
|
||||||
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
|
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
|
||||||
@@ -31,123 +32,69 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TreatmentServiceImpl treatmentService;
|
private TreatmentServiceImpl treatmentService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询羊只死淘记录
|
|
||||||
*
|
|
||||||
* @param id 羊只死淘记录主键
|
|
||||||
* @return 羊只死淘记录
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ScSheepDeath selectScSheepDeathById(Long id)
|
public ScSheepDeath selectScSheepDeathById(Long id)
|
||||||
{
|
{
|
||||||
ScSheepDeath scSheepDeath = scSheepDeathMapper.selectScSheepDeathById(id);
|
return scSheepDeathMapper.selectScSheepDeathById(id);
|
||||||
// 查询时也需要填充显示字段
|
|
||||||
if (scSheepDeath != null && scSheepDeath.getManageTags() != null) {
|
|
||||||
Map<String, Object> sheepInfo = selectSheepFileByManageTags(scSheepDeath.getManageTags());
|
|
||||||
if (sheepInfo != null) {
|
|
||||||
scSheepDeath.setVariety(sheepInfo.get("variety") != null ? sheepInfo.get("variety").toString() : null);
|
|
||||||
scSheepDeath.setSheepType(sheepInfo.get("sheepType") != null ? sheepInfo.get("sheepType").toString() : null);
|
|
||||||
scSheepDeath.setGender(sheepInfo.get("gender") != null ? Integer.valueOf(sheepInfo.get("gender").toString()) : null);
|
|
||||||
scSheepDeath.setDayAge(sheepInfo.get("dayAge") != null ? Long.valueOf(sheepInfo.get("dayAge").toString()) : null);
|
|
||||||
scSheepDeath.setParity(sheepInfo.get("parity") != null ? Integer.valueOf(sheepInfo.get("parity").toString()) : null);
|
|
||||||
scSheepDeath.setSheepfoldName(sheepInfo.get("sheepfoldName") != null ? sheepInfo.get("sheepfoldName").toString() : null);
|
|
||||||
scSheepDeath.setBreedStatus(sheepInfo.get("breedStatus") != null ? sheepInfo.get("breedStatus").toString() : null);
|
|
||||||
scSheepDeath.setPostLambingDay(sheepInfo.get("postLambingDay") != null ? Integer.valueOf(sheepInfo.get("postLambingDay").toString()) : null);
|
|
||||||
scSheepDeath.setLactationDay(sheepInfo.get("lactationDay") != null ? Integer.valueOf(sheepInfo.get("lactationDay").toString()) : null);
|
|
||||||
scSheepDeath.setGestationDay(sheepInfo.get("gestationDay") != null ? Integer.valueOf(sheepInfo.get("gestationDay").toString()) : null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return scSheepDeath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询羊只死淘记录列表
|
|
||||||
*
|
|
||||||
* @param scSheepDeath 羊只死淘记录
|
|
||||||
* @return 羊只死淘记录
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public List<ScSheepDeath> selectScSheepDeathList(ScSheepDeath scSheepDeath)
|
public List<ScSheepDeath> selectScSheepDeathList(ScSheepDeath scSheepDeath)
|
||||||
{
|
{
|
||||||
List<ScSheepDeath> list = scSheepDeathMapper.selectScSheepDeathList(scSheepDeath);
|
return scSheepDeathMapper.selectScSheepDeathList(scSheepDeath);
|
||||||
// 为列表中的每条记录填充显示字段
|
|
||||||
for (ScSheepDeath death : list) {
|
|
||||||
if (death.getManageTags() != null) {
|
|
||||||
Map<String, Object> sheepInfo = selectSheepFileByManageTags(death.getManageTags());
|
|
||||||
if (sheepInfo != null) {
|
|
||||||
death.setVariety(sheepInfo.get("variety") != null ? sheepInfo.get("variety").toString() : null);
|
|
||||||
death.setSheepType(sheepInfo.get("sheepType") != null ? sheepInfo.get("sheepType").toString() : null);
|
|
||||||
death.setGender(sheepInfo.get("gender") != null ? Integer.valueOf(sheepInfo.get("gender").toString()) : null);
|
|
||||||
death.setDayAge(sheepInfo.get("dayAge") != null ? Long.valueOf(sheepInfo.get("dayAge").toString()) : null);
|
|
||||||
death.setParity(sheepInfo.get("parity") != null ? Integer.valueOf(sheepInfo.get("parity").toString()) : null);
|
|
||||||
death.setSheepfoldName(sheepInfo.get("sheepfoldName") != null ? sheepInfo.get("sheepfoldName").toString() : null);
|
|
||||||
death.setBreedStatus(sheepInfo.get("breedStatus") != null ? sheepInfo.get("breedStatus").toString() : null);
|
|
||||||
death.setPostLambingDay(sheepInfo.get("postLambingDay") != null ? Integer.valueOf(sheepInfo.get("postLambingDay").toString()) : null);
|
|
||||||
death.setLactationDay(sheepInfo.get("lactationDay") != null ? Integer.valueOf(sheepInfo.get("lactationDay").toString()) : null);
|
|
||||||
death.setGestationDay(sheepInfo.get("gestationDay") != null ? Integer.valueOf(sheepInfo.get("gestationDay").toString()) : null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据管理耳号查询sheep_file视图信息
|
|
||||||
*
|
|
||||||
* @param manageTags 管理耳号
|
|
||||||
* @return 羊只信息
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> selectSheepFileByManageTags(String manageTags)
|
public Map<String, Object> selectSheepFileByManageTags(String manageTags)
|
||||||
{
|
{
|
||||||
return scSheepDeathMapper.selectSheepFileByManageTags(manageTags);
|
return scSheepDeathMapper.selectSheepFileByManageTags(manageTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增羊只死淘记录
|
|
||||||
*
|
|
||||||
* @param scSheepDeath 羊只死淘记录
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public int insertScSheepDeath(ScSheepDeath scSheepDeath)
|
public int insertScSheepDeath(ScSheepDeath scSheepDeath)
|
||||||
{
|
{
|
||||||
// 设置事件类型默认为"死亡"
|
String manageTagsInput = scSheepDeath.getManageTags();
|
||||||
if (scSheepDeath.getEventType() == null || scSheepDeath.getEventType().isEmpty()) {
|
if (manageTagsInput == null || manageTagsInput.trim().isEmpty()) {
|
||||||
scSheepDeath.setEventType("死亡");
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果有管理耳号,查询并设置羊只ID
|
// 支持空格、逗号分隔
|
||||||
if (scSheepDeath.getManageTags() != null && !scSheepDeath.getManageTags().isEmpty()) {
|
String[] tags = manageTagsInput.split("[\\s,,]+");
|
||||||
Map<String, Object> sheepInfo = selectSheepFileByManageTags(scSheepDeath.getManageTags());
|
int successCount = 0;
|
||||||
|
|
||||||
|
for (String tag : tags) {
|
||||||
|
if (tag == null || tag.trim().isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ScSheepDeath newRecord = new ScSheepDeath();
|
||||||
|
BeanUtils.copyProperties(scSheepDeath, newRecord);
|
||||||
|
newRecord.setManageTags(tag.trim());
|
||||||
|
newRecord.setId(null);
|
||||||
|
|
||||||
|
if (newRecord.getEventType() == null || newRecord.getEventType().isEmpty()) {
|
||||||
|
newRecord.setEventType("死亡");
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> sheepInfo = selectSheepFileByManageTags(newRecord.getManageTags());
|
||||||
if (sheepInfo != null) {
|
if (sheepInfo != null) {
|
||||||
Long sheepId = sheepInfo.get("sheepId") != null ? Long.valueOf(sheepInfo.get("sheepId").toString()) : null;
|
Long sheepId = sheepInfo.get("sheepId") != null ? Long.valueOf(sheepInfo.get("sheepId").toString()) : null;
|
||||||
scSheepDeath.setSheepId(sheepId);
|
newRecord.setSheepId(sheepId);
|
||||||
|
|
||||||
// 插入死淘记录后,同时更新羊只在群状态为"不在群"(状态ID为2)
|
// 插入死淘记录后,同时更新羊只在群状态为"不在群"(状态ID为2)
|
||||||
if (sheepId != null) {
|
if (sheepId != null) {
|
||||||
scSheepDeathMapper.updateSheepStatus(sheepId, "2");
|
scSheepDeathMapper.updateSheepStatus(sheepId, "2");
|
||||||
|
treatmentService.updateTreatmentStatus(sheepId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newRecord.setCreateTime(DateUtils.getNowDate());
|
||||||
|
successCount += scSheepDeathMapper.insertScSheepDeath(newRecord);
|
||||||
}
|
}
|
||||||
|
return successCount;
|
||||||
treatmentService.updateTreatmentStatus(scSheepDeath.getSheepId());
|
|
||||||
|
|
||||||
scSheepDeath.setCreateTime(DateUtils.getNowDate());
|
|
||||||
|
|
||||||
return scSheepDeathMapper.insertScSheepDeath(scSheepDeath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改羊只死淘记录
|
|
||||||
*
|
|
||||||
* @param scSheepDeath 羊只死淘记录
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int updateScSheepDeath(ScSheepDeath scSheepDeath)
|
public int updateScSheepDeath(ScSheepDeath scSheepDeath)
|
||||||
{
|
{
|
||||||
@@ -168,12 +115,6 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
|||||||
return scSheepDeathMapper.updateScSheepDeath(scSheepDeath);
|
return scSheepDeathMapper.updateScSheepDeath(scSheepDeath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除羊只死淘记录
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的羊只死淘记录主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteScSheepDeathByIds(Long[] ids)
|
public int deleteScSheepDeathByIds(Long[] ids)
|
||||||
{
|
{
|
||||||
@@ -189,12 +130,6 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
|||||||
return scSheepDeathMapper.deleteScSheepDeathByIds(ids);
|
return scSheepDeathMapper.deleteScSheepDeathByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除羊只死淘记录信息
|
|
||||||
*
|
|
||||||
* @param id 羊只死淘记录主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteScSheepDeathById(Long id)
|
public int deleteScSheepDeathById(Long id)
|
||||||
{
|
{
|
||||||
@@ -208,8 +143,19 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
|||||||
return scSheepDeathMapper.deleteScSheepDeathById(id);
|
return scSheepDeathMapper.deleteScSheepDeathById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- 远程搜索实现 ---
|
||||||
@Override
|
@Override
|
||||||
public List<String> searchEarNumbers(String query) {
|
public List<String> selectDistinctManageTags(String query) {
|
||||||
return scSheepDeathMapper.searchEarNumbers(query);
|
return scSheepDeathMapper.selectDistinctManageTags(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> selectDistinctTechnician(String query) {
|
||||||
|
return scSheepDeathMapper.selectDistinctTechnician(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> selectDistinctHandler(String query) {
|
||||||
|
return scSheepDeathMapper.selectDistinctHandler(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,10 @@ package com.zhyc.module.produce.breed.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.zhyc.common.utils.DateUtils;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
import com.zhyc.module.produce.breed.mapper.ScWeanRecordMapper;
|
import com.zhyc.module.produce.breed.mapper.ScWeanRecordMapper;
|
||||||
|
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
||||||
import com.zhyc.module.produce.breed.service.IScWeanRecordService;
|
import com.zhyc.module.produce.breed.service.IScWeanRecordService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -11,127 +13,112 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 断奶记录Service业务层处理
|
* 断奶记录Service业务层处理
|
||||||
*
|
* * @author zhyc
|
||||||
* @author ruoyi
|
* @date 2024-01-01
|
||||||
* @date 2025-07-13
|
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ScWeanRecordServiceImpl implements IScWeanRecordService {
|
public class ScWeanRecordServiceImpl implements IScWeanRecordService
|
||||||
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScWeanRecordMapper scWeanRecordMapper;
|
private ScWeanRecordMapper scWeanRecordMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询断奶记录
|
* 查询断奶记录
|
||||||
*
|
* * @param id 断奶记录主键
|
||||||
* @param id 断奶记录主键
|
|
||||||
* @return 断奶记录
|
* @return 断奶记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ScWeanRecord selectScWeanRecordById(Long id) {
|
public ScWeanRecord selectScWeanRecordById(Long id)
|
||||||
|
{
|
||||||
return scWeanRecordMapper.selectScWeanRecordById(id);
|
return scWeanRecordMapper.selectScWeanRecordById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询断奶记录列表
|
* 查询断奶记录列表
|
||||||
*
|
* * @param scWeanRecord 断奶记录
|
||||||
* @param scWeanRecord 断奶记录
|
|
||||||
* @return 断奶记录
|
* @return 断奶记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ScWeanRecord> selectScWeanRecordList(ScWeanRecord scWeanRecord) {
|
public List<ScWeanRecord> selectScWeanRecordList(ScWeanRecord scWeanRecord)
|
||||||
|
{
|
||||||
return scWeanRecordMapper.selectScWeanRecordList(scWeanRecord);
|
return scWeanRecordMapper.selectScWeanRecordList(scWeanRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增断奶记录
|
* 新增断奶记录
|
||||||
*
|
* * @param scWeanRecord 断奶记录
|
||||||
* @param scWeanRecord 断奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public int insertScWeanRecord(ScWeanRecord scWeanRecord) {
|
public int insertScWeanRecord(ScWeanRecord scWeanRecord)
|
||||||
// 如果前端传递的是耳号,需要先获取羊只ID
|
{
|
||||||
if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) {
|
|
||||||
Long sheepId = scWeanRecordMapper.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
|
|
||||||
if (sheepId != null) {
|
|
||||||
scWeanRecord.setSheepId(sheepId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scWeanRecord.setCreateTime(DateUtils.getNowDate());
|
scWeanRecord.setCreateTime(DateUtils.getNowDate());
|
||||||
|
// 1. 插入断奶记录
|
||||||
|
int rows = scWeanRecordMapper.insertScWeanRecord(scWeanRecord);
|
||||||
|
|
||||||
// 插入断奶记录
|
// 2. 同步更新羊只档案中的断奶状态(断奶日期、断奶重、电子耳号等)
|
||||||
int result = scWeanRecordMapper.insertScWeanRecord(scWeanRecord);
|
// 确保 scWeanRecord 中包含 earNumber (Controller中add方法校验过)
|
||||||
|
if (rows > 0 && scWeanRecord.getEarNumber() != null) {
|
||||||
// 同步更新bas_sheep表中的断奶信息
|
|
||||||
if (result > 0 && scWeanRecord.getEarNumber() != null) {
|
|
||||||
scWeanRecordMapper.updateBasSheepWeaningInfo(scWeanRecord);
|
scWeanRecordMapper.updateBasSheepWeaningInfo(scWeanRecord);
|
||||||
}
|
}
|
||||||
|
return rows;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改断奶记录
|
* 修改断奶记录
|
||||||
*
|
* * @param scWeanRecord 断奶记录
|
||||||
* @param scWeanRecord 断奶记录
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public int updateScWeanRecord(ScWeanRecord scWeanRecord) {
|
public int updateScWeanRecord(ScWeanRecord scWeanRecord)
|
||||||
// 如果前端传递的是耳号,需要先获取羊只ID
|
{
|
||||||
if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) {
|
// 1. 更新断奶记录
|
||||||
Long sheepId = scWeanRecordMapper.selectSheepIdByEarNumber(scWeanRecord.getEarNumber());
|
int rows = scWeanRecordMapper.updateScWeanRecord(scWeanRecord);
|
||||||
if (sheepId != null) {
|
|
||||||
scWeanRecord.setSheepId(sheepId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新断奶记录
|
// 2. 同步更新羊只档案信息
|
||||||
int result = scWeanRecordMapper.updateScWeanRecord(scWeanRecord);
|
if (rows > 0 && scWeanRecord.getEarNumber() != null) {
|
||||||
|
|
||||||
// 同步更新bas_sheep表中的断奶信息
|
|
||||||
if (result > 0 && scWeanRecord.getEarNumber() != null) {
|
|
||||||
scWeanRecordMapper.updateBasSheepWeaningInfo(scWeanRecord);
|
scWeanRecordMapper.updateBasSheepWeaningInfo(scWeanRecord);
|
||||||
}
|
}
|
||||||
|
return rows;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除断奶记录
|
* 批量删除断奶记录
|
||||||
*
|
* * @param ids 需要删除的断奶记录主键
|
||||||
* @param ids 需要删除的断奶记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteScWeanRecordByIds(Long[] ids) {
|
public int deleteScWeanRecordByIds(Long[] ids)
|
||||||
|
{
|
||||||
return scWeanRecordMapper.deleteScWeanRecordByIds(ids);
|
return scWeanRecordMapper.deleteScWeanRecordByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除断奶记录信息
|
* 删除断奶记录信息
|
||||||
*
|
* * @param id 断奶记录主键
|
||||||
* @param id 断奶记录主键
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteScWeanRecordById(Long id) {
|
public int deleteScWeanRecordById(Long id)
|
||||||
|
{
|
||||||
return scWeanRecordMapper.deleteScWeanRecordById(id);
|
return scWeanRecordMapper.deleteScWeanRecordById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据耳号查询羊只ID
|
* 根据耳号查询羊只ID
|
||||||
*
|
|
||||||
* @param earNumber 耳号
|
|
||||||
* @return 羊只ID
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Long selectSheepIdByEarNumber(String earNumber) {
|
public Long selectSheepIdByEarNumber(String earNumber) {
|
||||||
return scWeanRecordMapper.selectSheepIdByEarNumber(earNumber);
|
return scWeanRecordMapper.selectSheepIdByEarNumber(earNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【新增】模糊查询耳号列表 (用于前端远程搜索)
|
||||||
|
* @param query 查询关键字
|
||||||
|
* @return 耳号列表
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<String> searchEarNumbers(String query) {
|
public List<String> searchEarNumbers(String query) {
|
||||||
return scWeanRecordMapper.searchEarNumbers(query);
|
return scWeanRecordMapper.searchEarNumbers(query);
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ public class SxCustomerController extends BaseController {
|
|||||||
@Log(title = "客户管理", businessType = BusinessType.INSERT)
|
@Log(title = "客户管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody SxCustomer sxCustomer) {
|
public AjaxResult add(@RequestBody SxCustomer sxCustomer) {
|
||||||
|
// 【新增】自动填充当前登录用户的 userId 和 deptId
|
||||||
|
sxCustomer.setUserId(getUserId());
|
||||||
|
sxCustomer.setDeptId(getDeptId());
|
||||||
return toAjax(sxCustomerService.insertSxCustomer(sxCustomer));
|
return toAjax(sxCustomerService.insertSxCustomer(sxCustomer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,4 +85,4 @@ public class SxCustomerController extends BaseController {
|
|||||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
return toAjax(sxCustomerService.deleteSxCustomerByIds(ids));
|
return toAjax(sxCustomerService.deleteSxCustomerByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,6 +78,9 @@ public class SxSheepSaleController extends BaseController {
|
|||||||
@Log(title = "羊只销售记录", businessType = BusinessType.INSERT)
|
@Log(title = "羊只销售记录", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody SxSheepSale sxSheepSale) {
|
public AjaxResult add(@RequestBody SxSheepSale sxSheepSale) {
|
||||||
|
// 【新增】自动填充当前登录用户的 userId 和 deptId
|
||||||
|
sxSheepSale.setUserId(getUserId());
|
||||||
|
sxSheepSale.setDeptId(getDeptId());
|
||||||
return toAjax(sxSheepSaleService.insertSxSheepSale(sxSheepSale));
|
return toAjax(sxSheepSaleService.insertSxSheepSale(sxSheepSale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,56 +5,134 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||||||
import com.zhyc.common.annotation.Excel;
|
import com.zhyc.common.annotation.Excel;
|
||||||
import com.zhyc.common.core.domain.BaseEntity;
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户管理对象 sx_customer
|
||||||
|
* * @author ruoyi
|
||||||
|
* @date 2025-08-18
|
||||||
|
*/
|
||||||
public class SxCustomer extends BaseEntity {
|
public class SxCustomer extends BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键ID */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/** 客户名称 */
|
||||||
@Excel(name = "客户名称")
|
@Excel(name = "客户名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/** 客户电话 */
|
||||||
@Excel(name = "客户电话")
|
@Excel(name = "客户电话")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
|
/** 省 */
|
||||||
@Excel(name = "省")
|
@Excel(name = "省")
|
||||||
private String province;
|
private String province;
|
||||||
|
|
||||||
|
/** 市 */
|
||||||
@Excel(name = "市")
|
@Excel(name = "市")
|
||||||
private String city;
|
private String city;
|
||||||
|
|
||||||
|
/** 区县 */
|
||||||
@Excel(name = "区县")
|
@Excel(name = "区县")
|
||||||
private String district;
|
private String district;
|
||||||
|
|
||||||
|
/** 详细地址 */
|
||||||
@Excel(name = "详细地址")
|
@Excel(name = "详细地址")
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
public Long getId() { return id; }
|
|
||||||
public void setId(Long id) { this.id = id; }
|
public Long getId() {
|
||||||
public String getName() { return name; }
|
return id;
|
||||||
public void setName(String name) { this.name = name; }
|
}
|
||||||
public String getPhone() { return phone; }
|
|
||||||
public void setPhone(String phone) { this.phone = phone; }
|
public void setId(Long id) {
|
||||||
public String getProvince() { return province; }
|
this.id = id;
|
||||||
public void setProvince(String province) { this.province = province; }
|
}
|
||||||
public String getCity() { return city; }
|
|
||||||
public void setCity(String city) { this.city = city; }
|
public String getName() {
|
||||||
public String getDistrict() { return district; }
|
return name;
|
||||||
public void setDistrict(String district) { this.district = district; }
|
}
|
||||||
public String getAddress() { return address; }
|
|
||||||
public void setAddress(String address) { this.address = address; }
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProvince() {
|
||||||
|
return province;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProvince(String province) {
|
||||||
|
this.province = province;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCity() {
|
||||||
|
return city;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCity(String city) {
|
||||||
|
this.city = city;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDistrict() {
|
||||||
|
return district;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistrict(String district) {
|
||||||
|
this.district = district;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("id", id)
|
.append("id", getId())
|
||||||
.append("name", name)
|
.append("name", getName())
|
||||||
.append("phone", phone)
|
.append("phone", getPhone())
|
||||||
.append("province", province)
|
.append("province", getProvince())
|
||||||
.append("city", city)
|
.append("city", getCity())
|
||||||
.append("district", district)
|
.append("district", getDistrict())
|
||||||
.append("address", address)
|
.append("address", getAddress())
|
||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
|
.append("userId", getUserId())
|
||||||
|
.append("deptId", getDeptId())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,6 +147,12 @@ public class SxSheepSale extends BaseEntity {
|
|||||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date createdAt;
|
private Date createdAt;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
// 【新增】非数据库字段:用于前端展示和选择羊舍后传递多个耳号
|
// 【新增】非数据库字段:用于前端展示和选择羊舍后传递多个耳号
|
||||||
private List<String> bsManageTagsList;
|
private List<String> bsManageTagsList;
|
||||||
|
|
||||||
@@ -423,6 +429,22 @@ public class SxSheepSale extends BaseEntity {
|
|||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
// 【新增】getter 和 setter 方法
|
// 【新增】getter 和 setter 方法
|
||||||
public List<String> getBsManageTagsList() {
|
public List<String> getBsManageTagsList() {
|
||||||
return bsManageTagsList;
|
return bsManageTagsList;
|
||||||
@@ -531,6 +553,8 @@ public class SxSheepSale extends BaseEntity {
|
|||||||
.append("handlerId", getHandlerId())
|
.append("handlerId", getHandlerId())
|
||||||
.append("createdBy", getCreatedBy())
|
.append("createdBy", getCreatedBy())
|
||||||
.append("createdAt", getCreatedAt())
|
.append("createdAt", getCreatedAt())
|
||||||
|
.append("userId", getUserId())
|
||||||
|
.append("deptId", getDeptId())
|
||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
.append("customerName", getCustomerName())
|
.append("customerName", getCustomerName())
|
||||||
.append("customerPhone", getCustomerPhone())
|
.append("customerPhone", getCustomerPhone())
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.zhyc.module.sale.service.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.zhyc.common.annotation.DataScope; // 【新增】引入数据权限注解
|
||||||
import com.zhyc.module.sale.mapper.SxCustomerMapper;
|
import com.zhyc.module.sale.mapper.SxCustomerMapper;
|
||||||
import com.zhyc.module.sale.domain.SxCustomer;
|
import com.zhyc.module.sale.domain.SxCustomer;
|
||||||
import com.zhyc.module.sale.service.ISxCustomerService;
|
import com.zhyc.module.sale.service.ISxCustomerService;
|
||||||
@@ -17,7 +18,14 @@ public class SxCustomerServiceImpl implements ISxCustomerService {
|
|||||||
return sxCustomerMapper.selectSxCustomerById(id);
|
return sxCustomerMapper.selectSxCustomerById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询客户管理列表
|
||||||
|
* 【新增】添加数据权限过滤注解
|
||||||
|
* deptAlias = "c": 对应 Mapper.xml 中表 sx_customer 的别名 c
|
||||||
|
* userAlias = "c": 对应 Mapper.xml 中表 sx_customer 的别名 c
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "c", userAlias = "c")
|
||||||
public List<SxCustomer> selectSxCustomerList(SxCustomer sxCustomer) {
|
public List<SxCustomer> selectSxCustomerList(SxCustomer sxCustomer) {
|
||||||
return sxCustomerMapper.selectSxCustomerList(sxCustomer);
|
return sxCustomerMapper.selectSxCustomerList(sxCustomer);
|
||||||
}
|
}
|
||||||
@@ -41,4 +49,4 @@ public class SxCustomerServiceImpl implements ISxCustomerService {
|
|||||||
public int deleteSxCustomerById(Long id) {
|
public int deleteSxCustomerById(Long id) {
|
||||||
return sxCustomerMapper.deleteSxCustomerById(id);
|
return sxCustomerMapper.deleteSxCustomerById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,8 +5,7 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import com.zhyc.common.annotation.DataScope; // 【新增】引入数据权限注解
|
||||||
import com.zhyc.common.exception.ServiceException;
|
|
||||||
import com.zhyc.module.sale.mapper.SxSheepSaleMapper;
|
import com.zhyc.module.sale.mapper.SxSheepSaleMapper;
|
||||||
import com.zhyc.module.sale.domain.SxSheepSale;
|
import com.zhyc.module.sale.domain.SxSheepSale;
|
||||||
import com.zhyc.module.sale.service.ISxSheepSaleService;
|
import com.zhyc.module.sale.service.ISxSheepSaleService;
|
||||||
@@ -35,11 +34,15 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询羊只销售记录列表
|
* 查询羊只销售记录列表
|
||||||
|
* 【新增】添加数据权限过滤注解
|
||||||
|
* deptAlias = "s": 对应 Mapper.xml 中表 sx_sheep_sale 的别名 s
|
||||||
|
* userAlias = "s": 对应 Mapper.xml 中表 sx_sheep_sale 的别名 s
|
||||||
*
|
*
|
||||||
* @param sxSheepSale 羊只销售记录
|
* @param sxSheepSale 羊只销售记录
|
||||||
* @return 羊只销售记录
|
* @return 羊只销售记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "s", userAlias = "s")
|
||||||
public List<SxSheepSale> selectSxSheepSaleList(SxSheepSale sxSheepSale) {
|
public List<SxSheepSale> selectSxSheepSaleList(SxSheepSale sxSheepSale) {
|
||||||
return sxSheepSaleMapper.selectSxSheepSaleList(sxSheepSale);
|
return sxSheepSaleMapper.selectSxSheepSaleList(sxSheepSale);
|
||||||
}
|
}
|
||||||
@@ -51,9 +54,8 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class) // 事务控制
|
|
||||||
public int insertSxSheepSale(SxSheepSale sxSheepSale) {
|
public int insertSxSheepSale(SxSheepSale sxSheepSale) {
|
||||||
// 1. 业务验证
|
// 1. 业务验证 (例如:销售日期不能为空,淘汰销售必须填写疾病类型等)
|
||||||
validateSalesFields(sxSheepSale);
|
validateSalesFields(sxSheepSale);
|
||||||
|
|
||||||
// 2. 自动计算逻辑
|
// 2. 自动计算逻辑
|
||||||
@@ -80,7 +82,6 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public int updateSxSheepSale(SxSheepSale sxSheepSale) {
|
public int updateSxSheepSale(SxSheepSale sxSheepSale) {
|
||||||
// 1. 业务验证
|
// 1. 业务验证
|
||||||
validateSalesFields(sxSheepSale);
|
validateSalesFields(sxSheepSale);
|
||||||
@@ -88,7 +89,7 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
|
|||||||
// 2. 自动计算逻辑
|
// 2. 自动计算逻辑
|
||||||
calculateSalesFields(sxSheepSale);
|
calculateSalesFields(sxSheepSale);
|
||||||
|
|
||||||
// 3. 处理耳号列表
|
// 3. 处理耳号列表(多个耳号用逗号分隔)
|
||||||
if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) {
|
if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) {
|
||||||
sxSheepSale.setBsManageTags(String.join(",", sxSheepSale.getBsManageTagsList()));
|
sxSheepSale.setBsManageTags(String.join(",", sxSheepSale.getBsManageTagsList()));
|
||||||
}
|
}
|
||||||
@@ -120,7 +121,7 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据耳号查询羊只信息
|
* 【新增】根据耳号查询羊只信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SxSheepSale selectSheepInfoByTag(String bsManageTags) {
|
public SxSheepSale selectSheepInfoByTag(String bsManageTags) {
|
||||||
@@ -128,7 +129,7 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自动计算总价、平均体重、平均单只价格
|
* 【新增】自动计算总价、平均体重、平均单只价格
|
||||||
*/
|
*/
|
||||||
private void calculateSalesFields(SxSheepSale sxSheepSale) {
|
private void calculateSalesFields(SxSheepSale sxSheepSale) {
|
||||||
String pricingMethod = sxSheepSale.getPricingMethod();
|
String pricingMethod = sxSheepSale.getPricingMethod();
|
||||||
@@ -139,48 +140,59 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
|
|||||||
if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) {
|
if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) {
|
||||||
sheepCount = sxSheepSale.getBsManageTagsList().size();
|
sheepCount = sxSheepSale.getBsManageTagsList().size();
|
||||||
} else if (sxSheepSale.getBsManageTags() != null && !sxSheepSale.getBsManageTags().isEmpty()) {
|
} else if (sxSheepSale.getBsManageTags() != null && !sxSheepSale.getBsManageTags().isEmpty()) {
|
||||||
|
// 如果前端没有传递列表,但有逗号分隔的字符串,也计算数量
|
||||||
sheepCount = sxSheepSale.getBsManageTags().split(",").length;
|
sheepCount = sxSheepSale.getBsManageTags().split(",").length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("按个体".equals(pricingMethod)) {
|
if ("按个体".equals(pricingMethod)) {
|
||||||
|
// 总价 = 单价 * 数量
|
||||||
if (unitPrice != null) {
|
if (unitPrice != null) {
|
||||||
sxSheepSale.setTotalPrice(unitPrice.multiply(new BigDecimal(sheepCount)));
|
sxSheepSale.setTotalPrice(unitPrice.multiply(new BigDecimal(sheepCount)));
|
||||||
}
|
}
|
||||||
|
// 平均单只价格就是单价
|
||||||
sxSheepSale.setAvgPricePerSheep(unitPrice);
|
sxSheepSale.setAvgPricePerSheep(unitPrice);
|
||||||
|
|
||||||
} else if ("按体重".equals(pricingMethod)) {
|
} else if ("按体重".equals(pricingMethod)) {
|
||||||
BigDecimal totalWeight = sxSheepSale.getTotalWeight();
|
BigDecimal totalWeight = sxSheepSale.getTotalWeight();
|
||||||
|
// 总价 = 单价 * 总重量
|
||||||
if (unitPrice != null && totalWeight != null) {
|
if (unitPrice != null && totalWeight != null) {
|
||||||
sxSheepSale.setTotalPrice(unitPrice.multiply(totalWeight));
|
sxSheepSale.setTotalPrice(unitPrice.multiply(totalWeight));
|
||||||
}
|
}
|
||||||
|
// 平均体重 = 总重量 / 数量
|
||||||
if (totalWeight != null && sheepCount > 0) {
|
if (totalWeight != null && sheepCount > 0) {
|
||||||
sxSheepSale.setAvgWeight(totalWeight.divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP));
|
sxSheepSale.setAvgWeight(totalWeight.divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP));
|
||||||
}
|
}
|
||||||
|
// 平均单只价格 = 总价 / 数量
|
||||||
if (sxSheepSale.getTotalPrice() != null && sheepCount > 0) {
|
if (sxSheepSale.getTotalPrice() != null && sheepCount > 0) {
|
||||||
sxSheepSale.setAvgPricePerSheep(sxSheepSale.getTotalPrice().divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP));
|
sxSheepSale.setAvgPricePerSheep(sxSheepSale.getTotalPrice().divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 可以添加其他计价方式的逻辑
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务字段验证 (使用 ServiceException)
|
* 【新增】业务字段验证
|
||||||
*/
|
*/
|
||||||
private void validateSalesFields(SxSheepSale sxSheepSale) {
|
private void validateSalesFields(SxSheepSale sxSheepSale) {
|
||||||
|
// 验证销售日期不能为空
|
||||||
if (sxSheepSale.getSaleDate() == null) {
|
if (sxSheepSale.getSaleDate() == null) {
|
||||||
throw new ServiceException("销售日期不能为空!");
|
throw new RuntimeException("销售日期不能为空!");
|
||||||
}
|
}
|
||||||
|
|
||||||
String saleType = sxSheepSale.getSaleType();
|
String saleType = sxSheepSale.getSaleType();
|
||||||
|
// 如果销售类别是"淘汰销售"或"淘汰屠宰",则疾病类型和班组不能为空
|
||||||
if ("淘汰销售".equals(saleType) || "淘汰屠宰".equals(saleType)) {
|
if ("淘汰销售".equals(saleType) || "淘汰屠宰".equals(saleType)) {
|
||||||
if (sxSheepSale.getDiseaseType() == null) {
|
if (sxSheepSale.getDiseaseType() == null) {
|
||||||
throw new ServiceException("淘汰销售或淘汰屠宰必须选择疾病类型!");
|
throw new RuntimeException("淘汰销售或淘汰屠宰必须选择疾病类型!");
|
||||||
}
|
}
|
||||||
if (sxSheepSale.getGroupCode() == null) {
|
if (sxSheepSale.getGroupCode() == null) {
|
||||||
throw new ServiceException("淘汰销售或淘汰屠宰必须选择班组!");
|
throw new RuntimeException("淘汰销售或淘汰屠宰必须选择班组!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 如果疾病类型是"病残羊",则次要原因不能为空
|
||||||
if ("病残羊".equals(sxSheepSale.getDiseaseType())) {
|
if ("病残羊".equals(sxSheepSale.getDiseaseType())) {
|
||||||
if (sxSheepSale.getSecondaryReason() == null || sxSheepSale.getSecondaryReason().trim().isEmpty()) {
|
if (sxSheepSale.getSecondaryReason() == null || sxSheepSale.getSecondaryReason().trim().isEmpty()) {
|
||||||
throw new ServiceException("疾病类型为病残羊时,必须填写次要原因!");
|
throw new RuntimeException("疾病类型为病残羊时,必须填写次要原因!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@
|
|||||||
SELECT DISTINCT manage_tags
|
SELECT DISTINCT manage_tags
|
||||||
FROM bas_sheep b
|
FROM bas_sheep b
|
||||||
<where>
|
<where>
|
||||||
manage_tags LIKE CONCAT(#{query}, '%')
|
manage_tags LIKE CONCAT(#{manageTags}, '%')
|
||||||
AND is_delete = 0
|
AND is_delete = 0
|
||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
@@ -165,8 +165,26 @@
|
|||||||
bv.variety AS varietyName
|
bv.variety AS varietyName
|
||||||
FROM bas_sheep s
|
FROM bas_sheep s
|
||||||
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
|
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
|
||||||
WHERE s.manage_tags = #{manageTags}
|
<where>s.manage_tags = #{manageTags}
|
||||||
AND s.is_delete = 0 LIMIT 1
|
AND s.is_delete = 0
|
||||||
|
${params.dataScope}
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBasSheepByManageTagsList" resultMap="BasSheepResult">
|
||||||
|
SELECT s.*,
|
||||||
|
bv.variety AS varietyName
|
||||||
|
FROM bas_sheep s
|
||||||
|
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
|
||||||
|
<where>manage_tags IN
|
||||||
|
<foreach collection="manageTagsList" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
AND s.is_delete = 0
|
||||||
|
${sheep.params.dataScope}
|
||||||
|
</where>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBasSheepBySheepfold" parameterType="BasSheep" resultMap="BasSheepResult">
|
<select id="selectBasSheepBySheepfold" parameterType="BasSheep" resultMap="BasSheepResult">
|
||||||
|
|||||||
@@ -6,18 +6,18 @@
|
|||||||
|
|
||||||
<resultMap type="DaRanch" id="DaRanchResult">
|
<resultMap type="DaRanch" id="DaRanchResult">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id"/>
|
||||||
<result property="sysRanch" column="sysRanch"/>
|
<result property="ranch" column="ranch"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDaRanchVo">
|
<sql id="selectDaRanchVo">
|
||||||
select id, sysRanch
|
select id, ranch
|
||||||
from da_ranch
|
from da_ranch
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectDaRanchList" parameterType="DaRanch" resultMap="DaRanchResult">
|
<select id="selectDaRanchList" parameterType="DaRanch" resultMap="DaRanchResult">
|
||||||
<include refid="selectDaRanchVo"/>
|
<include refid="selectDaRanchVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="sysRanch != null and sysRanch != ''">and sysRanch = #{sysRanch}</if>
|
<if test="ranch != null and ranch != ''">and ranch = #{ranch}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -29,17 +29,17 @@
|
|||||||
<insert id="insertDaRanch" parameterType="DaRanch" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertDaRanch" parameterType="DaRanch" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into da_ranch
|
insert into da_ranch
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="sysRanch != null">sysRanch,</if>
|
<if test="ranch != null">ranch,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="sysRanch != null">#{sysRanch},</if>
|
<if test="ranch != null">#{ranch},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateDaRanch" parameterType="DaRanch">
|
<update id="updateDaRanch" parameterType="DaRanch">
|
||||||
update da_ranch
|
update da_ranch
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="sysRanch != null">sysRanch = #{sysRanch},</if>
|
<if test="ranch != null">ranch = #{ranch},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.zhyc.module.base.mapper.SheepFileMapper">
|
<mapper namespace="com.zhyc.module.base.mapper.SheepFileMapper">
|
||||||
|
|
||||||
<resultMap type="SheepFile" id="SheepFileResult">
|
<resultMap type="SheepFile" id="SheepFileResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="bsManageTags" column="bs_manage_tags" />
|
<result property="bsManageTags" column="bs_manage_tags" />
|
||||||
@@ -79,7 +79,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="selectSheepFileList" parameterType="SheepFile" resultMap="SheepFileResult">
|
<select id="selectSheepFileList" parameterType="SheepFile" resultMap="SheepFileResult">
|
||||||
<include refid="selectSheepFileVo"/>
|
<include refid="selectSheepFileVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
AND (is_delete = 0 OR is_delete IS NULL)
|
||||||
<if test="id != null "> and id = #{id}</if>
|
<if test="id != null "> and id = #{id}</if>
|
||||||
<if test="bsManageTags != null and bsManageTags != ''"> and bs_manage_tags = #{bsManageTags}</if>
|
<if test="bsManageTags != null and bsManageTags != ''"> and bs_manage_tags = #{bsManageTags}</if>
|
||||||
<if test="drRanch != null and drRanch != ''"> and dr_ranch = #{drRanch}</if>
|
<if test="drRanch != null and drRanch != ''"> and dr_ranch = #{drRanch}</if>
|
||||||
@@ -90,91 +91,111 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="statusId != null "> and status_id = #{statusId}</if>
|
<if test="statusId != null "> and status_id = #{statusId}</if>
|
||||||
<if test="breed != null and breed != ''"> and breed = #{breed}</if>
|
<if test="breed != null and breed != ''"> and breed = #{breed}</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY id ASC <!-- 修改为升序 -->
|
ORDER BY id ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="searchEarNumbers" resultType="String">
|
||||||
|
SELECT DISTINCT bs_manage_tags
|
||||||
|
FROM sheep_file
|
||||||
|
WHERE (is_delete = 0 OR is_delete IS NULL)
|
||||||
|
<if test="query != null and query != ''">
|
||||||
|
AND bs_manage_tags LIKE CONCAT('%', #{query}, '%')
|
||||||
|
</if>
|
||||||
|
ORDER BY bs_manage_tags ASC
|
||||||
|
LIMIT 20
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectSheepFileById" parameterType="Long" resultMap="SheepFileResult">
|
<select id="selectSheepFileById" parameterType="Long" resultMap="SheepFileResult">
|
||||||
<include refid="selectSheepFileVo"/>
|
<include refid="selectSheepFileVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSheepByManageTags" parameterType="String" resultMap="SheepFileResult">
|
<select id="selectSheepByManageTags" parameterType="String" resultMap="SheepFileResult">
|
||||||
<include refid="selectSheepFileVo"/>
|
<include refid="selectSheepFileVo"/>
|
||||||
where bs_manage_tags = #{tags}
|
where bs_manage_tags = #{tags}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 在群羊只总数 -->
|
|
||||||
<select id="countInGroup" resultType="java.lang.Long">
|
<select id="countInGroup" resultType="java.lang.Long">
|
||||||
SELECT COUNT(*) FROM sheep_file WHERE status_id = 1
|
SELECT COUNT(*) FROM sheep_file WHERE status_id = 1 AND (is_delete = 0 OR is_delete IS NULL)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 羊只类别分布 -->
|
|
||||||
<select id="countBySheepType" resultType="java.util.Map">
|
<select id="countBySheepType" resultType="java.util.Map">
|
||||||
SELECT name AS name, COUNT(*) AS value
|
SELECT name AS name, COUNT(*) AS value
|
||||||
FROM sheep_file
|
FROM sheep_file
|
||||||
WHERE status_id = 1
|
WHERE status_id = 1 AND (is_delete = 0 OR is_delete IS NULL)
|
||||||
GROUP BY name
|
GROUP BY name
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 繁育状态分布 -->
|
|
||||||
<select id="countByBreedStatus" resultType="java.util.Map">
|
<select id="countByBreedStatus" resultType="java.util.Map">
|
||||||
SELECT breed AS name, COUNT(*) AS value
|
SELECT breed AS name, COUNT(*) AS value
|
||||||
FROM sheep_file
|
FROM sheep_file
|
||||||
WHERE status_id = 1
|
WHERE status_id = 1 AND (is_delete = 0 OR is_delete IS NULL)
|
||||||
GROUP BY breed
|
GROUP BY breed
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 品种分布 -->
|
|
||||||
<select id="countByVariety" resultType="java.util.Map">
|
<select id="countByVariety" resultType="java.util.Map">
|
||||||
SELECT variety AS name, COUNT(*) AS value
|
SELECT variety AS name, COUNT(*) AS value
|
||||||
FROM sheep_file
|
FROM sheep_file
|
||||||
WHERE status_id = 1
|
WHERE status_id = 1 AND (is_delete = 0 OR is_delete IS NULL)
|
||||||
GROUP BY variety
|
GROUP BY variety
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 泌乳羊胎次分布 -->
|
|
||||||
<select id="countParityOfLactation" resultType="java.util.Map">
|
<select id="countParityOfLactation" resultType="java.util.Map">
|
||||||
SELECT parity AS name, COUNT(*) AS value
|
SELECT parity AS name, COUNT(*) AS value
|
||||||
FROM sheep_file
|
FROM sheep_file
|
||||||
WHERE status_id = 1 AND name = '泌乳羊'
|
WHERE status_id = 1 AND name = '泌乳羊' AND (is_delete = 0 OR is_delete IS NULL)
|
||||||
GROUP BY parity
|
GROUP BY parity
|
||||||
ORDER BY parity
|
ORDER BY parity
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--
|
|
||||||
获取字段唯一值的SQL映射
|
|
||||||
说明:这个查询使用 ${fieldName} 直接拼接字段名,因为MyBatis的#{}不支持列名作为参数
|
|
||||||
安全性:通过Service层的白名单验证来确保fieldName的安全性
|
|
||||||
-->
|
|
||||||
<select id="selectFieldValues" parameterType="String" resultType="String">
|
<select id="selectFieldValues" parameterType="String" resultType="String">
|
||||||
SELECT
|
SELECT DISTINCT ${fieldName} as field_value
|
||||||
DISTINCT ${fieldName} as field_value
|
FROM sheep_file
|
||||||
FROM
|
WHERE ${fieldName} IS NOT NULL AND ${fieldName} != '' AND ${fieldName} != 'null'
|
||||||
sheep_file
|
ORDER BY ${fieldName} ASC
|
||||||
WHERE
|
|
||||||
<!-- 过滤空值和NULL值,确保返回的数据质量 -->
|
|
||||||
${fieldName} IS NOT NULL
|
|
||||||
AND ${fieldName} != ''
|
|
||||||
AND ${fieldName} != 'null'
|
|
||||||
ORDER BY
|
|
||||||
<!-- 按字母顺序排序,方便前端显示 -->
|
|
||||||
${fieldName} ASC
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSheepFileListByCondition" parameterType="map" resultMap="SheepFileResult">
|
<select id="selectSheepFileListByCondition" resultMap="SheepFileResult">
|
||||||
<include refid="selectSheepFileVo"/>
|
<include refid="selectSheepFileVo"/>
|
||||||
FROM sheep_file
|
|
||||||
<where>
|
<where>
|
||||||
<!-- 逻辑删除过滤 -->
|
AND (is_delete = 0 OR is_delete IS NULL)
|
||||||
AND is_delete = 0
|
|
||||||
|
|
||||||
<!-- 原有的 SheepFile 条件(保持兼容性) -->
|
|
||||||
<if test="sheepFile != null">
|
<if test="sheepFile != null">
|
||||||
<if test="sheepFile.bsManageTags != null and sheepFile.bsManageTags != ''">
|
<if test="sheepFile.allEarNumbers != null and sheepFile.allEarNumbers.size() > 0">
|
||||||
|
AND bs_manage_tags IN
|
||||||
|
<foreach collection="sheepFile.allEarNumbers" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="sheepFile.allEleEarNumbers != null and sheepFile.allEleEarNumbers.size() > 0">
|
||||||
|
AND electronic_tags IN
|
||||||
|
<foreach collection="sheepFile.allEleEarNumbers" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="sheepFile.allGenders != null and sheepFile.allGenders.size() > 0">
|
||||||
|
AND gender IN
|
||||||
|
<foreach collection="sheepFile.allGenders" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="sheepFile.allBreedingStatus != null and sheepFile.allBreedingStatus.size() > 0">
|
||||||
|
AND breed IN
|
||||||
|
<foreach collection="sheepFile.allBreedingStatus" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="sheepFile.allSheepTypes != null and sheepFile.allSheepTypes.size() > 0">
|
||||||
|
AND name IN
|
||||||
|
<foreach collection="sheepFile.allSheepTypes" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="sheepFile.bsManageTags != null and sheepFile.bsManageTags != '' and (sheepFile.allEarNumbers == null or sheepFile.allEarNumbers.size() == 0)">
|
||||||
AND bs_manage_tags LIKE CONCAT('%', #{sheepFile.bsManageTags}, '%')
|
AND bs_manage_tags LIKE CONCAT('%', #{sheepFile.bsManageTags}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="sheepFile.electronicTags != null and sheepFile.electronicTags != ''">
|
<if test="sheepFile.electronicTags != null and sheepFile.electronicTags != '' and (sheepFile.allEleEarNumbers == null or sheepFile.allEleEarNumbers.size() == 0)">
|
||||||
AND electronic_tags LIKE CONCAT('%', #{sheepFile.electronicTags}, '%')
|
AND electronic_tags LIKE CONCAT('%', #{sheepFile.electronicTags}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="sheepFile.drRanch != null and sheepFile.drRanch != ''">
|
<if test="sheepFile.drRanch != null and sheepFile.drRanch != ''">
|
||||||
@@ -183,23 +204,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="sheepFile.variety != null and sheepFile.variety != ''">
|
<if test="sheepFile.variety != null and sheepFile.variety != ''">
|
||||||
AND variety LIKE CONCAT('%', #{sheepFile.variety}, '%')
|
AND variety LIKE CONCAT('%', #{sheepFile.variety}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="sheepFile.name != null and sheepFile.name != ''">
|
<if test="sheepFile.name != null and sheepFile.name != '' and (sheepFile.allSheepTypes == null or sheepFile.allSheepTypes.size() == 0)">
|
||||||
AND name LIKE CONCAT('%', #{sheepFile.name}, '%')
|
AND name LIKE CONCAT('%', #{sheepFile.name}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="sheepFile.gender != null">
|
<if test="sheepFile.gender != null and (sheepFile.allGenders == null or sheepFile.allGenders.size() == 0)">
|
||||||
AND gender = #{sheepFile.gender}
|
AND gender = #{sheepFile.gender}
|
||||||
</if>
|
</if>
|
||||||
<if test="sheepFile.statusId != null">
|
<if test="sheepFile.statusId != null">
|
||||||
AND status_id = #{sheepFile.statusId}
|
AND status_id = #{sheepFile.statusId}
|
||||||
</if>
|
</if>
|
||||||
<if test="sheepFile.breed != null and sheepFile.breed != ''">
|
<if test="sheepFile.breed != null and sheepFile.breed != '' and (sheepFile.allBreedingStatus == null or sheepFile.allBreedingStatus.size() == 0)">
|
||||||
AND breed LIKE CONCAT('%', #{sheepFile.breed}, '%')
|
AND breed LIKE CONCAT('%', #{sheepFile.breed}, '%')
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<!-- 动态条件处理 - 使用多个if标签代替复杂的choose -->
|
|
||||||
<if test="params != null and !params.isEmpty()">
|
<if test="params != null and !params.isEmpty()">
|
||||||
<!-- 空值条件 -->
|
|
||||||
<foreach collection="params.entrySet()" item="value" index="key">
|
<foreach collection="params.entrySet()" item="value" index="key">
|
||||||
<if test="value != null and value.toString() == 'IS_NULL'">
|
<if test="value != null and value.toString() == 'IS_NULL'">
|
||||||
AND ${key} IS NULL
|
AND ${key} IS NULL
|
||||||
@@ -207,12 +226,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="value != null and value.toString() == 'NOT_NULL'">
|
<if test="value != null and value.toString() == 'NOT_NULL'">
|
||||||
AND ${key} IS NOT NULL
|
AND ${key} IS NOT NULL
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
|
||||||
|
|
||||||
<!-- 范围条件 -->
|
<if test="value != null and value.toString() != null and (value.toString().startsWith('GT:') or value.toString().startsWith('LT:') or value.toString().startsWith('GE:') or value.toString().startsWith('LE:'))">
|
||||||
<foreach collection="params.entrySet()" item="value" index="key">
|
|
||||||
<!-- 显式将 value 转换为字符串 -->
|
|
||||||
<if test="value != null and value.toString() != null">
|
|
||||||
<choose>
|
<choose>
|
||||||
<when test="value.toString().startsWith('GT:')">
|
<when test="value.toString().startsWith('GT:')">
|
||||||
AND ${key} > #{value.toString().substring(3)}
|
AND ${key} > #{value.toString().substring(3)}
|
||||||
@@ -228,21 +243,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
|
||||||
|
|
||||||
<!-- 列表条件 -->
|
<if test="value != null and value.toString() != null and value.toString().contains(',') and !value.toString().startsWith('GT:')">
|
||||||
<foreach collection="params.entrySet()" item="value" index="key">
|
|
||||||
<if test="value != null and value.toString() != null and value.toString().contains(',')">
|
|
||||||
AND ${key} IN
|
AND ${key} IN
|
||||||
<foreach collection="value.toString().split(',')" item="item" open="(" separator="," close=")">
|
<foreach collection="value.toString().split(',')" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
|
||||||
|
|
||||||
<!-- 模糊查询条件(针对文本字段) -->
|
<if test="value != null and value.toString() != 'IS_NULL' and value.toString() != 'NOT_NULL' and !value.toString().contains(',') and !value.toString().startsWith('GT:') and !value.toString().startsWith('LT:') and !value.toString().startsWith('GE:') and !value.toString().startsWith('LE:')">
|
||||||
<foreach collection="params.entrySet()" item="value" index="key">
|
|
||||||
<if test="value != null and value.toString() != null">
|
|
||||||
<choose>
|
<choose>
|
||||||
<when test="key == 'bs_manage_tags' or key == 'electronic_tags' or
|
<when test="key == 'bs_manage_tags' or key == 'electronic_tags' or
|
||||||
key == 'dr_ranch' or key == 'sheepfold_name' or
|
key == 'dr_ranch' or key == 'sheepfold_name' or
|
||||||
@@ -253,7 +262,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
AND ${key} LIKE CONCAT('%', #{value}, '%')
|
AND ${key} LIKE CONCAT('%', #{value}, '%')
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
<!-- 普通等于条件 -->
|
|
||||||
AND ${key} = #{value}
|
AND ${key} = #{value}
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
@@ -264,23 +272,234 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ORDER BY id ASC
|
ORDER BY id ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- <!– 查询所有公羊(gender=2) –>-->
|
|
||||||
<!-- <select id="selectRamList" resultMap="SheepFileResult">-->
|
|
||||||
<!-- <include refid="selectSheepFileVo"/>-->
|
|
||||||
<!-- where gender = 2 and (is_delete = 0 or is_delete is null)-->
|
|
||||||
<!-- order by create_time desc-->
|
|
||||||
<!-- </select>-->
|
|
||||||
|
|
||||||
<!-- 查询所有公羊 -->
|
|
||||||
<select id="selectRamList" resultMap="SheepFileResult">
|
<select id="selectRamList" resultMap="SheepFileResult">
|
||||||
SELECT * FROM sheep_file
|
SELECT * FROM sheep_file
|
||||||
WHERE gender = 2 AND is_delete = 0
|
WHERE gender = 2 AND is_delete = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 根据管理耳号查询 -->
|
|
||||||
<select id="selectSheepFileByManageTags" resultMap="SheepFileResult">
|
<select id="selectSheepFileByManageTags" resultMap="SheepFileResult">
|
||||||
SELECT * FROM sheep_file
|
SELECT * FROM sheep_file
|
||||||
WHERE bs_manage_tags = #{manageTags} AND is_delete = 0
|
WHERE bs_manage_tags = #{manageTags} AND is_delete = 0
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSheepFile" parameterType="SheepFile" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sheep_file
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="bsManageTags != null">bs_manage_tags,</if>
|
||||||
|
<if test="ranchId != null">ranch_id,</if>
|
||||||
|
<if test="drRanch != null">dr_ranch,</if>
|
||||||
|
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||||
|
<if test="sheepfoldName != null">sheepfold_name,</if>
|
||||||
|
<if test="electronicTags != null">electronic_tags,</if>
|
||||||
|
<if test="varietyId != null">variety_id,</if>
|
||||||
|
<if test="variety != null">variety,</if>
|
||||||
|
<if test="family != null">family,</if>
|
||||||
|
<if test="name != null">name,</if>
|
||||||
|
<if test="gender != null">gender,</if>
|
||||||
|
<if test="birthday != null">birthday,</if>
|
||||||
|
<if test="dayAge != null">day_age,</if>
|
||||||
|
<if test="monthAge != null">month_age,</if>
|
||||||
|
<if test="parity != null">parity,</if>
|
||||||
|
<if test="birthWeight != null">birth_weight,</if>
|
||||||
|
<if test="weaningDate != null">weaning_date,</if>
|
||||||
|
<if test="statusId != null">status_id,</if>
|
||||||
|
<if test="weaningWeight != null">weaning_weight,</if>
|
||||||
|
<if test="currentWeight != null">current_weight,</if>
|
||||||
|
<if test="weaningDayAge != null">weaning_day_age,</if>
|
||||||
|
<if test="weaningDailyGain != null">weaning_daily_gain,</if>
|
||||||
|
<if test="breedStatusId != null">breed_status_id,</if>
|
||||||
|
<if test="breed != null">breed,</if>
|
||||||
|
<if test="bsFatherId != null">bs_father_id,</if>
|
||||||
|
<if test="fatherManageTags != null">father_manage_tags,</if>
|
||||||
|
<if test="bsMotherId != null">bs_mother_id,</if>
|
||||||
|
<if test="motherManageTags != null">mother_manage_tags,</if>
|
||||||
|
<if test="receptorId != null">receptor_id,</if>
|
||||||
|
<if test="receptorManageTags != null">receptor_manage_tags,</if>
|
||||||
|
<if test="fatherFatherId != null">father_father_id,</if>
|
||||||
|
<if test="grandfatherManageTags != null">grandfather_manage_tags,</if>
|
||||||
|
<if test="fatherMotherId != null">father_mother_id,</if>
|
||||||
|
<if test="grandmotherManageTags != null">grandmother_manage_tags,</if>
|
||||||
|
<if test="fatherId != null">father_id,</if>
|
||||||
|
<if test="maternalGrandfatherManageTags != null">maternal_grandfather_manage_tags,</if>
|
||||||
|
<if test="motherId != null">mother_id,</if>
|
||||||
|
<if test="maternalGrandmotherManageTags != null">maternal_grandmother_manage_tags,</if>
|
||||||
|
<if test="matingDate != null">mating_date,</if>
|
||||||
|
<if test="matingTypeId != null">mating_type_id,</if>
|
||||||
|
<if test="pregDate != null">preg_date,</if>
|
||||||
|
<if test="lambingDate != null">lambing_date,</if>
|
||||||
|
<if test="lambingDay != null">lambing_day,</if>
|
||||||
|
<if test="matingDay != null">mating_day,</if>
|
||||||
|
<if test="gestationDay != null">gestation_day,</if>
|
||||||
|
<if test="expectedDate != null">expected_date,</if>
|
||||||
|
<if test="postLambingDay != null">post_lambing_day,</if>
|
||||||
|
<if test="lactationDay != null">lactation_day,</if>
|
||||||
|
<if test="anestrousDay != null">anestrous_day,</if>
|
||||||
|
<if test="matingCounts != null">mating_counts,</if>
|
||||||
|
<if test="matingTotal != null">mating_total,</if>
|
||||||
|
<if test="miscarriageCounts != null">miscarriage_counts,</if>
|
||||||
|
<if test="comment != null">comment,</if>
|
||||||
|
<if test="controlled != null">controlled,</if>
|
||||||
|
<if test="body != null">body,</if>
|
||||||
|
<if test="breast != null">breast,</if>
|
||||||
|
<if test="source != null">source,</if>
|
||||||
|
<if test="sourceDate != null">source_date,</if>
|
||||||
|
<if test="sourceRanchId != null">source_ranch_id,</if>
|
||||||
|
<if test="sourceRanch != null">source_ranch,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="isDelete != null">is_delete,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="bsManageTags != null">#{bsManageTags},</if>
|
||||||
|
<if test="ranchId != null">#{ranchId},</if>
|
||||||
|
<if test="drRanch != null">#{drRanch},</if>
|
||||||
|
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||||
|
<if test="sheepfoldName != null">#{sheepfoldName},</if>
|
||||||
|
<if test="electronicTags != null">#{electronicTags},</if>
|
||||||
|
<if test="varietyId != null">#{varietyId},</if>
|
||||||
|
<if test="variety != null">#{variety},</if>
|
||||||
|
<if test="family != null">#{family},</if>
|
||||||
|
<if test="name != null">#{name},</if>
|
||||||
|
<if test="gender != null">#{gender},</if>
|
||||||
|
<if test="birthday != null">#{birthday},</if>
|
||||||
|
<if test="dayAge != null">#{dayAge},</if>
|
||||||
|
<if test="monthAge != null">#{monthAge},</if>
|
||||||
|
<if test="parity != null">#{parity},</if>
|
||||||
|
<if test="birthWeight != null">#{birthWeight},</if>
|
||||||
|
<if test="weaningDate != null">#{weaningDate},</if>
|
||||||
|
<if test="statusId != null">#{statusId},</if>
|
||||||
|
<if test="weaningWeight != null">#{weaningWeight},</if>
|
||||||
|
<if test="currentWeight != null">#{currentWeight},</if>
|
||||||
|
<if test="weaningDayAge != null">#{weaningDayAge},</if>
|
||||||
|
<if test="weaningDailyGain != null">#{weaningDailyGain},</if>
|
||||||
|
<if test="breedStatusId != null">#{breedStatusId},</if>
|
||||||
|
<if test="breed != null">#{breed},</if>
|
||||||
|
<if test="bsFatherId != null">#{bsFatherId},</if>
|
||||||
|
<if test="fatherManageTags != null">#{fatherManageTags},</if>
|
||||||
|
<if test="bsMotherId != null">#{bsMotherId},</if>
|
||||||
|
<if test="motherManageTags != null">#{motherManageTags},</if>
|
||||||
|
<if test="receptorId != null">#{receptorId},</if>
|
||||||
|
<if test="receptorManageTags != null">#{receptorManageTags},</if>
|
||||||
|
<if test="fatherFatherId != null">#{fatherFatherId},</if>
|
||||||
|
<if test="grandfatherManageTags != null">#{grandfatherManageTags},</if>
|
||||||
|
<if test="fatherMotherId != null">#{fatherMotherId},</if>
|
||||||
|
<if test="grandmotherManageTags != null">#{grandmotherManageTags},</if>
|
||||||
|
<if test="fatherId != null">#{fatherId},</if>
|
||||||
|
<if test="maternalGrandfatherManageTags != null">#{maternalGrandfatherManageTags},</if>
|
||||||
|
<if test="motherId != null">#{motherId},</if>
|
||||||
|
<if test="maternalGrandmotherManageTags != null">#{maternalGrandmotherManageTags},</if>
|
||||||
|
<if test="matingDate != null">#{matingDate},</if>
|
||||||
|
<if test="matingTypeId != null">#{matingTypeId},</if>
|
||||||
|
<if test="pregDate != null">#{pregDate},</if>
|
||||||
|
<if test="lambingDate != null">#{lambingDate},</if>
|
||||||
|
<if test="lambingDay != null">#{lambingDay},</if>
|
||||||
|
<if test="matingDay != null">#{matingDay},</if>
|
||||||
|
<if test="gestationDay != null">#{gestationDay},</if>
|
||||||
|
<if test="expectedDate != null">#{expectedDate},</if>
|
||||||
|
<if test="postLambingDay != null">#{postLambingDay},</if>
|
||||||
|
<if test="lactationDay != null">#{lactationDay},</if>
|
||||||
|
<if test="anestrousDay != null">#{anestrousDay},</if>
|
||||||
|
<if test="matingCounts != null">#{matingCounts},</if>
|
||||||
|
<if test="matingTotal != null">#{matingTotal},</if>
|
||||||
|
<if test="miscarriageCounts != null">#{miscarriageCounts},</if>
|
||||||
|
<if test="comment != null">#{comment},</if>
|
||||||
|
<if test="controlled != null">#{controlled},</if>
|
||||||
|
<if test="body != null">#{body},</if>
|
||||||
|
<if test="breast != null">#{breast},</if>
|
||||||
|
<if test="source != null">#{source},</if>
|
||||||
|
<if test="sourceDate != null">#{sourceDate},</if>
|
||||||
|
<if test="sourceRanchId != null">#{sourceRanchId},</if>
|
||||||
|
<if test="sourceRanch != null">#{sourceRanch},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="isDelete != null">#{isDelete},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSheepFile" parameterType="SheepFile">
|
||||||
|
update sheep_file
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="bsManageTags != null">bs_manage_tags = #{bsManageTags},</if>
|
||||||
|
<if test="ranchId != null">ranch_id = #{ranchId},</if>
|
||||||
|
<if test="drRanch != null">dr_ranch = #{drRanch},</if>
|
||||||
|
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
||||||
|
<if test="sheepfoldName != null">sheepfold_name = #{sheepfoldName},</if>
|
||||||
|
<if test="electronicTags != null">electronic_tags = #{electronicTags},</if>
|
||||||
|
<if test="varietyId != null">variety_id = #{varietyId},</if>
|
||||||
|
<if test="variety != null">variety = #{variety},</if>
|
||||||
|
<if test="family != null">family = #{family},</if>
|
||||||
|
<if test="name != null">name = #{name},</if>
|
||||||
|
<if test="gender != null">gender = #{gender},</if>
|
||||||
|
<if test="birthday != null">birthday = #{birthday},</if>
|
||||||
|
<if test="dayAge != null">day_age = #{dayAge},</if>
|
||||||
|
<if test="monthAge != null">month_age = #{monthAge},</if>
|
||||||
|
<if test="parity != null">parity = #{parity},</if>
|
||||||
|
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
|
||||||
|
<if test="weaningDate != null">weaning_date = #{weaningDate},</if>
|
||||||
|
<if test="statusId != null">status_id = #{statusId},</if>
|
||||||
|
<if test="weaningWeight != null">weaning_weight = #{weaningWeight},</if>
|
||||||
|
<if test="currentWeight != null">current_weight = #{currentWeight},</if>
|
||||||
|
<if test="weaningDayAge != null">weaning_day_age = #{weaningDayAge},</if>
|
||||||
|
<if test="weaningDailyGain != null">weaning_daily_gain = #{weaningDailyGain},</if>
|
||||||
|
<if test="breedStatusId != null">breed_status_id = #{breedStatusId},</if>
|
||||||
|
<if test="breed != null">breed = #{breed},</if>
|
||||||
|
<if test="bsFatherId != null">bs_father_id = #{bsFatherId},</if>
|
||||||
|
<if test="fatherManageTags != null">father_manage_tags = #{fatherManageTags},</if>
|
||||||
|
<if test="bsMotherId != null">bs_mother_id = #{bsMotherId},</if>
|
||||||
|
<if test="motherManageTags != null">mother_manage_tags = #{motherManageTags},</if>
|
||||||
|
<if test="receptorId != null">receptor_id = #{receptorId},</if>
|
||||||
|
<if test="receptorManageTags != null">receptor_manage_tags = #{receptorManageTags},</if>
|
||||||
|
<if test="fatherFatherId != null">father_father_id = #{fatherFatherId},</if>
|
||||||
|
<if test="grandfatherManageTags != null">grandfather_manage_tags = #{grandfatherManageTags},</if>
|
||||||
|
<if test="fatherMotherId != null">father_mother_id = #{fatherMotherId},</if>
|
||||||
|
<if test="grandmotherManageTags != null">grandmother_manage_tags = #{grandmotherManageTags},</if>
|
||||||
|
<if test="fatherId != null">father_id = #{fatherId},</if>
|
||||||
|
<if test="maternalGrandfatherManageTags != null">maternal_grandfather_manage_tags = #{maternalGrandfatherManageTags},</if>
|
||||||
|
<if test="motherId != null">mother_id = #{motherId},</if>
|
||||||
|
<if test="maternalGrandmotherManageTags != null">maternal_grandmother_manage_tags = #{maternalGrandmotherManageTags},</if>
|
||||||
|
<if test="matingDate != null">mating_date = #{matingDate},</if>
|
||||||
|
<if test="matingTypeId != null">mating_type_id = #{matingTypeId},</if>
|
||||||
|
<if test="pregDate != null">preg_date = #{pregDate},</if>
|
||||||
|
<if test="lambingDate != null">lambing_date = #{lambingDate},</if>
|
||||||
|
<if test="lambingDay != null">lambing_day = #{lambingDay},</if>
|
||||||
|
<if test="matingDay != null">mating_day = #{matingDay},</if>
|
||||||
|
<if test="gestationDay != null">gestation_day = #{gestationDay},</if>
|
||||||
|
<if test="expectedDate != null">expected_date = #{expectedDate},</if>
|
||||||
|
<if test="postLambingDay != null">post_lambing_day = #{postLambingDay},</if>
|
||||||
|
<if test="lactationDay != null">lactation_day = #{lactationDay},</if>
|
||||||
|
<if test="anestrousDay != null">anestrous_day = #{anestrousDay},</if>
|
||||||
|
<if test="matingCounts != null">mating_counts = #{matingCounts},</if>
|
||||||
|
<if test="matingTotal != null">mating_total = #{matingTotal},</if>
|
||||||
|
<if test="miscarriageCounts != null">miscarriage_counts = #{miscarriageCounts},</if>
|
||||||
|
<if test="comment != null">comment = #{comment},</if>
|
||||||
|
<if test="controlled != null">controlled = #{controlled},</if>
|
||||||
|
<if test="body != null">body = #{body},</if>
|
||||||
|
<if test="breast != null">breast = #{breast},</if>
|
||||||
|
<if test="source != null">source = #{source},</if>
|
||||||
|
<if test="sourceDate != null">source_date = #{sourceDate},</if>
|
||||||
|
<if test="sourceRanchId != null">source_ranch_id = #{sourceRanchId},</if>
|
||||||
|
<if test="sourceRanch != null">source_ranch = #{sourceRanch},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSheepFileById" parameterType="Long">
|
||||||
|
update sheep_file set is_delete = 1 where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSheepFileByIds" parameterType="String">
|
||||||
|
update sheep_file set is_delete = 1 where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -0,0 +1,391 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.zhyc.module.base.mapper.SheepPedigreeMapper">
|
||||||
|
|
||||||
|
<resultMap type="SheepPedigree" id="SheepPedigreeResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="bsManageTags" column="bs_manage_tags" />
|
||||||
|
<result property="ranchId" column="ranch_id" />
|
||||||
|
<result property="drRanch" column="dr_ranch" />
|
||||||
|
<result property="sheepfoldId" column="sheepfold_id" />
|
||||||
|
<result property="sheepfoldName" column="sheepfold_name" />
|
||||||
|
<result property="electronicTags" column="electronic_tags" />
|
||||||
|
<result property="varietyId" column="variety_id" />
|
||||||
|
<result property="variety" column="variety" />
|
||||||
|
<result property="family" column="family" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="gender" column="gender" />
|
||||||
|
<result property="birthday" column="birthday" />
|
||||||
|
<result property="dayAge" column="day_age" />
|
||||||
|
<result property="monthAge" column="month_age" />
|
||||||
|
<result property="parity" column="parity" />
|
||||||
|
<result property="birthWeight" column="birth_weight" />
|
||||||
|
<result property="weaningDate" column="weaning_date" />
|
||||||
|
<result property="statusId" column="status_id" />
|
||||||
|
<result property="weaningWeight" column="weaning_weight" />
|
||||||
|
<result property="weaningDayAge" column="weaning_day_age" />
|
||||||
|
<result property="weaningDailyGain" column="weaning_daily_gain" />
|
||||||
|
<result property="currentWeight" column="current_weight" />
|
||||||
|
<result property="breedStatusId" column="breed_status_id" />
|
||||||
|
<result property="breed" column="breed" />
|
||||||
|
<result property="bsFatherId" column="bs_father_id" />
|
||||||
|
<result property="fatherManageTags" column="father_manage_tags" />
|
||||||
|
<result property="bsMotherId" column="bs_mother_id" />
|
||||||
|
<result property="motherManageTags" column="mother_manage_tags" />
|
||||||
|
<result property="receptorId" column="receptor_id" />
|
||||||
|
<result property="receptorManageTags" column="receptor_manage_tags" />
|
||||||
|
<result property="fatherFatherId" column="father_father_id" />
|
||||||
|
<result property="grandfatherManageTags" column="grandfather_manage_tags" />
|
||||||
|
<result property="fatherMotherId" column="father_mother_id" />
|
||||||
|
<result property="grandmotherManageTags" column="grandmother_manage_tags" />
|
||||||
|
<result property="fatherId" column="father_id" />
|
||||||
|
<result property="maternalGrandfatherManageTags" column="maternal_grandfather_manage_tags" />
|
||||||
|
<result property="motherId" column="mother_id" />
|
||||||
|
<result property="maternalGrandmotherManageTags" column="maternal_grandmother_manage_tags" />
|
||||||
|
<result property="matingDate" column="mating_date" />
|
||||||
|
<result property="matingTypeId" column="mating_type_id" />
|
||||||
|
<result property="pregDate" column="preg_date" />
|
||||||
|
<result property="lambingDate" column="lambing_date" />
|
||||||
|
<result property="lambingDay" column="lambing_day" />
|
||||||
|
<result property="matingDay" column="mating_day" />
|
||||||
|
<result property="gestationDay" column="gestation_day" />
|
||||||
|
<result property="expectedDate" column="expected_date" />
|
||||||
|
<result property="postLambingDay" column="post_lambing_day" />
|
||||||
|
<result property="lactationDay" column="lactation_day" />
|
||||||
|
<result property="anestrousDay" column="anestrous_day" />
|
||||||
|
<result property="matingCounts" column="mating_counts" />
|
||||||
|
<result property="matingTotal" column="mating_total" />
|
||||||
|
<result property="miscarriageCounts" column="miscarriage_counts" />
|
||||||
|
<result property="comment" column="comment" />
|
||||||
|
<result property="controlled" column="controlled" />
|
||||||
|
<result property="body" column="body" />
|
||||||
|
<result property="breast" column="breast" />
|
||||||
|
<result property="source" column="source" />
|
||||||
|
<result property="sourceDate" column="source_date" />
|
||||||
|
<result property="sourceRanchId" column="source_ranch_id" />
|
||||||
|
<result property="sourceRanch" column="source_ranch" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="isDelete" column="is_delete" />
|
||||||
|
<result property="sheepColor" column="sheep_color" />
|
||||||
|
<result property="groupName" column="group_name" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSheepPedigreeVo">
|
||||||
|
select id, bs_manage_tags, ranch_id, dr_ranch, sheepfold_id, sheepfold_name, electronic_tags, variety_id, variety, family, name, gender, birthday, day_age, month_age, parity, birth_weight, weaning_date, status_id, weaning_weight, weaning_day_age, weaning_daily_gain, current_weight, breed_status_id, breed, bs_father_id, father_manage_tags, bs_mother_id, mother_manage_tags, receptor_id, receptor_manage_tags, father_father_id, grandfather_manage_tags, father_mother_id, grandmother_manage_tags, father_id, maternal_grandfather_manage_tags, mother_id, maternal_grandmother_manage_tags, mating_date, mating_type_id, preg_date, lambing_date, lambing_day, mating_day, gestation_day, expected_date, post_lambing_day, lactation_day, anestrous_day, mating_counts, mating_total, miscarriage_counts, comment, controlled, body, breast, source, source_date, source_ranch_id, source_ranch, update_by, update_time, create_by, create_time, is_delete, sheep_color, group_name from sheep_pedigree
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSheepPedigreeList" parameterType="SheepPedigree" resultMap="SheepPedigreeResult">
|
||||||
|
<include refid="selectSheepPedigreeVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="bsManageTags != null and bsManageTags != ''"> and bs_manage_tags = #{bsManageTags}</if>
|
||||||
|
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
|
||||||
|
<if test="drRanch != null and drRanch != ''"> and dr_ranch = #{drRanch}</if>
|
||||||
|
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
|
||||||
|
<if test="sheepfoldName != null and sheepfoldName != ''"> and sheepfold_name like concat('%', #{sheepfoldName}, '%')</if>
|
||||||
|
<if test="electronicTags != null and electronicTags != ''"> and electronic_tags = #{electronicTags}</if>
|
||||||
|
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
|
||||||
|
<if test="variety != null and variety != ''"> and variety = #{variety}</if>
|
||||||
|
<if test="family != null and family != ''"> and family = #{family}</if>
|
||||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="gender != null "> and gender = #{gender}</if>
|
||||||
|
<if test="birthday != null "> and birthday = #{birthday}</if>
|
||||||
|
<if test="dayAge != null "> and day_age = #{dayAge}</if>
|
||||||
|
<if test="monthAge != null "> and month_age = #{monthAge}</if>
|
||||||
|
<if test="parity != null "> and parity = #{parity}</if>
|
||||||
|
<if test="birthWeight != null "> and birth_weight = #{birthWeight}</if>
|
||||||
|
<if test="weaningDate != null "> and weaning_date = #{weaningDate}</if>
|
||||||
|
<if test="statusId != null "> and status_id = #{statusId}</if>
|
||||||
|
<if test="weaningWeight != null "> and weaning_weight = #{weaningWeight}</if>
|
||||||
|
<if test="weaningDayAge != null "> and weaning_day_age = #{weaningDayAge}</if>
|
||||||
|
<if test="weaningDailyGain != null "> and weaning_daily_gain = #{weaningDailyGain}</if>
|
||||||
|
<if test="currentWeight != null "> and current_weight = #{currentWeight}</if>
|
||||||
|
<if test="breedStatusId != null "> and breed_status_id = #{breedStatusId}</if>
|
||||||
|
<if test="breed != null and breed != ''"> and breed = #{breed}</if>
|
||||||
|
<if test="bsFatherId != null "> and bs_father_id = #{bsFatherId}</if>
|
||||||
|
<if test="fatherManageTags != null and fatherManageTags != ''"> and father_manage_tags = #{fatherManageTags}</if>
|
||||||
|
<if test="bsMotherId != null "> and bs_mother_id = #{bsMotherId}</if>
|
||||||
|
<if test="motherManageTags != null and motherManageTags != ''"> and mother_manage_tags = #{motherManageTags}</if>
|
||||||
|
<if test="receptorId != null "> and receptor_id = #{receptorId}</if>
|
||||||
|
<if test="receptorManageTags != null and receptorManageTags != ''"> and receptor_manage_tags = #{receptorManageTags}</if>
|
||||||
|
<if test="fatherFatherId != null "> and father_father_id = #{fatherFatherId}</if>
|
||||||
|
<if test="grandfatherManageTags != null and grandfatherManageTags != ''"> and grandfather_manage_tags = #{grandfatherManageTags}</if>
|
||||||
|
<if test="fatherMotherId != null "> and father_mother_id = #{fatherMotherId}</if>
|
||||||
|
<if test="grandmotherManageTags != null and grandmotherManageTags != ''"> and grandmother_manage_tags = #{grandmotherManageTags}</if>
|
||||||
|
<if test="fatherId != null "> and father_id = #{fatherId}</if>
|
||||||
|
<if test="maternalGrandfatherManageTags != null and maternalGrandfatherManageTags != ''"> and maternal_grandfather_manage_tags = #{maternalGrandfatherManageTags}</if>
|
||||||
|
<if test="motherId != null "> and mother_id = #{motherId}</if>
|
||||||
|
<if test="maternalGrandmotherManageTags != null and maternalGrandmotherManageTags != ''"> and maternal_grandmother_manage_tags = #{maternalGrandmotherManageTags}</if>
|
||||||
|
<if test="matingDate != null "> and mating_date = #{matingDate}</if>
|
||||||
|
<if test="matingTypeId != null "> and mating_type_id = #{matingTypeId}</if>
|
||||||
|
<if test="pregDate != null "> and preg_date = #{pregDate}</if>
|
||||||
|
<if test="lambingDate != null "> and lambing_date = #{lambingDate}</if>
|
||||||
|
<if test="lambingDay != null "> and lambing_day = #{lambingDay}</if>
|
||||||
|
<if test="matingDay != null "> and mating_day = #{matingDay}</if>
|
||||||
|
<if test="gestationDay != null "> and gestation_day = #{gestationDay}</if>
|
||||||
|
<if test="expectedDate != null "> and expected_date = #{expectedDate}</if>
|
||||||
|
<if test="postLambingDay != null "> and post_lambing_day = #{postLambingDay}</if>
|
||||||
|
<if test="lactationDay != null "> and lactation_day = #{lactationDay}</if>
|
||||||
|
<if test="anestrousDay != null "> and anestrous_day = #{anestrousDay}</if>
|
||||||
|
<if test="matingCounts != null "> and mating_counts = #{matingCounts}</if>
|
||||||
|
<if test="matingTotal != null "> and mating_total = #{matingTotal}</if>
|
||||||
|
<if test="miscarriageCounts != null "> and miscarriage_counts = #{miscarriageCounts}</if>
|
||||||
|
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
||||||
|
<if test="controlled != null "> and controlled = #{controlled}</if>
|
||||||
|
<if test="body != null "> and body = #{body}</if>
|
||||||
|
<if test="breast != null "> and breast = #{breast}</if>
|
||||||
|
<if test="source != null and source != ''"> and source = #{source}</if>
|
||||||
|
<if test="sourceDate != null "> and source_date = #{sourceDate}</if>
|
||||||
|
<if test="sourceRanchId != null "> and source_ranch_id = #{sourceRanchId}</if>
|
||||||
|
<if test="sourceRanch != null and sourceRanch != ''"> and source_ranch = #{sourceRanch}</if>
|
||||||
|
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
||||||
|
<if test="sheepColor != null and sheepColor != ''"> and sheep_color = #{sheepColor}</if>
|
||||||
|
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSheepPedigreeById" parameterType="Long" resultMap="SheepPedigreeResult">
|
||||||
|
<include refid="selectSheepPedigreeVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSheepPedigree" parameterType="SheepPedigree">
|
||||||
|
insert into sheep_pedigree
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="bsManageTags != null">bs_manage_tags,</if>
|
||||||
|
<if test="ranchId != null">ranch_id,</if>
|
||||||
|
<if test="drRanch != null">dr_ranch,</if>
|
||||||
|
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||||
|
<if test="sheepfoldName != null">sheepfold_name,</if>
|
||||||
|
<if test="electronicTags != null">electronic_tags,</if>
|
||||||
|
<if test="varietyId != null">variety_id,</if>
|
||||||
|
<if test="variety != null">variety,</if>
|
||||||
|
<if test="family != null">family,</if>
|
||||||
|
<if test="name != null">name,</if>
|
||||||
|
<if test="gender != null">gender,</if>
|
||||||
|
<if test="birthday != null">birthday,</if>
|
||||||
|
<if test="dayAge != null">day_age,</if>
|
||||||
|
<if test="monthAge != null">month_age,</if>
|
||||||
|
<if test="parity != null">parity,</if>
|
||||||
|
<if test="birthWeight != null">birth_weight,</if>
|
||||||
|
<if test="weaningDate != null">weaning_date,</if>
|
||||||
|
<if test="statusId != null">status_id,</if>
|
||||||
|
<if test="weaningWeight != null">weaning_weight,</if>
|
||||||
|
<if test="weaningDayAge != null">weaning_day_age,</if>
|
||||||
|
<if test="weaningDailyGain != null">weaning_daily_gain,</if>
|
||||||
|
<if test="currentWeight != null">current_weight,</if>
|
||||||
|
<if test="breedStatusId != null">breed_status_id,</if>
|
||||||
|
<if test="breed != null">breed,</if>
|
||||||
|
<if test="bsFatherId != null">bs_father_id,</if>
|
||||||
|
<if test="fatherManageTags != null">father_manage_tags,</if>
|
||||||
|
<if test="bsMotherId != null">bs_mother_id,</if>
|
||||||
|
<if test="motherManageTags != null">mother_manage_tags,</if>
|
||||||
|
<if test="receptorId != null">receptor_id,</if>
|
||||||
|
<if test="receptorManageTags != null">receptor_manage_tags,</if>
|
||||||
|
<if test="fatherFatherId != null">father_father_id,</if>
|
||||||
|
<if test="grandfatherManageTags != null">grandfather_manage_tags,</if>
|
||||||
|
<if test="fatherMotherId != null">father_mother_id,</if>
|
||||||
|
<if test="grandmotherManageTags != null">grandmother_manage_tags,</if>
|
||||||
|
<if test="fatherId != null">father_id,</if>
|
||||||
|
<if test="maternalGrandfatherManageTags != null">maternal_grandfather_manage_tags,</if>
|
||||||
|
<if test="motherId != null">mother_id,</if>
|
||||||
|
<if test="maternalGrandmotherManageTags != null">maternal_grandmother_manage_tags,</if>
|
||||||
|
<if test="matingDate != null">mating_date,</if>
|
||||||
|
<if test="matingTypeId != null">mating_type_id,</if>
|
||||||
|
<if test="pregDate != null">preg_date,</if>
|
||||||
|
<if test="lambingDate != null">lambing_date,</if>
|
||||||
|
<if test="lambingDay != null">lambing_day,</if>
|
||||||
|
<if test="matingDay != null">mating_day,</if>
|
||||||
|
<if test="gestationDay != null">gestation_day,</if>
|
||||||
|
<if test="expectedDate != null">expected_date,</if>
|
||||||
|
<if test="postLambingDay != null">post_lambing_day,</if>
|
||||||
|
<if test="lactationDay != null">lactation_day,</if>
|
||||||
|
<if test="anestrousDay != null">anestrous_day,</if>
|
||||||
|
<if test="matingCounts != null">mating_counts,</if>
|
||||||
|
<if test="matingTotal != null">mating_total,</if>
|
||||||
|
<if test="miscarriageCounts != null">miscarriage_counts,</if>
|
||||||
|
<if test="comment != null">comment,</if>
|
||||||
|
<if test="controlled != null">controlled,</if>
|
||||||
|
<if test="body != null">body,</if>
|
||||||
|
<if test="breast != null">breast,</if>
|
||||||
|
<if test="source != null">source,</if>
|
||||||
|
<if test="sourceDate != null">source_date,</if>
|
||||||
|
<if test="sourceRanchId != null">source_ranch_id,</if>
|
||||||
|
<if test="sourceRanch != null">source_ranch,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="isDelete != null">is_delete,</if>
|
||||||
|
<if test="sheepColor != null and sheepColor != ''">sheep_color,</if>
|
||||||
|
<if test="groupName != null and groupName != ''">group_name,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id},</if>
|
||||||
|
<if test="bsManageTags != null">#{bsManageTags},</if>
|
||||||
|
<if test="ranchId != null">#{ranchId},</if>
|
||||||
|
<if test="drRanch != null">#{drRanch},</if>
|
||||||
|
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||||
|
<if test="sheepfoldName != null">#{sheepfoldName},</if>
|
||||||
|
<if test="electronicTags != null">#{electronicTags},</if>
|
||||||
|
<if test="varietyId != null">#{varietyId},</if>
|
||||||
|
<if test="variety != null">#{variety},</if>
|
||||||
|
<if test="family != null">#{family},</if>
|
||||||
|
<if test="name != null">#{name},</if>
|
||||||
|
<if test="gender != null">#{gender},</if>
|
||||||
|
<if test="birthday != null">#{birthday},</if>
|
||||||
|
<if test="dayAge != null">#{dayAge},</if>
|
||||||
|
<if test="monthAge != null">#{monthAge},</if>
|
||||||
|
<if test="parity != null">#{parity},</if>
|
||||||
|
<if test="birthWeight != null">#{birthWeight},</if>
|
||||||
|
<if test="weaningDate != null">#{weaningDate},</if>
|
||||||
|
<if test="statusId != null">#{statusId},</if>
|
||||||
|
<if test="weaningWeight != null">#{weaningWeight},</if>
|
||||||
|
<if test="weaningDayAge != null">#{weaningDayAge},</if>
|
||||||
|
<if test="weaningDailyGain != null">#{weaningDailyGain},</if>
|
||||||
|
<if test="currentWeight != null">#{currentWeight},</if>
|
||||||
|
<if test="breedStatusId != null">#{breedStatusId},</if>
|
||||||
|
<if test="breed != null">#{breed},</if>
|
||||||
|
<if test="bsFatherId != null">#{bsFatherId},</if>
|
||||||
|
<if test="fatherManageTags != null">#{fatherManageTags},</if>
|
||||||
|
<if test="bsMotherId != null">#{bsMotherId},</if>
|
||||||
|
<if test="motherManageTags != null">#{motherManageTags},</if>
|
||||||
|
<if test="receptorId != null">#{receptorId},</if>
|
||||||
|
<if test="receptorManageTags != null">#{receptorManageTags},</if>
|
||||||
|
<if test="fatherFatherId != null">#{fatherFatherId},</if>
|
||||||
|
<if test="grandfatherManageTags != null">#{grandfatherManageTags},</if>
|
||||||
|
<if test="fatherMotherId != null">#{fatherMotherId},</if>
|
||||||
|
<if test="grandmotherManageTags != null">#{grandmotherManageTags},</if>
|
||||||
|
<if test="fatherId != null">#{fatherId},</if>
|
||||||
|
<if test="maternalGrandfatherManageTags != null">#{maternalGrandfatherManageTags},</if>
|
||||||
|
<if test="motherId != null">#{motherId},</if>
|
||||||
|
<if test="maternalGrandmotherManageTags != null">#{maternalGrandmotherManageTags},</if>
|
||||||
|
<if test="matingDate != null">#{matingDate},</if>
|
||||||
|
<if test="matingTypeId != null">#{matingTypeId},</if>
|
||||||
|
<if test="pregDate != null">#{pregDate},</if>
|
||||||
|
<if test="lambingDate != null">#{lambingDate},</if>
|
||||||
|
<if test="lambingDay != null">#{lambingDay},</if>
|
||||||
|
<if test="matingDay != null">#{matingDay},</if>
|
||||||
|
<if test="gestationDay != null">#{gestationDay},</if>
|
||||||
|
<if test="expectedDate != null">#{expectedDate},</if>
|
||||||
|
<if test="postLambingDay != null">#{postLambingDay},</if>
|
||||||
|
<if test="lactationDay != null">#{lactationDay},</if>
|
||||||
|
<if test="anestrousDay != null">#{anestrousDay},</if>
|
||||||
|
<if test="matingCounts != null">#{matingCounts},</if>
|
||||||
|
<if test="matingTotal != null">#{matingTotal},</if>
|
||||||
|
<if test="miscarriageCounts != null">#{miscarriageCounts},</if>
|
||||||
|
<if test="comment != null">#{comment},</if>
|
||||||
|
<if test="controlled != null">#{controlled},</if>
|
||||||
|
<if test="body != null">#{body},</if>
|
||||||
|
<if test="breast != null">#{breast},</if>
|
||||||
|
<if test="source != null">#{source},</if>
|
||||||
|
<if test="sourceDate != null">#{sourceDate},</if>
|
||||||
|
<if test="sourceRanchId != null">#{sourceRanchId},</if>
|
||||||
|
<if test="sourceRanch != null">#{sourceRanch},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="isDelete != null">#{isDelete},</if>
|
||||||
|
<if test="sheepColor != null and sheepColor != ''">#{sheepColor},</if>
|
||||||
|
<if test="groupName != null and groupName != ''">#{groupName},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSheepPedigree" parameterType="SheepPedigree">
|
||||||
|
update sheep_pedigree
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="bsManageTags != null">bs_manage_tags = #{bsManageTags},</if>
|
||||||
|
<if test="ranchId != null">ranch_id = #{ranchId},</if>
|
||||||
|
<if test="drRanch != null">dr_ranch = #{drRanch},</if>
|
||||||
|
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
||||||
|
<if test="sheepfoldName != null">sheepfold_name = #{sheepfoldName},</if>
|
||||||
|
<if test="electronicTags != null">electronic_tags = #{electronicTags},</if>
|
||||||
|
<if test="varietyId != null">variety_id = #{varietyId},</if>
|
||||||
|
<if test="variety != null">variety = #{variety},</if>
|
||||||
|
<if test="family != null">family = #{family},</if>
|
||||||
|
<if test="name != null">name = #{name},</if>
|
||||||
|
<if test="gender != null">gender = #{gender},</if>
|
||||||
|
<if test="birthday != null">birthday = #{birthday},</if>
|
||||||
|
<if test="dayAge != null">day_age = #{dayAge},</if>
|
||||||
|
<if test="monthAge != null">month_age = #{monthAge},</if>
|
||||||
|
<if test="parity != null">parity = #{parity},</if>
|
||||||
|
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
|
||||||
|
<if test="weaningDate != null">weaning_date = #{weaningDate},</if>
|
||||||
|
<if test="statusId != null">status_id = #{statusId},</if>
|
||||||
|
<if test="weaningWeight != null">weaning_weight = #{weaningWeight},</if>
|
||||||
|
<if test="weaningDayAge != null">weaning_day_age = #{weaningDayAge},</if>
|
||||||
|
<if test="weaningDailyGain != null">weaning_daily_gain = #{weaningDailyGain},</if>
|
||||||
|
<if test="currentWeight != null">current_weight = #{currentWeight},</if>
|
||||||
|
<if test="breedStatusId != null">breed_status_id = #{breedStatusId},</if>
|
||||||
|
<if test="breed != null">breed = #{breed},</if>
|
||||||
|
<if test="bsFatherId != null">bs_father_id = #{bsFatherId},</if>
|
||||||
|
<if test="fatherManageTags != null">father_manage_tags = #{fatherManageTags},</if>
|
||||||
|
<if test="bsMotherId != null">bs_mother_id = #{bsMotherId},</if>
|
||||||
|
<if test="motherManageTags != null">mother_manage_tags = #{motherManageTags},</if>
|
||||||
|
<if test="receptorId != null">receptor_id = #{receptorId},</if>
|
||||||
|
<if test="receptorManageTags != null">receptor_manage_tags = #{receptorManageTags},</if>
|
||||||
|
<if test="fatherFatherId != null">father_father_id = #{fatherFatherId},</if>
|
||||||
|
<if test="grandfatherManageTags != null">grandfather_manage_tags = #{grandfatherManageTags},</if>
|
||||||
|
<if test="fatherMotherId != null">father_mother_id = #{fatherMotherId},</if>
|
||||||
|
<if test="grandmotherManageTags != null">grandmother_manage_tags = #{grandmotherManageTags},</if>
|
||||||
|
<if test="fatherId != null">father_id = #{fatherId},</if>
|
||||||
|
<if test="maternalGrandfatherManageTags != null">maternal_grandfather_manage_tags = #{maternalGrandfatherManageTags},</if>
|
||||||
|
<if test="motherId != null">mother_id = #{motherId},</if>
|
||||||
|
<if test="maternalGrandmotherManageTags != null">maternal_grandmother_manage_tags = #{maternalGrandmotherManageTags},</if>
|
||||||
|
<if test="matingDate != null">mating_date = #{matingDate},</if>
|
||||||
|
<if test="matingTypeId != null">mating_type_id = #{matingTypeId},</if>
|
||||||
|
<if test="pregDate != null">preg_date = #{pregDate},</if>
|
||||||
|
<if test="lambingDate != null">lambing_date = #{lambingDate},</if>
|
||||||
|
<if test="lambingDay != null">lambing_day = #{lambingDay},</if>
|
||||||
|
<if test="matingDay != null">mating_day = #{matingDay},</if>
|
||||||
|
<if test="gestationDay != null">gestation_day = #{gestationDay},</if>
|
||||||
|
<if test="expectedDate != null">expected_date = #{expectedDate},</if>
|
||||||
|
<if test="postLambingDay != null">post_lambing_day = #{postLambingDay},</if>
|
||||||
|
<if test="lactationDay != null">lactation_day = #{lactationDay},</if>
|
||||||
|
<if test="anestrousDay != null">anestrous_day = #{anestrousDay},</if>
|
||||||
|
<if test="matingCounts != null">mating_counts = #{matingCounts},</if>
|
||||||
|
<if test="matingTotal != null">mating_total = #{matingTotal},</if>
|
||||||
|
<if test="miscarriageCounts != null">miscarriage_counts = #{miscarriageCounts},</if>
|
||||||
|
<if test="comment != null">comment = #{comment},</if>
|
||||||
|
<if test="controlled != null">controlled = #{controlled},</if>
|
||||||
|
<if test="body != null">body = #{body},</if>
|
||||||
|
<if test="breast != null">breast = #{breast},</if>
|
||||||
|
<if test="source != null">source = #{source},</if>
|
||||||
|
<if test="sourceDate != null">source_date = #{sourceDate},</if>
|
||||||
|
<if test="sourceRanchId != null">source_ranch_id = #{sourceRanchId},</if>
|
||||||
|
<if test="sourceRanch != null">source_ranch = #{sourceRanch},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||||
|
<if test="sheepColor != null and sheepColor != ''">sheep_color = #{sheepColor},</if>
|
||||||
|
<if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSheepPedigreeById" parameterType="Long">
|
||||||
|
delete from sheep_pedigree where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSheepPedigreeByIds" parameterType="String">
|
||||||
|
delete from sheep_pedigree where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectBreedNameById" resultType="java.lang.String">
|
||||||
|
SELECT breed
|
||||||
|
FROM bas_breed_status
|
||||||
|
WHERE id = #{id} <!-- #{id}会自动适配int类型 -->
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="sheepId" column="sheep_id" />
|
<result property="sheepId" column="sheep_id" />
|
||||||
<result property="sheepNo" column="sheep_no"/>
|
<result property="sheepNo" column="sheep_no"/>
|
||||||
|
<result property="variety" column="variety"/>
|
||||||
<result property="sheepType" column="sheep_type"/>
|
<result property="sheepType" column="sheep_type"/>
|
||||||
<result property="gender" column="gender"/>
|
<result property="gender" column="gender"/>
|
||||||
<result property="monthAge" column="month_age"/>
|
<result property="monthAge" column="month_age"/>
|
||||||
@@ -30,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectQuarantineReportVo">
|
<sql id="selectQuarantineReportVo">
|
||||||
select sqr.id, sheep_type,sqr.gender,sqr.parity,sqr.breed,sqr.month_age,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status,
|
select sqr.id, sheep_type,sqr.variety,sqr.gender,sqr.parity,sqr.breed,sqr.month_age,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status,
|
||||||
sqr.update_by, sqr.update_time, sqr.create_by, sqr.create_time,
|
sqr.update_by, sqr.update_time, sqr.create_by, sqr.create_time,
|
||||||
sqi.name as item_name,
|
sqi.name as item_name,
|
||||||
sqs.name as sample,
|
sqs.name as sample,
|
||||||
@@ -98,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
INSERT INTO sw_quarantine_report
|
INSERT INTO sw_quarantine_report
|
||||||
(
|
(
|
||||||
sheep_id,
|
sheep_id,
|
||||||
|
variety,
|
||||||
sheep_type,
|
sheep_type,
|
||||||
month_age,
|
month_age,
|
||||||
parity,
|
parity,
|
||||||
@@ -121,6 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(
|
(
|
||||||
#{item.sheepId},
|
#{item.sheepId},
|
||||||
|
#{item.variety},
|
||||||
#{item.sheepType},
|
#{item.sheepType},
|
||||||
#{item.monthAge},
|
#{item.monthAge},
|
||||||
#{item.parity},
|
#{item.parity},
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
bacterial_colony_1, bacterial_colony_2, bacterial_colony_3,
|
bacterial_colony_1, bacterial_colony_2, bacterial_colony_3,
|
||||||
bacterial_colony_4, bacterial_colony_5, coli, lactoferrin,
|
bacterial_colony_4, bacterial_colony_5, coli, lactoferrin,
|
||||||
ig, commnet, create_by, create_time
|
ig, commnet, create_by, create_time
|
||||||
FROM np_fresh_milk_insp
|
FROM np_fresh_milk_insp a
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectNpFreshMilkInspList" parameterType="NpFreshMilkInsp" resultMap="NpFreshMilkInspResult">
|
<select id="selectNpFreshMilkInspList" parameterType="NpFreshMilkInsp" resultMap="NpFreshMilkInspResult">
|
||||||
@@ -46,6 +46,8 @@
|
|||||||
<if test="params.endTime != null and params.endTime != ''">
|
<if test="params.endTime != null and params.endTime != ''">
|
||||||
AND datetime <= #{params.endTime}
|
AND datetime <= #{params.endTime}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
${params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -74,6 +76,8 @@
|
|||||||
<if test="commnet != null">commnet,</if>
|
<if test="commnet != null">commnet,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="source != null">#{source},</if>
|
<if test="source != null">#{source},</if>
|
||||||
@@ -93,6 +97,8 @@
|
|||||||
<if test="commnet != null">#{commnet},</if>
|
<if test="commnet != null">#{commnet},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.zhyc.module.dairyProducts.mapper.NpMilkInOutStoreMapper">
|
<mapper namespace="com.zhyc.module.dairyProducts.mapper.NpMilkInOutStoreMapper">
|
||||||
<select id="selectWithColumns" resultType="map">
|
<select id="selectWithColumns" resultType="map">
|
||||||
SELECT s.datetime, s.num, s.colost_sheep, s.commercial_intake, s.anti_intake,
|
SELECT s.datetime, s.num, s.colost_sheep, s.commercial_intake, s.anti_intake,
|
||||||
@@ -20,6 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<where>
|
<where>
|
||||||
<if test="start != null"> s.datetime >= #{start}</if>
|
<if test="start != null"> s.datetime >= #{start}</if>
|
||||||
<if test="end != null"> AND s.datetime <= #{end}</if>
|
<if test="end != null"> AND s.datetime <= #{end}</if>
|
||||||
|
|
||||||
|
${params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
GROUP BY s.id
|
GROUP BY s.id
|
||||||
ORDER BY s.datetime
|
ORDER BY s.datetime
|
||||||
@@ -32,27 +34,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
INSERT INTO np_milk_in_out_store(datetime, num, colost_sheep, commercial_intake, anti_intake,
|
INSERT INTO np_milk_in_out_store(datetime, num, colost_sheep, commercial_intake, anti_intake,
|
||||||
colost_intake, intake_total, commercial_test, colost_test, transfer_commercial,
|
colost_intake, intake_total, commercial_test, colost_test, transfer_commercial,
|
||||||
transfer_anti, transfer_colost, transfer_total, loss, stock_commercial,
|
transfer_anti, transfer_colost, transfer_total, loss, stock_commercial,
|
||||||
stock_anti, colost, return_fresh, return_yogurt)
|
stock_anti, colost, return_fresh, return_yogurt, user_id, dept_id)
|
||||||
VALUES (
|
VALUES (
|
||||||
#{datetime}, #{num}, #{colostSheep}, #{commercialIntake}, #{antiIntake},
|
#{datetime}, #{num}, #{colostSheep}, #{commercialIntake}, #{antiIntake},
|
||||||
#{colostIntake}, #{intakeTotal}, #{commercialTest}, #{colostTest},
|
#{colostIntake}, #{intakeTotal}, #{commercialTest}, #{colostTest},
|
||||||
#{transferCommercial}, #{transferAnti}, #{transferColost}, #{transferTotal},
|
#{transferCommercial}, #{transferAnti}, #{transferColost}, #{transferTotal},
|
||||||
#{loss}, #{stockCommercial}, #{stockAnti}, #{colost}, #{returnFresh}, #{returnYogurt}
|
#{loss}, #{stockCommercial}, #{stockAnti}, #{colost}, #{returnFresh}, #{returnYogurt}, #{userId}, #{deptId}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertFeedRecord">
|
<insert id="insertFeedRecord">
|
||||||
INSERT INTO np_milk_feed_records(store_id, source_id, amount)
|
INSERT INTO np_milk_feed_records(store_id, source_id, amount, user_id, dept_id)
|
||||||
VALUES(#{storeId},
|
VALUES(#{storeId},
|
||||||
(SELECT id FROM np_milk_feed WHERE source_name = #{source}),
|
(SELECT id FROM np_milk_feed WHERE source_name = #{source}),
|
||||||
#{amount})
|
#{amount}, #{userId}, #{deptId})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertSaleRecord">
|
<insert id="insertSaleRecord">
|
||||||
INSERT INTO np_milk_sale_records(store_id, destination_id, amount)
|
INSERT INTO np_milk_sale_records(store_id, destination_id, amount, user_id, dept_id)
|
||||||
VALUES(#{storeId},
|
VALUES(#{storeId},
|
||||||
(SELECT id FROM np_milk_sale WHERE destination_name = #{destination}),
|
(SELECT id FROM np_milk_sale WHERE destination_name = #{destination}),
|
||||||
#{amount})
|
#{amount}, #{userId}, #{deptId})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -54,6 +54,8 @@
|
|||||||
<if test="npMilkProdClasses.classes != null">
|
<if test="npMilkProdClasses.classes != null">
|
||||||
AND mpc.classes = #{npMilkProdClasses.classes}
|
AND mpc.classes = #{npMilkProdClasses.classes}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
${npMilkProdClasses.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -93,8 +95,8 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertNpMilkProdClasses" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertNpMilkProdClasses" useGeneratedKeys="true" keyProperty="id">
|
||||||
INSERT INTO np_milk_prod_classes (datetime, sheep_id, classes, milk, corrected_milk)
|
INSERT INTO np_milk_prod_classes (datetime, sheep_id, classes, milk, corrected_milk, user_id, dept_id)
|
||||||
VALUES (#{datetime}, #{sheepId}, #{classes}, #{milk}, #{correctedMilk})
|
VALUES (#{datetime}, #{sheepId}, #{classes}, #{milk}, #{correctedMilk}, #{userId}, #{deptId})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="selectSheepIdByManageEarNo" resultType="java.lang.String">
|
<select id="selectSheepIdByManageEarNo" resultType="java.lang.String">
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
select id, datetime, source, freeze, density, fat, protein, non_fat, dry_matter,
|
select id, datetime, source, freeze, density, fat, protein, non_fat, dry_matter,
|
||||||
impurity, lactose, ash_content, acidity, ph, bacterial_colony, lactoferrin,
|
impurity, lactose, ash_content, acidity, ph, bacterial_colony, lactoferrin,
|
||||||
ig, somatic_cell, usea, fat_ratio, comment, create_by, create_time
|
ig, somatic_cell, usea, fat_ratio, comment, create_by, create_time
|
||||||
from np_raw_milk_inspe
|
from np_raw_milk_inspe a
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectNpRawMilkInspeList" parameterType="NpRawMilkInspe" resultMap="NpRawMilkInspeResult">
|
<select id="selectNpRawMilkInspeList" parameterType="NpRawMilkInspe" resultMap="NpRawMilkInspeResult">
|
||||||
@@ -47,6 +47,8 @@
|
|||||||
and datetime <= #{params.endTime}
|
and datetime <= #{params.endTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="source != null and source != ''"> and source like concat('%', #{source}, '%')</if>
|
<if test="source != null and source != ''"> and source like concat('%', #{source}, '%')</if>
|
||||||
|
|
||||||
|
${params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -80,6 +82,8 @@
|
|||||||
<if test="comment != null">comment,</if>
|
<if test="comment != null">comment,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="datetime != null">#{datetime},</if>
|
<if test="datetime != null">#{datetime},</if>
|
||||||
@@ -104,6 +108,8 @@
|
|||||||
<if test="comment != null">#{comment},</if>
|
<if test="comment != null">#{comment},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
acidity, bacterial_colony_1, bacterial_clony_2,
|
acidity, bacterial_colony_1, bacterial_clony_2,
|
||||||
bacterial_clony_3, bacterial_clony_4, bacterial_clony_5,
|
bacterial_clony_3, bacterial_clony_4, bacterial_clony_5,
|
||||||
yeast, mould, lacto, comment, create_by, create_time
|
yeast, mould, lacto, comment, create_by, create_time
|
||||||
from np_yogurt_insp
|
from np_yogurt_insp a
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectNpYogurtInspList" parameterType="NpYogurtInsp" resultMap="NpYogurtInspResult">
|
<select id="selectNpYogurtInspList" parameterType="NpYogurtInsp" resultMap="NpYogurtInspResult">
|
||||||
@@ -45,6 +45,8 @@
|
|||||||
<if test="params.endTime != null and params.endTime != ''">
|
<if test="params.endTime != null and params.endTime != ''">
|
||||||
and datetime <= #{params.endTime}
|
and datetime <= #{params.endTime}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
${params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -73,6 +75,8 @@
|
|||||||
<if test="comment != null">comment,</if>
|
<if test="comment != null">comment,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="source != null">#{source},</if>
|
<if test="source != null">#{source},</if>
|
||||||
@@ -92,6 +96,8 @@
|
|||||||
<if test="comment != null">#{comment},</if>
|
<if test="comment != null">#{comment},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -105,7 +111,7 @@
|
|||||||
<if test="nonFat != null">non_fat = #{nonFat},</if>
|
<if test="nonFat != null">non_fat = #{nonFat},</if>
|
||||||
<if test="acidity != null">acidity = #{acidity},</if>
|
<if test="acidity != null">acidity = #{acidity},</if>
|
||||||
<if test="bacterialColony1 != null">bacterial_colony_1 = #{bacterialColony1},</if>
|
<if test="bacterialColony1 != null">bacterial_colony_1 = #{bacterialColony1},</if>
|
||||||
<if test="bacterialClony2 != null">bacterial_clony_2 = #{bacterialClony2},</if>
|
<if test="bacterialClony2 != null">bacterial_colony_2 = #{bacterialClony2},</if>
|
||||||
<if test="bacterialClony3 != null">bacterial_clony_3 = #{bacterialClony3},</if>
|
<if test="bacterialClony3 != null">bacterial_clony_3 = #{bacterialClony3},</if>
|
||||||
<if test="bacterialClony4 != null">bacterial_clony_4 = #{bacterialClony4},</if>
|
<if test="bacterialClony4 != null">bacterial_clony_4 = #{bacterialClony4},</if>
|
||||||
<if test="bacterialClony5 != null">bacterial_clony_5 = #{bacterialClony5},</if>
|
<if test="bacterialClony5 != null">bacterial_clony_5 = #{bacterialClony5},</if>
|
||||||
|
|||||||
@@ -11,51 +11,56 @@
|
|||||||
<result property="content" column="content"/>
|
<result property="content" column="content"/>
|
||||||
<result property="standard" column="standard"/>
|
<result property="standard" column="standard"/>
|
||||||
<result property="coefficient" column="coefficient"/>
|
<result property="coefficient" column="coefficient"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="deptId" column="dept_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectXzDryMatterCorrectionVo">
|
<sql id="selectXzDryMatterCorrectionVo">
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
d.id,
|
||||||
datetime,
|
d.datetime,
|
||||||
factory,
|
d.factory,
|
||||||
content,
|
d.content,
|
||||||
COALESCE(standard, 18) as standard,
|
COALESCE(d.standard, 18) as standard,
|
||||||
CASE
|
CASE
|
||||||
WHEN standard = 0 OR standard IS NULL THEN NULL
|
WHEN d.standard = 0 OR d.standard IS NULL THEN NULL
|
||||||
ELSE ROUND(content / standard, 2)
|
ELSE ROUND(d.content / d.standard, 2)
|
||||||
END AS coefficient
|
END AS coefficient,
|
||||||
FROM xz_dry_matter_correction
|
d.user_id,
|
||||||
|
d.dept_id
|
||||||
|
FROM xz_dry_matter_correction d
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectXzDryMatterCorrectionList" parameterType="XzDryMatterCorrection" resultMap="XzDryMatterCorrectionResult">
|
<select id="selectXzDryMatterCorrectionList" parameterType="XzDryMatterCorrection" resultMap="XzDryMatterCorrectionResult">
|
||||||
<include refid="selectXzDryMatterCorrectionVo"/>
|
<include refid="selectXzDryMatterCorrectionVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="params.beginTime != null and params.beginTime != ''">
|
<if test="params.beginTime != null and params.beginTime != ''">
|
||||||
AND DATE_FORMAT(datetime, '%Y-%m') >= #{params.beginTime}
|
AND DATE_FORMAT(d.datetime, '%Y-%m') >= #{params.beginTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.endTime != null and params.endTime != ''">
|
<if test="params.endTime != null and params.endTime != ''">
|
||||||
AND DATE_FORMAT(datetime, '%Y-%m') <= #{params.endTime}
|
AND DATE_FORMAT(d.datetime, '%Y-%m') <= #{params.endTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="factory != null and factory != ''">
|
<if test="factory != null and factory != ''">
|
||||||
AND factory = #{factory}
|
AND d.factory = #{factory}
|
||||||
</if>
|
</if>
|
||||||
AND (standard IS NULL OR standard != 0)
|
AND (d.standard IS NULL OR d.standard != 0)
|
||||||
|
${params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
ORDER BY datetime DESC
|
ORDER BY d.datetime DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectXzDryMatterCorrectionById" parameterType="Long" resultMap="XzDryMatterCorrectionResult">
|
<select id="selectXzDryMatterCorrectionById" parameterType="Long" resultMap="XzDryMatterCorrectionResult">
|
||||||
<include refid="selectXzDryMatterCorrectionVo"/>
|
<include refid="selectXzDryMatterCorrectionVo"/>
|
||||||
WHERE id = #{id}
|
WHERE d.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertXzDryMatterCorrection" parameterType="XzDryMatterCorrection" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertXzDryMatterCorrection" parameterType="XzDryMatterCorrection" useGeneratedKeys="true" keyProperty="id">
|
||||||
INSERT INTO xz_dry_matter_correction
|
INSERT INTO xz_dry_matter_correction
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
datetime, factory, content, standard
|
datetime, factory, content, standard, user_id, dept_id
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||||
#{datetime}, #{factory}, #{content}, #{standard}
|
#{datetime}, #{factory}, #{content}, #{standard}, #{userId}, #{deptId}
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@@ -11,38 +11,44 @@
|
|||||||
<result property="actual" column="actual" />
|
<result property="actual" column="actual" />
|
||||||
<result property="systemMilk" column="system_milk" />
|
<result property="systemMilk" column="system_milk" />
|
||||||
<result property="coefficient" column="coefficient" />
|
<result property="coefficient" column="coefficient" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="deptId" column="dept_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectXzWegihCorrectionVo">
|
<sql id="selectXzWegihCorrectionVo">
|
||||||
select
|
select
|
||||||
id,
|
w.id,
|
||||||
datetime,
|
w.datetime,
|
||||||
factory,
|
w.factory,
|
||||||
actual,
|
w.actual,
|
||||||
system_milk,
|
w.system_milk,
|
||||||
CASE
|
CASE
|
||||||
WHEN system_milk = 0 THEN 0
|
WHEN w.system_milk = 0 THEN 0
|
||||||
ELSE ROUND(actual / system_milk, 4)
|
ELSE ROUND(w.actual / w.system_milk, 4)
|
||||||
END as coefficient
|
END as coefficient,
|
||||||
from xz_wegih_correction
|
w.user_id,
|
||||||
|
w.dept_id
|
||||||
|
from xz_wegih_correction w
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectXzWegihCorrectionList" parameterType="XzWegihCorrection" resultMap="XzWegihCorrectionResult">
|
<select id="selectXzWegihCorrectionList" parameterType="XzWegihCorrection" resultMap="XzWegihCorrectionResult">
|
||||||
<include refid="selectXzWegihCorrectionVo"/>
|
<include refid="selectXzWegihCorrectionVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="params.beginTime != null and params.beginTime != ''">
|
<if test="params.beginTime != null and params.beginTime != ''">
|
||||||
and datetime >= #{params.beginTime}
|
and w.datetime >= #{params.beginTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.endTime != null and params.endTime != ''">
|
<if test="params.endTime != null and params.endTime != ''">
|
||||||
and datetime <= #{params.endTime}
|
and w.datetime <= #{params.endTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="factory != null and factory != ''"> and factory = #{factory}</if>
|
<if test="factory != null and factory != ''"> and w.factory = #{factory}</if>
|
||||||
|
|
||||||
|
${params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectXzWegihCorrectionById" parameterType="Long" resultMap="XzWegihCorrectionResult">
|
<select id="selectXzWegihCorrectionById" parameterType="Long" resultMap="XzWegihCorrectionResult">
|
||||||
<include refid="selectXzWegihCorrectionVo"/>
|
<include refid="selectXzWegihCorrectionVo"/>
|
||||||
where id = #{id}
|
where w.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertXzWegihCorrection" parameterType="XzWegihCorrection" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertXzWegihCorrection" parameterType="XzWegihCorrection" useGeneratedKeys="true" keyProperty="id">
|
||||||
@@ -52,12 +58,14 @@
|
|||||||
<if test="factory != null">factory,</if>
|
<if test="factory != null">factory,</if>
|
||||||
<if test="actual != null">actual,</if>
|
<if test="actual != null">actual,</if>
|
||||||
<if test="systemMilk != null">system_milk,</if>
|
<if test="systemMilk != null">system_milk,</if>
|
||||||
|
user_id, dept_id
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="datetime != null">#{datetime},</if>
|
<if test="datetime != null">#{datetime},</if>
|
||||||
<if test="factory != null">#{factory},</if>
|
<if test="factory != null">#{factory},</if>
|
||||||
<if test="actual != null">#{actual},</if>
|
<if test="actual != null">#{actual},</if>
|
||||||
<if test="systemMilk != null">#{systemMilk},</if>
|
<if test="systemMilk != null">#{systemMilk},</if>
|
||||||
|
#{userId}, #{deptId}
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@@ -33,34 +33,53 @@
|
|||||||
<select id="selectScDryMilkList" parameterType="ScDryMilk" resultMap="ScDryMilkResult">
|
<select id="selectScDryMilkList" parameterType="ScDryMilk" resultMap="ScDryMilkResult">
|
||||||
<include refid="selectScDryMilkVo"/>
|
<include refid="selectScDryMilkVo"/>
|
||||||
<where>
|
<where>
|
||||||
<!-- 多耳号精确匹配查询 -->
|
<if test="manageTagsList != null and manageTagsList.size() > 0">
|
||||||
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
|
|
||||||
AND s.bs_manage_tags IN
|
AND s.bs_manage_tags IN
|
||||||
<foreach item="earNumber" collection="allEarNumbers" open="(" separator="," close=")">
|
<foreach collection="manageTagsList" item="tag" open="(" separator="," close=")">
|
||||||
#{earNumber}
|
#{tag}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="(manageTagsList == null or manageTagsList.size() == 0) and manageTags != null and manageTags != ''">
|
||||||
<!-- 保留原单耳号模糊查询(仅当allEarNumbers为空时生效) -->
|
AND s.bs_manage_tags like concat('%', #{manageTags}, '%')
|
||||||
<if test="(allEarNumbers == null or allEarNumbers.size() == 0) and manageTags != null and manageTags != ''">
|
|
||||||
AND s.bs_manage_tags LIKE CONCAT('%', #{manageTags}, '%')
|
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="sheepId != null">AND d.sheep_id = #{sheepId}</if>
|
<if test="technicianList != null and technicianList.size() > 0">
|
||||||
<if test="datetime != null">AND d.datetime = #{datetime}</if>
|
AND d.tecahnician IN
|
||||||
<if test="status != null">AND d.status = #{status}</if>
|
<foreach collection="technicianList" item="tech" open="(" separator="," close=")">
|
||||||
<if test="sheepfold != null">AND d.sheepfold = #{sheepfold}</if>
|
#{tech}
|
||||||
<if test="tecahnician != null and tecahnician != ''">
|
</foreach>
|
||||||
AND d.tecahnician LIKE CONCAT('%', #{tecahnician}, '%')
|
|
||||||
</if>
|
</if>
|
||||||
<if test="createBy != null and createBy != ''">AND d.create_by = #{createBy}</if>
|
<if test="(technicianList == null or technicianList.size() == 0) and tecahnician != null and tecahnician != ''">
|
||||||
<if test="createTime != null">AND d.create_time = #{createTime}</if>
|
AND d.tecahnician like concat('%', #{tecahnician}, '%')
|
||||||
<if test="variety != null and variety != ''">
|
|
||||||
AND s.variety LIKE CONCAT('%', #{variety}, '%')
|
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
<if test="params.beginTime != null and params.beginTime != ''">
|
||||||
|
AND date_format(d.datetime,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="params.endTime != null and params.endTime != ''">
|
||||||
|
AND date_format(d.datetime,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="status != null "> and d.status = #{status}</if>
|
||||||
|
<if test="sheepfold != null "> and d.sheepfold = #{sheepfold}</if>
|
||||||
|
<if test="variety != null and variety != ''"> and s.variety like concat('%', #{variety}, '%')</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by d.datetime desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSheepEarNumberList" resultType="String">
|
||||||
|
SELECT bs_manage_tags
|
||||||
|
FROM sheep_file
|
||||||
|
WHERE bs_manage_tags LIKE concat('%', #{query}, '%')
|
||||||
|
LIMIT 20
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="searchTechnicianList" resultType="String">
|
||||||
|
SELECT nick_name
|
||||||
|
FROM sys_user
|
||||||
|
WHERE nick_name LIKE concat('%', #{query}, '%')
|
||||||
|
LIMIT 20
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectScDryMilkById" parameterType="Long" resultMap="ScDryMilkResult">
|
<select id="selectScDryMilkById" parameterType="Long" resultMap="ScDryMilkResult">
|
||||||
<include refid="selectScDryMilkVo"/>
|
<include refid="selectScDryMilkVo"/>
|
||||||
@@ -70,7 +89,7 @@
|
|||||||
|
|
||||||
<!-- 根据耳号查询羊只ID -->
|
<!-- 根据耳号查询羊只ID -->
|
||||||
<select id="selectSheepIdByManageTags" parameterType="String" resultType="Long">
|
<select id="selectSheepIdByManageTags" parameterType="String" resultType="Long">
|
||||||
select id from sheep_file where bs_manage_tags = #{manageTags}
|
select id from sheep_file where bs_manage_tags = #{manageTags} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertScDryMilk" parameterType="ScDryMilk" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertScDryMilk" parameterType="ScDryMilk" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
|||||||
@@ -22,45 +22,119 @@
|
|||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="isDelete" column="is_delete" />
|
<result property="isDelete" column="is_delete" />
|
||||||
|
|
||||||
|
<result property="variety" column="variety" />
|
||||||
|
<result property="sheepType" column="sheep_type_name" />
|
||||||
|
<result property="gender" column="gender" />
|
||||||
|
<result property="dayAge" column="day_age" />
|
||||||
|
<result property="parity" column="parity" />
|
||||||
|
<result property="sheepfoldName" column="sheepfold_name" />
|
||||||
|
<result property="breedStatus" column="breed_status" />
|
||||||
|
<result property="postLambingDay" column="post_lambing_day" />
|
||||||
|
<result property="lactationDay" column="lactation_day" />
|
||||||
|
<result property="gestationDay" column="gestation_day" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectScSheepDeathVo">
|
<sql id="selectScSheepDeathVo">
|
||||||
select id, sheep_id, manage_tags, event_type, death_date, disease_type_id, disease_subtype_id, disposal_direction, technician, handler, work_group, create_by, create_time, comment, update_by, update_time, is_delete from sc_sheep_death d
|
select d.id, d.sheep_id, d.manage_tags, d.event_type, d.death_date, d.disease_type_id, d.disease_subtype_id,
|
||||||
left join sheep_file s on d.sheep_id = s.id
|
d.disposal_direction, d.technician, d.handler, d.work_group, d.create_by, d.create_time, d.comment,
|
||||||
|
d.update_by, d.update_time, d.is_delete,
|
||||||
|
s.variety, s.name as sheep_type_name, s.gender, s.day_age, s.parity, s.sheepfold_name,
|
||||||
|
s.breed as breed_status, s.post_lambing_day, s.lactation_day, s.gestation_day
|
||||||
|
from sc_sheep_death d
|
||||||
|
left join sheep_file s on d.manage_tags = s.bs_manage_tags
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectScSheepDeathList" parameterType="ScSheepDeath" resultMap="ScSheepDeathResult">
|
<select id="selectScSheepDeathList" parameterType="ScSheepDeath" resultMap="ScSheepDeathResult">
|
||||||
<include refid="selectScSheepDeathVo"/>
|
<include refid="selectScSheepDeathVo"/>
|
||||||
<where>
|
<where>
|
||||||
<!-- 全部羊多耳号查询 -->
|
<if test="sheepId != null "> and d.sheep_id = #{sheepId}</if>
|
||||||
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
|
|
||||||
AND (
|
<if test="manageTagsList != null and manageTagsList.size() > 0">
|
||||||
<!-- 注意:s 代表 sheep_file 表的别名,根据实际 SQL 别名修改 -->
|
AND d.manage_tags IN
|
||||||
s.bs_manage_tags IN
|
<foreach collection="manageTagsList" item="tag" open="(" separator="," close=")">
|
||||||
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
|
#{tag}
|
||||||
#{earNumber}
|
|
||||||
</foreach>
|
</foreach>
|
||||||
)
|
|
||||||
</if>
|
</if>
|
||||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
<if test="(manageTagsList == null or manageTagsList.size() == 0) and manageTags != null and manageTags != ''">
|
||||||
<if test="manageTags != null and manageTags != ''"> and manage_tags = #{manageTags}</if>
|
and d.manage_tags like concat('%', #{manageTags}, '%')
|
||||||
<if test="eventType != null and eventType != ''"> and event_type = #{eventType}</if>
|
</if>
|
||||||
<if test="deathDate != null "> and death_date = #{deathDate}</if>
|
|
||||||
<if test="diseaseTypeId != null "> and disease_type_id = #{diseaseTypeId}</if>
|
<if test="params.beginDeathDate != null and params.beginDeathDate != '' and params.endDeathDate != null and params.endDeathDate != ''">
|
||||||
<if test="diseaseSubtypeId != null "> and disease_subtype_id = #{diseaseSubtypeId}</if>
|
and d.death_date between #{params.beginDeathDate} and #{params.endDeathDate}
|
||||||
<if test="disposalDirection != null and disposalDirection != ''"> and disposal_direction = #{disposalDirection}</if>
|
</if>
|
||||||
<if test="technician != null and technician != ''"> and technician = #{technician}</if>
|
|
||||||
<if test="handler != null and handler != ''"> and handler = #{handler}</if>
|
<if test="eventType != null and eventType != ''"> and d.event_type = #{eventType}</if>
|
||||||
<if test="workGroup != null and workGroup != ''"> and work_group = #{workGroup}</if>
|
<if test="diseaseTypeId != null "> and d.disease_type_id = #{diseaseTypeId}</if>
|
||||||
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
<if test="diseaseSubtypeId != null "> and d.disease_subtype_id = #{diseaseSubtypeId}</if>
|
||||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
<if test="disposalDirection != null and disposalDirection != ''"> and d.disposal_direction = #{disposalDirection}</if>
|
||||||
|
|
||||||
|
<if test="technicianList != null and technicianList.size() > 0">
|
||||||
|
AND d.technician IN
|
||||||
|
<foreach collection="technicianList" item="tech" open="(" separator="," close=")">
|
||||||
|
#{tech}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="(technicianList == null or technicianList.size() == 0) and technician != null and technician != ''">
|
||||||
|
and d.technician like concat('%', #{technician}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="handlerList != null and handlerList.size() > 0">
|
||||||
|
AND d.handler IN
|
||||||
|
<foreach collection="handlerList" item="hand" open="(" separator="," close=")">
|
||||||
|
#{hand}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="(handlerList == null or handlerList.size() == 0) and handler != null and handler != ''">
|
||||||
|
and d.handler like concat('%', #{handler}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="workGroupList != null and workGroupList.size() > 0">
|
||||||
|
AND d.work_group IN
|
||||||
|
<foreach collection="workGroupList" item="grp" open="(" separator="," close=")">
|
||||||
|
#{grp}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="(workGroupList == null or workGroupList.size() == 0) and workGroup != null and workGroup != ''">
|
||||||
|
and d.work_group = #{workGroup}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="variety != null and variety != ''"> and s.variety like concat('%', #{variety}, '%')</if>
|
||||||
|
|
||||||
|
<if test="sheepTypeList != null and sheepTypeList.size() > 0">
|
||||||
|
AND s.name IN
|
||||||
|
<foreach collection="sheepTypeList" item="sType" open="(" separator="," close=")">
|
||||||
|
#{sType}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="(sheepTypeList == null or sheepTypeList.size() == 0) and sheepType != null and sheepType != ''">
|
||||||
|
and s.name like concat('%', #{sheepType}, '%')
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
order by d.create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDistinctManageTags" resultType="String">
|
||||||
|
SELECT DISTINCT manage_tags FROM sc_sheep_death
|
||||||
|
WHERE manage_tags LIKE concat('%', #{query}, '%')
|
||||||
|
LIMIT 20
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDistinctTechnician" resultType="String">
|
||||||
|
SELECT DISTINCT technician FROM sc_sheep_death
|
||||||
|
WHERE technician LIKE concat('%', #{query}, '%') AND technician IS NOT NULL AND technician != ''
|
||||||
|
LIMIT 20
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDistinctHandler" resultType="String">
|
||||||
|
SELECT DISTINCT handler FROM sc_sheep_death
|
||||||
|
WHERE handler LIKE concat('%', #{query}, '%') AND handler IS NOT NULL AND handler != ''
|
||||||
|
LIMIT 20
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectScSheepDeathById" parameterType="Long" resultMap="ScSheepDeathResult">
|
<select id="selectScSheepDeathById" parameterType="Long" resultMap="ScSheepDeathResult">
|
||||||
<include refid="selectScSheepDeathVo"/>
|
<include refid="selectScSheepDeathVo"/>
|
||||||
where id = #{id}
|
where d.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 根据管理耳号查询sheep_file视图信息 -->
|
<!-- 根据管理耳号查询sheep_file视图信息 -->
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="electronicTags" column="electronic_tags" />
|
<result property="electronicTags" column="electronic_tags" />
|
||||||
<!-- 关联查询的字段 -->
|
|
||||||
<result property="earNumber" column="bs_manage_tags" />
|
<result property="earNumber" column="bs_manage_tags" />
|
||||||
<result property="breed" column="variety" />
|
<result property="breed" column="variety" />
|
||||||
<result property="eventType" column="event_type" />
|
<result property="eventType" column="event_type" />
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
<result property="breedingStatus" column="breed" />
|
<result property="breedingStatus" column="breed" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 带关联查询的基础SQL -->
|
|
||||||
<sql id="selectScWeanRecordVo">
|
<sql id="selectScWeanRecordVo">
|
||||||
select
|
select
|
||||||
wr.id, wr.sheep_id, wr.datetime, wr.weight, wr.status, wr.technician,
|
wr.id, wr.sheep_id, wr.datetime, wr.weight, wr.status, wr.technician,
|
||||||
@@ -40,7 +39,6 @@
|
|||||||
left join sheep_file sf on wr.sheep_id = sf.id
|
left join sheep_file sf on wr.sheep_id = sf.id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 查询断奶记录列表 -->
|
|
||||||
<select id="selectScWeanRecordList" parameterType="ScWeanRecord" resultMap="ScWeanRecordResult">
|
<select id="selectScWeanRecordList" parameterType="ScWeanRecord" resultMap="ScWeanRecordResult">
|
||||||
<include refid="selectScWeanRecordVo"/>
|
<include refid="selectScWeanRecordVo"/>
|
||||||
<where>
|
<where>
|
||||||
@@ -54,8 +52,32 @@
|
|||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="sheepId != null "> and wr.sheep_id = #{sheepId}</if>
|
<if test="sheepId != null "> and wr.sheep_id = #{sheepId}</if>
|
||||||
<if test="earNumber != null and earNumber != ''"> and sf.bs_manage_tags like concat('%', #{earNumber}, '%')</if>
|
|
||||||
<if test="datetime != null "> and wr.datetime = #{datetime}</if>
|
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
|
||||||
|
AND sf.bs_manage_tags IN
|
||||||
|
<foreach collection="allEarNumbers" item="ear" open="(" separator="," close=")">
|
||||||
|
#{ear}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="(allEarNumbers == null or allEarNumbers.size() == 0) and earNumber != null and earNumber != ''">
|
||||||
|
and sf.bs_manage_tags like concat('%', #{earNumber}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="params.beginTime != null and params.beginTime != ''">
|
||||||
|
AND date_format(wr.datetime,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="params.endTime != null and params.endTime != ''">
|
||||||
|
AND date_format(wr.datetime,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="isInHerd != null and isInHerd != ''">
|
||||||
|
AND sf.status = #{isInHerd}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="sheepCategory != null and sheepCategory != ''">
|
||||||
|
AND sf.breed = #{sheepCategory}
|
||||||
|
</if>
|
||||||
|
|
||||||
<if test="weight != null "> and wr.weight = #{weight}</if>
|
<if test="weight != null "> and wr.weight = #{weight}</if>
|
||||||
<if test="status != null "> and wr.status = #{status}</if>
|
<if test="status != null "> and wr.status = #{status}</if>
|
||||||
<if test="technician != null and technician != ''"> and wr.technician like concat('%', #{technician}, '%')</if>
|
<if test="technician != null and technician != ''"> and wr.technician like concat('%', #{technician}, '%')</if>
|
||||||
@@ -68,23 +90,27 @@
|
|||||||
<if test="fatherNumber != null and fatherNumber != ''"> and sf.father_manage_tags like concat('%', #{fatherNumber}, '%')</if>
|
<if test="fatherNumber != null and fatherNumber != ''"> and sf.father_manage_tags like concat('%', #{fatherNumber}, '%')</if>
|
||||||
<if test="motherNumber != null and motherNumber != ''"> and sf.mother_manage_tags like concat('%', #{motherNumber}, '%')</if>
|
<if test="motherNumber != null and motherNumber != ''"> and sf.mother_manage_tags like concat('%', #{motherNumber}, '%')</if>
|
||||||
<if test="sheepPen != null and sheepPen != ''"> and sf.sheepfold_name like concat('%', #{sheepPen}, '%')</if>
|
<if test="sheepPen != null and sheepPen != ''"> and sf.sheepfold_name like concat('%', #{sheepPen}, '%')</if>
|
||||||
<if test="breedingStatus != null and breedingStatus != ''"> and sf.breed = #{breedingStatus}</if>
|
|
||||||
</where>
|
</where>
|
||||||
order by wr.create_time desc
|
order by wr.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 根据ID查询断奶记录 -->
|
<select id="searchEarNumbers" resultType="String">
|
||||||
|
SELECT DISTINCT bs_manage_tags
|
||||||
|
FROM sheep_file
|
||||||
|
WHERE bs_manage_tags LIKE CONCAT('%', #{query}, '%')
|
||||||
|
AND is_delete = 0
|
||||||
|
LIMIT 20
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectScWeanRecordById" parameterType="Long" resultMap="ScWeanRecordResult">
|
<select id="selectScWeanRecordById" parameterType="Long" resultMap="ScWeanRecordResult">
|
||||||
<include refid="selectScWeanRecordVo"/>
|
<include refid="selectScWeanRecordVo"/>
|
||||||
where wr.id = #{id}
|
where wr.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 根据耳号查询羊只ID -->
|
|
||||||
<select id="selectSheepIdByEarNumber" parameterType="String" resultType="Long">
|
<select id="selectSheepIdByEarNumber" parameterType="String" resultType="Long">
|
||||||
select id from sheep_file where bs_manage_tags = #{earNumber}
|
select id from sheep_file where bs_manage_tags = #{earNumber}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 插入断奶记录 -->
|
|
||||||
<insert id="insertScWeanRecord" parameterType="ScWeanRecord" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertScWeanRecord" parameterType="ScWeanRecord" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into sc_wean_record
|
insert into sc_wean_record
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@@ -111,7 +137,6 @@
|
|||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 更新断奶记录 -->
|
|
||||||
<update id="updateScWeanRecord" parameterType="ScWeanRecord">
|
<update id="updateScWeanRecord" parameterType="ScWeanRecord">
|
||||||
update sc_wean_record
|
update sc_wean_record
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
@@ -128,23 +153,10 @@
|
|||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!-- 根据耳号更新bas_sheep表中的断奶信息 -->
|
|
||||||
<update id="updateBasSheepWeaningInfo" parameterType="ScWeanRecord">
|
|
||||||
update bas_sheep
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="datetime != null">weaning_date = #{datetime},</if>
|
|
||||||
<if test="weight != null">weaning_weight = #{weight},</if>
|
|
||||||
<if test="electronicTags != null and electronicTags != ''">electronic_tags = #{electronicTags},</if>
|
|
||||||
</trim>
|
|
||||||
where manage_tags = #{earNumber}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<!-- 删除断奶记录 -->
|
|
||||||
<delete id="deleteScWeanRecordById" parameterType="Long">
|
<delete id="deleteScWeanRecordById" parameterType="Long">
|
||||||
delete from sc_wean_record where id = #{id}
|
delete from sc_wean_record where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<!-- 批量删除断奶记录 -->
|
|
||||||
<delete id="deleteScWeanRecordByIds" parameterType="String">
|
<delete id="deleteScWeanRecordByIds" parameterType="String">
|
||||||
delete from sc_wean_record where id in
|
delete from sc_wean_record where id in
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
@@ -152,13 +164,4 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<!-- 模糊查询耳号列表 -->
|
|
||||||
<select id="searchEarNumbers" resultType="java.lang.String">
|
|
||||||
SELECT DISTINCT sf.bs_manage_tags
|
|
||||||
FROM sheep_file sf
|
|
||||||
WHERE sf.bs_manage_tags LIKE CONCAT(#{query}, '%')
|
|
||||||
AND sf.is_delete = 0
|
|
||||||
ORDER BY sf.bs_manage_tags
|
|
||||||
LIMIT 50
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -11,23 +11,26 @@
|
|||||||
<result property="district" column="district"/>
|
<result property="district" column="district"/>
|
||||||
<result property="address" column="address"/>
|
<result property="address" column="address"/>
|
||||||
<result property="remark" column="remark"/>
|
<result property="remark" column="remark"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="deptId" column="dept_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectSxCustomerVo">
|
<sql id="selectSxCustomerVo">
|
||||||
SELECT id, name, phone, province, city, district, address, remark
|
SELECT c.id, c.name, c.phone, c.province, c.city, c.district, c.address, c.remark, c.user_id, c.dept_id
|
||||||
FROM sx_customer
|
FROM sx_customer c
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectSxCustomerList" parameterType="SxCustomer" resultMap="SxCustomerResult">
|
<select id="selectSxCustomerList" parameterType="SxCustomer" resultMap="SxCustomerResult">
|
||||||
<include refid="selectSxCustomerVo"/>
|
<include refid="selectSxCustomerVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="name != null and name != ''"> AND name LIKE CONCAT('%', #{name}, '%')</if>
|
<if test="name != null and name != ''"> AND c.name LIKE CONCAT('%', #{name}, '%')</if>
|
||||||
|
${params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSxCustomerById" parameterType="Long" resultMap="SxCustomerResult">
|
<select id="selectSxCustomerById" parameterType="Long" resultMap="SxCustomerResult">
|
||||||
<include refid="selectSxCustomerVo"/>
|
<include refid="selectSxCustomerVo"/>
|
||||||
WHERE id = #{id}
|
WHERE c.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertSxCustomer" parameterType="SxCustomer" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertSxCustomer" parameterType="SxCustomer" useGeneratedKeys="true" keyProperty="id">
|
||||||
@@ -40,6 +43,8 @@
|
|||||||
<if test="district != null">district,</if>
|
<if test="district != null">district,</if>
|
||||||
<if test="address != null">address,</if>
|
<if test="address != null">address,</if>
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||||
<if test="name != null and name != ''">#{name},</if>
|
<if test="name != null and name != ''">#{name},</if>
|
||||||
@@ -49,6 +54,8 @@
|
|||||||
<if test="district != null">#{district},</if>
|
<if test="district != null">#{district},</if>
|
||||||
<if test="address != null">#{address},</if>
|
<if test="address != null">#{address},</if>
|
||||||
<if test="remark != null">#{remark},</if>
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -76,4 +83,4 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -36,33 +36,28 @@
|
|||||||
<result property="createdBy" column="created_by" />
|
<result property="createdBy" column="created_by" />
|
||||||
<result property="createdAt" column="created_at" />
|
<result property="createdAt" column="created_at" />
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
<result property="customerName" column="customer_name" />
|
<result property="deptId" column="dept_id" />
|
||||||
<result property="salesPersonName" column="sales_person_name" />
|
|
||||||
<result property="customerPhone" column="customer_phone" />
|
|
||||||
<result property="customerAddress" column="customer_address" />
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectSxSheepSaleVo">
|
<sql id="selectSxSheepSaleVo">
|
||||||
SELECT
|
select s.id, s.bs_manage_tags, s.sheepfold_id, s.variety, s.sheep_name, s.gender, s.month_age, s.parity, s.breed, s.post_lambing_day, s.lactation_day, s.lambing_day, s.event_type, s.sale_date, s.pricing_method, s.unit_price, s.total_price, s.total_weight, s.avg_weight, s.avg_price_per_sheep, s.sale_type, s.disease_type, s.secondary_reason, s.group_code, s.customer_id, s.sales_person_id, s.quarantine_no, s.approval_no, s.technician_id, s.handler_id, s.created_by, s.created_at, s.remark, s.user_id, s.dept_id
|
||||||
s.id, s.bs_manage_tags, s.sheepfold_id, s.variety, s.sheep_name, s.gender, s.month_age, s.parity, s.breed,
|
from sx_sheep_sale s
|
||||||
s.post_lambing_day, s.lactation_day, s.lambing_day, s.event_type, s.sale_date, s.pricing_method,
|
|
||||||
s.unit_price, s.total_price, s.total_weight, s.avg_weight, s.avg_price_per_sheep, s.sale_type,
|
|
||||||
s.disease_type, s.secondary_reason, s.group_code, s.customer_id, s.sales_person_id,
|
|
||||||
s.quarantine_no, s.approval_no, s.technician_id, s.handler_id, s.created_by, s.created_at, s.remark,
|
|
||||||
c.name AS customer_name,
|
|
||||||
c.phone AS customer_phone,
|
|
||||||
CONCAT(IFNULL(c.province,''), IFNULL(c.city,''), IFNULL(c.district,''), IFNULL(c.address,'')) AS customer_address,
|
|
||||||
u.nick_name AS sales_person_name
|
|
||||||
FROM sx_sheep_sale s
|
|
||||||
LEFT JOIN sx_customer c ON s.customer_id = c.id
|
|
||||||
LEFT JOIN sys_user u ON s.sales_person_id = u.user_id
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="selectSheepFileVo">
|
<sql id="selectSheepFileVo">
|
||||||
select
|
select
|
||||||
bs_manage_tags, variety, name as sheep_name, gender, month_age, parity, breed,
|
bs_manage_tags,
|
||||||
post_lambing_day, lactation_day, lambing_day, sheepfold_id
|
variety,
|
||||||
|
name as sheep_name,
|
||||||
|
gender,
|
||||||
|
month_age,
|
||||||
|
parity,
|
||||||
|
breed,
|
||||||
|
post_lambing_day,
|
||||||
|
lactation_day,
|
||||||
|
lambing_day,
|
||||||
|
sheepfold_id
|
||||||
from sheep_file
|
from sheep_file
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
@@ -74,20 +69,13 @@
|
|||||||
<select id="selectSxSheepSaleList" parameterType="SxSheepSale" resultMap="SxSheepSaleResult">
|
<select id="selectSxSheepSaleList" parameterType="SxSheepSale" resultMap="SxSheepSaleResult">
|
||||||
<include refid="selectSxSheepSaleVo"/>
|
<include refid="selectSxSheepSaleVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="customerName != null and customerName != ''">
|
<if test="bsManageTags != null and bsManageTags != ''"> and s.bs_manage_tags = #{bsManageTags}</if>
|
||||||
AND c.name LIKE CONCAT('%', #{customerName}, '%')
|
<if test="sheepfoldId != null "> and s.sheepfold_id = #{sheepfoldId}</if>
|
||||||
</if>
|
<if test="variety != null and variety != ''"> and s.variety = #{variety}</if>
|
||||||
|
<if test="sheepName != null and sheepName != ''"> and s.sheep_name = #{sheepName}</if>
|
||||||
<if test="salesPersonName != null and salesPersonName != ''">
|
<if test="saleDate != null"> and s.sale_date = #{saleDate}</if>
|
||||||
AND u.nick_name LIKE CONCAT('%', #{salesPersonName}, '%')
|
<if test="saleType != null and saleType != ''"> and s.sale_type = #{saleType}</if>
|
||||||
</if>
|
${params.dataScope}
|
||||||
|
|
||||||
<if test="params.beginSaleDate != null and params.beginSaleDate != ''">
|
|
||||||
AND date_format(s.sale_date,'%y%m%d') >= date_format(#{params.beginSaleDate},'%y%m%d')
|
|
||||||
</if>
|
|
||||||
<if test="params.endSaleDate != null and params.endSaleDate != ''">
|
|
||||||
AND date_format(s.sale_date,'%y%m%d') <= date_format(#{params.endSaleDate},'%y%m%d')
|
|
||||||
</if>
|
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -131,6 +119,8 @@
|
|||||||
<if test="createdBy != null">created_by,</if>
|
<if test="createdBy != null">created_by,</if>
|
||||||
<if test="createdAt != null">created_at,</if>
|
<if test="createdAt != null">created_at,</if>
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="bsManageTags != null and bsManageTags != ''">#{bsManageTags},</if>
|
<if test="bsManageTags != null and bsManageTags != ''">#{bsManageTags},</if>
|
||||||
@@ -165,6 +155,8 @@
|
|||||||
<if test="createdBy != null">#{createdBy},</if>
|
<if test="createdBy != null">#{createdBy},</if>
|
||||||
<if test="createdAt != null">#{createdAt},</if>
|
<if test="createdAt != null">#{createdAt},</if>
|
||||||
<if test="remark != null">#{remark},</if>
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user