Merge remote-tracking branch 'origin/main'

This commit is contained in:
zyk
2026-03-07 11:22:22 +08:00
66 changed files with 573 additions and 231 deletions

View File

@@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
# url: jdbc:mysql://146.56.214.124:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://localhost:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: zhyc
# password: zhyc1234
url: jdbc:mysql://118.182.97.76:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8

View File

@@ -50,6 +50,7 @@ public class DaSheepfoldController extends BaseController
/**
* 主表格:羊舍级别汇总列表
*/
@PreAuthorize("@ss.hasPermi('sheepfold_management:sheepfold_management:list')")
@GetMapping("/summaryList")
public TableDataInfo summaryList(DaSheepfold daSheepfold) {
startPage();

View File

@@ -8,6 +8,7 @@ import com.zhyc.common.core.page.TableDataInfo;
import com.zhyc.common.core.text.Convert;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.service.ISheepFileService;
import org.apache.commons.lang3.StringUtils;
@@ -139,7 +140,7 @@ public class SheepFileController extends BaseController
PageHelper.startPage(pageNum, pageSize);
// 调用支持复杂查询的Service方法
List<SheepFile> list = sheepFileService.selectSheepFileListByCondition(customParams, sheepFile);
List<SheepFile> list = sheepFileService.selectSheepFileListByCondition( sheepFile,customParams);
return getDataTable(list);
}
@@ -255,7 +256,7 @@ public class SheepFileController extends BaseController
}
// 3. 获取数据并执行行过滤
List<SheepFile> list = sheepFileService.selectSheepFileListByCondition(customParams, sheepFile);
List<SheepFile> list = sheepFileService.selectSheepFileListByCondition(sheepFile,customParams);
if (StringUtils.isNotBlank(exportIdsStr)) {
List<String> exportIdList = Arrays.asList(exportIdsStr.split(","));
list = list.stream()
@@ -332,28 +333,28 @@ public class SheepFileController extends BaseController
@GetMapping("/stat/sheepType")
public AjaxResult statSheepType() {
return success(sheepFileService.countBySheepType());
return success(sheepFileService.countBySheepType(new SheepFile()));
}
@GetMapping("/stat/breedStatus")
public AjaxResult statBreedStatus() {
return success(sheepFileService.countByBreedStatus());
return success(sheepFileService.countByBreedStatus(new SheepFile()));
}
@GetMapping("/stat/variety")
public AjaxResult statVariety() {
return success(sheepFileService.countByVariety());
return success(sheepFileService.countByVariety(new SheepFile()));
}
@GetMapping("/stat/lactationParity")
public AjaxResult statLactationParity() {
return success(sheepFileService.countParityOfLactation());
return success(sheepFileService.countParityOfLactation(new SheepFile()));
}
// 在群总数
@GetMapping("/stat/inGroupCount")
public AjaxResult inGroupCount() {
return success(sheepFileService.countInGroup());
return success(sheepFileService.countInGroup(new SheepFile()));
}
/**

View File

@@ -19,70 +19,6 @@ public class DaSheepfold extends BaseEntity
{
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRanchId() {
return ranchId;
}
public void setRanchId(Long ranchId) {
this.ranchId = ranchId;
}
public String getSheepfoldName() {
return sheepfoldName;
}
public void setSheepfoldName(String sheepfoldName) {
this.sheepfoldName = sheepfoldName;
}
public Long getSheepfoldTypeId() {
return sheepfoldTypeId;
}
public void setSheepfoldTypeId(Long sheepfoldTypeId) {
this.sheepfoldTypeId = sheepfoldTypeId;
}
public String getSheepfoldNo() {
return sheepfoldNo;
}
public void setSheepfoldNo(String sheepfoldNo) {
this.sheepfoldNo = sheepfoldNo;
}
public String getRowNo() {
return rowNo;
}
public void setRowNo(String rowNo) {
this.rowNo = rowNo;
}
public String getColumns() {
return columns;
}
public void setColumns(String columns) {
this.columns = columns;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
/** 羊舍id */
@Excel(name = "羊舍id")
private Long id;
@@ -127,20 +63,4 @@ public class DaSheepfold extends BaseEntity
/** 部门编号 */
private Long deptId;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
}

View File

@@ -3,8 +3,6 @@ package com.zhyc.module.base.mapper;
import com.zhyc.module.base.domain.SheepFile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.SelectProvider;
import java.util.List;
import java.util.Map;
@@ -50,19 +48,19 @@ public interface SheepFileMapper
SheepFile selectSheepByManageTags(String tags);
// 在群羊只总数
Long countInGroup();
Long countInGroup(SheepFile sheep);
// 羊只类别分布(按 name 分组)
List<Map<String,Object>> countBySheepType();
List<Map<String,Object>> countBySheepType(SheepFile sheep);
// 繁育状态分布(按 breed 分组)
List<Map<String,Object>> countByBreedStatus();
List<Map<String,Object>> countByBreedStatus(SheepFile sheep);
// 品种分布(按 variety 分组)
List<Map<String,Object>> countByVariety();
List<Map<String,Object>> countByVariety(SheepFile sheep);
// 泌乳羊胎次分布name = '泌乳羊' 时按 parity 分组)
List<Map<String,Object>> countParityOfLactation();
List<Map<String,Object>> countParityOfLactation(SheepFile sheep);
/**
* 获取指定字段的唯一值列表 (配合 XML 中的 selectFieldValues)
@@ -75,22 +73,22 @@ public interface SheepFileMapper
* 必须使用 @Param 注解以便 XML 能正确识别两个参数
*/
List<SheepFile> selectSheepFileListByCondition(
@Param("params") Map<String, Object> params,
@Param("sheepFile") SheepFile sheepFile
);
/**
* 保留原有 Provider 方法 (若项目其他地方有用到)
*/
@SelectProvider(type = SheepFileSqlProvider.class, method = "selectByCondition")
@ResultMap("SheepFileResult")
List<SheepFile> selectByCondition(
@Param("sheepFile") SheepFile sheepFile,
@Param("conditions") Map<String, Object> conditions
@Param("params") Map<String, Object> params
);
@SelectProvider(type = SheepFileSqlProvider.class, method = "selectFieldValues")
List<String> selectFieldValuesByProvider(@Param("fieldName") String fieldName);
// /**
// * 保留原有 Provider 方法 (若项目其他地方有用到)
// */
// @SelectProvider(type = SheepFileSqlProvider.class, method = "selectByCondition")
// @ResultMap("SheepFileResult")
// List<SheepFile> selectByCondition(
// @Param("sheepFile") SheepFile sheepFile,
// @Param("conditions") Map<String, Object> conditions
// );
//
// @SelectProvider(type = SheepFileSqlProvider.class, method = "selectFieldValues")
// List<String> selectFieldValuesByProvider(@Param("fieldName") String fieldName);
/**
* 查询所有公羊gender=2

View File

@@ -1,6 +1,7 @@
package com.zhyc.module.base.service;
import com.zhyc.module.base.domain.SheepFile;
import io.lettuce.core.dynamic.annotation.Param;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@@ -34,26 +35,21 @@ public interface ISheepFileService
SheepFile selectBasSheepByManageTags(String trim);
Long countInGroup();
Long countInGroup(SheepFile sheepFile);
List<Map<String,Object>> countBySheepType();
List<Map<String,Object>> countByBreedStatus();
List<Map<String,Object>> countByVariety();
List<Map<String,Object>> countParityOfLactation();
List<Map<String,Object>> countBySheepType(SheepFile sheepFile);
List<Map<String,Object>> countByBreedStatus(SheepFile sheepFile);
List<Map<String,Object>> countByVariety(SheepFile sheepFile);
List<Map<String,Object>> countParityOfLactation(SheepFile sheepFile);
/**
* 获取指定字段的唯一值列表
*/
List<String> getFieldValues(String fieldName);
/**
* 根据复杂条件查询羊只档案列表
* @param params 自定义参数Map (用于动态SQL)
* @param sheepFile 包含List筛选条件的实体对象
*/
List<SheepFile> selectSheepFileListByCondition(
Map<String, Object> params,
SheepFile sheepFile
@Param("sheepFile") SheepFile sheepFile,
@Param("params") Map<String, Object> params
);
@Transactional

View File

@@ -63,8 +63,10 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
* 羊舍级别汇总查询(主表格)
*/
@DataScope(deptAlias = "ds", userAlias = "ds")
@Override
public List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold) {
return daSheepfoldMapper.selectDaSheepfoldSummaryList(daSheepfold);
List<DaSheepfold> sheepfoldList = daSheepfoldMapper.selectDaSheepfoldSummaryList(daSheepfold);
return sheepfoldList;
}
/**

View File

@@ -2,6 +2,7 @@ package com.zhyc.module.base.service.impl;
// 新增这一行导入
import com.zhyc.common.annotation.DataScope;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.BreedRamFile;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.SheepFileMapper;
@@ -61,31 +62,33 @@ public class SheepFileServiceImpl implements ISheepFileService {
@DataScope(deptAlias = "sf", userAlias = "sf")
@Override
public List<Map<String, Object>> countBySheepType() {
return sheepFileMapper.countBySheepType();
public List<Map<String, Object>> countBySheepType(SheepFile sheepFile) {
return sheepFileMapper.countBySheepType(sheepFile);
}
@DataScope(deptAlias = "sf", userAlias = "sf")
@Override
public List<Map<String, Object>> countByBreedStatus() {
return sheepFileMapper.countByBreedStatus();
public List<Map<String, Object>> countByBreedStatus(SheepFile sheepFile) {
return sheepFileMapper.countByBreedStatus(sheepFile);
}
@DataScope(deptAlias = "sf", userAlias = "sf")
@Override
public List<Map<String, Object>> countByVariety() {
return sheepFileMapper.countByVariety();
public List<Map<String, Object>> countByVariety(SheepFile sheepFile) {
return sheepFileMapper.countByVariety(sheepFile);
}
@DataScope(deptAlias = "sf", userAlias = "sf")
@Override
public List<Map<String, Object>> countParityOfLactation() {
return sheepFileMapper.countParityOfLactation();
public List<Map<String, Object>> countParityOfLactation(SheepFile sheepFile) {
return sheepFileMapper.countParityOfLactation(sheepFile);
}
@DataScope(deptAlias = "sf", userAlias = "sf")
@Override
public Long countInGroup() { return sheepFileMapper.countInGroup(); }
public Long countInGroup(SheepFile sheepFile) {
return sheepFileMapper.countInGroup(sheepFile);
}
/**
* 获取指定字段的唯一值列表
@@ -110,13 +113,14 @@ public class SheepFileServiceImpl implements ISheepFileService {
*/
@DataScope(deptAlias = "sf", userAlias = "sf")
@Override
public List<SheepFile> selectSheepFileListByCondition(Map<String, Object> params, SheepFile sheepFile) {
public List<SheepFile> selectSheepFileListByCondition( SheepFile sheepFile,Map<String, Object> params) {
// 1. 验证并处理自定义参数 (驼峰转下划线、安全检查)
Map<String, Object> safeConditions = processConditions(params);
System.out.println("sheepFile.params: " + (sheepFile.getParams() != null ? sheepFile.getParams().get("dataScope") : "null"));
// 2. 调用 Mapper
// 这里必须使用与 XML 中 <select id="selectSheepFileListByCondition"> 对应的方法
return sheepFileMapper.selectSheepFileListByCondition(safeConditions, sheepFile);
return sheepFileMapper.selectSheepFileListByCondition(sheepFile,safeConditions);
}
@Override

View File

@@ -47,6 +47,16 @@ public class DewormController extends BaseController
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('biosafety:deworm:list')")
@GetMapping("/searchEarNumbers")
public AjaxResult getSheepNoList(String sheepNo)
{
Deworm deworm = new Deworm();
deworm.setSheepNo(sheepNo);
List<String> list = dewormService.selectSheepNoList(deworm);
return success(list);
}
/**
* 导出驱虫列表
*/

View File

@@ -2,6 +2,8 @@ package com.zhyc.module.biosafety.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.biosafety.domain.Deworm;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -114,4 +116,15 @@ public class DiagnosisController extends BaseController
{
return toAjax(diagnosisService.deleteDiagnosisByIds(ids));
}
@PreAuthorize("@ss.hasPermi('biosafety:diagnosis:list')")
@GetMapping("/searchEarNumbers")
public AjaxResult getSheepNoList(String sheepNo)
{
Diagnosis diagnosis = new Diagnosis();
diagnosis.setSheepNo(sheepNo);
List<String> list = diagnosisService.selectSheepNoList(diagnosis);
return success(list);
}
}

View File

@@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.module.biosafety.domain.Deworm;
import com.zhyc.module.biosafety.service.IHealthService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@@ -105,4 +106,15 @@ public class HealthController extends BaseController
{
return toAjax(healthService.deleteHealthByIds(ids));
}
@PreAuthorize("@ss.hasPermi('biosafety:health:list')")
@GetMapping("/searchEarNumbers")
public AjaxResult getSheepNoList(String sheepNo)
{
Health health = new Health();
health.setSheepNo(sheepNo);
List<String> list = healthService.selectSheepNoList(health);
return success(list);
}
}

View File

@@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.biosafety.domain.Health;
import com.zhyc.module.biosafety.service.IImmunityService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@@ -104,4 +105,15 @@ public class ImmunityController extends BaseController
{
return toAjax(immunityService.deleteImmunityByIds(ids));
}
@PreAuthorize("@ss.hasPermi('biosafety:immunity:list')")
@GetMapping("/searchEarNumbers")
public AjaxResult getSheepNoList(String sheepNo)
{
Immunity immunity = new Immunity();
immunity.setSheepNo(sheepNo);
List<String> list = immunityService.selectSheepNoList(immunity);
return success(list);
}
}

View File

@@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.biosafety.domain.Health;
import com.zhyc.module.biosafety.domain.QuarantineReport;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@@ -104,4 +105,15 @@ public class QuarantineReportController extends BaseController
{
return toAjax(quarantineReportService.deleteQuarantineReportByIds(ids));
}
@PreAuthorize("@ss.hasPermi('biosafety:quarantine:list')")
@GetMapping("/searchEarNumbers")
public AjaxResult getSheepNoList(String sheepNo)
{
QuarantineReport report = new QuarantineReport();
report.setSheepNo(sheepNo);
List<String> list = quarantineReportService.selectSheepNoList(report);
return success(list);
}
}

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.biosafety.domain.Health;
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.service.ISwMedicineUsageService;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -110,4 +111,14 @@ public class SwMedicineUsageController extends BaseController
{
return toAjax(swMedicineUsageService.deleteSwMedicineUsageByIds(ids));
}
@PreAuthorize("@ss.hasPermi('biosafety:usageInfo:list')")
@GetMapping("/searchEarNumbers")
public AjaxResult getSheepNoList(String sheepNo)
{
SwMedicineUsage usage = new SwMedicineUsage();
usage.setSheepNo(sheepNo);
List<String> list = swMedicineUsageService.selectSheepNoList(usage);
return success(list);
}
}

View File

@@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.biosafety.domain.Health;
import com.zhyc.module.biosafety.domain.Treatment;
import com.zhyc.module.biosafety.service.ITreatmentService;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -104,4 +105,15 @@ public class TreatmentController extends BaseController
{
return toAjax(treatmentService.deleteTreatmentByIds(ids));
}
@PreAuthorize("@ss.hasPermi('biosafety:treatment:list')")
@GetMapping("/searchEarNumbers")
public AjaxResult getSheepNoList(String sheepNo)
{
Treatment treatment = new Treatment();
treatment.setSheepNo(sheepNo);
List<String> list = treatmentService.selectSheepNoList(treatment);
return success(list);
}
}

View File

@@ -61,4 +61,6 @@ public interface DewormMapper
* @return 结果
*/
public int deleteDewormByIds(Long[] ids);
List<String> selectSheepNoList(Deworm deworm);
}

View File

@@ -60,4 +60,6 @@ public interface DiagnosisMapper
* @return 结果
*/
public int deleteDiagnosisByIds(Long[] ids);
List<String> selectSheepNoList(Diagnosis diagnosis);
}

View File

@@ -13,6 +13,9 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface HealthMapper
{
/**
* 查询保健
*
@@ -60,4 +63,6 @@ public interface HealthMapper
* @return 结果
*/
public int deleteHealthByIds(Long[] ids);
List<String> selectSheepNoList(Health health);
}

View File

@@ -60,4 +60,6 @@ public interface ImmunityMapper
* @return 结果
*/
public int deleteImmunityByIds(Long[] ids);
List<String> selectSheepNoList(Immunity immunity);
}

View File

@@ -61,4 +61,6 @@ public interface QuarantineReportMapper
* @return 结果
*/
public int deleteQuarantineReportByIds(Long[] ids);
List<String> selectSheepNoList(QuarantineReport report);
}

View File

@@ -89,4 +89,6 @@ public interface SwMedicineUsageMapper
public int deleteSwMedicineUsageDetailsByMediUsage(Integer id);
List<SwMedicineUsageDetails> selectSwMedicineUsageDetailsById(Integer id);
List<String> selectSheepNoList(SwMedicineUsage usage);
}

View File

@@ -66,4 +66,6 @@ public interface TreatmentMapper
List<Treatment> selectTreatmentStatus(Long sheepId);
List<String> selectSheepNoList(Treatment treatment);
}

View File

@@ -59,4 +59,6 @@ public interface IDewormService
* @return 结果
*/
public int deleteDewormById(Long id);
List<String> selectSheepNoList(Deworm deworm);
}

View File

@@ -61,4 +61,6 @@ public interface IDiagnosisService
public int deleteDiagnosisById(Long id);
int insertDiagnosisList(Diagnosis diagnosis);
List<String> selectSheepNoList(Diagnosis diagnosis);
}

View File

@@ -58,4 +58,6 @@ public interface IHealthService
* @return 结果
*/
public int deleteHealthById(Long id);
List<String> selectSheepNoList(Health health);
}

View File

@@ -58,4 +58,6 @@ public interface IImmunityService
* @return 结果
*/
public int deleteImmunityById(Long id);
List<String> selectSheepNoList(Immunity immunity);
}

View File

@@ -59,4 +59,6 @@ public interface IQuarantineReportService
* @return 结果
*/
public int deleteQuarantineReportById(Long id);
List<String> selectSheepNoList(QuarantineReport report);
}

View File

@@ -61,4 +61,6 @@ public interface ISwMedicineUsageService
public int deleteSwMedicineUsageById(Integer id);
List<SwMedicineUsageDetails> selectSwMedicineUsageDetailsById(Integer id);
List<String> selectSheepNoList(SwMedicineUsage usage);
}

View File

@@ -60,4 +60,6 @@ public interface ITreatmentService
* @return 结果
*/
public int deleteTreatmentById(Long id);
List<String> selectSheepNoList(Treatment treatment);
}

View File

@@ -172,4 +172,10 @@ public class DewormServiceImpl implements IDewormService
{
return dewormMapper.deleteDewormById(id);
}
@DataScope(deptAlias = "s", userAlias = "s")
@Override
public List<String> selectSheepNoList(Deworm deworm) {
return dewormMapper.selectSheepNoList(deworm);
}
}

View File

@@ -11,6 +11,7 @@ import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.BasSheepMapper;
import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.biosafety.domain.Deworm;
import com.zhyc.module.biosafety.domain.Treatment;
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
import com.zhyc.module.biosafety.mapper.TreatmentMapper;
@@ -220,4 +221,10 @@ public class DiagnosisServiceImpl implements IDiagnosisService
return diagnosisMapper.deleteDiagnosisById(id);
}
@DataScope(deptAlias = "s", userAlias = "s")
@Override
public List<String> selectSheepNoList(Diagnosis diagnosis) {
return diagnosisMapper.selectSheepNoList(diagnosis);
}
}

View File

@@ -11,6 +11,7 @@ import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.bean.BeanUtils;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.biosafety.domain.Deworm;
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
@@ -165,4 +166,11 @@ public class HealthServiceImpl implements IHealthService
{
return healthMapper.deleteHealthById(id);
}
@DataScope(deptAlias = "s", userAlias = "s")
@Override
public List<String> selectSheepNoList(Health health) {
return healthMapper.selectSheepNoList(health);
}
}

View File

@@ -9,6 +9,7 @@ import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.bean.BeanUtils;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.biosafety.domain.Deworm;
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
@@ -170,4 +171,10 @@ public class ImmunityServiceImpl implements IImmunityService
{
return immunityMapper.deleteImmunityById(id);
}
@DataScope(deptAlias = "s", userAlias = "s")
@Override
public List<String> selectSheepNoList(Immunity immunity) {
return immunityMapper.selectSheepNoList(immunity);
}
}

View File

@@ -9,6 +9,7 @@ import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.bean.BeanUtils;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.service.impl.SheepFileServiceImpl;
import com.zhyc.module.biosafety.domain.Immunity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.biosafety.mapper.QuarantineReportMapper;
@@ -136,4 +137,10 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
{
return quarantineReportMapper.deleteQuarantineReportById(id);
}
@DataScope(deptAlias = "s", userAlias = "s")
@Override
public List<String> selectSheepNoList(QuarantineReport report) {
return quarantineReportMapper.selectSheepNoList(report);
}
}

View File

@@ -5,6 +5,7 @@ import java.util.List;
import com.zhyc.common.annotation.DataScope;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.module.biosafety.domain.Immunity;
import com.zhyc.module.biosafety.service.ISwMedicineUsageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -152,4 +153,10 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService
}
}
}
@DataScope(deptAlias = "s", userAlias = "s")
@Override
public List<String> selectSheepNoList(SwMedicineUsage usage) {
return swMedicineUsageMapper.selectSheepNoList(usage);
}
}

View File

@@ -10,15 +10,12 @@ import com.zhyc.common.utils.bean.BeanUtils;
import com.zhyc.module.Exception.BusinessException;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.biosafety.domain.Diagnosis;
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
import com.zhyc.module.biosafety.domain.*;
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.biosafety.mapper.TreatmentMapper;
import com.zhyc.module.biosafety.domain.Treatment;
import com.zhyc.module.biosafety.service.ITreatmentService;
import org.springframework.transaction.annotation.Transactional;
@@ -243,6 +240,12 @@ public class TreatmentServiceImpl implements ITreatmentService
return treatmentMapper.deleteTreatmentById(id);
}
@DataScope(deptAlias = "s", userAlias = "s")
@Override
public List<String> selectSheepNoList(Treatment treatment) {
return treatmentMapper.selectSheepNoList(treatment);
}
public void updateTreatmentStatus(Long sheepId) {
List<Treatment> treatments=treatmentMapper.selectTreatmentStatus(sheepId);
Diagnosis diagnosis = new Diagnosis();

View File

@@ -5,6 +5,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate;
import com.zhyc.module.produce.breed.service.IScBreedPlanGenerateService;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -50,7 +51,7 @@ public class ScBreedPlanGenerateController extends BaseController
@GetMapping("/selectEwe")
public AjaxResult selectEligibleEwe(@RequestParam(value = "manageTags", required = false) String manageTags)
{
List<Map<String, Object>> eligibleEwe = scBreedPlanGenerateService.selectEligibleEwe(manageTags);
List<Map<String, Object>> eligibleEwe = scBreedPlanGenerateService.selectEligibleEwe(new SheepFile(),manageTags);
return success(eligibleEwe);
}
@@ -61,7 +62,7 @@ public class ScBreedPlanGenerateController extends BaseController
@GetMapping("/selectRam")
public AjaxResult selectEligibleRam(@RequestParam(value = "manageTags", required = false) String manageTags)
{
List<Map<String, Object>> eligibleRam = scBreedPlanGenerateService.selectEligibleRam(manageTags);
List<Map<String, Object>> eligibleRam = scBreedPlanGenerateService.selectEligibleRam(new SheepFile(),manageTags);
return success(eligibleRam);
}

View File

@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper;
import java.util.List;
import java.util.Map;
import com.zhyc.module.base.domain.SheepFile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate;
@@ -38,14 +39,14 @@ public interface ScBreedPlanGenerateMapper
*
* @return 符合条件的母羊列表
*/
public List<Map<String, Object>> selectEligibleEwe();
public List<Map<String, Object>> selectEligibleEwe(SheepFile sheepFile);
/**
* 筛选符合条件的公羊
*
* @return 符合条件的公羊列表
*/
public List<Map<String, Object>> selectEligibleRam();
public List<Map<String, Object>> selectEligibleRam(SheepFile sheepFile);
/**
* 新增配种计划生成

View File

@@ -3,6 +3,8 @@ package com.zhyc.module.produce.breed.service;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
@@ -37,14 +39,14 @@ public interface IScBreedPlanGenerateService
*
* @return 符合条件的母羊列表
*/
public List<Map<String, Object>> selectEligibleEwe(@RequestParam(value = "manageTags", required = false) String manageTags);
public List<Map<String, Object>> selectEligibleEwe(SheepFile sheepFile, @RequestParam(value = "manageTags", required = false) String manageTags);
/**
* 筛选符合条件的公羊
*
* @return 符合条件的公羊列表
*/
public List<Map<String, Object>> selectEligibleRam(@RequestParam(value = "manageTags", required = false) String manageTags);
public List<Map<String, Object>> selectEligibleRam(SheepFile sheepFile, @RequestParam(value = "manageTags", required = false) String manageTags);
void exportSelectedPairs(HttpServletResponse response, List<Long> eweIds, List<Long> ramIds);

View File

@@ -11,6 +11,7 @@ import java.io.InputStream;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.common.annotation.DataScope;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.produce.breed.domain.ScBreedPlan;
import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate;
import com.zhyc.module.produce.breed.mapper.ScBreedPlanGenerateMapper;
@@ -65,19 +66,21 @@ public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateServi
/**
* 筛选符合条件的母羊
*/
@DataScope(deptAlias = "bs", userAlias = "bs")
@Override
public List<Map<String, Object>> selectEligibleEwe(@RequestParam(value = "manageTags", required = false) String manageTags)
public List<Map<String, Object>> selectEligibleEwe(SheepFile sheepFile, @RequestParam(value = "manageTags", required = false) String manageTags)
{
return scBreedPlanGenerateMapper.selectEligibleEwe();
return scBreedPlanGenerateMapper.selectEligibleEwe(sheepFile);
}
/**
* 筛选符合条件的公羊
*/
@DataScope(deptAlias = "bs", userAlias = "bs")
@Override
public List<Map<String, Object>> selectEligibleRam(@RequestParam(value = "manageTags", required = false) String manageTags)
public List<Map<String, Object>> selectEligibleRam(SheepFile sheepFile,@RequestParam(value = "manageTags", required = false) String manageTags)
{
return scBreedPlanGenerateMapper.selectEligibleRam();
return scBreedPlanGenerateMapper.selectEligibleRam(sheepFile);
}
/**
@@ -453,7 +456,7 @@ public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateServi
result.put("planInfo", planGenerate);
List<Map<String, Object>> planDetails = scBreedPlanGenerateMapper.selectApproveBreedPlanDetails(id);
result.put("planDetails", planDetails);
List<Map<String, Object>> availableRams = scBreedPlanGenerateMapper.selectEligibleRam();
List<Map<String, Object>> availableRams = scBreedPlanGenerateMapper.selectEligibleRam(new SheepFile());
result.put("availableRams", availableRams);
return result;
}

View File

@@ -46,6 +46,7 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService
* @param scPregnancyRecord 孕检记录
* @return 孕检记录
*/
@DataScope(deptAlias = "pr", userAlias = "pr")
@Override
public List<ScPregnancyRecord> selectScPregnancyRecordList(ScPregnancyRecord scPregnancyRecord)
{

View File

@@ -134,15 +134,30 @@ public class SxSheepSaleController extends BaseController {
}
/**
* 【新增】搜索耳号(模糊查询)
* 【修改】搜索耳号(模糊查询,支持羊舍过滤
*/
@GetMapping("/searchEarNumbers")
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
public AjaxResult searchEarNumbers(
@RequestParam(value = "query", required = false) String query,
@RequestParam(value = "sheepfoldId", required = false) Long sheepfoldId) {
try {
List<String> earNumbers = sxSheepSaleService.searchEarNumbers(query);
List<String> earNumbers = sxSheepSaleService.searchEarNumbers(query, sheepfoldId);
return success(earNumbers);
} catch (Exception e) {
return error("搜索耳号失败:" + e.getMessage());
}
}
/**
* 【新增】专门用于顶部查询条件:搜索列表中已销售的羊只耳号
*/
@GetMapping("/searchSoldEarNumbers")
public AjaxResult searchSoldEarNumbers(@RequestParam(value = "query", required = false) String query) {
try {
List<String> earNumbers = sxSheepSaleService.searchSoldEarNumbers(query);
return success(earNumbers);
} catch (Exception e) {
return error("搜索已销售耳号失败:" + e.getMessage());
}
}
}

View File

@@ -192,6 +192,15 @@ public class SxSheepSale extends BaseEntity {
/** 【新增】非数据库字段:用于前端展示和选择羊舍后传递多个耳号 */
private List<String> bsManageTagsList;
/** 【新增】非数据库字段用于导出指定的记录ID集合 */
private List<Long> exportIds;
/** * 【修复】在子类中重新声明 remark 字段,并打上 @Excel 注解
* 解决 @Excel 不能作用于方法的问题,使得导出时能成功抓取备注列
*/
@Excel(name = "备注")
private String remark;
public void setId(Long id) {
this.id = id;
}
@@ -552,6 +561,27 @@ public class SxSheepSale extends BaseEntity {
this.customerArea = customerArea;
}
public List<Long> getExportIds() {
return exportIds;
}
public void setExportIds(List<Long> exportIds) {
this.exportIds = exportIds;
}
/**
* 【修复】重写 get/set 方法,指向子类自身的 remark 字段
*/
@Override
public String getRemark() {
return remark;
}
@Override
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -600,6 +630,8 @@ public class SxSheepSale extends BaseEntity {
.append("createdByName", getCreatedByName())
.append("sheepfoldName", getSheepfoldName())
.append("currentWeight", getCurrentWeight())
.append("exportIds", getExportIds())
.append("bsManageTagsList", getBsManageTagsList())
.toString();
}
}

View File

@@ -74,10 +74,16 @@ public interface SxSheepSaleMapper {
public List<String> selectSheepTagsBySheepfoldId(Long sheepfoldId);
/**
* 【新增】模糊查询羊只耳号列表(用于前端搜索补全
* 【修改】模糊查询羊只耳号列表(支持传入羊舍ID过滤
* @param query 查询关键字
* @param sheepfoldId 羊舍ID可为空
* @return 耳号列表
*/
public List<String> searchEarNumbers(@Param("query") String query);
public List<String> searchEarNumbers(@Param("query") String query, @Param("sheepfoldId") Long sheepfoldId);
/**
* 【新增】查询已销售的原始耳号数据(含逗号分隔的字符串)
*/
public List<String> selectSoldEarNumbers(@Param("query") String query);
}

View File

@@ -70,10 +70,16 @@ public interface ISxSheepSaleService {
*/
public List<String> selectSheepTagsBySheepfoldId(Long sheepfoldId);
/**
* 【新增】模糊查询羊只耳号列表
* 【修改】模糊查询羊只耳号列表
*/
public List<String> searchEarNumbers(String query, Long sheepfoldId);
/**
* 【新增】查询已销售的单独耳号列表(拆分逗号并去重)
* @param query 查询关键字
* @return 耳号列表
*/
public List<String> searchEarNumbers(String query);
public List<String> searchSoldEarNumbers(String query);
}

View File

@@ -1,6 +1,9 @@
package com.zhyc.module.sale.service.impl;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
import java.math.BigDecimal;
import java.math.RoundingMode;
import org.springframework.beans.factory.annotation.Autowired;
@@ -9,6 +12,9 @@ import com.zhyc.common.annotation.DataScope;
import com.zhyc.module.sale.mapper.SxSheepSaleMapper;
import com.zhyc.module.sale.domain.SxSheepSale;
import com.zhyc.module.sale.service.ISxSheepSaleService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.BeanUtils;
import java.util.Arrays;
/**
* 羊只销售记录Service业务层处理
@@ -47,53 +53,93 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
}
/**
* 新增羊只销售记录
*
* @param sxSheepSale 羊只销售记录
* @return 结果
* 新增羊只销售记录(支持多选耳号自动拆分为单条记录)
*/
@Override
@Transactional(rollbackFor = Exception.class) // 增加事务注解,确保批量插入要么全成功,要么全失败
public int insertSxSheepSale(SxSheepSale sxSheepSale) {
// 1. 业务验证 (必填项校验、级联校验)
validateSalesFields(sxSheepSale);
// 2. 自动计算逻辑 (价格、体重)
// 2. 获取标签列表
List<String> tags = sxSheepSale.getBsManageTagsList();
if (tags == null || tags.isEmpty()) {
if (sxSheepSale.getBsManageTags() != null && !sxSheepSale.getBsManageTags().isEmpty()) {
tags = Arrays.asList(sxSheepSale.getBsManageTags().split(","));
} else {
throw new RuntimeException("耳号不能为空!");
}
}
// 3. 先计算出这批羊的总价、均价、均重(基于前端传来的总数量和总重量)
// 这里的 calculateSalesFields 会自动根据 tags 的数量算出 avgWeight 和 avgPricePerSheep
calculateSalesFields(sxSheepSale);
// 3. 设置默认事件类型
if (sxSheepSale.getEventType() == null) {
sxSheepSale.setEventType("销售");
int rows = 0;
// 4. 遍历每个耳号,拆分为独立的记录进行保存
for (String tag : tags) {
SxSheepSale singleRecord = new SxSheepSale();
// 复制前端传来的公共基础属性(如日期、客户信息、销售人员等)
BeanUtils.copyProperties(sxSheepSale, singleRecord);
// 防御性清空主键,防止 MyBatis 主键回填导致重复主键冲突
singleRecord.setId(null);
// 覆盖为单个耳号
singleRecord.setBsManageTags(tag);
// 清空列表,避免后续影响
singleRecord.setBsManageTagsList(null);
// 5. 调整单条记录的价格和重量字段,使其符合“单只羊”的逻辑
if ("按个体".equals(singleRecord.getPricingMethod())) {
// 按个体卖:单只羊的总价就是单价
singleRecord.setTotalPrice(singleRecord.getUnitPrice());
singleRecord.setAvgPricePerSheep(singleRecord.getUnitPrice());
singleRecord.setTotalWeight(null);
singleRecord.setAvgWeight(null);
} else if ("按体重".equals(singleRecord.getPricingMethod())) {
// 按体重卖:单只羊的重量设为这批羊的平均重量,单只羊的价格设为平均价格
singleRecord.setTotalWeight(sxSheepSale.getAvgWeight());
singleRecord.setAvgWeight(sxSheepSale.getAvgWeight());
singleRecord.setTotalPrice(sxSheepSale.getAvgPricePerSheep());
singleRecord.setAvgPricePerSheep(sxSheepSale.getAvgPricePerSheep());
}
// 4. 处理耳号列表(多个耳号用逗号分隔)
if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) {
sxSheepSale.setBsManageTags(String.join(",", sxSheepSale.getBsManageTagsList()));
// 6. 设置默认事件类型
if (singleRecord.getEventType() == null) {
singleRecord.setEventType("销售");
}
// 5. 调用Mapper插入数据
return sxSheepSaleMapper.insertSxSheepSale(sxSheepSale);
// 7. 插入数据
rows += sxSheepSaleMapper.insertSxSheepSale(singleRecord);
}
return rows;
}
/**
* 修改羊只销售记录
*
* @param sxSheepSale 羊只销售记录
* @return 结果
*/
@Override
public int updateSxSheepSale(SxSheepSale sxSheepSale) {
// 1. 业务验证
validateSalesFields(sxSheepSale);
// 2. 自动计算逻辑
calculateSalesFields(sxSheepSale);
// 3. 处理耳号列表(多个耳号用逗号分隔)
if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) {
sxSheepSale.setBsManageTags(String.join(",", sxSheepSale.getBsManageTagsList()));
// 2. 限制修改时只能是单只羊
if (sxSheepSale.getBsManageTagsList() != null && sxSheepSale.getBsManageTagsList().size() > 1) {
throw new RuntimeException("修改单条记录时只能保留一个耳号。如需销售更多羊只,请使用新增功能!");
}
// 4. 调用Mapper更新数据
// 3. 自动计算逻辑此时只会按1只羊进行准确计算
calculateSalesFields(sxSheepSale);
// 4. 处理耳号列表,确保保存的是单个字符串
if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) {
sxSheepSale.setBsManageTags(sxSheepSale.getBsManageTagsList().get(0));
}
// 5. 调用Mapper更新数据
return sxSheepSaleMapper.updateSxSheepSale(sxSheepSale);
}
@@ -136,10 +182,9 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
* 【新增】实现模糊查询耳号
*/
@Override
public List<String> searchEarNumbers(String query) {
return sxSheepSaleMapper.searchEarNumbers(query);
public List<String> searchEarNumbers(String query, Long sheepfoldId) {
return sxSheepSaleMapper.searchEarNumbers(query, sheepfoldId);
}
/**
* 自动计算总价、平均体重、平均单只价格
*/
@@ -226,4 +271,29 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
}
}
}
/**
* 【新增】实现查询已销售的耳号,并处理逗号分隔的问题
*/
@Override
public List<String> searchSoldEarNumbers(String query) {
// 获取包含关键字的原始字符串(可能包含逗号)
List<String> rawTags = sxSheepSaleMapper.selectSoldEarNumbers(query);
Set<String> uniqueTags = new HashSet<>();
for (String raw : rawTags) {
if (raw != null && !raw.isEmpty()) {
String[] tags = raw.split(",");
for (String tag : tags) {
// 再次进行精准包含判断(过滤掉连带查出的其他无辜耳号)
if (query == null || query.isEmpty() || tag.contains(query)) {
uniqueTags.add(tag);
}
}
}
}
// 转为列表按字母排序提升体验限制返回最多50条
return uniqueTags.stream().sorted().limit(50).collect(Collectors.toList());
}
}

View File

@@ -74,7 +74,7 @@
</resultMap>
<sql id="selectSheepFileVo">
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, current_weight,weaning_day_age,weaning_daily_gain,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 from sheep_file
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, current_weight,weaning_day_age,weaning_daily_gain,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 from sheep_file sf
</sql>
<select id="selectSheepFileList" parameterType="SheepFile" resultMap="SheepFileResult">
@@ -95,7 +95,7 @@
ORDER BY id ASC
</select>
<select id="searchEarNumbers" resultType="String">
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs_manage_tags
FROM sheep_file
WHERE (is_delete = 0 OR is_delete IS NULL)
@@ -116,7 +116,7 @@
where bs_manage_tags = #{tags}
</select>
<select id="countInGroup" resultType="java.lang.Long">
<select id="countInGroup" resultType="java.lang.Long" parameterType="SheepFile">
SELECT COUNT(*)
FROM sheep_file sf
WHERE sf.status_id = 1
@@ -124,7 +124,7 @@
${params.dataScope}
</select>
<select id="countBySheepType" resultType="java.util.Map">
<select id="countBySheepType" resultType="java.util.Map" parameterType="SheepFile">
SELECT sf.name AS name, COUNT(*) AS value
FROM sheep_file sf
WHERE sf.status_id = 1
@@ -133,7 +133,7 @@
GROUP BY sf.name
</select>
<select id="countByBreedStatus" resultType="java.util.Map">
<select id="countByBreedStatus" resultType="java.util.Map" parameterType="SheepFile">
SELECT sf.breed AS name, COUNT(*) AS value
FROM sheep_file sf
WHERE sf.status_id = 1
@@ -142,7 +142,7 @@
GROUP BY sf.breed
</select>
<select id="countByVariety" resultType="java.util.Map">
<select id="countByVariety" resultType="java.util.Map" parameterType="SheepFile">
SELECT sf.variety AS name, COUNT(*) AS value
FROM sheep_file sf
WHERE sf.status_id = 1
@@ -151,7 +151,7 @@
GROUP BY sf.variety
</select>
<select id="countParityOfLactation" resultType="java.util.Map">
<select id="countParityOfLactation" resultType="java.util.Map" parameterType="SheepFile">
SELECT sf.parity AS name, COUNT(*) AS value
FROM sheep_file sf
WHERE sf.status_id = 1
@@ -162,7 +162,7 @@
ORDER BY sf.parity
</select>
<select id="selectFieldValues" parameterType="String" resultType="String">
<select id="selectFieldValues" parameterType="String" resultType="java.lang.String">
SELECT DISTINCT ${fieldName} as field_value
FROM sheep_file
WHERE ${fieldName} IS NOT NULL AND ${fieldName} != '' AND ${fieldName} != 'null'
@@ -173,7 +173,7 @@
<include refid="selectSheepFileVo"/>
<where>
AND (is_delete = 0 OR is_delete IS NULL)
${sheepFile.params.dataScope}
<if test="sheepFile != null">
<if test="sheepFile.allEarNumbers != null and sheepFile.allEarNumbers.size() > 0">
AND bs_manage_tags IN
@@ -282,7 +282,7 @@
</if>
</foreach>
</if>
${params.dataScope}
</where>
ORDER BY id ASC
</select>

View File

@@ -82,6 +82,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDewormVo"/>
where s.id = #{id}
</select>
<select id="selectSheepNoList" resultType="java.lang.String" parameterType="Deworm">
SELECT DISTINCT bs.manage_tags
FROM sw_deworm s
LEFT JOIN bas_sheep bs ON s.sheep_id = bs.id
<where>
bs.manage_tags IS NOT NULL AND bs.manage_tags != ''
<if test="sheepNo!=null and sheepNo!= ''">
and bs.manage_tags LIKE CONCAT('%', #{sheepNo}, '%')
</if>
${params.dataScope}
</where>
ORDER BY bs.manage_tags ASC
</select>
<insert id="insertDeworm" parameterType="java.util.List">
insert into sw_deworm

View File

@@ -91,6 +91,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDiagnosisVo"/>
where sd.id = #{id}
</select>
<select id="selectSheepNoList" resultType="java.lang.String" parameterType="Diagnosis">
SELECT DISTINCT bs.manage_tags
FROM sw_diagnosis s
LEFT JOIN bas_sheep bs ON s.sheep_id = bs.id
<where>
bs.manage_tags IS NOT NULL AND bs.manage_tags != ''
<if test="sheepNo!=null and sheepNo!= ''">
and bs.manage_tags LIKE CONCAT('%', #{sheepNo}, '%')
</if>
${params.dataScope}
</where>
ORDER BY bs.manage_tags ASC
</select>
<insert id="insertDiagnosis" parameterType="Diagnosis" useGeneratedKeys="true" keyProperty="id">
insert into sw_diagnosis

View File

@@ -85,6 +85,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectHealthVo"/>
where s.id = #{id}
</select>
<select id="selectSheepNoList" resultType="java.lang.String" parameterType="Health">
SELECT DISTINCT bs.manage_tags
FROM sw_health s
LEFT JOIN bas_sheep bs ON s.sheep_id = bs.id
<where>
bs.manage_tags IS NOT NULL AND bs.manage_tags != ''
<if test="sheepNo!=null and sheepNo!= ''">
and bs.manage_tags LIKE CONCAT('%', #{sheepNo}, '%')
</if>
${params.dataScope}
</where>
ORDER BY bs.manage_tags ASC
</select>
<insert id="insertHealth" parameterType="Health" useGeneratedKeys="true" keyProperty="id">
insert into sw_health

View File

@@ -83,6 +83,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectImmunityVo"/>
where s.id = #{id}
</select>
<select id="selectSheepNoList" resultType="java.lang.String" parameterType="Immunity">
SELECT DISTINCT bs.manage_tags
FROM sw_immunity s
LEFT JOIN bas_sheep bs ON s.sheep_id = bs.id
<where>
bs.manage_tags IS NOT NULL AND bs.manage_tags != ''
<if test="sheepNo!=null and sheepNo!= ''">
and bs.manage_tags LIKE CONCAT('%', #{sheepNo}, '%')
</if>
${params.dataScope}
</where>
ORDER BY bs.manage_tags ASC
</select>
<insert id="insertImmunity" parameterType="Immunity" useGeneratedKeys="true" keyProperty="id">
insert into sw_immunity

View File

@@ -102,6 +102,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sqr.id = #{id}
ORDER BY datetime DESC
</select>
<select id="selectSheepNoList" resultType="java.lang.String" parameterType="QuarantineReport">
SELECT DISTINCT bs.manage_tags
FROM sw_quarantine_report s
LEFT JOIN bas_sheep bs ON s.sheep_id = bs.id
<where>
bs.manage_tags IS NOT NULL AND bs.manage_tags != ''
<if test="sheepNo!=null and sheepNo!= ''">
and bs.manage_tags LIKE CONCAT('%', #{sheepNo}, '%')
</if>
${params.dataScope}
</where>
ORDER BY bs.manage_tags ASC
</select>
<insert id="insertQuarantineReport" parameterType="java.util.List">
INSERT INTO sw_quarantine_report

View File

@@ -156,6 +156,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
smud.medi_usage = #{id}
</select>
<select id="selectSheepNoList" resultType="java.lang.String" parameterType="SwMedicineUsage">
SELECT DISTINCT bs.manage_tags
FROM sw_medicine_usage s
LEFT JOIN bas_sheep bs ON s.sheep = bs.id
<where>
bs.manage_tags IS NOT NULL AND bs.manage_tags != ''
<if test="sheepNo!=null and sheepNo!= ''">
and bs.manage_tags LIKE CONCAT('%', #{sheepNo}, '%')
</if>
${params.dataScope}
</where>
ORDER BY bs.manage_tags ASC
</select>
<insert id="insertSwMedicineUsage" parameterType="SwMedicineUsage" useGeneratedKeys="true" keyProperty="id">
insert into sw_medicine_usage

View File

@@ -105,6 +105,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTreatmentStatus" resultMap="TreatmentResult">
select * from sw_treatment where sheep_id = #{sheepId} and status in (0, 1)
</select>
<select id="selectSheepNoList" resultType="java.lang.String" parameterType="Treatment">
SELECT DISTINCT bs.manage_tags
FROM sw_treatment s
LEFT JOIN bas_sheep bs ON s.sheep_id = bs.id
<where>
bs.manage_tags IS NOT NULL AND bs.manage_tags != ''
<if test="sheepNo!=null and sheepNo!= ''">
and bs.manage_tags LIKE CONCAT('%', #{sheepNo}, '%')
</if>
${params.dataScope}
</where>
ORDER BY bs.manage_tags ASC
</select>
<insert id="insertTreatment" parameterType="Treatment" useGeneratedKeys="true" keyProperty="id">
insert into sw_treatment

View File

@@ -278,9 +278,9 @@
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs.manage_tags
FROM bas_sheep bs
FROM sc_body_measure sm
LEFT JOIN bas_sheep bs ON sm.sheep_id = bs.id
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0
ORDER BY bs.manage_tags
</select>

View File

@@ -143,9 +143,9 @@
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs.manage_tags
FROM bas_sheep bs
FROM sc_body_score sbs
LEFT JOIN bas_sheep bs ON sbs.sheep_id = bs.id
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0
ORDER BY bs.manage_tags
</select>
</mapper>

View File

@@ -155,11 +155,12 @@
#{id}
</foreach>
</delete>
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs.manage_tags
FROM bas_sheep bs
FROM sc_breast_rating sbr
LEFT JOIN bas_sheep bs ON sbr.sheep_id = bs.id
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0
ORDER BY bs.manage_tags
</select>

View File

@@ -61,7 +61,7 @@
</select>
<!-- 筛选符合条件的母羊关联bas_sheep不需要数据权限 -->
<select id="selectEligibleEwe" resultType="Map">
<select id="selectEligibleEwe" resultType="java.util.Map" >
select
bs.id,
bs.manage_tags as bs_manage_tags,
@@ -86,9 +86,10 @@
left join da_sheepfold dsf on bs.sheepfold_id = dsf.id
where bs.gender = 1
and bs.is_delete = 0
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
<if test="bsManageTags != null and bsManageTags != ''">
and bs.manage_tags like concat('%', #{bsManageTags}, '%')
</if>
${params.dataScope}
and (bs.status_id = 1 or bs.status_id is null)
and (
(bst.name in ('青年羊', '超龄羊') and (
@@ -103,7 +104,7 @@
</select>
<!-- 筛选符合条件的公羊关联bas_sheep不需要数据权限 -->
<select id="selectEligibleRam" resultType="Map">
<select id="selectEligibleRam" resultType="java.util.Map">
select
bs.id,
bs.manage_tags as bs_manage_tags,
@@ -121,9 +122,10 @@
left join bas_breed_status bbs on bs.breed_status_id = bbs.id
where bs.gender = 2
and bs.is_delete = 0
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
<if test="bsManageTags != null and bsManageTags != ''">
and bs.manage_tags like concat('%', #{bsManageTags}, '%')
</if>
${params.dataScope}
and bs.status_id = 1
and (
(bst.name in ('青年羊', '超龄羊') and (
@@ -212,7 +214,7 @@
</insert>
<!-- 获取配种计划详情:关联查询,不需要数据权限 -->
<select id="selectBreedPlanDetails" parameterType="Long" resultType="Map">
<select id="selectBreedPlanDetails" parameterType="Long" resultType="java.util.Map">
select
temp.id,
temp.ram_id,
@@ -254,7 +256,7 @@
</select>
<!-- 获取审批详情:关联查询,不需要数据权限 -->
<select id="selectApproveBreedPlanDetails" parameterType="Long" resultType="Map">
<select id="selectApproveBreedPlanDetails" parameterType="Long" resultType="java.util.Map">
select
temp.id,
temp.ram_id,

View File

@@ -139,9 +139,9 @@
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs.manage_tags
FROM bas_sheep bs
FROM sc_change_comment scc
LEFT JOIN bas_sheep bs ON scc.sheep_id = bs.id
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0
ORDER BY bs.manage_tags
</select>
</mapper>

View File

@@ -152,9 +152,9 @@
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs.manage_tags
FROM bas_sheep bs
FROM sc_change_ear sce
LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0
ORDER BY bs.manage_tags
</select>
</mapper>

View File

@@ -139,9 +139,9 @@
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs.manage_tags
FROM bas_sheep bs
FROM sc_change_variety scv
LEFT JOIN bas_sheep bs ON scv.sheep_id = bs.id
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0
ORDER BY bs.manage_tags
</select>
</mapper>

View File

@@ -163,9 +163,9 @@
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT s.manage_tags
FROM bas_sheep s
FROM sc_trans_group tg
LEFT JOIN bas_sheep s ON tg.sheep_id = s.id
WHERE s.manage_tags LIKE CONCAT('%', #{query}, '%')
AND s.is_delete = 0
ORDER BY s.manage_tags
</select>
</mapper>

View File

@@ -187,9 +187,9 @@
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs.manage_tags
FROM bas_sheep bs
FROM sc_transition_info t
LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0
ORDER BY bs.manage_tags
</select>
</mapper>

View File

@@ -137,9 +137,9 @@
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs.manage_tags
FROM bas_sheep bs
FROM sc_castrate sc
LEFT JOIN bas_sheep bs ON sc.sheep_id = bs.id
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0
ORDER BY bs.manage_tags
</select>
</mapper>

View File

@@ -134,9 +134,9 @@
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs.manage_tags
FROM bas_sheep bs
FROM sc_fix_hoof fh
LEFT JOIN bas_sheep bs ON fh.sheep_id = bs.id
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0
ORDER BY bs.manage_tags
</select>
</mapper>

View File

@@ -76,12 +76,20 @@
LEFT JOIN sys_user u_create ON s.created_by = u_create.user_id
LEFT JOIN da_sheepfold sf ON s.sheepfold_id = sf.id
<where>
<if test="bsManageTagsList != null and bsManageTagsList.size() > 0">
AND s.bs_manage_tags IN
<foreach collection="bsManageTagsList" item="tag" open="(" separator="," close=")">
#{tag}
<if test="exportIds != null and exportIds.size() > 0">
AND s.id IN
<foreach collection="exportIds" item="exportId" open="(" separator="," close=")">
#{exportId}
</foreach>
</if>
<if test="bsManageTagsList != null and bsManageTagsList.size() > 0">
AND (
<foreach collection="bsManageTagsList" item="tag" separator=" OR ">
FIND_IN_SET(#{tag}, s.bs_manage_tags)
</foreach>
)
</if>
<if test="(bsManageTagsList == null or bsManageTagsList.size() == 0) and bsManageTags != null and bsManageTags != ''">
AND s.bs_manage_tags LIKE CONCAT('%', #{bsManageTags}, '%')
</if>
@@ -166,11 +174,28 @@
<select id="searchEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs_manage_tags
FROM sheep_file
WHERE bs_manage_tags LIKE CONCAT(#{query}, '%')
<where>
<if test="query != null and query != ''">
AND bs_manage_tags LIKE CONCAT('%', #{query}, '%')
</if>
<if test="sheepfoldId != null">
AND sheepfold_id = #{sheepfoldId}
</if>
</where>
ORDER BY bs_manage_tags
LIMIT 50
</select>
<select id="selectSoldEarNumbers" resultType="java.lang.String">
SELECT DISTINCT bs_manage_tags
FROM sx_sheep_sale
<where>
<if test="query != null and query != ''">
bs_manage_tags LIKE CONCAT('%', #{query}, '%')
</if>
</where>
</select>
<insert id="insertSxSheepSale" parameterType="SxSheepSale" useGeneratedKeys="true" keyProperty="id">
insert into sx_sheep_sale
<trim prefix="(" suffix=")" suffixOverrides=",">