数据分离bug相关修改

This commit is contained in:
2026-03-06 15:51:30 +08:00
parent ca54b5f544
commit 73a6e881e3
15 changed files with 98 additions and 166 deletions

View File

@@ -6,7 +6,7 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: 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 # username: zhyc
# password: zhyc1234 # password: zhyc1234
url: jdbc:mysql://118.182.97.76:3306/zhyc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 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") @GetMapping("/summaryList")
public TableDataInfo summaryList(DaSheepfold daSheepfold) { public TableDataInfo summaryList(DaSheepfold daSheepfold) {
startPage(); 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.core.text.Convert;
import com.zhyc.common.enums.BusinessType; 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.BasSheep;
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.apache.commons.lang3.StringUtils;
@@ -139,7 +140,7 @@ public class SheepFileController extends BaseController
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
// 调用支持复杂查询的Service方法 // 调用支持复杂查询的Service方法
List<SheepFile> list = sheepFileService.selectSheepFileListByCondition(customParams, sheepFile); List<SheepFile> list = sheepFileService.selectSheepFileListByCondition( sheepFile,customParams);
return getDataTable(list); return getDataTable(list);
} }
@@ -255,7 +256,7 @@ public class SheepFileController extends BaseController
} }
// 3. 获取数据并执行行过滤 // 3. 获取数据并执行行过滤
List<SheepFile> list = sheepFileService.selectSheepFileListByCondition(customParams, sheepFile); List<SheepFile> list = sheepFileService.selectSheepFileListByCondition(sheepFile,customParams);
if (StringUtils.isNotBlank(exportIdsStr)) { if (StringUtils.isNotBlank(exportIdsStr)) {
List<String> exportIdList = Arrays.asList(exportIdsStr.split(",")); List<String> exportIdList = Arrays.asList(exportIdsStr.split(","));
list = list.stream() list = list.stream()
@@ -332,28 +333,28 @@ public class SheepFileController extends BaseController
@GetMapping("/stat/sheepType") @GetMapping("/stat/sheepType")
public AjaxResult statSheepType() { public AjaxResult statSheepType() {
return success(sheepFileService.countBySheepType()); return success(sheepFileService.countBySheepType(new SheepFile()));
} }
@GetMapping("/stat/breedStatus") @GetMapping("/stat/breedStatus")
public AjaxResult statBreedStatus() { public AjaxResult statBreedStatus() {
return success(sheepFileService.countByBreedStatus()); return success(sheepFileService.countByBreedStatus(new SheepFile()));
} }
@GetMapping("/stat/variety") @GetMapping("/stat/variety")
public AjaxResult statVariety() { public AjaxResult statVariety() {
return success(sheepFileService.countByVariety()); return success(sheepFileService.countByVariety(new SheepFile()));
} }
@GetMapping("/stat/lactationParity") @GetMapping("/stat/lactationParity")
public AjaxResult statLactationParity() { public AjaxResult statLactationParity() {
return success(sheepFileService.countParityOfLactation()); return success(sheepFileService.countParityOfLactation(new SheepFile()));
} }
// 在群总数 // 在群总数
@GetMapping("/stat/inGroupCount") @GetMapping("/stat/inGroupCount")
public AjaxResult 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; 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 */ /** 羊舍id */
@Excel(name = "羊舍id") @Excel(name = "羊舍id")
private Long id; private Long id;
@@ -127,20 +63,4 @@ public class DaSheepfold extends BaseEntity
/** 部门编号 */ /** 部门编号 */
private Long deptId; 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 com.zhyc.module.base.domain.SheepFile;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; 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.List;
import java.util.Map; import java.util.Map;
@@ -50,19 +48,19 @@ public interface SheepFileMapper
SheepFile selectSheepByManageTags(String tags); SheepFile selectSheepByManageTags(String tags);
// 在群羊只总数 // 在群羊只总数
Long countInGroup(); Long countInGroup(SheepFile sheep);
// 羊只类别分布(按 name 分组) // 羊只类别分布(按 name 分组)
List<Map<String,Object>> countBySheepType(); List<Map<String,Object>> countBySheepType(SheepFile sheep);
// 繁育状态分布(按 breed 分组) // 繁育状态分布(按 breed 分组)
List<Map<String,Object>> countByBreedStatus(); List<Map<String,Object>> countByBreedStatus(SheepFile sheep);
// 品种分布(按 variety 分组) // 品种分布(按 variety 分组)
List<Map<String,Object>> countByVariety(); List<Map<String,Object>> countByVariety(SheepFile sheep);
// 泌乳羊胎次分布name = '泌乳羊' 时按 parity 分组) // 泌乳羊胎次分布name = '泌乳羊' 时按 parity 分组)
List<Map<String,Object>> countParityOfLactation(); List<Map<String,Object>> countParityOfLactation(SheepFile sheep);
/** /**
* 获取指定字段的唯一值列表 (配合 XML 中的 selectFieldValues) * 获取指定字段的唯一值列表 (配合 XML 中的 selectFieldValues)
@@ -75,22 +73,22 @@ public interface SheepFileMapper
* 必须使用 @Param 注解以便 XML 能正确识别两个参数 * 必须使用 @Param 注解以便 XML 能正确识别两个参数
*/ */
List<SheepFile> selectSheepFileListByCondition( 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("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 * 查询所有公羊gender=2

View File

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

View File

@@ -63,8 +63,10 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
* 羊舍级别汇总查询(主表格) * 羊舍级别汇总查询(主表格)
*/ */
@DataScope(deptAlias = "ds", userAlias = "ds") @DataScope(deptAlias = "ds", userAlias = "ds")
@Override
public List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold) { 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.common.annotation.DataScope;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.BreedRamFile; import com.zhyc.module.base.domain.BreedRamFile;
import com.zhyc.module.base.domain.SheepFile; import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.SheepFileMapper; import com.zhyc.module.base.mapper.SheepFileMapper;
@@ -61,31 +62,33 @@ public class SheepFileServiceImpl implements ISheepFileService {
@DataScope(deptAlias = "sf", userAlias = "sf") @DataScope(deptAlias = "sf", userAlias = "sf")
@Override @Override
public List<Map<String, Object>> countBySheepType() { public List<Map<String, Object>> countBySheepType(SheepFile sheepFile) {
return sheepFileMapper.countBySheepType(); return sheepFileMapper.countBySheepType(sheepFile);
} }
@DataScope(deptAlias = "sf", userAlias = "sf") @DataScope(deptAlias = "sf", userAlias = "sf")
@Override @Override
public List<Map<String, Object>> countByBreedStatus() { public List<Map<String, Object>> countByBreedStatus(SheepFile sheepFile) {
return sheepFileMapper.countByBreedStatus(); return sheepFileMapper.countByBreedStatus(sheepFile);
} }
@DataScope(deptAlias = "sf", userAlias = "sf") @DataScope(deptAlias = "sf", userAlias = "sf")
@Override @Override
public List<Map<String, Object>> countByVariety() { public List<Map<String, Object>> countByVariety(SheepFile sheepFile) {
return sheepFileMapper.countByVariety(); return sheepFileMapper.countByVariety(sheepFile);
} }
@DataScope(deptAlias = "sf", userAlias = "sf") @DataScope(deptAlias = "sf", userAlias = "sf")
@Override @Override
public List<Map<String, Object>> countParityOfLactation() { public List<Map<String, Object>> countParityOfLactation(SheepFile sheepFile) {
return sheepFileMapper.countParityOfLactation(); return sheepFileMapper.countParityOfLactation(sheepFile);
} }
@DataScope(deptAlias = "sf", userAlias = "sf") @DataScope(deptAlias = "sf", userAlias = "sf")
@Override @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") @DataScope(deptAlias = "sf", userAlias = "sf")
@Override @Override
public List<SheepFile> selectSheepFileListByCondition(Map<String, Object> params, SheepFile sheepFile) { public List<SheepFile> selectSheepFileListByCondition( SheepFile sheepFile,Map<String, Object> params) {
// 1. 验证并处理自定义参数 (驼峰转下划线、安全检查) // 1. 验证并处理自定义参数 (驼峰转下划线、安全检查)
Map<String, Object> safeConditions = processConditions(params); Map<String, Object> safeConditions = processConditions(params);
System.out.println("sheepFile.params: " + (sheepFile.getParams() != null ? sheepFile.getParams().get("dataScope") : "null"));
// 2. 调用 Mapper // 2. 调用 Mapper
// 这里必须使用与 XML 中 <select id="selectSheepFileListByCondition"> 对应的方法 // 这里必须使用与 XML 中 <select id="selectSheepFileListByCondition"> 对应的方法
return sheepFileMapper.selectSheepFileListByCondition(safeConditions, sheepFile); return sheepFileMapper.selectSheepFileListByCondition(sheepFile,safeConditions);
} }
@Override @Override

View File

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

View File

@@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.zhyc.module.base.domain.SheepFile;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate; import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate;
@@ -38,14 +39,14 @@ public interface ScBreedPlanGenerateMapper
* *
* @return 符合条件的母羊列表 * @return 符合条件的母羊列表
*/ */
public List<Map<String, Object>> selectEligibleEwe(); public List<Map<String, Object>> selectEligibleEwe(SheepFile sheepFile);
/** /**
* 筛选符合条件的公羊 * 筛选符合条件的公羊
* *
* @return 符合条件的公羊列表 * @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.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletResponse; 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.domain.ScBreedPlanGenerate;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@@ -37,14 +39,14 @@ public interface IScBreedPlanGenerateService
* *
* @return 符合条件的母羊列表 * @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 符合条件的公羊列表 * @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); 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 javax.servlet.http.HttpServletResponse;
import com.zhyc.common.annotation.DataScope; 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.ScBreedPlan;
import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate; import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate;
import com.zhyc.module.produce.breed.mapper.ScBreedPlanGenerateMapper; import com.zhyc.module.produce.breed.mapper.ScBreedPlanGenerateMapper;
@@ -65,19 +66,21 @@ public class ScBreedPlanGenerateServiceImpl implements IScBreedPlanGenerateServi
/** /**
* 筛选符合条件的母羊 * 筛选符合条件的母羊
*/ */
@DataScope(deptAlias = "bs", userAlias = "bs")
@Override @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 @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); result.put("planInfo", planGenerate);
List<Map<String, Object>> planDetails = scBreedPlanGenerateMapper.selectApproveBreedPlanDetails(id); List<Map<String, Object>> planDetails = scBreedPlanGenerateMapper.selectApproveBreedPlanDetails(id);
result.put("planDetails", planDetails); result.put("planDetails", planDetails);
List<Map<String, Object>> availableRams = scBreedPlanGenerateMapper.selectEligibleRam(); List<Map<String, Object>> availableRams = scBreedPlanGenerateMapper.selectEligibleRam(new SheepFile());
result.put("availableRams", availableRams); result.put("availableRams", availableRams);
return result; return result;
} }

View File

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

View File

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

View File

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