繁育多个页面的多耳号输入
This commit is contained in:
@@ -70,6 +70,7 @@ public class ScBreedPlanController extends BaseController
|
||||
return success(scBreedPlanService.selectScBreedPlanById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增配种计划
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhyc.module.produce.breed.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -299,4 +301,52 @@ public class ScDryMilkController extends BaseController
|
||||
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,14 +5,7 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.zhyc.common.annotation.Log;
|
||||
import com.zhyc.common.core.controller.BaseController;
|
||||
import com.zhyc.common.core.domain.AjaxResult;
|
||||
@@ -62,7 +55,17 @@ public class ScLambingRecordController extends BaseController {
|
||||
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 = scLambingRecordService.searchEarNumbers(query);
|
||||
return success(earNumbers);
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索耳号异常", e);
|
||||
return error("搜索耳号失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 导出产羔记录列表
|
||||
*/
|
||||
|
||||
@@ -5,14 +5,7 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.zhyc.common.annotation.Log;
|
||||
import com.zhyc.common.core.controller.BaseController;
|
||||
import com.zhyc.common.core.domain.AjaxResult;
|
||||
@@ -131,4 +124,19 @@ public class ScMiscarriageRecordController extends BaseController
|
||||
{
|
||||
return toAjax(scMiscarriageRecordService.deleteScMiscarriageRecordByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") // 根据实际权限修改
|
||||
@GetMapping("/search_ear_numbers")
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
try {
|
||||
List<String> earNumbers = scMiscarriageRecordService.searchEarNumbers(query);
|
||||
return success(earNumbers);
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索耳号异常", e);
|
||||
return error("搜索耳号失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -356,4 +356,18 @@ public class ScPregnancyRecordController extends BaseController
|
||||
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 = scPregnancyRecordService.searchEarNumbers(query);
|
||||
return success(earNumbers);
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索耳号异常", e);
|
||||
return error("搜索耳号失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,7 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.zhyc.common.annotation.Log;
|
||||
import com.zhyc.common.core.controller.BaseController;
|
||||
import com.zhyc.common.core.domain.AjaxResult;
|
||||
@@ -245,4 +238,19 @@ public class ScSheepDeathController extends BaseController
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
import com.zhyc.common.annotation.Log;
|
||||
import com.zhyc.common.core.controller.BaseController;
|
||||
import com.zhyc.common.core.domain.AjaxResult;
|
||||
@@ -159,4 +152,20 @@ public class ScWeanRecordController extends BaseController {
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(scWeanRecordService.deleteScWeanRecordByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*/
|
||||
@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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.produce.breed.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -67,5 +69,15 @@ public class ScDryMilk extends BaseEntity
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
}
|
||||
|
||||
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||
this.allEarNumbers = allEarNumbers;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -121,6 +121,17 @@ public class ScLambingRecord extends BaseEntity
|
||||
@Excel(name = "未留养母羔数量")
|
||||
private Integer unretainedFemaleCount;
|
||||
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
}
|
||||
|
||||
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||
this.allEarNumbers = allEarNumbers;
|
||||
}
|
||||
|
||||
/** 羔羊信息列表(从羊只信息表查询) */
|
||||
private List<SheepLambInfo> lambInfoList;
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.produce.breed.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@@ -305,4 +307,15 @@ public class ScMiscarriageRecord extends BaseEntity
|
||||
.append("variety", getVariety())
|
||||
.toString();
|
||||
}
|
||||
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
}
|
||||
|
||||
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||
this.allEarNumbers = allEarNumbers;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.produce.breed.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -119,4 +121,14 @@ public class ScPregnancyRecord extends BaseEntity
|
||||
/** 配后天数 */
|
||||
@Excel(name = "配后天数")
|
||||
private Integer daysAfterMating;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
}
|
||||
|
||||
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||
this.allEarNumbers = allEarNumbers;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.produce.breed.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@@ -353,4 +355,15 @@ public class ScSheepDeath extends BaseEntity
|
||||
.append("isDelete", getIsDelete())
|
||||
.toString();
|
||||
}
|
||||
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
}
|
||||
|
||||
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||
this.allEarNumbers = allEarNumbers;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.zhyc.module.produce.breed.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
@@ -94,5 +96,15 @@ public class ScWeanRecord extends BaseEntity {
|
||||
@Excel(name = "繁育状态")
|
||||
private String breedingStatus;
|
||||
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
}
|
||||
|
||||
public void setAllEarNumbers(List<String> allEarNumbers) {
|
||||
this.allEarNumbers = allEarNumbers;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper;
|
||||
import java.util.List;
|
||||
import com.zhyc.module.produce.breed.domain.ScDryMilk;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 干奶记录Mapper接口
|
||||
@@ -68,4 +69,12 @@ public interface ScDryMilkMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScDryMilkByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
List<String> searchEarNumbers(@Param("query") String query);
|
||||
}
|
||||
@@ -85,4 +85,6 @@ public interface ScLambingRecordMapper
|
||||
* @return 后代总数
|
||||
*/
|
||||
Long countOffspringByRamId(String ramManageTags);
|
||||
|
||||
List<String> searchEarNumbers(@Param("query") String query);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.zhyc.module.produce.breed.domain.ScMiscarriageRecord;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 流产记录Mapper接口
|
||||
@@ -67,4 +68,12 @@ public interface ScMiscarriageRecordMapper
|
||||
* @return 羊只信息
|
||||
*/
|
||||
public Map<String, Object> selectSheepByManageTags(String manageTags);
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
List<String> searchEarNumbers(@Param("query") String query);
|
||||
}
|
||||
@@ -100,4 +100,12 @@ public interface ScPregnancyRecordMapper
|
||||
*/
|
||||
Long countPregnantEwesByRamIdAndBreedType(@Param("ramManageTags") String ramManageTags,
|
||||
@Param("breedType") Integer breedType);
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
List<String> searchEarNumbers(@Param("query") String query);
|
||||
}
|
||||
@@ -86,4 +86,12 @@ public interface ScSheepDeathMapper
|
||||
* @return 更新结果
|
||||
*/
|
||||
public int updateSheepStatus(@Param("sheepId") Long sheepId, @Param("status") String status);
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
List<String> searchEarNumbers(@Param("query") String query);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper;
|
||||
import java.util.List;
|
||||
import com.zhyc.module.produce.breed.domain.ScWeanRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 断奶记录Mapper接口
|
||||
@@ -75,4 +76,12 @@ public interface ScWeanRecordMapper {
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasSheepWeaningInfo(ScWeanRecord scWeanRecord);
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
List<String> searchEarNumbers(@Param("query") String query);
|
||||
}
|
||||
@@ -60,4 +60,12 @@ public interface IScDryMilkService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScDryMilkById(Long id);
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
public List<String> searchEarNumbers(String query);
|
||||
}
|
||||
|
||||
@@ -58,4 +58,6 @@ public interface IScLambingRecordService {
|
||||
* 查询羔羊详情
|
||||
*/
|
||||
public List<ScLambDetail> selectLambDetailByLambingRecordId(Long lambingRecordId);
|
||||
|
||||
public List<String> searchEarNumbers(String query);
|
||||
}
|
||||
@@ -67,4 +67,11 @@ public interface IScMiscarriageRecordService
|
||||
* @return 羊只信息
|
||||
*/
|
||||
public Map<String, Object> selectSheepByManageTags(String manageTags);
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
public List<String> searchEarNumbers(String query);
|
||||
}
|
||||
@@ -75,4 +75,11 @@ public interface IScPregnancyRecordService
|
||||
* @return 配种信息
|
||||
*/
|
||||
public Map<String, Object> getBreedInfoByManageTags(String manageTags);
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
public List<String> searchEarNumbers(String query);
|
||||
}
|
||||
@@ -67,4 +67,12 @@ public interface IScSheepDeathService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScSheepDeathById(Long id);
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
public List<String> searchEarNumbers(String query);
|
||||
}
|
||||
@@ -66,4 +66,12 @@ public interface IScWeanRecordService {
|
||||
* @return 羊只ID
|
||||
*/
|
||||
public Long selectSheepIdByEarNumber(String earNumber);
|
||||
|
||||
/**
|
||||
* 模糊查询母羊耳号列表
|
||||
*
|
||||
* @param query 查询关键字
|
||||
* @return 耳号列表
|
||||
*/
|
||||
public List<String> searchEarNumbers(String query);
|
||||
}
|
||||
@@ -138,4 +138,12 @@ public class ScDryMilkServiceImpl implements IScDryMilkService
|
||||
{
|
||||
return scDryMilkMapper.deleteScDryMilkById(id);
|
||||
}
|
||||
|
||||
// ScLambingRecordServiceImpl.java 添加方法
|
||||
|
||||
@Override
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
return scDryMilkMapper.searchEarNumbers(query);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,6 +40,10 @@ public class ScLambingRecordServiceImpl implements IScLambingRecordService {
|
||||
return scLambingRecordMapper.getLatestBreedingByEarNumber(earNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
return scLambingRecordMapper.searchEarNumbers(query);
|
||||
}
|
||||
/**
|
||||
* 新增产羔记录(包含羔羊详情)
|
||||
*/
|
||||
|
||||
@@ -167,4 +167,9 @@ public class ScMiscarriageRecordServiceImpl implements IScMiscarriageRecordServi
|
||||
|
||||
// 验证通过
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
return scMiscarriageRecordMapper.searchEarNumbers(query);
|
||||
}
|
||||
}
|
||||
@@ -271,4 +271,8 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService
|
||||
System.err.println("更新羊只怀孕状态失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
return scPregnancyRecordMapper.searchEarNumbers(query);
|
||||
}
|
||||
}
|
||||
@@ -207,4 +207,9 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
||||
|
||||
return scSheepDeathMapper.deleteScSheepDeathById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
return scSheepDeathMapper.searchEarNumbers(query);
|
||||
}
|
||||
}
|
||||
@@ -131,4 +131,9 @@ public class ScWeanRecordServiceImpl implements IScWeanRecordService {
|
||||
public Long selectSheepIdByEarNumber(String earNumber) {
|
||||
return scWeanRecordMapper.selectSheepIdByEarNumber(earNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> searchEarNumbers(String query) {
|
||||
return scWeanRecordMapper.searchEarNumbers(query);
|
||||
}
|
||||
}
|
||||
@@ -33,24 +33,41 @@
|
||||
<select id="selectScDryMilkList" parameterType="ScDryMilk" resultMap="ScDryMilkResult">
|
||||
<include refid="selectScDryMilkVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null and sheepId != ''"> and d.sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''"> and s.bs_manage_tags like concat('%', #{manageTags}, '%')</if>
|
||||
<if test="datetime != null "> and d.datetime = #{datetime}</if>
|
||||
<if test="status != null "> and d.status = #{status}</if>
|
||||
<if test="sheepfold != null "> and d.sheepfold = #{sheepfold}</if>
|
||||
<if test="tecahnician != null and tecahnician != ''"> and d.tecahnician like concat('%', #{tecahnician}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and d.create_by = #{createBy}</if>
|
||||
<if test="createTime != null "> and d.create_time = #{createTime}</if>
|
||||
<if test="variety != null and variety != ''"> and s.variety like concat('%', #{variety}, '%')</if>
|
||||
<!-- 多耳号精确匹配查询 -->
|
||||
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
|
||||
AND s.bs_manage_tags IN
|
||||
<foreach item="earNumber" collection="allEarNumbers" open="(" separator="," close=")">
|
||||
#{earNumber}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<!-- 保留原单耳号模糊查询(仅当allEarNumbers为空时生效) -->
|
||||
<if test="(allEarNumbers == null or allEarNumbers.size() == 0) and manageTags != null and manageTags != ''">
|
||||
AND s.bs_manage_tags LIKE CONCAT('%', #{manageTags}, '%')
|
||||
</if>
|
||||
|
||||
<if test="sheepId != null">AND d.sheep_id = #{sheepId}</if>
|
||||
<if test="datetime != null">AND d.datetime = #{datetime}</if>
|
||||
<if test="status != null">AND d.status = #{status}</if>
|
||||
<if test="sheepfold != null">AND d.sheepfold = #{sheepfold}</if>
|
||||
<if test="tecahnician != null and tecahnician != ''">
|
||||
AND d.tecahnician LIKE CONCAT('%', #{tecahnician}, '%')
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">AND d.create_by = #{createBy}</if>
|
||||
<if test="createTime != null">AND d.create_time = #{createTime}</if>
|
||||
<if test="variety != null and variety != ''">
|
||||
AND s.variety LIKE CONCAT('%', #{variety}, '%')
|
||||
</if>
|
||||
</where>
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectScDryMilkById" parameterType="Long" resultMap="ScDryMilkResult">
|
||||
<include refid="selectScDryMilkVo"/>
|
||||
where d.id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 根据耳号查询羊只ID -->
|
||||
<select id="selectSheepIdByManageTags" parameterType="String" resultType="Long">
|
||||
select id from sheep_file where bs_manage_tags = #{manageTags}
|
||||
@@ -105,4 +122,14 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 当 gender=null 时,不会添加 gender 条件,即查询全部羊 -->
|
||||
<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>
|
||||
@@ -105,7 +105,16 @@
|
||||
<select id="selectScLambingRecordList" parameterType="ScLambingRecord" resultMap="ScLambingRecordDetailResult">
|
||||
<include refid="selectScLambingRecordDetailVo"/>
|
||||
<where>
|
||||
<if test="femaleEarNumber != null and femaleEarNumber != ''"> and mother.bs_manage_tags LIKE CONCAT('%', #{femaleEarNumber}, '%')</if>
|
||||
<!-- 全部羊多耳号查询 -->
|
||||
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
|
||||
AND (
|
||||
<!-- 注意:s 代表 sheep_file 表的别名,根据实际 SQL 别名修改 -->
|
||||
mother.bs_manage_tags IN
|
||||
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
|
||||
#{earNumber}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="femaleBreed != null and femaleBreed != ''"> and mother.variety LIKE CONCAT('%', #{femaleBreed}, '%')</if>
|
||||
<if test="farm != null and farm != ''"> and mother.dr_ranch LIKE CONCAT('%', #{farm}, '%')</if>
|
||||
<if test="sheepId != null and sheepId != ''"> and lr.sheep_id = #{sheepId}</if>
|
||||
@@ -229,5 +238,15 @@
|
||||
FROM sc_breed_record br
|
||||
JOIN sc_lambing_record lr ON br.ewe_id = lr.sheep_id
|
||||
WHERE br.ram_id = #{ramManageTags} AND br.is_delete = 0
|
||||
|
||||
</select>
|
||||
<!-- 模糊查询耳号列表 -->
|
||||
<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>
|
||||
@@ -91,18 +91,12 @@
|
||||
<where>
|
||||
pr.is_delete = 0
|
||||
|
||||
<!-- 耳号搜索 - 支持多种匹配方式 -->
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
<bind name="searchTag" value="manageTags.trim()" />
|
||||
AND (
|
||||
<!-- 精确匹配 -->
|
||||
sf.bs_manage_tags = #{searchTag}
|
||||
<!-- 模糊匹配 -->
|
||||
OR sf.bs_manage_tags LIKE CONCAT('%', #{searchTag}, '%')
|
||||
<!-- 处理逗号分隔的多个耳号 -->
|
||||
OR FIND_IN_SET(sf.bs_manage_tags, REPLACE(#{searchTag}, ' ', '')) > 0
|
||||
<!-- 反向匹配:输入包含数据库中的耳号 -->
|
||||
OR #{searchTag} LIKE CONCAT('%', sf.bs_manage_tags, '%')
|
||||
<!-- 正确:sf.bs_manage_tags,sf是sheep_file的别名 -->
|
||||
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
|
||||
AND (sf.bs_manage_tags IN
|
||||
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
|
||||
#{earNumber}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
|
||||
@@ -242,4 +236,14 @@
|
||||
AND br.breed_type = #{breedType}
|
||||
AND pr.result IN ('有胎', '阳性', '怀孕')
|
||||
</select>
|
||||
|
||||
<!-- 模糊查询耳号列表 -->
|
||||
<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>
|
||||
@@ -25,12 +25,23 @@
|
||||
</resultMap>
|
||||
|
||||
<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
|
||||
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
|
||||
left join sheep_file s on d.sheep_id = s.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScSheepDeathList" parameterType="ScSheepDeath" resultMap="ScSheepDeathResult">
|
||||
<include refid="selectScSheepDeathVo"/>
|
||||
<where>
|
||||
<!-- 全部羊多耳号查询 -->
|
||||
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
|
||||
AND (
|
||||
<!-- 注意:s 代表 sheep_file 表的别名,根据实际 SQL 别名修改 -->
|
||||
s.bs_manage_tags IN
|
||||
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
|
||||
#{earNumber}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''"> and manage_tags = #{manageTags}</if>
|
||||
<if test="eventType != null and eventType != ''"> and event_type = #{eventType}</if>
|
||||
@@ -163,4 +174,13 @@
|
||||
AND is_delete = 0
|
||||
</update>
|
||||
|
||||
<!-- 模糊查询耳号列表 -->
|
||||
<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>
|
||||
@@ -44,6 +44,15 @@
|
||||
<select id="selectScWeanRecordList" parameterType="ScWeanRecord" resultMap="ScWeanRecordResult">
|
||||
<include refid="selectScWeanRecordVo"/>
|
||||
<where>
|
||||
<!-- 全部羊多耳号查询 -->
|
||||
<!-- 正确:sf.bs_manage_tags,sf是sheep_file的别名 -->
|
||||
<if test="allEarNumbers != null and allEarNumbers.size() > 0">
|
||||
AND (sf.bs_manage_tags IN
|
||||
<foreach collection="allEarNumbers" item="earNumber" open="(" separator="," close=")">
|
||||
#{earNumber}
|
||||
</foreach>
|
||||
)
|
||||
</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>
|
||||
@@ -142,4 +151,14 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</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>
|
||||
Reference in New Issue
Block a user