Merge remote-tracking branch 'origin/main'

This commit is contained in:
zyh 2025-08-14 15:58:38 +08:00
commit 11ede5a585
55 changed files with 4558 additions and 210 deletions

View File

@ -8,12 +8,14 @@ import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis;
import com.zhyc.module.dairyProducts.service.INpSheepMilkAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 只保留分页列表只读 + 单条查询 + 导出
*/
@RestController
@RequestMapping("/dairyProducts/sheepMilkAnalysis")
public class NpSheepMilkAnalysisController extends BaseController {
@ -22,58 +24,33 @@ public class NpSheepMilkAnalysisController extends BaseController {
private INpSheepMilkAnalysisService npSheepMilkAnalysisService;
/**
* 查询奶产量分析列表
* 查询奶产量分析列表只读分页
* 支持参数 manageEarTag耳号模糊 screenDays筛选天数
*/
@GetMapping("/list")
public TableDataInfo list(NpSheepMilkAnalysis analysis) {
startPage();
startPage(); // 使用 PageHelper 分页注意 service 中第一个 DB 调用是 distinct sheep id
List<NpSheepMilkAnalysis> list = npSheepMilkAnalysisService.selectNpSheepMilkAnalysisList(analysis);
return getDataTable(list);
}
/**
* 获取单个分析记录详细信息
* 获取单个分析记录详细信息 sheepId
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(npSheepMilkAnalysisService.selectNpSheepMilkAnalysisById(id));
}
/**
* 新增奶产量分析记录
*/
@Log(title = "奶产量分析", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody NpSheepMilkAnalysis analysis) {
return toAjax(npSheepMilkAnalysisService.insertNpSheepMilkAnalysis(analysis));
@GetMapping(value = "/{sheepId}")
public AjaxResult getInfo(@PathVariable("sheepId") String sheepId) {
return AjaxResult.success(npSheepMilkAnalysisService.selectNpSheepMilkAnalysisBySheepId(sheepId));
}
/**
* 修改奶产量分析记录
* 导出奶产量分析记录Excel
* 支持 manageEarTag screenDays 两个查询条件
*/
@Log(title = "奶产量分析", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody NpSheepMilkAnalysis analysis) {
return toAjax(npSheepMilkAnalysisService.updateNpSheepMilkAnalysis(analysis));
}
/**
* 删除奶产量分析记录
*/
@Log(title = "奶产量分析", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(npSheepMilkAnalysisService.deleteNpSheepMilkAnalysisByIds(ids));
}
/**
* 导出奶产量分析记录
*/
@Log(title = "奶产量分析", businessType = BusinessType.EXPORT)
@Log(title = "奶产量分析 导出", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(NpSheepMilkAnalysis analysis) {
List<NpSheepMilkAnalysis> list = npSheepMilkAnalysisService.selectNpSheepMilkAnalysisList(analysis);
ExcelUtil<NpSheepMilkAnalysis> util = new ExcelUtil<>(NpSheepMilkAnalysis.class);
return util.exportExcel(list, "奶产量分析数据");
return util.exportExcel(list, "羊奶产量分析数据");
}
}

View File

@ -1,34 +1,64 @@
package com.zhyc.module.dairyProducts.domain;
import java.util.Date;
public class NpSheepMilkAnalysis {
// 唯一键可用于前端 row-key
private String sheepId;
// 耳号 sheep_file.bs_manage_tags
private String manageEarTag;
private String variety;
// 最高校正胎次的挤奶开始时间 & 干奶时间
private Date milkingStartTime;
private Date dryEndTime;
// 挤奶天数该胎次
private Integer milkingDays;
// 前端传入的筛选天数screenDays
private Integer screenDays;
// 分析天数若你有不同命名可忽略
private Integer analysisDays;
// 校正后最大胎次即校正奶量之和最大的胎次
private Integer maxParity;
// 最高校正胎次区间内的系统奶量与校正奶量按筛选窗口
private Double sumSystemMilk;
private Double sumCorrectedMilk;
// 校正日平均奶量 min(挤奶天数, 筛选天数)
private Double avgCorrectedDaily;
// 各胎次总奶量校正
private Double sumParity1Milk;
private Double sumParity2Milk;
private Double sumParity3Milk;
private Double sumParity4Milk;
// 各胎次日平均按规则
private Double avgParity1Daily;
private Double avgParity2Daily;
private Double avgParity3Daily;
private Double avgParity4Daily;
// 泌乳天数sheep_file.lactation_day
private Integer lactationDays;
// 过去 7 / 14 / 30 日平均系统奶量
private Double avgLast7Milk;
private Double avgLast7Corrected;
private Double avgLast7Corrected; // = avgLast7Milk * weightCoefficient 默认 1.0
private Double avgLast14Milk;
private Double avgLast30Milk;
// 羊只基础信息来自 sheep_file
private String sheepCategory;
private Date birthday;
private Integer parity;
private Integer parity; // 当前胎次
private Integer monthAge;
private Double currentWeight;
private String breedStatus;
@ -36,12 +66,16 @@ public class NpSheepMilkAnalysis {
private String motherManageTags;
private String ranchName;
private String family;
// 母亲相关字段由已计算的母亲分析结果中取值
private Integer motherMilkingDays;
private Double motherSumCorrected;
private Integer motherMaxParity;
private Double motherAvgCorrectedDaily;
private Date lastUpdate;
// getters and setters
public String getSheepId() { return sheepId; }
public void setSheepId(String sheepId) { this.sheepId = sheepId; }
@ -60,6 +94,9 @@ public class NpSheepMilkAnalysis {
public Integer getMilkingDays() { return milkingDays; }
public void setMilkingDays(Integer milkingDays) { this.milkingDays = milkingDays; }
public Integer getScreenDays() { return screenDays; }
public void setScreenDays(Integer screenDays) { this.screenDays = screenDays; }
public Integer getAnalysisDays() { return analysisDays; }
public void setAnalysisDays(Integer analysisDays) { this.analysisDays = analysisDays; }
@ -159,4 +196,3 @@ public class NpSheepMilkAnalysis {
public Date getLastUpdate() { return lastUpdate; }
public void setLastUpdate(Date lastUpdate) { this.lastUpdate = lastUpdate; }
}

View File

@ -1,19 +1,36 @@
package com.zhyc.module.dairyProducts.mapper;
import com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface NpSheepMilkAnalysisMapper {
NpSheepMilkAnalysis selectNpSheepMilkAnalysisById(Long id);
/**
* 按筛选天数 screenDays 统计并返回所有羊只的奶产量分析
*/
List<NpSheepMilkAnalysis> selectAnalysisForExport(@Param("screenDays") Integer screenDays);
List<NpSheepMilkAnalysis> selectNpSheepMilkAnalysisList(NpSheepMilkAnalysis analysis);
/**
* 根据羊只ID查询羊只奶产量分析信息返回Map结构
*/
Map<String, Object> selectNpSheepMilkAnalysisBySheepId(@Param("sheepId") String sheepId);
int insertNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis);
/**
* 根据管理耳标筛选返回distinct的sheepId列表
*/
List<String> selectDistinctSheepIds(@Param("manageEarTag") String manageEarTag);
int updateNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis);
/**
* 根据羊只ID查询羊只档案信息返回Map结构
*/
Map<String, Object> selectSheepFileBySheepId(@Param("sheepId") String sheepId);
int deleteNpSheepMilkAnalysisById(Long id);
/**
* 根据羊只ID查询挤奶班次数据返回List<Map>
*/
List<Map<String, Object>> selectMilkRecordsBySheepId(@Param("sheepId") String sheepId);
int deleteNpSheepMilkAnalysisByIds(Long[] ids);
}

View File

@ -5,16 +5,8 @@ import java.util.List;
public interface INpSheepMilkAnalysisService {
NpSheepMilkAnalysis selectNpSheepMilkAnalysisById(Long id);
NpSheepMilkAnalysis selectNpSheepMilkAnalysisBySheepId(String sheepId);
List<NpSheepMilkAnalysis> selectNpSheepMilkAnalysisList(NpSheepMilkAnalysis analysis);
int insertNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis);
int updateNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis);
int deleteNpSheepMilkAnalysisById(Long id);
int deleteNpSheepMilkAnalysisByIds(Long[] ids);
}

View File

@ -1,12 +1,17 @@
package com.zhyc.module.dairyProducts.service.impl;
import java.util.List;
import com.zhyc.module.dairyProducts.mapper.NpSheepMilkAnalysisMapper;
import com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis;
import com.zhyc.module.dairyProducts.mapper.NpSheepMilkAnalysisMapper;
import com.zhyc.module.dairyProducts.service.INpSheepMilkAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class NpSheepMilkAnalysisServiceImpl implements INpSheepMilkAnalysisService {
@ -14,34 +19,268 @@ public class NpSheepMilkAnalysisServiceImpl implements INpSheepMilkAnalysisServi
@Autowired
private NpSheepMilkAnalysisMapper npSheepMilkAnalysisMapper;
// Rec 定义为静态内部类
private static class Rec {
LocalDate date;
double systemMilk;
double correctedMilk;
int parity;
}
// ParityStat 定义为静态内部类
private static class ParityStat {
int parity;
double sumCorrected;
double sumSystem;
LocalDate first;
LocalDate last;
long days;
}
@Override
public NpSheepMilkAnalysis selectNpSheepMilkAnalysisById(Long id) {
return npSheepMilkAnalysisMapper.selectNpSheepMilkAnalysisById(id);
public NpSheepMilkAnalysis selectNpSheepMilkAnalysisBySheepId(String sheepId) {
Map<String, Object> map = npSheepMilkAnalysisMapper.selectNpSheepMilkAnalysisBySheepId(sheepId);
if (map == null) return null;
NpSheepMilkAnalysis ana = new NpSheepMilkAnalysis();
ana.setSheepId(sheepId);
ana.setManageEarTag((String) map.get("manageEarTag"));
return ana;
}
@Override
public List<NpSheepMilkAnalysis> selectNpSheepMilkAnalysisList(NpSheepMilkAnalysis analysis) {
return npSheepMilkAnalysisMapper.selectNpSheepMilkAnalysisList(analysis);
int screenDays = (analysis != null && analysis.getScreenDays() != null) ? analysis.getScreenDays() : 100;
String manageEarTagFilter = (analysis != null) ? analysis.getManageEarTag() : null;
List<String> sheepIds = npSheepMilkAnalysisMapper.selectDistinctSheepIds(manageEarTagFilter);
if (CollectionUtils.isEmpty(sheepIds)) return Collections.emptyList();
List<NpSheepMilkAnalysis> resultList = new ArrayList<>();
Map<String, NpSheepMilkAnalysis> mapByManageTag = new HashMap<>();
for (String sheepId : sheepIds) {
Map<String, Object> sf = npSheepMilkAnalysisMapper.selectSheepFileBySheepId(sheepId);
List<Map<String, Object>> records = npSheepMilkAnalysisMapper.selectMilkRecordsBySheepId(sheepId);
if (records == null || records.isEmpty()) {
NpSheepMilkAnalysis emptyAna = new NpSheepMilkAnalysis();
emptyAna.setSheepId(sheepId);
if (sf != null) {
emptyAna.setManageEarTag((String) sf.get("manageEarTag"));
emptyAna.setVariety((String) sf.get("variety"));
emptyAna.setLactationDays(toInteger(sf.get("lactationDay")));
emptyAna.setSheepCategory((String) sf.get("sheepType"));
emptyAna.setBirthday(convertToDate(sf.get("birthday")));
emptyAna.setParity(toInteger(sf.get("currentParity")));
emptyAna.setMonthAge(toInteger(sf.get("monthAge")));
emptyAna.setCurrentWeight(toDouble(sf.get("currentWeight")));
emptyAna.setBreedStatus((String) sf.get("breedStatus"));
emptyAna.setFatherManageTags((String) sf.get("fatherManageTags"));
emptyAna.setMotherManageTags((String) sf.get("motherManageTags"));
emptyAna.setRanchName((String) sf.get("ranchName"));
emptyAna.setFamily((String) sf.get("family"));
}
resultList.add(emptyAna);
mapByManageTag.put(emptyAna.getManageEarTag(), emptyAna);
continue;
}
// 使用静态内部类 Rec
List<Rec> recs = new ArrayList<>();
for (Map<String, Object> r : records) {
Rec rr = new Rec();
rr.date = toLocalDate(r.get("classDate"));
rr.systemMilk = toDouble(r.get("systemMilk"));
rr.correctedMilk = toDouble(r.get("correctedMilk"));
rr.parity = (r.get("parity") == null) ? 0 : Integer.parseInt(String.valueOf(r.get("parity")));
recs.add(rr);
}
Map<Integer, List<Rec>> byParity = recs.stream().collect(Collectors.groupingBy(r -> r.parity));
// 使用静态内部类 ParityStat
List<ParityStat> parityStats = new ArrayList<>();
for (Map.Entry<Integer, List<Rec>> e : byParity.entrySet()) {
List<Rec> list = e.getValue();
double sumCorr = list.stream().mapToDouble(x -> x.correctedMilk).sum();
double sumSys = list.stream().mapToDouble(x -> x.systemMilk).sum();
LocalDate first = list.stream().map(x -> x.date).min(LocalDate::compareTo).get();
LocalDate last = list.stream().map(x -> x.date).max(LocalDate::compareTo).get();
long days = ChronoUnit.DAYS.between(first, last) + 1;
ParityStat ps = new ParityStat();
ps.parity = e.getKey();
ps.sumCorrected = sumCorr;
ps.sumSystem = sumSys;
ps.first = first;
ps.last = last;
ps.days = Math.max(days, 1);
parityStats.add(ps);
}
parityStats.sort(Comparator.comparingDouble((ParityStat p) -> p.sumCorrected).reversed()
.thenComparingInt(p -> p.parity));
ParityStat maxParityStat = parityStats.get(0);
LocalDate windowStart = maxParityStat.first;
LocalDate windowEndByDays = windowStart.plusDays(screenDays - 1);
LocalDate actualWindowEnd = (maxParityStat.last.isBefore(windowEndByDays)) ? maxParityStat.last : windowEndByDays;
double sumSystemWindow = recs.stream()
.filter(r -> r.parity == maxParityStat.parity && !r.date.isBefore(windowStart) && !r.date.isAfter(actualWindowEnd))
.mapToDouble(r -> r.systemMilk).sum();
double sumCorrectedWindow = recs.stream()
.filter(r -> r.parity == maxParityStat.parity && !r.date.isBefore(windowStart) && !r.date.isAfter(actualWindowEnd))
.mapToDouble(r -> r.correctedMilk).sum();
long milkingDays = maxParityStat.days;
long denominator = Math.min(milkingDays, screenDays);
double avgCorrectedDaily = (denominator > 0) ? (sumCorrectedWindow / (double) denominator) : 0.0;
double sumParity1 = parityStats.stream().filter(p -> p.parity == 1).mapToDouble(p -> p.sumCorrected).sum();
double sumParity2 = parityStats.stream().filter(p -> p.parity == 2).mapToDouble(p -> p.sumCorrected).sum();
double sumParity3 = parityStats.stream().filter(p -> p.parity == 3).mapToDouble(p -> p.sumCorrected).sum();
double sumParity4 = parityStats.stream().filter(p -> p.parity == 4).mapToDouble(p -> p.sumCorrected).sum();
// 你之前的 computeParityAvg 方法里没实现保留调用0
double avgP1 = computeParityAvg(parityStats, 1, screenDays);
double avgP2 = computeParityAvg(parityStats, 2, screenDays);
double avgP3 = computeParityAvg(parityStats, 3, screenDays);
double avgP4 = computeParityAvg(parityStats, 4, screenDays);
LocalDate lastDate = recs.stream().map(r -> r.date).max(LocalDate::compareTo).get();
double avgLast7 = computeLastNDaysAvg(recs, lastDate, 7);
double avgLast14 = computeLastNDaysAvg(recs, lastDate, 14);
double avgLast30 = computeLastNDaysAvg(recs, lastDate, 30);
double weightCoefficient = 1.0;
if (sf != null && sf.get("weighCoefficient") != null) {
weightCoefficient = toDouble(sf.get("weighCoefficient"));
}
double avgLast7Corrected = avgLast7 * weightCoefficient;
NpSheepMilkAnalysis ana = new NpSheepMilkAnalysis();
ana.setSheepId(sheepId);
ana.setManageEarTag(sf == null ? null : (String) sf.get("manageEarTag"));
ana.setVariety(sf == null ? null : (String) sf.get("variety"));
ana.setMilkingStartTime(toDate(windowStart));
ana.setDryEndTime(toDate(maxParityStat.last));
ana.setMilkingDays((int) milkingDays);
ana.setScreenDays(screenDays);
ana.setMaxParity(maxParityStat.parity);
ana.setSumSystemMilk(sumSystemWindow);
ana.setSumCorrectedMilk(sumCorrectedWindow);
ana.setAvgCorrectedDaily(avgCorrectedDaily);
ana.setSumParity1Milk(sumParity1);
ana.setSumParity2Milk(sumParity2);
ana.setSumParity3Milk(sumParity3);
ana.setSumParity4Milk(sumParity4);
ana.setAvgParity1Daily(avgP1);
ana.setAvgParity2Daily(avgP2);
ana.setAvgParity3Daily(avgP3);
ana.setAvgParity4Daily(avgP4);
ana.setLactationDays(toInteger(sf == null ? null : sf.get("lactationDay")));
ana.setAvgLast7Milk(avgLast7);
ana.setAvgLast7Corrected(avgLast7Corrected);
ana.setAvgLast14Milk(avgLast14);
ana.setAvgLast30Milk(avgLast30);
if (sf != null) {
ana.setSheepCategory((String) sf.get("sheepType"));
ana.setBirthday(convertToDate(sf.get("birthday")));
ana.setParity(toInteger(sf.get("currentParity")));
ana.setMonthAge(toInteger(sf.get("monthAge")));
ana.setCurrentWeight(toDouble(sf.get("currentWeight")));
ana.setBreedStatus((String) sf.get("breedStatus"));
ana.setFatherManageTags((String) sf.get("fatherManageTags"));
ana.setMotherManageTags((String) sf.get("motherManageTags"));
ana.setRanchName((String) sf.get("ranchName"));
ana.setFamily((String) sf.get("family"));
}
ana.setLastUpdate(toDate(lastDate));
resultList.add(ana);
mapByManageTag.put(ana.getManageEarTag(), ana);
}
// 填充母亲相关字段
for (NpSheepMilkAnalysis a : resultList) {
String motherTag = a.getMotherManageTags();
if (motherTag != null && mapByManageTag.containsKey(motherTag)) {
NpSheepMilkAnalysis mom = mapByManageTag.get(motherTag);
a.setMotherMilkingDays(mom.getMilkingDays());
a.setMotherSumCorrected(mom.getSumCorrectedMilk());
a.setMotherMaxParity(mom.getMaxParity());
a.setMotherAvgCorrectedDaily(mom.getAvgCorrectedDaily());
}
}
return resultList;
}
@Override
public int insertNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis) {
return npSheepMilkAnalysisMapper.insertNpSheepMilkAnalysis(analysis);
private static Date convertToDate(Object obj) {
if (obj == null) return null;
if (obj instanceof Date) {
return (Date) obj;
}
if (obj instanceof java.sql.Date) {
return new Date(((java.sql.Date) obj).getTime());
}
return null;
}
@Override
public int updateNpSheepMilkAnalysis(NpSheepMilkAnalysis analysis) {
return npSheepMilkAnalysisMapper.updateNpSheepMilkAnalysis(analysis);
private static LocalDate toLocalDate(Object obj) {
if (obj == null) return null;
if (obj instanceof java.sql.Date) {
return ((java.sql.Date) obj).toLocalDate();
}
if (obj instanceof Date) {
return ((Date) obj).toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
return null;
}
@Override
public int deleteNpSheepMilkAnalysisById(Long id) {
return npSheepMilkAnalysisMapper.deleteNpSheepMilkAnalysisById(id);
private static Date toDate(LocalDate ld) {
if (ld == null) return null;
return Date.from(ld.atStartOfDay(ZoneId.systemDefault()).toInstant());
}
@Override
public int deleteNpSheepMilkAnalysisByIds(Long[] ids) {
return npSheepMilkAnalysisMapper.deleteNpSheepMilkAnalysisByIds(ids);
private static Integer toInteger(Object obj) {
if (obj == null) return null;
if (obj instanceof Number) return ((Number) obj).intValue();
try {
return Integer.parseInt(obj.toString());
} catch (Exception e) {
return null;
}
}
private static Double toDouble(Object obj) {
if (obj == null) return 0.0;
if (obj instanceof Number) return ((Number) obj).doubleValue();
try {
return Double.parseDouble(obj.toString());
} catch (Exception e) {
return 0.0;
}
}
private double computeParityAvg(List<ParityStat> stats, int parity, int screenDays) {
// 这里你之前实现是直接返回0可按需完善
return 0.0;
}
private double computeLastNDaysAvg(List<Rec> recs, LocalDate lastDate, int days) {
LocalDate startDate = lastDate.minusDays(days - 1);
double sum = 0;
int count = 0;
for (Rec r : recs) {
if (r.date != null && !r.date.isBefore(startDate) && !r.date.isAfter(lastDate)) {
sum += r.correctedMilk;
count++;
}
}
return (count > 0) ? (sum / count) : 0.0;
}
}

View File

@ -0,0 +1,104 @@
package com.zhyc.module.feed.controller;
import java.util.List;
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 com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFeedDetails;
import com.zhyc.module.feed.service.ISgFeedDetailsService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 饲喂记录详情Controller
*
* @author ruoyi
* @date 2025-08-01
*/
@RestController
@RequestMapping("/feed/details")
public class SgFeedDetailsController extends BaseController
{
@Autowired
private ISgFeedDetailsService sgFeedDetailsService;
/**
* 查询饲喂记录详情列表
*/
@PreAuthorize("@ss.hasPermi('feed:details:list')")
@GetMapping("/list")
public TableDataInfo list(SgFeedDetails sgFeedDetails)
{
startPage();
List<SgFeedDetails> list = sgFeedDetailsService.selectSgFeedDetailsList(sgFeedDetails);
return getDataTable(list);
}
/**
* 导出饲喂记录详情列表
*/
@PreAuthorize("@ss.hasPermi('feed:details:export')")
@Log(title = "饲喂记录详情", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFeedDetails sgFeedDetails)
{
List<SgFeedDetails> list = sgFeedDetailsService.selectSgFeedDetailsList(sgFeedDetails);
ExcelUtil<SgFeedDetails> util = new ExcelUtil<SgFeedDetails>(SgFeedDetails.class);
util.exportExcel(response, list, "饲喂记录详情数据");
}
/**
* 获取饲喂记录详情详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:details:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sgFeedDetailsService.selectSgFeedDetailsById(id));
}
/**
* 新增饲喂记录详情
*/
@PreAuthorize("@ss.hasPermi('feed:details:add')")
@Log(title = "饲喂记录详情", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFeedDetails sgFeedDetails)
{
return toAjax(sgFeedDetailsService.insertSgFeedDetails(sgFeedDetails));
}
/**
* 修改饲喂记录详情
*/
@PreAuthorize("@ss.hasPermi('feed:details:edit')")
@Log(title = "饲喂记录详情", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFeedDetails sgFeedDetails)
{
return toAjax(sgFeedDetailsService.updateSgFeedDetails(sgFeedDetails));
}
/**
* 删除饲喂记录详情
*/
@PreAuthorize("@ss.hasPermi('feed:details:remove')")
@Log(title = "饲喂记录详情", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sgFeedDetailsService.deleteSgFeedDetailsByIds(ids));
}
}

View File

@ -0,0 +1,104 @@
package com.zhyc.module.feed.controller;
import java.util.List;
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 com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFeedInfo;
import com.zhyc.module.feed.service.ISgFeedInfoService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 饲喂记录Controller
*
* @author ruoyi
* @date 2025-08-01
*/
@RestController
@RequestMapping("/feed/info")
public class SgFeedInfoController extends BaseController
{
@Autowired
private ISgFeedInfoService sgFeedInfoService;
/**
* 查询饲喂记录列表
*/
@PreAuthorize("@ss.hasPermi('feed:info:list')")
@GetMapping("/list")
public TableDataInfo list(SgFeedInfo sgFeedInfo)
{
startPage();
List<SgFeedInfo> list = sgFeedInfoService.selectSgFeedInfoList(sgFeedInfo);
return getDataTable(list);
}
/**
* 导出饲喂记录列表
*/
@PreAuthorize("@ss.hasPermi('feed:info:export')")
@Log(title = "饲喂记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFeedInfo sgFeedInfo)
{
List<SgFeedInfo> list = sgFeedInfoService.selectSgFeedInfoList(sgFeedInfo);
ExcelUtil<SgFeedInfo> util = new ExcelUtil<SgFeedInfo>(SgFeedInfo.class);
util.exportExcel(response, list, "饲喂记录数据");
}
/**
* 获取饲喂记录详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:info:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sgFeedInfoService.selectSgFeedInfoById(id));
}
/**
* 新增饲喂记录
*/
@PreAuthorize("@ss.hasPermi('feed:info:add')")
@Log(title = "饲喂记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFeedInfo sgFeedInfo)
{
return toAjax(sgFeedInfoService.insertSgFeedInfo(sgFeedInfo));
}
/**
* 修改饲喂记录
*/
@PreAuthorize("@ss.hasPermi('feed:info:edit')")
@Log(title = "饲喂记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFeedInfo sgFeedInfo)
{
return toAjax(sgFeedInfoService.updateSgFeedInfo(sgFeedInfo));
}
/**
* 删除饲喂记录
*/
@PreAuthorize("@ss.hasPermi('feed:info:remove')")
@Log(title = "饲喂记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sgFeedInfoService.deleteSgFeedInfoByIds(ids));
}
}

View File

@ -0,0 +1,107 @@
package com.zhyc.module.feed.controller;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFeedPlan;
import com.zhyc.module.feed.service.ISgFeedPlanService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 饲喂计划Controller
*
* @author HashMap
* @date 2025-08-08
*/
@RestController
@RequestMapping("/feed/FeedPlan")
public class SgFeedPlanController extends BaseController
{
private final ISgFeedPlanService sgFeedPlanService;
public SgFeedPlanController(ISgFeedPlanService sgFeedPlanService) {
this.sgFeedPlanService = sgFeedPlanService;
}
/**
* 查询饲喂计划列表
*/
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:list')")
@GetMapping("/list")
public TableDataInfo list(SgFeedPlan sgFeedPlan)
{
startPage();
List<SgFeedPlan> list = sgFeedPlanService.selectSgFeedPlanList(sgFeedPlan);
return getDataTable(list);
}
/**
* 导出饲喂计划列表
*/
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:export')")
@Log(title = "饲喂计划", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFeedPlan sgFeedPlan)
{
List<SgFeedPlan> list = sgFeedPlanService.selectSgFeedPlanList(sgFeedPlan);
ExcelUtil<SgFeedPlan> util = new ExcelUtil<>(SgFeedPlan.class);
util.exportExcel(response, list, "饲喂计划数据");
}
/**
* 获取饲喂计划详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:query')")
@GetMapping(value = "/{createDate}")
public AjaxResult getInfo(@PathVariable("createDate") Date createDate)
{
return success(sgFeedPlanService.selectSgFeedPlanByCreateDate(createDate));
}
/**
* 新增饲喂计划
*/
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:add')")
@Log(title = "饲喂计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFeedPlan sgFeedPlan)
{
return toAjax(sgFeedPlanService.insertSgFeedPlan(sgFeedPlan));
}
/**
* 修改饲喂计划
*/
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:edit')")
@Log(title = "饲喂计划", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFeedPlan sgFeedPlan)
{
return toAjax(sgFeedPlanService.updateSgFeedPlan(sgFeedPlan));
}
/**
* 删除饲喂计划
*/
@PreAuthorize("@ss.hasPermi('feed:FeedPlan:remove')")
@Log(title = "饲喂计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{createDates}")
public AjaxResult remove(@PathVariable Date[] createDates)
{
return toAjax(sgFeedPlanService.deleteSgFeedPlanByCreateDates(createDates));
}
}

View File

@ -0,0 +1,104 @@
package com.zhyc.module.feed.controller;
import java.util.List;
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 com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFeedRatio;
import com.zhyc.module.feed.service.ISgFeedRatioService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 饲喂比例Controller
*
* @author ruoyi
* @date 2025-08-01
*/
@RestController
@RequestMapping("/feed/ratio")
public class SgFeedRatioController extends BaseController
{
@Autowired
private ISgFeedRatioService sgFeedRatioService;
/**
* 查询饲喂比例列表
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:list')")
@GetMapping("/list")
public TableDataInfo list(SgFeedRatio sgFeedRatio)
{
startPage();
List<SgFeedRatio> list = sgFeedRatioService.selectSgFeedRatioList(sgFeedRatio);
return getDataTable(list);
}
/**
* 导出饲喂比例列表
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:export')")
@Log(title = "饲喂比例", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFeedRatio sgFeedRatio)
{
List<SgFeedRatio> list = sgFeedRatioService.selectSgFeedRatioList(sgFeedRatio);
ExcelUtil<SgFeedRatio> util = new ExcelUtil<SgFeedRatio>(SgFeedRatio.class);
util.exportExcel(response, list, "饲喂比例数据");
}
/**
* 获取饲喂比例详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sgFeedRatioService.selectSgFeedRatioById(id));
}
/**
* 新增饲喂比例
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:add')")
@Log(title = "饲喂比例", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFeedRatio sgFeedRatio)
{
return toAjax(sgFeedRatioService.insertSgFeedRatio(sgFeedRatio));
}
/**
* 修改饲喂比例
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:edit')")
@Log(title = "饲喂比例", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFeedRatio sgFeedRatio)
{
return toAjax(sgFeedRatioService.updateSgFeedRatio(sgFeedRatio));
}
/**
* 删除饲喂比例
*/
@PreAuthorize("@ss.hasPermi('feed:ratio:remove')")
@Log(title = "饲喂比例", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sgFeedRatioService.deleteSgFeedRatioByIds(ids));
}
}

View File

@ -0,0 +1,104 @@
package com.zhyc.module.feed.controller;
import java.util.List;
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 com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFodder;
import com.zhyc.module.feed.service.ISgFodderService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 原料Controller
*
* @author ruoyi
* @date 2025-08-01
*/
@RestController
@RequestMapping("/feed/fodder")
public class SgFodderController extends BaseController
{
@Autowired
private ISgFodderService sgFodderService;
/**
* 查询原料列表
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:list')")
@GetMapping("/list")
public TableDataInfo list(SgFodder sgFodder)
{
startPage();
List<SgFodder> list = sgFodderService.selectSgFodderList(sgFodder);
return getDataTable(list);
}
/**
* 导出原料列表
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:export')")
@Log(title = "原料", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFodder sgFodder)
{
List<SgFodder> list = sgFodderService.selectSgFodderList(sgFodder);
ExcelUtil<SgFodder> util = new ExcelUtil<SgFodder>(SgFodder.class);
util.exportExcel(response, list, "原料数据");
}
/**
* 获取原料详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sgFodderService.selectSgFodderById(id));
}
/**
* 新增原料
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:add')")
@Log(title = "原料", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFodder sgFodder)
{
return toAjax(sgFodderService.insertSgFodder(sgFodder));
}
/**
* 修改原料
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:edit')")
@Log(title = "原料", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFodder sgFodder)
{
return toAjax(sgFodderService.updateSgFodder(sgFodder));
}
/**
* 删除原料
*/
@PreAuthorize("@ss.hasPermi('feed:fodder:remove')")
@Log(title = "原料", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sgFodderService.deleteSgFodderByIds(ids));
}
}

View File

@ -0,0 +1,106 @@
package com.zhyc.module.feed.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFormulaList;
import com.zhyc.module.feed.service.ISgFormulaListService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 配方列表Controller
*
* @author HashMap
* @date 2025-08-09
*/
@RestController
@RequestMapping("/feed/FormulaList")
public class SgFormulaListController extends BaseController
{
private final ISgFormulaListService sgFormulaListService;
public SgFormulaListController(ISgFormulaListService sgFormulaListService) {
this.sgFormulaListService = sgFormulaListService;
}
/**
* 查询配方列表列表
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaList:list')")
@GetMapping("/list")
public TableDataInfo list(SgFormulaList sgFormulaList)
{
startPage();
List<SgFormulaList> list = sgFormulaListService.selectSgFormulaListList(sgFormulaList);
return getDataTable(list);
}
/**
* 导出配方列表列表
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaList:export')")
@Log(title = "配方列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFormulaList sgFormulaList)
{
List<SgFormulaList> list = sgFormulaListService.selectSgFormulaListList(sgFormulaList);
ExcelUtil<SgFormulaList> util = new ExcelUtil<>(SgFormulaList.class);
util.exportExcel(response, list, "配方列表数据");
}
/**
* 获取配方列表详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaList:query')")
@GetMapping(value = "/{code}")
public AjaxResult getInfo(@PathVariable("code") Long code)
{
return success(sgFormulaListService.selectSgFormulaListByCode(code));
}
/**
* 新增配方列表
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaList:add')")
@Log(title = "配方列表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFormulaList sgFormulaList)
{
return toAjax(sgFormulaListService.insertSgFormulaList(sgFormulaList));
}
/**
* 修改配方列表
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaList:edit')")
@Log(title = "配方列表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFormulaList sgFormulaList)
{
return toAjax(sgFormulaListService.updateSgFormulaList(sgFormulaList));
}
/**
* 删除配方列表
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaList:remove')")
@Log(title = "配方列表", businessType = BusinessType.DELETE)
@DeleteMapping("/{codes}")
public AjaxResult remove(@PathVariable Long[] codes)
{
return toAjax(sgFormulaListService.deleteSgFormulaListByCodes(codes));
}
}

View File

@ -0,0 +1,172 @@
package com.zhyc.module.feed.controller;
import java.util.List;
import java.util.Objects;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.feed.domain.SgFormulaList;
import com.zhyc.module.feed.service.ISgFormulaListService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgFormulaManagement;
import com.zhyc.module.feed.service.ISgFormulaManagementService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 配方管理Controller
*
* @author HashMap
* @date 2025-08-09
*/
@RestController
@RequestMapping("/feed/FormulaManagement")
public class SgFormulaManagementController extends BaseController {
private final ISgFormulaManagementService sgFormulaManagementService;
private final ISgFormulaListService sgFormulaListService;
public SgFormulaManagementController(ISgFormulaManagementService sgFormulaManagementService, ISgFormulaListService sgFormulaListService) {
this.sgFormulaManagementService = sgFormulaManagementService;
this.sgFormulaListService = sgFormulaListService;
}
/**
* 查询配方管理列表
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaManagement:list')")
@GetMapping("/list")
public TableDataInfo list(SgFormulaManagement sgFormulaManagement) {
startPage();
// 非查询详情时设定BatchId为0查询配方模板
if (null != sgFormulaManagement && !Objects.equals(sgFormulaManagement.getQueryType(), "query")) {
sgFormulaManagement.setBatchId("0");
}
List<SgFormulaManagement> FormulaManagement = sgFormulaManagementService.selectSgFormulaManagementList(sgFormulaManagement);
for (SgFormulaManagement sgFormulaManagementItem : FormulaManagement) {
SgFormulaManagement query = new SgFormulaManagement();
query.setFormulaId(sgFormulaManagementItem.getFormulaId());
query.setQueryType("Sub");
List<SgFormulaManagement> subFormula = sgFormulaManagementService.selectSgFormulaManagementList(query);
sgFormulaManagementItem.setSubFormulaList(subFormula);
}
return getDataTable(FormulaManagement);
}
/**
* 导出配方管理列表
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaManagement:export')")
@Log(title = "配方管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFormulaManagement sgFormulaManagement) {
List<SgFormulaManagement> list = sgFormulaManagementService.selectSgFormulaManagementList(sgFormulaManagement);
ExcelUtil<SgFormulaManagement> util = new ExcelUtil<>(SgFormulaManagement.class);
util.exportExcel(response, list, "配方管理数据");
}
/**
* 获取配方管理详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaManagement:query')")
@GetMapping(value = "/{formulaId}")
public AjaxResult getInfo(@PathVariable("formulaId") String formulaId) {
return success(sgFormulaManagementService.selectSgFormulaManagementByFormulaId(formulaId));
}
/**
* 新增配方管理
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaManagement:add')")
@Log(title = "配方管理", businessType = BusinessType.INSERT)
@PostMapping
@Transactional(rollbackFor = Exception.class)
public AjaxResult add(@RequestBody SgFormulaManagement sgFormulaManagement) {
if (null == sgFormulaManagement)
throw new RuntimeException("ERROR: 数据为空");
if (Objects.equals(sgFormulaManagement.getBatchId(), "0")) {
SgFormulaManagement exist = sgFormulaManagementService.selectSgFormulaManagementByFormulaId(sgFormulaManagement.getFormulaId());
if (exist != null) {
throw new RuntimeException("WARNING: 配方编码重复,录入失败");
}
} else {
SgFormulaManagement exist = new SgFormulaManagement();
exist.setFormulaId(sgFormulaManagement.getFormulaId());
exist.setBatchId(sgFormulaManagement.getBatchId());
if (!sgFormulaManagementService.selectSgFormulaManagementList(exist).isEmpty()) {
throw new RuntimeException("WARNING: 批号重复,录入失败");
}
}
List<SgFormulaList> sgFormulaList = sgFormulaManagement.getSgFormulaList();
for (SgFormulaList sgFormulaListItem : sgFormulaList) {
// 前端引用模板数据时会引用主键Code,在插入前置为空
sgFormulaListItem.setCode(null);
sgFormulaListItem.setFormulaId(sgFormulaManagement.getFormulaId());
sgFormulaListItem.setBatchId(sgFormulaManagement.getBatchId());
sgFormulaListService.insertSgFormulaList(sgFormulaListItem);
}
return toAjax(sgFormulaManagementService.insertSgFormulaManagement(sgFormulaManagement));
}
/**
* 修改配方管理
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaManagement:edit')")
@Log(title = "配方管理", businessType = BusinessType.UPDATE)
@PutMapping
@Transactional(rollbackFor = Exception.class)
public AjaxResult edit(@RequestBody SgFormulaManagement sgFormulaManagement) {
List<SgFormulaList> sgFormulaList = sgFormulaManagement.getSgFormulaList();
if (null != sgFormulaManagement.getFormulaId() && null != sgFormulaManagement.getBatchId()) {
SgFormulaList delete = new SgFormulaList();
delete.setFormulaId(sgFormulaManagement.getFormulaId());
delete.setBatchId(sgFormulaManagement.getBatchId());
sgFormulaListService.deleteSgFormulaListByFormulaIdAndBatchId(delete);
} else {
throw new RuntimeException("FormulaID & BatchID不能为空");
}
// 配方表同步更新
for (SgFormulaList sgFormulaListItem : sgFormulaList) {
sgFormulaListItem.setBatchId(sgFormulaManagement.getBatchId());
sgFormulaListItem.setFormulaId(sgFormulaManagement.getFormulaId());
sgFormulaListService.insertSgFormulaList(sgFormulaListItem);
}
return toAjax(sgFormulaManagementService.updateSgFormulaManagement(sgFormulaManagement));
}
/**
* 删除配方管理
*/
@PreAuthorize("@ss.hasPermi('feed:FormulaManagement:remove')")
@Log(title = "配方管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{formulaId}/{batchId}")
@Transactional(rollbackFor = Exception.class)
public AjaxResult remove(@PathVariable String formulaId, @PathVariable String batchId) {
SgFormulaManagement sgFormulaManagement = new SgFormulaManagement();
sgFormulaManagement.setFormulaId(formulaId);
sgFormulaManagement.setBatchId(batchId);
if (sgFormulaManagement.getBatchId().equals("0")) {
sgFormulaManagement.setBatchId(null);
List<SgFormulaManagement> list = sgFormulaManagementService.selectSgFormulaManagementList(sgFormulaManagement);
if (list.size() > 1) {
throw new RuntimeException("WARNING 该配方正被使用,无法删除");
}
sgFormulaManagement.setBatchId(batchId);
}
// 前置检查完毕 执行删除
sgFormulaManagement.setBatchId(batchId);
return toAjax(sgFormulaManagementService.deleteSgFormulaManagement(sgFormulaManagement));
}
}

View File

@ -0,0 +1,107 @@
package com.zhyc.module.feed.controller;
import java.util.List;
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 com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.feed.domain.SgMaterial;
import com.zhyc.module.feed.service.ISgMaterialService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 原料Controller
*
* @author HashMap
* @date 2025-08-11
*/
@RestController
@RequestMapping("/feed/material")
public class SgMaterialController extends BaseController
{
private final ISgMaterialService sgMaterialService;
public SgMaterialController(ISgMaterialService sgMaterialService) {
this.sgMaterialService = sgMaterialService;
}
/**
* 查询原料列表
*/
@PreAuthorize("@ss.hasPermi('feed:material:list')")
@GetMapping("/list")
public TableDataInfo list(SgMaterial sgMaterial)
{
startPage();
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
return getDataTable(list);
}
/**
* 导出原料列表
*/
@PreAuthorize("@ss.hasPermi('feed:material:export')")
@Log(title = "原料", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgMaterial sgMaterial)
{
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
ExcelUtil<SgMaterial> util = new ExcelUtil<>(SgMaterial.class);
util.exportExcel(response, list, "原料数据");
}
/**
* 获取原料详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:material:query')")
@GetMapping(value = "/{materialId}")
public AjaxResult getInfo(@PathVariable("materialId") String materialId)
{
return success(sgMaterialService.selectSgMaterialByMaterialId(materialId));
}
/**
* 新增原料
*/
@PreAuthorize("@ss.hasPermi('feed:material:add')")
@Log(title = "原料", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgMaterial sgMaterial)
{
return toAjax(sgMaterialService.insertSgMaterial(sgMaterial));
}
/**
* 修改原料
*/
@PreAuthorize("@ss.hasPermi('feed:material:edit')")
@Log(title = "原料", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgMaterial sgMaterial)
{
return toAjax(sgMaterialService.updateSgMaterial(sgMaterial));
}
/**
* 删除原料
*/
@PreAuthorize("@ss.hasPermi('feed:material:remove')")
@Log(title = "原料", businessType = BusinessType.DELETE)
@DeleteMapping("/{materialIds}")
public AjaxResult remove(@PathVariable String[] materialIds)
{
return toAjax(sgMaterialService.deleteSgMaterialByMaterialIds(materialIds));
}
}

View File

@ -0,0 +1,82 @@
package com.zhyc.module.feed.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 饲喂记录详情对象 sg_feed_details
*
* @author ruoyi
* @date 2025-08-01
*/
public class SgFeedDetails extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 原料id */
@Excel(name = "原料id")
private String fodder;
/** 数量 */
@Excel(name = "数量")
private Long number;
/** 单位 */
@Excel(name = "单位")
private String nuit;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setFodder(String fodder)
{
this.fodder = fodder;
}
public String getFodder()
{
return fodder;
}
public void setNumber(Long number)
{
this.number = number;
}
public Long getNumber()
{
return number;
}
public void setNuit(String nuit)
{
this.nuit = nuit;
}
public String getNuit()
{
return nuit;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("fodder", getFodder())
.append("number", getNumber())
.append("nuit", getNuit())
.toString();
}
}

View File

@ -0,0 +1,252 @@
package com.zhyc.module.feed.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 饲喂记录对象 sg_feed_info
*
* @author ruoyi
* @date 2025-08-01
*/
public class SgFeedInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 配方编码 */
@Excel(name = "配方编码")
private Long formulaId;
/** 羊舍 */
@Excel(name = "羊舍")
private String sheepfoldId;
/** 日均计划量 */
@Excel(name = "日均计划量")
private Long average;
/** 早上计划量(通过饲喂比例算出来) */
@Excel(name = "早上计划量(通过饲喂比例算出来)")
private Long planMonring;
/** 实际添加(早) */
@Excel(name = "实际添加", readConverterExp = "早=")
private Long actualMonring;
/** 中午计划量 */
@Excel(name = "中午计划量")
private Long planNoon;
/** 实际添加(中) */
@Excel(name = "实际添加", readConverterExp = "中=")
private Long actualNoon;
/** 下午计划量 */
@Excel(name = "下午计划量")
private Long planEvenig;
/** 实际添加(下) */
@Excel(name = "实际添加", readConverterExp = "下=")
private Long actualEvening;
/** 颗粒原料 */
@Excel(name = "颗粒原料")
private Long particle;
/** 其他原料 */
@Excel(name = "其他原料")
private Long other;
/** 补饲饲料 */
@Excel(name = "补饲饲料")
private Long replenish;
/** 饲喂日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "饲喂日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date planDate;
/** 备注 */
@Excel(name = "备注")
private String comment;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setFormulaId(Long formulaId)
{
this.formulaId = formulaId;
}
public Long getFormulaId()
{
return formulaId;
}
public void setSheepfoldId(String sheepfoldId)
{
this.sheepfoldId = sheepfoldId;
}
public String getSheepfoldId()
{
return sheepfoldId;
}
public void setAverage(Long average)
{
this.average = average;
}
public Long getAverage()
{
return average;
}
public void setPlanMonring(Long planMonring)
{
this.planMonring = planMonring;
}
public Long getPlanMonring()
{
return planMonring;
}
public void setActualMonring(Long actualMonring)
{
this.actualMonring = actualMonring;
}
public Long getActualMonring()
{
return actualMonring;
}
public void setPlanNoon(Long planNoon)
{
this.planNoon = planNoon;
}
public Long getPlanNoon()
{
return planNoon;
}
public void setActualNoon(Long actualNoon)
{
this.actualNoon = actualNoon;
}
public Long getActualNoon()
{
return actualNoon;
}
public void setPlanEvenig(Long planEvenig)
{
this.planEvenig = planEvenig;
}
public Long getPlanEvenig()
{
return planEvenig;
}
public void setActualEvening(Long actualEvening)
{
this.actualEvening = actualEvening;
}
public Long getActualEvening()
{
return actualEvening;
}
public void setParticle(Long particle)
{
this.particle = particle;
}
public Long getParticle()
{
return particle;
}
public void setOther(Long other)
{
this.other = other;
}
public Long getOther()
{
return other;
}
public void setReplenish(Long replenish)
{
this.replenish = replenish;
}
public Long getReplenish()
{
return replenish;
}
public void setPlanDate(Date planDate)
{
this.planDate = planDate;
}
public Date getPlanDate()
{
return planDate;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("formulaId", getFormulaId())
.append("sheepfoldId", getSheepfoldId())
.append("average", getAverage())
.append("planMonring", getPlanMonring())
.append("actualMonring", getActualMonring())
.append("planNoon", getPlanNoon())
.append("actualNoon", getActualNoon())
.append("planEvenig", getPlanEvenig())
.append("actualEvening", getActualEvening())
.append("particle", getParticle())
.append("other", getOther())
.append("replenish", getReplenish())
.append("planDate", getPlanDate())
.append("comment", getComment())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,132 @@
package com.zhyc.module.feed.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 饲喂计划对象 sg_feed_plan
*
* @author HashMap
* @date 2025-08-08
*/
@Setter
@Getter
public class SgFeedPlan extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 创建日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date createDate;
/** 配方编码 */
@Excel(name = "配方编码")
private String formulaId;
/** 羊舍 */
@Excel(name = "羊舍")
private Long sheepHouseId;
/** 羊只数量 */
@Excel(name = "羊只数量")
private Long sheepCount;
/** 日均计划量 */
@Excel(name = "日均计划量")
private Long planDailySize;
/** 计划量(早) */
@Excel(name = "计划量(早)")
private Long planMorningSize;
/** 计划总量(早) */
@Excel(name = "计划总量(早)")
private Long planMorningTotal;
/** 饲喂比例(早) */
@Excel(name = "饲喂比例(早)")
private Long ratioMorning;
/** 实际量(早) */
@Excel(name = "实际量(早)")
private Long actualMorningSize;
/** 计划量(中) */
@Excel(name = "计划量(中)")
private Long planNoonSize;
/** 计划总量(中) */
@Excel(name = "计划总量(中)")
private Long planNoonTotal;
/** 实际量(中) */
@Excel(name = "实际量(中)")
private Long actualNoonSize;
/** 饲喂比例(中) */
@Excel(name = "饲喂比例(中)")
private Long ratioNoon;
/** 计划量(下) */
@Excel(name = "计划量(下)")
private Long planAfternoonSize;
/** 计划总量(下) */
@Excel(name = "计划总量(下)")
private Long planAfternoonTotal;
/** 实际量(下) */
@Excel(name = "实际量(下)")
private Long actualAfternoonSize;
/** 饲喂比例(下) */
@Excel(name = "饲喂比例(下)")
private Long ratioAfternoon;
/** 计划饲喂总量 */
@Excel(name = "计划饲喂总量")
private Long planFeedTotal;
/** 饲草班人员 */
@Excel(name = "饲草班人员")
private String zookeeper;
/** 饲喂计划日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "饲喂计划日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date planDate;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("createDate", getCreateDate())
.append("formulaId", getFormulaId())
.append("sheepHouseId", getSheepHouseId())
.append("sheepCount", getSheepCount())
.append("planDailySize", getPlanDailySize())
.append("planMorningSize", getPlanMorningSize())
.append("planMorningTotal", getPlanMorningTotal())
.append("ratioMorning", getRatioMorning())
.append("actualMorningSize", getActualMorningSize())
.append("planNoonSize", getPlanNoonSize())
.append("planNoonTotal", getPlanNoonTotal())
.append("actualNoonSize", getActualNoonSize())
.append("ratioNoon", getRatioNoon())
.append("planAfternoonSize", getPlanAfternoonSize())
.append("planAfternoonTotal", getPlanAfternoonTotal())
.append("actualAfternoonSize", getActualAfternoonSize())
.append("ratioAfternoon", getRatioAfternoon())
.append("planFeedTotal", getPlanFeedTotal())
.append("zookeeper", getZookeeper())
.append("planDate", getPlanDate())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,82 @@
package com.zhyc.module.feed.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 饲喂比例对象 sg_feed_ratio
*
* @author ruoyi
* @date 2025-08-01
*/
public class SgFeedRatio extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 早晨计划比列 */
@Excel(name = "早晨计划比列")
private String morning;
/** 中午计划比例 */
@Excel(name = "中午计划比例")
private String noon;
/** 下午计划比例 */
@Excel(name = "下午计划比例")
private String evening;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setMorning(String morning)
{
this.morning = morning;
}
public String getMorning()
{
return morning;
}
public void setNoon(String noon)
{
this.noon = noon;
}
public String getNoon()
{
return noon;
}
public void setEvening(String evening)
{
this.evening = evening;
}
public String getEvening()
{
return evening;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("morning", getMorning())
.append("noon", getNoon())
.append("evening", getEvening())
.toString();
}
}

View File

@ -0,0 +1,67 @@
package com.zhyc.module.feed.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 原料对象 sg_fodder
*
* @author ruoyi
* @date 2025-08-01
*/
public class SgFodder extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 名称 */
@Excel(name = "名称")
private String name;
/** 0补饲饲料1配方原料2颗粒原料 */
@Excel(name = "0补饲饲料1配方原料2颗粒原料")
private Long fodderType;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setFodderType(Long fodderType)
{
this.fodderType = fodderType;
}
public Long getFodderType()
{
return fodderType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("fodderType", getFodderType())
.toString();
}
}

View File

@ -0,0 +1,62 @@
package com.zhyc.module.feed.domain;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 配方列表对象 sg_formula_list
*
* @author HashMap
* @date 2025-08-09
*/
@Setter
@Getter
public class SgFormulaList extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 序号 */
private Long code;
/** 配方编号 */
private String formulaId;
/** 配方编号 */
private String batchId;
/** 原料编号 */
@Excel(name = "原料编号")
private String materialId;
/** 原料名称 */
@Excel(name = "原料名称")
private String materialName;
/** 比例 */
@Excel(name = "比例")
private Long ratio;
/** 颗粒原料 */
@Excel(name = "颗粒原料")
private String isGranular;
/** 补饲 */
@Excel(name = "补饲")
private String isSupplement;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("code", getCode())
.append("formulaId", getFormulaId())
.append("materialId", getMaterialId())
.append("materialName", getMaterialName())
.append("ratio", getRatio())
.append("isGranular", getIsGranular())
.append("isSupplement", getIsSupplement())
.toString();
}
}

View File

@ -0,0 +1,79 @@
package com.zhyc.module.feed.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 配方管理对象 sg_formula_management
*
* @author HashMap
* @date 2025-08-09
*/
@Setter
@Getter
public class SgFormulaManagement extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 配方编号 */
private String formulaId;
/** 饲养阶段 */
@Excel(name = "饲养阶段")
private String feedStage;
/** 批号 */
@Excel(name = "批号")
private String batchId;
/** 开始使用时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始使用时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date useStartDate;
/** 结束使用时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束使用时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date useEndDate;
/** 使用状态 */
@Excel(name = "使用状态")
private String useState;
/** 备注 */
@Excel(name = "备注")
private String remark;
/** 配方列表 */
private List<SgFormulaList> sgFormulaList;
/** 子配方 */
private List<SgFormulaManagement> subFormulaList;
/** 查询类型 *
* Sub : 子配方查询
* query : 类型查询
* */
private String queryType;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("formulaId", getFormulaId())
.append("feedStage", getFeedStage())
.append("batchId", getBatchId())
.append("useStartDate", getUseStartDate())
.append("useEndDate", getUseEndDate())
.append("useState", getUseState())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,15 @@
package com.zhyc.module.feed.domain;
import com.zhyc.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class SgMaterial extends BaseEntity {
private static final long serialVersionUID = 1L;
private String materialId;
private String materialName;
private String isGranular;
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedDetails;
/**
* 饲喂记录详情Mapper接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface SgFeedDetailsMapper
{
/**
* 查询饲喂记录详情
*
* @param id 饲喂记录详情主键
* @return 饲喂记录详情
*/
public SgFeedDetails selectSgFeedDetailsById(Long id);
/**
* 查询饲喂记录详情列表
*
* @param sgFeedDetails 饲喂记录详情
* @return 饲喂记录详情集合
*/
public List<SgFeedDetails> selectSgFeedDetailsList(SgFeedDetails sgFeedDetails);
/**
* 新增饲喂记录详情
*
* @param sgFeedDetails 饲喂记录详情
* @return 结果
*/
public int insertSgFeedDetails(SgFeedDetails sgFeedDetails);
/**
* 修改饲喂记录详情
*
* @param sgFeedDetails 饲喂记录详情
* @return 结果
*/
public int updateSgFeedDetails(SgFeedDetails sgFeedDetails);
/**
* 删除饲喂记录详情
*
* @param id 饲喂记录详情主键
* @return 结果
*/
public int deleteSgFeedDetailsById(Long id);
/**
* 批量删除饲喂记录详情
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSgFeedDetailsByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedInfo;
/**
* 饲喂记录Mapper接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface SgFeedInfoMapper
{
/**
* 查询饲喂记录
*
* @param id 饲喂记录主键
* @return 饲喂记录
*/
public SgFeedInfo selectSgFeedInfoById(Long id);
/**
* 查询饲喂记录列表
*
* @param sgFeedInfo 饲喂记录
* @return 饲喂记录集合
*/
public List<SgFeedInfo> selectSgFeedInfoList(SgFeedInfo sgFeedInfo);
/**
* 新增饲喂记录
*
* @param sgFeedInfo 饲喂记录
* @return 结果
*/
public int insertSgFeedInfo(SgFeedInfo sgFeedInfo);
/**
* 修改饲喂记录
*
* @param sgFeedInfo 饲喂记录
* @return 结果
*/
public int updateSgFeedInfo(SgFeedInfo sgFeedInfo);
/**
* 删除饲喂记录
*
* @param id 饲喂记录主键
* @return 结果
*/
public int deleteSgFeedInfoById(Long id);
/**
* 批量删除饲喂记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSgFeedInfoByIds(Long[] ids);
}

View File

@ -0,0 +1,64 @@
package com.zhyc.module.feed.mapper;
import java.util.Date;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedPlan;
import org.apache.ibatis.annotations.Mapper;
/**
* 饲喂计划Mapper接口
*
* @author HashMap
* @date 2025-08-08
*/
@Mapper
public interface SgFeedPlanMapper
{
/**
* 查询饲喂计划
*
* @param createDate 饲喂计划主键
* @return 饲喂计划
*/
SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate);
/**
* 查询饲喂计划列表
*
* @param sgFeedPlan 饲喂计划
* @return 饲喂计划集合
*/
List<SgFeedPlan> selectSgFeedPlanList(SgFeedPlan sgFeedPlan);
/**
* 新增饲喂计划
*
* @param sgFeedPlan 饲喂计划
* @return 结果
*/
int insertSgFeedPlan(SgFeedPlan sgFeedPlan);
/**
* 修改饲喂计划
*
* @param sgFeedPlan 饲喂计划
* @return 结果
*/
int updateSgFeedPlan(SgFeedPlan sgFeedPlan);
/**
* 删除饲喂计划
*
* @param createDate 饲喂计划主键
* @return 结果
*/
int deleteSgFeedPlanByCreateDate(Date createDate);
/**
* 批量删除饲喂计划
*
* @param createDates 需要删除的数据主键集合
* @return 结果
*/
int deleteSgFeedPlanByCreateDates(Date[] createDates);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedRatio;
/**
* 饲喂比例Mapper接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface SgFeedRatioMapper
{
/**
* 查询饲喂比例
*
* @param id 饲喂比例主键
* @return 饲喂比例
*/
public SgFeedRatio selectSgFeedRatioById(Long id);
/**
* 查询饲喂比例列表
*
* @param sgFeedRatio 饲喂比例
* @return 饲喂比例集合
*/
public List<SgFeedRatio> selectSgFeedRatioList(SgFeedRatio sgFeedRatio);
/**
* 新增饲喂比例
*
* @param sgFeedRatio 饲喂比例
* @return 结果
*/
public int insertSgFeedRatio(SgFeedRatio sgFeedRatio);
/**
* 修改饲喂比例
*
* @param sgFeedRatio 饲喂比例
* @return 结果
*/
public int updateSgFeedRatio(SgFeedRatio sgFeedRatio);
/**
* 删除饲喂比例
*
* @param id 饲喂比例主键
* @return 结果
*/
public int deleteSgFeedRatioById(Long id);
/**
* 批量删除饲喂比例
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSgFeedRatioByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFodder;
/**
* 原料Mapper接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface SgFodderMapper
{
/**
* 查询原料
*
* @param id 原料主键
* @return 原料
*/
public SgFodder selectSgFodderById(Long id);
/**
* 查询原料列表
*
* @param sgFodder 原料
* @return 原料集合
*/
public List<SgFodder> selectSgFodderList(SgFodder sgFodder);
/**
* 新增原料
*
* @param sgFodder 原料
* @return 结果
*/
public int insertSgFodder(SgFodder sgFodder);
/**
* 修改原料
*
* @param sgFodder 原料
* @return 结果
*/
public int updateSgFodder(SgFodder sgFodder);
/**
* 删除原料
*
* @param id 原料主键
* @return 结果
*/
public int deleteSgFodderById(Long id);
/**
* 批量删除原料
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSgFodderByIds(Long[] ids);
}

View File

@ -0,0 +1,71 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFormulaList;
import org.apache.ibatis.annotations.Mapper;
/**
* 配方列表Mapper接口
*
* @author HashMap
* @date 2025-08-09
*/
@Mapper
public interface SgFormulaListMapper
{
/**
* 查询配方列表
*
* @param code 配方列表主键
* @return 配方列表
*/
SgFormulaList selectSgFormulaListByCode(Long code);
/**
* 查询配方列表列表
*
* @param sgFormulaList 配方列表
* @return 配方列表集合
*/
List<SgFormulaList> selectSgFormulaListList(SgFormulaList sgFormulaList);
/**
* 新增配方列表
*
* @param sgFormulaList 配方列表
* @return 结果
*/
int insertSgFormulaList(SgFormulaList sgFormulaList);
/**
* 修改配方列表
*
* @param sgFormulaList 配方列表
* @return 结果
*/
int updateSgFormulaList(SgFormulaList sgFormulaList);
/**
* 删除配方列表
*
* @param code 配方列表主键
* @return 结果
*/
int deleteSgFormulaListByCode(Long code);
/**
* 批量删除配方列表
*
* @param codes 需要删除的数据主键集合
* @return 结果
*/
int deleteSgFormulaListByCodes(Long[] codes);
/**
* 批量删除配方列表
*
* @param sgFormulaList 参数实体
* @return 结果
*/
int deleteSgFormulaListByFormulaIdAndBatchId(SgFormulaList sgFormulaList);
}

View File

@ -0,0 +1,65 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFormulaManagement;
import org.apache.ibatis.annotations.Mapper;
/**
* 配方管理Mapper接口
*
* @author HashMap
* @date 2025-08-09
*/
@Mapper
public interface SgFormulaManagementMapper
{
/**
* 查询配方管理
*
* @param formulaId 配方管理主键
* @return 配方管理
*/
SgFormulaManagement selectSgFormulaManagementByFormulaId(String formulaId);
/**
* 查询配方管理列表
*
* @param sgFormulaManagement 配方管理
* @return 配方管理集合
*/
List<SgFormulaManagement> selectSgFormulaManagementList(SgFormulaManagement sgFormulaManagement);
/**
* 新增配方管理
*
* @param sgFormulaManagement 配方管理
* @return 结果
*/
int insertSgFormulaManagement(SgFormulaManagement sgFormulaManagement);
/**
* 修改配方管理
*
* @param sgFormulaManagement 配方管理
* @return 结果
*/
int updateSgFormulaManagement(SgFormulaManagement sgFormulaManagement);
/**
* 删除配方管理
*
* @param formulaId 配方管理主键
* @return 结果
*/
int deleteSgFormulaManagementByFormulaId(String formulaId);
/**
* 批量删除配方管理
*
* @param formulaIds 需要删除的数据主键集合
* @return 结果
*/
int deleteSgFormulaManagementByFormulaIds(String[] formulaIds);
int deleteSgFormulaManagement(SgFormulaManagement sgFormulaManagement);
}

View File

@ -0,0 +1,63 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgMaterial;
import org.apache.ibatis.annotations.Mapper;
/**
* 原料Mapper接口
*
* @author HashMap
* @date 2025-08-11
*/
@Mapper
public interface SgMaterialMapper
{
/**
* 查询原料
*
* @param materialId 原料主键
* @return 原料
*/
public SgMaterial selectSgMaterialByMaterialId(String materialId);
/**
* 查询原料列表
*
* @param sgMaterial 原料
* @return 原料集合
*/
public List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial);
/**
* 新增原料
*
* @param sgMaterial 原料
* @return 结果
*/
public int insertSgMaterial(SgMaterial sgMaterial);
/**
* 修改原料
*
* @param sgMaterial 原料
* @return 结果
*/
public int updateSgMaterial(SgMaterial sgMaterial);
/**
* 删除原料
*
* @param materialId 原料主键
* @return 结果
*/
public int deleteSgMaterialByMaterialId(String materialId);
/**
* 批量删除原料
*
* @param materialIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteSgMaterialByMaterialIds(String[] materialIds);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.feed.service;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedDetails;
/**
* 饲喂记录详情Service接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface ISgFeedDetailsService
{
/**
* 查询饲喂记录详情
*
* @param id 饲喂记录详情主键
* @return 饲喂记录详情
*/
public SgFeedDetails selectSgFeedDetailsById(Long id);
/**
* 查询饲喂记录详情列表
*
* @param sgFeedDetails 饲喂记录详情
* @return 饲喂记录详情集合
*/
public List<SgFeedDetails> selectSgFeedDetailsList(SgFeedDetails sgFeedDetails);
/**
* 新增饲喂记录详情
*
* @param sgFeedDetails 饲喂记录详情
* @return 结果
*/
public int insertSgFeedDetails(SgFeedDetails sgFeedDetails);
/**
* 修改饲喂记录详情
*
* @param sgFeedDetails 饲喂记录详情
* @return 结果
*/
public int updateSgFeedDetails(SgFeedDetails sgFeedDetails);
/**
* 批量删除饲喂记录详情
*
* @param ids 需要删除的饲喂记录详情主键集合
* @return 结果
*/
public int deleteSgFeedDetailsByIds(Long[] ids);
/**
* 删除饲喂记录详情信息
*
* @param id 饲喂记录详情主键
* @return 结果
*/
public int deleteSgFeedDetailsById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.feed.service;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedInfo;
/**
* 饲喂记录Service接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface ISgFeedInfoService
{
/**
* 查询饲喂记录
*
* @param id 饲喂记录主键
* @return 饲喂记录
*/
public SgFeedInfo selectSgFeedInfoById(Long id);
/**
* 查询饲喂记录列表
*
* @param sgFeedInfo 饲喂记录
* @return 饲喂记录集合
*/
public List<SgFeedInfo> selectSgFeedInfoList(SgFeedInfo sgFeedInfo);
/**
* 新增饲喂记录
*
* @param sgFeedInfo 饲喂记录
* @return 结果
*/
public int insertSgFeedInfo(SgFeedInfo sgFeedInfo);
/**
* 修改饲喂记录
*
* @param sgFeedInfo 饲喂记录
* @return 结果
*/
public int updateSgFeedInfo(SgFeedInfo sgFeedInfo);
/**
* 批量删除饲喂记录
*
* @param ids 需要删除的饲喂记录主键集合
* @return 结果
*/
public int deleteSgFeedInfoByIds(Long[] ids);
/**
* 删除饲喂记录信息
*
* @param id 饲喂记录主键
* @return 结果
*/
public int deleteSgFeedInfoById(Long id);
}

View File

@ -0,0 +1,62 @@
package com.zhyc.module.feed.service;
import java.util.Date;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedPlan;
/**
* 饲喂计划Service接口
*
* @author HashMap
* @date 2025-08-08
*/
public interface ISgFeedPlanService
{
/**
* 查询饲喂计划
*
* @param createDate 饲喂计划主键
* @return 饲喂计划
*/
SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate);
/**
* 查询饲喂计划列表
*
* @param sgFeedPlan 饲喂计划
* @return 饲喂计划集合
*/
List<SgFeedPlan> selectSgFeedPlanList(SgFeedPlan sgFeedPlan);
/**
* 新增饲喂计划
*
* @param sgFeedPlan 饲喂计划
* @return 结果
*/
int insertSgFeedPlan(SgFeedPlan sgFeedPlan);
/**
* 修改饲喂计划
*
* @param sgFeedPlan 饲喂计划
* @return 结果
*/
int updateSgFeedPlan(SgFeedPlan sgFeedPlan);
/**
* 批量删除饲喂计划
*
* @param createDates 需要删除的饲喂计划主键集合
* @return 结果
*/
int deleteSgFeedPlanByCreateDates(Date[] createDates);
/**
* 删除饲喂计划信息
*
* @param createDate 饲喂计划主键
* @return 结果
*/
int deleteSgFeedPlanByCreateDate(Date createDate);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.feed.service;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedRatio;
/**
* 饲喂比例Service接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface ISgFeedRatioService
{
/**
* 查询饲喂比例
*
* @param id 饲喂比例主键
* @return 饲喂比例
*/
public SgFeedRatio selectSgFeedRatioById(Long id);
/**
* 查询饲喂比例列表
*
* @param sgFeedRatio 饲喂比例
* @return 饲喂比例集合
*/
public List<SgFeedRatio> selectSgFeedRatioList(SgFeedRatio sgFeedRatio);
/**
* 新增饲喂比例
*
* @param sgFeedRatio 饲喂比例
* @return 结果
*/
public int insertSgFeedRatio(SgFeedRatio sgFeedRatio);
/**
* 修改饲喂比例
*
* @param sgFeedRatio 饲喂比例
* @return 结果
*/
public int updateSgFeedRatio(SgFeedRatio sgFeedRatio);
/**
* 批量删除饲喂比例
*
* @param ids 需要删除的饲喂比例主键集合
* @return 结果
*/
public int deleteSgFeedRatioByIds(Long[] ids);
/**
* 删除饲喂比例信息
*
* @param id 饲喂比例主键
* @return 结果
*/
public int deleteSgFeedRatioById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.feed.service;
import java.util.List;
import com.zhyc.module.feed.domain.SgFodder;
/**
* 原料Service接口
*
* @author ruoyi
* @date 2025-08-01
*/
public interface ISgFodderService
{
/**
* 查询原料
*
* @param id 原料主键
* @return 原料
*/
public SgFodder selectSgFodderById(Long id);
/**
* 查询原料列表
*
* @param sgFodder 原料
* @return 原料集合
*/
public List<SgFodder> selectSgFodderList(SgFodder sgFodder);
/**
* 新增原料
*
* @param sgFodder 原料
* @return 结果
*/
public int insertSgFodder(SgFodder sgFodder);
/**
* 修改原料
*
* @param sgFodder 原料
* @return 结果
*/
public int updateSgFodder(SgFodder sgFodder);
/**
* 批量删除原料
*
* @param ids 需要删除的原料主键集合
* @return 结果
*/
public int deleteSgFodderByIds(Long[] ids);
/**
* 删除原料信息
*
* @param id 原料主键
* @return 结果
*/
public int deleteSgFodderById(Long id);
}

View File

@ -0,0 +1,63 @@
package com.zhyc.module.feed.service;
import java.util.List;
import com.zhyc.module.feed.domain.SgFormulaList;
/**
* 配方列表Service接口
*
* @author HashMap
* @date 2025-08-09
*/
public interface ISgFormulaListService
{
/**
* 查询配方列表
*
* @param code 配方列表主键
* @return 配方列表
*/
SgFormulaList selectSgFormulaListByCode(Long code);
/**
* 查询配方列表列表
*
* @param sgFormulaList 配方列表
* @return 配方列表集合
*/
List<SgFormulaList> selectSgFormulaListList(SgFormulaList sgFormulaList);
/**
* 新增配方列表
*
* @param sgFormulaList 配方列表
* @return 结果
*/
int insertSgFormulaList(SgFormulaList sgFormulaList);
/**
* 修改配方列表
*
* @param sgFormulaList 配方列表
* @return 结果
*/
int updateSgFormulaList(SgFormulaList sgFormulaList);
/**
* 批量删除配方列表
*
* @param codes 需要删除的配方列表主键集合
* @return 结果
*/
int deleteSgFormulaListByCodes(Long[] codes);
/**
* 删除配方列表信息
*
* @param code 配方列表主键
* @return 结果
*/
int deleteSgFormulaListByCode(Long code);
int deleteSgFormulaListByFormulaIdAndBatchId(SgFormulaList sgFormulaList);
}

View File

@ -0,0 +1,66 @@
package com.zhyc.module.feed.service;
import java.util.List;
import com.zhyc.module.feed.domain.SgFormulaManagement;
/**
* 配方管理Service接口
*
* @author HashMap
* @date 2025-08-09
*/
public interface ISgFormulaManagementService
{
/**
* 查询配方管理
*
* @param formulaId 配方管理主键
* @return 配方管理
*/
SgFormulaManagement selectSgFormulaManagementByFormulaId(String formulaId);
/**
* 查询配方管理列表
*
* @param sgFormulaManagement 配方管理
* @return 配方管理集合
*/
List<SgFormulaManagement> selectSgFormulaManagementList(SgFormulaManagement sgFormulaManagement);
/**
* 新增配方管理
*
* @param sgFormulaManagement 配方管理
* @return 结果
*/
int insertSgFormulaManagement(SgFormulaManagement sgFormulaManagement);
/**
* 修改配方管理
*
* @param sgFormulaManagement 配方管理
* @return 结果
*/
int updateSgFormulaManagement(SgFormulaManagement sgFormulaManagement);
/**
* 批量删除配方管理
*
* @param formulaIds 需要删除的配方管理主键集合
* @return 结果
*/
int deleteSgFormulaManagementByFormulaIds(String[] formulaIds);
/**
* 删除配方管理信息
*
* @param formulaId 配方管理主键
* @return 结果
*/
int deleteSgFormulaManagementByFormulaId(String formulaId);
/***
* 删除配方管理信息
*/
int deleteSgFormulaManagement(SgFormulaManagement sgFormulaManagement);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.feed.service;
import java.util.List;
import com.zhyc.module.feed.domain.SgMaterial;
/**
* 原料Service接口
*
* @author HashMap
* @date 2025-08-11
*/
public interface ISgMaterialService
{
/**
* 查询原料
*
* @param materialId 原料主键
* @return 原料
*/
SgMaterial selectSgMaterialByMaterialId(String materialId);
/**
* 查询原料列表
*
* @param sgMaterial 原料
* @return 原料集合
*/
List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial);
/**
* 新增原料
*
* @param sgMaterial 原料
* @return 结果
*/
int insertSgMaterial(SgMaterial sgMaterial);
/**
* 修改原料
*
* @param sgMaterial 原料
* @return 结果
*/
int updateSgMaterial(SgMaterial sgMaterial);
/**
* 批量删除原料
*
* @param materialIds 需要删除的原料主键集合
* @return 结果
*/
int deleteSgMaterialByMaterialIds(String[] materialIds);
/**
* 删除原料信息
*
* @param materialId 原料主键
* @return 结果
*/
int deleteSgMaterialByMaterialId(String materialId);
}

View File

@ -0,0 +1,93 @@
package com.zhyc.module.feed.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgFeedDetailsMapper;
import com.zhyc.module.feed.domain.SgFeedDetails;
import com.zhyc.module.feed.service.ISgFeedDetailsService;
/**
* 饲喂记录详情Service业务层处理
*
* @author ruoyi
* @date 2025-08-01
*/
@Service
public class SgFeedDetailsServiceImpl implements ISgFeedDetailsService
{
@Autowired
private SgFeedDetailsMapper sgFeedDetailsMapper;
/**
* 查询饲喂记录详情
*
* @param id 饲喂记录详情主键
* @return 饲喂记录详情
*/
@Override
public SgFeedDetails selectSgFeedDetailsById(Long id)
{
return sgFeedDetailsMapper.selectSgFeedDetailsById(id);
}
/**
* 查询饲喂记录详情列表
*
* @param sgFeedDetails 饲喂记录详情
* @return 饲喂记录详情
*/
@Override
public List<SgFeedDetails> selectSgFeedDetailsList(SgFeedDetails sgFeedDetails)
{
return sgFeedDetailsMapper.selectSgFeedDetailsList(sgFeedDetails);
}
/**
* 新增饲喂记录详情
*
* @param sgFeedDetails 饲喂记录详情
* @return 结果
*/
@Override
public int insertSgFeedDetails(SgFeedDetails sgFeedDetails)
{
return sgFeedDetailsMapper.insertSgFeedDetails(sgFeedDetails);
}
/**
* 修改饲喂记录详情
*
* @param sgFeedDetails 饲喂记录详情
* @return 结果
*/
@Override
public int updateSgFeedDetails(SgFeedDetails sgFeedDetails)
{
return sgFeedDetailsMapper.updateSgFeedDetails(sgFeedDetails);
}
/**
* 批量删除饲喂记录详情
*
* @param ids 需要删除的饲喂记录详情主键
* @return 结果
*/
@Override
public int deleteSgFeedDetailsByIds(Long[] ids)
{
return sgFeedDetailsMapper.deleteSgFeedDetailsByIds(ids);
}
/**
* 删除饲喂记录详情信息
*
* @param id 饲喂记录详情主键
* @return 结果
*/
@Override
public int deleteSgFeedDetailsById(Long id)
{
return sgFeedDetailsMapper.deleteSgFeedDetailsById(id);
}
}

View File

@ -0,0 +1,95 @@
package com.zhyc.module.feed.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgFeedInfoMapper;
import com.zhyc.module.feed.domain.SgFeedInfo;
import com.zhyc.module.feed.service.ISgFeedInfoService;
/**
* 饲喂记录Service业务层处理
*
* @author ruoyi
* @date 2025-08-01
*/
@Service
public class SgFeedInfoServiceImpl implements ISgFeedInfoService
{
@Autowired
private SgFeedInfoMapper sgFeedInfoMapper;
/**
* 查询饲喂记录
*
* @param id 饲喂记录主键
* @return 饲喂记录
*/
@Override
public SgFeedInfo selectSgFeedInfoById(Long id)
{
return sgFeedInfoMapper.selectSgFeedInfoById(id);
}
/**
* 查询饲喂记录列表
*
* @param sgFeedInfo 饲喂记录
* @return 饲喂记录
*/
@Override
public List<SgFeedInfo> selectSgFeedInfoList(SgFeedInfo sgFeedInfo)
{
return sgFeedInfoMapper.selectSgFeedInfoList(sgFeedInfo);
}
/**
* 新增饲喂记录
*
* @param sgFeedInfo 饲喂记录
* @return 结果
*/
@Override
public int insertSgFeedInfo(SgFeedInfo sgFeedInfo)
{
sgFeedInfo.setCreateTime(DateUtils.getNowDate());
return sgFeedInfoMapper.insertSgFeedInfo(sgFeedInfo);
}
/**
* 修改饲喂记录
*
* @param sgFeedInfo 饲喂记录
* @return 结果
*/
@Override
public int updateSgFeedInfo(SgFeedInfo sgFeedInfo)
{
return sgFeedInfoMapper.updateSgFeedInfo(sgFeedInfo);
}
/**
* 批量删除饲喂记录
*
* @param ids 需要删除的饲喂记录主键
* @return 结果
*/
@Override
public int deleteSgFeedInfoByIds(Long[] ids)
{
return sgFeedInfoMapper.deleteSgFeedInfoByIds(ids);
}
/**
* 删除饲喂记录信息
*
* @param id 饲喂记录主键
* @return 结果
*/
@Override
public int deleteSgFeedInfoById(Long id)
{
return sgFeedInfoMapper.deleteSgFeedInfoById(id);
}
}

View File

@ -0,0 +1,99 @@
package com.zhyc.module.feed.service.impl;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgFeedPlanMapper;
import com.zhyc.module.feed.domain.SgFeedPlan;
import com.zhyc.module.feed.service.ISgFeedPlanService;
import org.springframework.transaction.annotation.Transactional;
/**
* 饲喂计划Service业务层处理
*
* @author HashMap
* @date 2025-08-08
*/
@Service
@Transactional(rollbackFor=Exception.class)
public class SgFeedPlanServiceImpl implements ISgFeedPlanService
{
private final SgFeedPlanMapper sgFeedPlanMapper;
public SgFeedPlanServiceImpl(SgFeedPlanMapper sgFeedPlanMapper) {
this.sgFeedPlanMapper = sgFeedPlanMapper;
}
/**
* 查询饲喂计划
*
* @param createDate 饲喂计划主键
* @return 饲喂计划
*/
@Override
public SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate)
{
return sgFeedPlanMapper.selectSgFeedPlanByCreateDate(createDate);
}
/**
* 查询饲喂计划列表
*
* @param sgFeedPlan 饲喂计划
* @return 饲喂计划
*/
@Override
public List<SgFeedPlan> selectSgFeedPlanList(SgFeedPlan sgFeedPlan)
{
return sgFeedPlanMapper.selectSgFeedPlanList(sgFeedPlan);
}
/**
* 新增饲喂计划
*
* @param sgFeedPlan 饲喂计划
* @return 结果
*/
@Override
public int insertSgFeedPlan(SgFeedPlan sgFeedPlan)
{
return sgFeedPlanMapper.insertSgFeedPlan(sgFeedPlan);
}
/**
* 修改饲喂计划
*
* @param sgFeedPlan 饲喂计划
* @return 结果
*/
@Override
public int updateSgFeedPlan(SgFeedPlan sgFeedPlan)
{
return sgFeedPlanMapper.updateSgFeedPlan(sgFeedPlan);
}
/**
* 批量删除饲喂计划
*
* @param createDates 需要删除的饲喂计划主键
* @return 结果
*/
@Override
public int deleteSgFeedPlanByCreateDates(Date[] createDates)
{
return sgFeedPlanMapper.deleteSgFeedPlanByCreateDates(createDates);
}
/**
* 删除饲喂计划信息
*
* @param createDate 饲喂计划主键
* @return 结果
*/
@Override
public int deleteSgFeedPlanByCreateDate(Date createDate)
{
return sgFeedPlanMapper.deleteSgFeedPlanByCreateDate(createDate);
}
}

View File

@ -0,0 +1,93 @@
package com.zhyc.module.feed.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgFeedRatioMapper;
import com.zhyc.module.feed.domain.SgFeedRatio;
import com.zhyc.module.feed.service.ISgFeedRatioService;
/**
* 饲喂比例Service业务层处理
*
* @author ruoyi
* @date 2025-08-01
*/
@Service
public class SgFeedRatioServiceImpl implements ISgFeedRatioService
{
@Autowired
private SgFeedRatioMapper sgFeedRatioMapper;
/**
* 查询饲喂比例
*
* @param id 饲喂比例主键
* @return 饲喂比例
*/
@Override
public SgFeedRatio selectSgFeedRatioById(Long id)
{
return sgFeedRatioMapper.selectSgFeedRatioById(id);
}
/**
* 查询饲喂比例列表
*
* @param sgFeedRatio 饲喂比例
* @return 饲喂比例
*/
@Override
public List<SgFeedRatio> selectSgFeedRatioList(SgFeedRatio sgFeedRatio)
{
return sgFeedRatioMapper.selectSgFeedRatioList(sgFeedRatio);
}
/**
* 新增饲喂比例
*
* @param sgFeedRatio 饲喂比例
* @return 结果
*/
@Override
public int insertSgFeedRatio(SgFeedRatio sgFeedRatio)
{
return sgFeedRatioMapper.insertSgFeedRatio(sgFeedRatio);
}
/**
* 修改饲喂比例
*
* @param sgFeedRatio 饲喂比例
* @return 结果
*/
@Override
public int updateSgFeedRatio(SgFeedRatio sgFeedRatio)
{
return sgFeedRatioMapper.updateSgFeedRatio(sgFeedRatio);
}
/**
* 批量删除饲喂比例
*
* @param ids 需要删除的饲喂比例主键
* @return 结果
*/
@Override
public int deleteSgFeedRatioByIds(Long[] ids)
{
return sgFeedRatioMapper.deleteSgFeedRatioByIds(ids);
}
/**
* 删除饲喂比例信息
*
* @param id 饲喂比例主键
* @return 结果
*/
@Override
public int deleteSgFeedRatioById(Long id)
{
return sgFeedRatioMapper.deleteSgFeedRatioById(id);
}
}

View File

@ -0,0 +1,93 @@
package com.zhyc.module.feed.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgFodderMapper;
import com.zhyc.module.feed.domain.SgFodder;
import com.zhyc.module.feed.service.ISgFodderService;
/**
* 原料Service业务层处理
*
* @author ruoyi
* @date 2025-08-01
*/
@Service
public class SgFodderServiceImpl implements ISgFodderService
{
@Autowired
private SgFodderMapper sgFodderMapper;
/**
* 查询原料
*
* @param id 原料主键
* @return 原料
*/
@Override
public SgFodder selectSgFodderById(Long id)
{
return sgFodderMapper.selectSgFodderById(id);
}
/**
* 查询原料列表
*
* @param sgFodder 原料
* @return 原料
*/
@Override
public List<SgFodder> selectSgFodderList(SgFodder sgFodder)
{
return sgFodderMapper.selectSgFodderList(sgFodder);
}
/**
* 新增原料
*
* @param sgFodder 原料
* @return 结果
*/
@Override
public int insertSgFodder(SgFodder sgFodder)
{
return sgFodderMapper.insertSgFodder(sgFodder);
}
/**
* 修改原料
*
* @param sgFodder 原料
* @return 结果
*/
@Override
public int updateSgFodder(SgFodder sgFodder)
{
return sgFodderMapper.updateSgFodder(sgFodder);
}
/**
* 批量删除原料
*
* @param ids 需要删除的原料主键
* @return 结果
*/
@Override
public int deleteSgFodderByIds(Long[] ids)
{
return sgFodderMapper.deleteSgFodderByIds(ids);
}
/**
* 删除原料信息
*
* @param id 原料主键
* @return 结果
*/
@Override
public int deleteSgFodderById(Long id)
{
return sgFodderMapper.deleteSgFodderById(id);
}
}

View File

@ -0,0 +1,97 @@
package com.zhyc.module.feed.service.impl;
import java.util.List;
import java.util.Objects;
import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgFormulaListMapper;
import com.zhyc.module.feed.domain.SgFormulaList;
import com.zhyc.module.feed.service.ISgFormulaListService;
import org.springframework.transaction.annotation.Transactional;
/**
* 配方列表Service业务层处理
*
* @author HashMap
* @date 2025-08-09
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class SgFormulaListServiceImpl implements ISgFormulaListService {
private final SgFormulaListMapper sgFormulaListMapper;
public SgFormulaListServiceImpl(SgFormulaListMapper sgFormulaListMapper) {
this.sgFormulaListMapper = sgFormulaListMapper;
}
/**
* 查询配方列表
*
* @param code 配方列表主键
* @return 配方列表
*/
@Override
public SgFormulaList selectSgFormulaListByCode(Long code) {
return sgFormulaListMapper.selectSgFormulaListByCode(code);
}
/**
* 查询配方列表列表
*
* @param sgFormulaList 配方列表
* @return 配方列表
*/
@Override
public List<SgFormulaList> selectSgFormulaListList(SgFormulaList sgFormulaList) {
return sgFormulaListMapper.selectSgFormulaListList(sgFormulaList);
}
/**
* 新增配方列表
*
* @param sgFormulaList 配方列表
* @return 结果
*/
@Override
public int insertSgFormulaList(SgFormulaList sgFormulaList) {
return sgFormulaListMapper.insertSgFormulaList(sgFormulaList);
}
/**
* 修改配方列表
*
* @param sgFormulaList 配方列表
* @return 结果
*/
@Override
public int updateSgFormulaList(SgFormulaList sgFormulaList) {
return sgFormulaListMapper.updateSgFormulaList(sgFormulaList);
}
/**
* 批量删除配方列表
*
* @param codes 需要删除的配方列表主键
* @return 结果
*/
@Override
public int deleteSgFormulaListByCodes(Long[] codes) {
return sgFormulaListMapper.deleteSgFormulaListByCodes(codes);
}
/**
* 删除配方列表信息
*
* @param code 配方列表主键
* @return 结果
*/
@Override
public int deleteSgFormulaListByCode(Long code) {
return sgFormulaListMapper.deleteSgFormulaListByCode(code);
}
@Override
public int deleteSgFormulaListByFormulaIdAndBatchId(SgFormulaList sgFormulaList) {
return sgFormulaListMapper.deleteSgFormulaListByFormulaIdAndBatchId(sgFormulaList);
}
}

View File

@ -0,0 +1,135 @@
package com.zhyc.module.feed.service.impl;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import com.zhyc.module.feed.domain.SgFormulaList;
import com.zhyc.module.feed.mapper.SgFormulaListMapper;
import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgFormulaManagementMapper;
import com.zhyc.module.feed.domain.SgFormulaManagement;
import com.zhyc.module.feed.service.ISgFormulaManagementService;
import org.springframework.transaction.annotation.Transactional;
/**
* 配方管理Service业务层处理
*
* @author HashMap
* @date 2025-08-09
*/
@Service
public class SgFormulaManagementServiceImpl implements ISgFormulaManagementService {
private final SgFormulaManagementMapper sgFormulaManagementMapper;
private final SgFormulaListMapper sgFormulaListMapper;
public SgFormulaManagementServiceImpl(SgFormulaManagementMapper sgFormulaManagementMapper, SgFormulaListMapper sgFormulaListMapper) {
this.sgFormulaManagementMapper = sgFormulaManagementMapper;
this.sgFormulaListMapper = sgFormulaListMapper;
}
/**
* 查询配方管理
*
* @param formulaId 配方管理主键
* @return 配方管理
*/
@Override
public SgFormulaManagement selectSgFormulaManagementByFormulaId(String formulaId) {
return sgFormulaManagementMapper.selectSgFormulaManagementByFormulaId(formulaId);
}
/**
* 查询配方管理列表
*
* @param sgFormulaManagement 配方管理
* @return 配方管理
*/
@Override
public List<SgFormulaManagement> selectSgFormulaManagementList(SgFormulaManagement sgFormulaManagement) {
List<SgFormulaManagement> sgFormulaManagements =
sgFormulaManagementMapper.selectSgFormulaManagementList(sgFormulaManagement);
Iterator<SgFormulaManagement> iterator = sgFormulaManagements.iterator();
while (iterator.hasNext()) {
SgFormulaManagement formulaManagement = iterator.next();
// 子查询中去除重复的父项
if (formulaManagement != null
&& sgFormulaManagement.getQueryType() != null
&& sgFormulaManagement.getQueryType().equals("Sub")
&& Objects.equals(formulaManagement.getBatchId(), "0")) {
iterator.remove(); // 安全删除
continue; // 删除后跳过本次循环
}
// 绑定配方列表
if (formulaManagement != null
&& formulaManagement.getFormulaId() != null
&& formulaManagement.getBatchId() != null) {
SgFormulaList sgFormulaList = new SgFormulaList();
sgFormulaList.setFormulaId(formulaManagement.getFormulaId());
sgFormulaList.setBatchId(formulaManagement.getBatchId());
List<SgFormulaList> formulaLists =
sgFormulaListMapper.selectSgFormulaListList(sgFormulaList);
formulaManagement.setSgFormulaList(formulaLists);
}
}
return sgFormulaManagements;
}
/**
* 新增配方管理
*
* @param sgFormulaManagement 配方管理
* @return 结果
*/
@Override
public int insertSgFormulaManagement(SgFormulaManagement sgFormulaManagement) {
return sgFormulaManagementMapper.insertSgFormulaManagement(sgFormulaManagement);
}
/**
* 修改配方管理
*
* @param sgFormulaManagement 配方管理
* @return 结果
*/
@Override
public int updateSgFormulaManagement(SgFormulaManagement sgFormulaManagement) {
return sgFormulaManagementMapper.updateSgFormulaManagement(sgFormulaManagement);
}
/**
* 批量删除配方管理
*
* @param formulaIds 需要删除的配方管理主键
* @return 结果
*/
@Override
public int deleteSgFormulaManagementByFormulaIds(String[] formulaIds) {
return sgFormulaManagementMapper.deleteSgFormulaManagementByFormulaIds(formulaIds);
}
/**
* 删除配方管理信息
*
* @param formulaId 配方管理主键
* @return 结果
*/
@Override
public int deleteSgFormulaManagementByFormulaId(String formulaId) {
return sgFormulaManagementMapper.deleteSgFormulaManagementByFormulaId(formulaId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteSgFormulaManagement(SgFormulaManagement sgFormulaManagement) {
// 删除关联配方表
SgFormulaList sgFormulaList = new SgFormulaList();
sgFormulaList.setFormulaId(sgFormulaManagement.getFormulaId());
sgFormulaList.setBatchId(sgFormulaManagement.getBatchId());
sgFormulaListMapper.deleteSgFormulaListByFormulaIdAndBatchId(sgFormulaList);
return sgFormulaManagementMapper.deleteSgFormulaManagement(sgFormulaManagement);
}
}

View File

@ -0,0 +1,96 @@
package com.zhyc.module.feed.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgMaterialMapper;
import com.zhyc.module.feed.domain.SgMaterial;
import com.zhyc.module.feed.service.ISgMaterialService;
/**
* 原料Service业务层处理
*
* @author HashMap
* @date 2025-08-11
*/
@Service
public class SgMaterialServiceImpl implements ISgMaterialService
{
private final SgMaterialMapper sgMaterialMapper;
public SgMaterialServiceImpl(SgMaterialMapper sgMaterialMapper) {
this.sgMaterialMapper = sgMaterialMapper;
}
/**
* 查询原料
*
* @param materialId 原料主键
* @return 原料
*/
@Override
public SgMaterial selectSgMaterialByMaterialId(String materialId)
{
return sgMaterialMapper.selectSgMaterialByMaterialId(materialId);
}
/**
* 查询原料列表
*
* @param sgMaterial 原料
* @return 原料
*/
@Override
public List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial)
{
return sgMaterialMapper.selectSgMaterialList(sgMaterial);
}
/**
* 新增原料
*
* @param sgMaterial 原料
* @return 结果
*/
@Override
public int insertSgMaterial(SgMaterial sgMaterial)
{
return sgMaterialMapper.insertSgMaterial(sgMaterial);
}
/**
* 修改原料
*
* @param sgMaterial 原料
* @return 结果
*/
@Override
public int updateSgMaterial(SgMaterial sgMaterial)
{
return sgMaterialMapper.updateSgMaterial(sgMaterial);
}
/**
* 批量删除原料
*
* @param materialIds 需要删除的原料主键
* @return 结果
*/
@Override
public int deleteSgMaterialByMaterialIds(String[] materialIds)
{
return sgMaterialMapper.deleteSgMaterialByMaterialIds(materialIds);
}
/**
* 删除原料信息
*
* @param materialId 原料主键
* @return 结果
*/
@Override
public int deleteSgMaterialByMaterialId(String materialId)
{
return sgMaterialMapper.deleteSgMaterialByMaterialId(materialId);
}
}

View File

@ -107,13 +107,15 @@ public class WzStockInServiceImpl implements IWzStockInService {
int successNum = 0;
int failureNum = 0;
int sameNum = 0;
boolean emptyTable = true;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
try {
WzStockIn earliestStockIn = wzStockInMapper.getEarliestStockIn();
if (null != earliestStockIn) emptyTable = false;
System.out.println(earliestStockIn);
for (WzStockIn wzStockIn : StockInList) {
if (earliestStockIn.getDocDate().getTime() >= wzStockIn.getDocDate().getTime()) {
if (!emptyTable && earliestStockIn.getDocDate().getTime() >= wzStockIn.getDocDate().getTime()) {
sameNum++;
continue;
}

View File

@ -2,151 +2,61 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.dairyProducts.mapper.NpSheepMilkAnalysisMapper">
<resultMap id="NpSheepMilkAnalysisResultMap" type="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
<id column="id" property="id"/>
<result column="manage_ear_tag" property="manageEarTag"/>
<result column="variety" property="variety"/>
<result column="milking_date" property="milkingDate"/>
<result column="dry_date" property="dryDate"/>
<result column="milking_days" property="milkingDays"/>
<result column="max_parity" property="maxParity"/>
<result column="total_milk" property="totalMilk"/>
<result column="total_corrected_milk" property="totalCorrectedMilk"/>
<result column="avg_daily_corrected_milk" property="avgDailyCorrectedMilk"/>
<result column="parity1_total_milk" property="parity1TotalMilk"/>
<result column="parity2_total_milk" property="parity2TotalMilk"/>
<result column="parity3_total_milk" property="parity3TotalMilk"/>
<result column="parity4_total_milk" property="parity4TotalMilk"/>
<result column="parity1_avg_milk" property="parity1AvgMilk"/>
<result column="parity2_avg_milk" property="parity2AvgMilk"/>
<result column="parity3_avg_milk" property="parity3AvgMilk"/>
<result column="parity4_avg_milk" property="parity4AvgMilk"/>
<result column="lactation_days" property="lactationDays"/>
<result column="last_7_avg_milk" property="last7AvgMilk"/>
<result column="last_7_corrected_milk" property="last7CorrectedMilk"/>
<result column="last_14_avg_milk" property="last14AvgMilk"/>
<result column="last_30_avg_milk" property="last30AvgMilk"/>
<result column="sheep_type" property="sheepType"/>
<result column="birthday" property="birthday"/>
<result column="current_parity" property="currentParity"/>
<result column="month_age" property="monthAge"/>
<result column="current_weight" property="currentWeight"/>
<result column="breed_status" property="breedStatus"/>
<result column="father_tag" property="fatherTag"/>
<result column="mother_tag" property="motherTag"/>
<result column="ranch" property="ranch"/>
<result column="family" property="family"/>
<result column="mother_milking_days" property="motherMilkingDays"/>
<result column="mother_total_corrected_milk" property="motherTotalCorrectedMilk"/>
<result column="mother_max_parity" property="motherMaxParity"/>
<result column="mother_avg_corrected" property="motherAvgCorrected"/>
</resultMap>
<sql id="Base_Column_List">
id, manage_ear_tag, variety, milking_date, dry_date, milking_days,
screen_days, max_parity, total_milk, total_corrected_milk,
avg_daily_corrected_milk, parity1_total_milk, parity2_total_milk,
parity3_total_milk, parity4_total_milk, parity1_avg_milk,
parity2_avg_milk, parity3_avg_milk, parity4_avg_milk,
lactation_days, last_7_avg_milk, last_7_corrected_milk,
last_14_avg_milk, last_30_avg_milk, sheep_type, birthday,
current_parity, month_age, current_weight, breed_status,
father_tag, mother_tag, ranch, family, mother_milking_days,
mother_total_corrected_milk, mother_max_parity,
mother_avg_corrected
</sql>
<select id="selectNpSheepMilkAnalysisById" resultMap="NpSheepMilkAnalysisResultMap">
SELECT <include refid="Base_Column_List"/>
FROM np_sheep_milk_analysis
WHERE id = #{id}
</select>
<select id="selectNpSheepMilkAnalysisList" resultMap="NpSheepMilkAnalysisResultMap">
SELECT <include refid="Base_Column_List"/>
FROM np_sheep_milk_analysis
<!-- 1) 获取 distinct sheep_id支持按 sheep_file.bs_manage_tags 模糊搜索) -->
<select id="selectDistinctSheepIds" resultType="string" parameterType="map">
SELECT DISTINCT a.sheep_id
FROM np_milk_prod_classes a
LEFT JOIN sheep_file sf ON a.sheep_id = sf.id
<where>
<if test="manageEarTag != null and manageEarTag != ''">
AND manage_ear_tag LIKE CONCAT('%', #{manageEarTag}, '%')
AND sf.bs_manage_tags LIKE CONCAT('%', #{manageEarTag}, '%')
</if>
<!-- 可继续添加其他搜索条件 -->
</where>
ORDER BY milking_date DESC
ORDER BY a.sheep_id
</select>
<insert id="insertNpSheepMilkAnalysis" parameterType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
INSERT INTO np_sheep_milk_analysis (
<include refid="Base_Column_List"/>
) VALUES (
#{id}, #{manageEarTag}, #{variety}, #{milkingDate}, #{dryDate},
#{milkingDays}, #{screenDays}, #{maxParity}, #{totalMilk},
#{totalCorrectedMilk}, #{avgDailyCorrectedMilk}, #{parity1TotalMilk},
#{parity2TotalMilk}, #{parity3TotalMilk}, #{parity4TotalMilk},
#{parity1AvgMilk}, #{parity2AvgMilk}, #{parity3AvgMilk},
#{parity4AvgMilk}, #{lactationDays}, #{last7AvgMilk},
#{last7CorrectedMilk}, #{last14AvgMilk}, #{last30AvgMilk},
#{sheepType}, #{birthday}, #{currentParity}, #{monthAge},
#{currentWeight}, #{breedStatus}, #{fatherTag}, #{motherTag},
#{ranch}, #{family}, #{motherMilkingDays},
#{motherTotalCorrectedMilk}, #{motherMaxParity},
#{motherAvgCorrected}
)
</insert>
<!-- 2) 获取某只羊的所有班次记录(按班次日期升序) -->
<!-- 假设表中字段class_date, system_milk, corrected_milk, parity -->
<select id="selectMilkRecordsBySheepId" resultType="map" parameterType="string">
SELECT
datetime AS classDate,
milk AS systemMilk,
corrected_milk AS correctedMilk,
classes AS parity
FROM np_milk_prod_classes
WHERE sheep_id = #{sheepId}
ORDER BY datetime ASC
</select>
<update id="updateNpSheepMilkAnalysis" parameterType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
UPDATE np_sheep_milk_analysis
SET manage_ear_tag = #{manageEarTag},
variety = #{variety},
milking_date = #{milkingDate},
dry_date = #{dryDate},
milking_days = #{milkingDays},
screen_days = #{screenDays},
max_parity = #{maxParity},
total_milk = #{totalMilk},
total_corrected_milk = #{totalCorrectedMilk},
avg_daily_corrected_milk = #{avgDailyCorrectedMilk},
parity1_total_milk = #{parity1TotalMilk},
parity2_total_milk = #{parity2TotalMilk},
parity3_total_milk = #{parity3TotalMilk},
parity4_total_milk = #{parity4TotalMilk},
parity1_avg_milk = #{parity1AvgMilk},
parity2_avg_milk = #{parity2AvgMilk},
parity3_avg_milk = #{parity3AvgMilk},
parity4_avg_milk = #{parity4AvgMilk},
lactation_days = #{lactationDays},
last_7_avg_milk = #{last7AvgMilk},
last_7_corrected_milk = #{last7CorrectedMilk},
last_14_avg_milk = #{last14AvgMilk},
last_30_avg_milk = #{last30AvgMilk},
sheep_type = #{sheepType},
birthday = #{birthday},
current_parity = #{currentParity},
month_age = #{monthAge},
current_weight = #{currentWeight},
breed_status = #{breedStatus},
father_tag = #{fatherTag},
mother_tag = #{motherTag},
ranch = #{ranch},
family = #{family},
mother_milking_days = #{motherMilkingDays},
mother_total_corrected_milk = #{motherTotalCorrectedMilk},
mother_max_parity = #{motherMaxParity},
mother_avg_corrected = #{motherAvgCorrected}
WHERE id = #{id}
</update>
<delete id="deleteNpSheepMilkAnalysisById" parameterType="Long">
DELETE FROM np_sheep_milk_analysis WHERE id = #{id}
</delete>
<!-- 3) 获取该羊在 sheep_file 视图中的基础信息 -->
<!-- 假设字段名称bs_manage_tags、variety、lactation_day、name、birthday、parity、month_age、current_weight、breed、father_manage_tags、mother_manage_tags、dr_ranch、family -->
<select id="selectSheepFileBySheepId" resultType="map" parameterType="string">
SELECT
id AS sheep_id,
bs_manage_tags AS manageEarTag,
variety,
lactation_day AS lactationDay,
name AS sheepType,
birthday,
parity AS currentParity,
month_age AS monthAge,
current_weight AS currentWeight,
breed AS breedStatus,
father_manage_tags AS fatherManageTags,
mother_manage_tags AS motherManageTags,
dr_ranch AS ranchName,
family
FROM sheep_file
WHERE id = #{sheepId}
</select>
<delete id="deleteNpSheepMilkAnalysisByIds" parameterType="Long">
DELETE FROM np_sheep_milk_analysis WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 4) 兼容旧 list 查询(返回 domain 对象列表),但在我们的实现中 service 会构造最终的 NpSheepMilkAnalysis 列表 -->
<select id="selectNpSheepMilkAnalysisList" resultType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis" parameterType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
<!-- 如果你仍需基于某张表的简单映射,可在此实现;当前我们在 ServiceImpl 中组装对象,所以该查询不做复杂实现 -->
SELECT 1 FROM dual WHERE 1=0
</select>
</mapper>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgFeedDetailsMapper">
<resultMap type="SgFeedDetails" id="SgFeedDetailsResult">
<result property="id" column="id" />
<result property="fodder" column="fodder" />
<result property="number" column="number" />
<result property="nuit" column="nuit" />
</resultMap>
<sql id="selectSgFeedDetailsVo">
select id, fodder, number, nuit from sg_feed_details
</sql>
<select id="selectSgFeedDetailsList" parameterType="SgFeedDetails" resultMap="SgFeedDetailsResult">
<include refid="selectSgFeedDetailsVo"/>
<where>
<if test="fodder != null and fodder != ''"> and fodder = #{fodder}</if>
<if test="number != null "> and number = #{number}</if>
<if test="nuit != null and nuit != ''"> and nuit = #{nuit}</if>
</where>
</select>
<select id="selectSgFeedDetailsById" parameterType="Long" resultMap="SgFeedDetailsResult">
<include refid="selectSgFeedDetailsVo"/>
where id = #{id}
</select>
<insert id="insertSgFeedDetails" parameterType="SgFeedDetails" useGeneratedKeys="true" keyProperty="id">
insert into sg_feed_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fodder != null">fodder,</if>
<if test="number != null">number,</if>
<if test="nuit != null">nuit,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fodder != null">#{fodder},</if>
<if test="number != null">#{number},</if>
<if test="nuit != null">#{nuit},</if>
</trim>
</insert>
<update id="updateSgFeedDetails" parameterType="SgFeedDetails">
update sg_feed_details
<trim prefix="SET" suffixOverrides=",">
<if test="fodder != null">fodder = #{fodder},</if>
<if test="number != null">number = #{number},</if>
<if test="nuit != null">nuit = #{nuit},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSgFeedDetailsById" parameterType="Long">
delete from sg_feed_details where id = #{id}
</delete>
<delete id="deleteSgFeedDetailsByIds" parameterType="String">
delete from sg_feed_details where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgFeedInfoMapper">
<resultMap type="SgFeedInfo" id="SgFeedInfoResult">
<result property="id" column="id" />
<result property="formulaId" column="formula_id" />
<result property="sheepfoldId" column="sheepfold_id" />
<result property="average" column="average" />
<result property="planMonring" column="plan_monring" />
<result property="actualMonring" column="actual_monring" />
<result property="planNoon" column="plan_noon" />
<result property="actualNoon" column="actual_noon" />
<result property="planEvenig" column="plan_evenig" />
<result property="actualEvening" column="actual_evening" />
<result property="particle" column="particle" />
<result property="other" column="other" />
<result property="replenish" column="replenish" />
<result property="planDate" column="plan_date" />
<result property="comment" column="comment" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectSgFeedInfoVo">
select id, formula_id, sheepfold_id, average, plan_monring, actual_monring, plan_noon, actual_noon, plan_evenig, actual_evening, particle, other, replenish, plan_date, comment, create_by, create_time from sg_feed_info
</sql>
<select id="selectSgFeedInfoList" parameterType="SgFeedInfo" resultMap="SgFeedInfoResult">
<include refid="selectSgFeedInfoVo"/>
<where>
<if test="formulaId != null "> and formula_id = #{formulaId}</if>
<if test="sheepfoldId != null and sheepfoldId != ''"> and sheepfold_id = #{sheepfoldId}</if>
<if test="average != null "> and average = #{average}</if>
<if test="planMonring != null "> and plan_monring = #{planMonring}</if>
<if test="actualMonring != null "> and actual_monring = #{actualMonring}</if>
<if test="planNoon != null "> and plan_noon = #{planNoon}</if>
<if test="actualNoon != null "> and actual_noon = #{actualNoon}</if>
<if test="planEvenig != null "> and plan_evenig = #{planEvenig}</if>
<if test="actualEvening != null "> and actual_evening = #{actualEvening}</if>
<if test="particle != null "> and particle = #{particle}</if>
<if test="other != null "> and other = #{other}</if>
<if test="replenish != null "> and replenish = #{replenish}</if>
<if test="planDate != null "> and plan_date = #{planDate}</if>
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
</where>
</select>
<select id="selectSgFeedInfoById" parameterType="Long" resultMap="SgFeedInfoResult">
<include refid="selectSgFeedInfoVo"/>
where id = #{id}
</select>
<insert id="insertSgFeedInfo" parameterType="SgFeedInfo" useGeneratedKeys="true" keyProperty="id">
insert into sg_feed_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="formulaId != null">formula_id,</if>
<if test="sheepfoldId != null">sheepfold_id,</if>
<if test="average != null">average,</if>
<if test="planMonring != null">plan_monring,</if>
<if test="actualMonring != null">actual_monring,</if>
<if test="planNoon != null">plan_noon,</if>
<if test="actualNoon != null">actual_noon,</if>
<if test="planEvenig != null">plan_evenig,</if>
<if test="actualEvening != null">actual_evening,</if>
<if test="particle != null">particle,</if>
<if test="other != null">other,</if>
<if test="replenish != null">replenish,</if>
<if test="planDate != null">plan_date,</if>
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="formulaId != null">#{formulaId},</if>
<if test="sheepfoldId != null">#{sheepfoldId},</if>
<if test="average != null">#{average},</if>
<if test="planMonring != null">#{planMonring},</if>
<if test="actualMonring != null">#{actualMonring},</if>
<if test="planNoon != null">#{planNoon},</if>
<if test="actualNoon != null">#{actualNoon},</if>
<if test="planEvenig != null">#{planEvenig},</if>
<if test="actualEvening != null">#{actualEvening},</if>
<if test="particle != null">#{particle},</if>
<if test="other != null">#{other},</if>
<if test="replenish != null">#{replenish},</if>
<if test="planDate != null">#{planDate},</if>
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateSgFeedInfo" parameterType="SgFeedInfo">
update sg_feed_info
<trim prefix="SET" suffixOverrides=",">
<if test="formulaId != null">formula_id = #{formulaId},</if>
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
<if test="average != null">average = #{average},</if>
<if test="planMonring != null">plan_monring = #{planMonring},</if>
<if test="actualMonring != null">actual_monring = #{actualMonring},</if>
<if test="planNoon != null">plan_noon = #{planNoon},</if>
<if test="actualNoon != null">actual_noon = #{actualNoon},</if>
<if test="planEvenig != null">plan_evenig = #{planEvenig},</if>
<if test="actualEvening != null">actual_evening = #{actualEvening},</if>
<if test="particle != null">particle = #{particle},</if>
<if test="other != null">other = #{other},</if>
<if test="replenish != null">replenish = #{replenish},</if>
<if test="planDate != null">plan_date = #{planDate},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSgFeedInfoById" parameterType="Long">
delete from sg_feed_info where id = #{id}
</delete>
<delete id="deleteSgFeedInfoByIds" parameterType="String">
delete from sg_feed_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgFeedPlanMapper">
<resultMap type="SgFeedPlan" id="SgFeedPlanResult">
<result property="createDate" column="create_date" />
<result property="formulaId" column="formula_id" />
<result property="sheepHouseId" column="sheep_house_id" />
<result property="sheepCount" column="sheep_count" />
<result property="planDailySize" column="plan_daily_size" />
<result property="planMorningSize" column="plan_morning_size" />
<result property="planMorningTotal" column="plan_morning_total" />
<result property="ratioMorning" column="ratio_morning" />
<result property="actualMorningSize" column="actual_morning_size" />
<result property="planNoonSize" column="plan_noon_size" />
<result property="planNoonTotal" column="plan_noon_total" />
<result property="actualNoonSize" column="actual_noon_size" />
<result property="ratioNoon" column="ratio_noon" />
<result property="planAfternoonSize" column="plan_afternoon_size" />
<result property="planAfternoonTotal" column="plan_afternoon_total" />
<result property="actualAfternoonSize" column="actual_afternoon_size" />
<result property="ratioAfternoon" column="ratio_afternoon" />
<result property="planFeedTotal" column="plan_feed_total" />
<result property="zookeeper" column="zookeeper" />
<result property="planDate" column="plan_date" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSgFeedPlanVo">
select create_date, formula_id, sheep_house_id, sheep_count, plan_daily_size, plan_morning_size, plan_morning_total, ratio_morning, actual_morning_size, plan_noon_size, plan_noon_total, actual_noon_size, ratio_noon, plan_afternoon_size, plan_afternoon_total, actual_afternoon_size, ratio_afternoon, plan_feed_total, zookeeper, plan_date, remark from sg_feed_plan
</sql>
<select id="selectSgFeedPlanList" parameterType="SgFeedPlan" resultMap="SgFeedPlanResult">
<include refid="selectSgFeedPlanVo"/>
<where>
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
<if test="sheepHouseId != null "> and sheep_house_id = #{sheepHouseId}</if>
<if test="zookeeper != null and zookeeper != ''"> and zookeeper = #{zookeeper}</if>
<if test="planDate != null "> and plan_date = #{planDate}</if>
</where>
</select>
<select id="selectSgFeedPlanByCreateDate" parameterType="Date" resultMap="SgFeedPlanResult">
<include refid="selectSgFeedPlanVo"/>
where create_date = #{createDate}
</select>
<insert id="insertSgFeedPlan" parameterType="SgFeedPlan">
insert into sg_feed_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createDate != null">create_date,</if>
<if test="formulaId != null and formulaId != ''">formula_id,</if>
<if test="sheepHouseId != null">sheep_house_id,</if>
<if test="sheepCount != null">sheep_count,</if>
<if test="planDailySize != null">plan_daily_size,</if>
<if test="planMorningSize != null">plan_morning_size,</if>
<if test="planMorningTotal != null">plan_morning_total,</if>
<if test="ratioMorning != null">ratio_morning,</if>
<if test="actualMorningSize != null">actual_morning_size,</if>
<if test="planNoonSize != null">plan_noon_size,</if>
<if test="planNoonTotal != null">plan_noon_total,</if>
<if test="actualNoonSize != null">actual_noon_size,</if>
<if test="ratioNoon != null">ratio_noon,</if>
<if test="planAfternoonSize != null">plan_afternoon_size,</if>
<if test="planAfternoonTotal != null">plan_afternoon_total,</if>
<if test="actualAfternoonSize != null">actual_afternoon_size,</if>
<if test="ratioAfternoon != null">ratio_afternoon,</if>
<if test="planFeedTotal != null">plan_feed_total,</if>
<if test="zookeeper != null">zookeeper,</if>
<if test="planDate != null">plan_date,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createDate != null">#{createDate},</if>
<if test="formulaId != null and formulaId != ''">#{formulaId},</if>
<if test="sheepHouseId != null">#{sheepHouseId},</if>
<if test="sheepCount != null">#{sheepCount},</if>
<if test="planDailySize != null">#{planDailySize},</if>
<if test="planMorningSize != null">#{planMorningSize},</if>
<if test="planMorningTotal != null">#{planMorningTotal},</if>
<if test="ratioMorning != null">#{ratioMorning},</if>
<if test="actualMorningSize != null">#{actualMorningSize},</if>
<if test="planNoonSize != null">#{planNoonSize},</if>
<if test="planNoonTotal != null">#{planNoonTotal},</if>
<if test="actualNoonSize != null">#{actualNoonSize},</if>
<if test="ratioNoon != null">#{ratioNoon},</if>
<if test="planAfternoonSize != null">#{planAfternoonSize},</if>
<if test="planAfternoonTotal != null">#{planAfternoonTotal},</if>
<if test="actualAfternoonSize != null">#{actualAfternoonSize},</if>
<if test="ratioAfternoon != null">#{ratioAfternoon},</if>
<if test="planFeedTotal != null">#{planFeedTotal},</if>
<if test="zookeeper != null">#{zookeeper},</if>
<if test="planDate != null">#{planDate},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSgFeedPlan" parameterType="SgFeedPlan">
update sg_feed_plan
<trim prefix="SET" suffixOverrides=",">
<if test="formulaId != null and formulaId != ''">formula_id = #{formulaId},</if>
<if test="sheepHouseId != null">sheep_house_id = #{sheepHouseId},</if>
<if test="sheepCount != null">sheep_count = #{sheepCount},</if>
<if test="planDailySize != null">plan_daily_size = #{planDailySize},</if>
<if test="planMorningSize != null">plan_morning_size = #{planMorningSize},</if>
<if test="planMorningTotal != null">plan_morning_total = #{planMorningTotal},</if>
<if test="ratioMorning != null">ratio_morning = #{ratioMorning},</if>
<if test="actualMorningSize != null">actual_morning_size = #{actualMorningSize},</if>
<if test="planNoonSize != null">plan_noon_size = #{planNoonSize},</if>
<if test="planNoonTotal != null">plan_noon_total = #{planNoonTotal},</if>
<if test="actualNoonSize != null">actual_noon_size = #{actualNoonSize},</if>
<if test="ratioNoon != null">ratio_noon = #{ratioNoon},</if>
<if test="planAfternoonSize != null">plan_afternoon_size = #{planAfternoonSize},</if>
<if test="planAfternoonTotal != null">plan_afternoon_total = #{planAfternoonTotal},</if>
<if test="actualAfternoonSize != null">actual_afternoon_size = #{actualAfternoonSize},</if>
<if test="ratioAfternoon != null">ratio_afternoon = #{ratioAfternoon},</if>
<if test="planFeedTotal != null">plan_feed_total = #{planFeedTotal},</if>
<if test="zookeeper != null">zookeeper = #{zookeeper},</if>
<if test="planDate != null">plan_date = #{planDate},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where create_date = #{createDate}
</update>
<delete id="deleteSgFeedPlanByCreateDate" parameterType="Date">
delete from sg_feed_plan where create_date = #{createDate}
</delete>
<delete id="deleteSgFeedPlanByCreateDates" parameterType="String">
delete from sg_feed_plan where create_date in
<foreach item="createDate" collection="array" open="(" separator="," close=")">
#{createDate}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgFeedRatioMapper">
<resultMap type="SgFeedRatio" id="SgFeedRatioResult">
<result property="id" column="id" />
<result property="morning" column="morning" />
<result property="noon" column="noon" />
<result property="evening" column="evening" />
</resultMap>
<sql id="selectSgFeedRatioVo">
select id, morning, noon, evening from sg_feed_ratio
</sql>
<select id="selectSgFeedRatioList" parameterType="SgFeedRatio" resultMap="SgFeedRatioResult">
<include refid="selectSgFeedRatioVo"/>
<where>
<if test="morning != null and morning != ''"> and morning = #{morning}</if>
<if test="noon != null and noon != ''"> and noon = #{noon}</if>
<if test="evening != null and evening != ''"> and evening = #{evening}</if>
</where>
</select>
<select id="selectSgFeedRatioById" parameterType="Long" resultMap="SgFeedRatioResult">
<include refid="selectSgFeedRatioVo"/>
where id = #{id}
</select>
<insert id="insertSgFeedRatio" parameterType="SgFeedRatio" useGeneratedKeys="true" keyProperty="id">
insert into sg_feed_ratio
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="morning != null">morning,</if>
<if test="noon != null">noon,</if>
<if test="evening != null">evening,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="morning != null">#{morning},</if>
<if test="noon != null">#{noon},</if>
<if test="evening != null">#{evening},</if>
</trim>
</insert>
<update id="updateSgFeedRatio" parameterType="SgFeedRatio">
update sg_feed_ratio
<trim prefix="SET" suffixOverrides=",">
<if test="morning != null">morning = #{morning},</if>
<if test="noon != null">noon = #{noon},</if>
<if test="evening != null">evening = #{evening},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSgFeedRatioById" parameterType="Long">
delete from sg_feed_ratio where id = #{id}
</delete>
<delete id="deleteSgFeedRatioByIds" parameterType="String">
delete from sg_feed_ratio where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgFodderMapper">
<resultMap type="SgFodder" id="SgFodderResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="fodderType" column="fodder_type" />
</resultMap>
<sql id="selectSgFodderVo">
select id, name, fodder_type from sg_fodder
</sql>
<select id="selectSgFodderList" parameterType="SgFodder" resultMap="SgFodderResult">
<include refid="selectSgFodderVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="fodderType != null "> and fodder_type = #{fodderType}</if>
</where>
</select>
<select id="selectSgFodderById" parameterType="Long" resultMap="SgFodderResult">
<include refid="selectSgFodderVo"/>
where id = #{id}
</select>
<insert id="insertSgFodder" parameterType="SgFodder" useGeneratedKeys="true" keyProperty="id">
insert into sg_fodder
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="fodderType != null">fodder_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="fodderType != null">#{fodderType},</if>
</trim>
</insert>
<update id="updateSgFodder" parameterType="SgFodder">
update sg_fodder
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="fodderType != null">fodder_type = #{fodderType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSgFodderById" parameterType="Long">
delete from sg_fodder where id = #{id}
</delete>
<delete id="deleteSgFodderByIds" parameterType="String">
delete from sg_fodder where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgFormulaListMapper">
<resultMap type="SgFormulaList" id="SgFormulaListResult">
<result property="code" column="code" />
<result property="formulaId" column="formula_id" />
<result property="batchId" column="batch_id" />
<result property="materialId" column="material_id" />
<result property="materialName" column="material_name" />
<result property="ratio" column="ratio" />
<result property="isGranular" column="is_granular" />
<result property="isSupplement" column="is_supplement" />
</resultMap>
<sql id="selectSgFormulaListVo">
select code, formula_id, material_id, material_name, ratio, is_granular, is_supplement from sg_formula_list
</sql>
<select id="selectSgFormulaListList" parameterType="SgFormulaList" resultMap="SgFormulaListResult">
<include refid="selectSgFormulaListVo"/>
<where>
<if test="materialId != null and materialId != ''">material_id = #{materialId}</if>
<if test="formulaId != null and formulaId != ''">and formula_id = #{formulaId}</if>
<if test="batchId != null and batchId != ''"> and batch_id = #{batchId}</if>
</where>
</select>
<select id="selectSgFormulaListByCode" parameterType="Long" resultMap="SgFormulaListResult">
<include refid="selectSgFormulaListVo"/>
where code = #{code}
</select>
<insert id="insertSgFormulaList" parameterType="SgFormulaList">
insert into sg_formula_list
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">code,</if>
<if test="formulaId != null">formula_id,</if>
<if test="batchId != null">batch_id,</if>
<if test="materialId != null">material_id,</if>
<if test="materialName != null">material_name,</if>
<if test="ratio != null">ratio,</if>
<if test="isGranular != null">is_granular,</if>
<if test="isSupplement != null">is_supplement,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="formulaId != null">#{formulaId},</if>
<if test="batchId != null">#{batchId},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialName != null">#{materialName},</if>
<if test="ratio != null">#{ratio},</if>
<if test="isGranular != null">#{isGranular},</if>
<if test="isSupplement != null">#{isSupplement},</if>
</trim>
</insert>
<update id="updateSgFormulaList" parameterType="SgFormulaList">
update sg_formula_list
<trim prefix="SET" suffixOverrides=",">
<if test="formulaId != null">formula_id = #{formulaId},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="ratio != null">ratio = #{ratio},</if>
<if test="isGranular != null">is_granular = #{isGranular},</if>
<if test="isSupplement != null">is_supplement = #{isSupplement},</if>
</trim>
where code = #{code}
</update>
<delete id="deleteSgFormulaListByCode" parameterType="Long">
delete from sg_formula_list where code = #{code}
</delete>
<delete id="deleteSgFormulaListByCodes" parameterType="String">
delete from sg_formula_list where code in
<foreach item="code" collection="array" open="(" separator="," close=")">
#{code}
</foreach>
</delete>
<delete id="deleteSgFormulaListByFormulaIdAndBatchId" parameterType="SgFormulaList">
DELETE FROM sg_formula_list WHERE formula_id = #{formulaId} AND batch_id = #{batchId}
</delete>
</mapper>

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgFormulaManagementMapper">
<resultMap type="SgFormulaManagement" id="SgFormulaManagementResult">
<result property="formulaId" column="formula_id" />
<result property="feedStage" column="feed_stage" />
<result property="batchId" column="batch_id" />
<result property="useStartDate" column="use_start_date" />
<result property="useEndDate" column="use_end_date" />
<result property="useState" column="use_state" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSgFormulaManagementVo">
select formula_id, feed_stage, batch_id, use_start_date, use_end_date, use_state, remark from sg_formula_management
</sql>
<select id="selectSgFormulaManagementList" parameterType="SgFormulaManagement" resultMap="SgFormulaManagementResult">
<include refid="selectSgFormulaManagementVo"/>
<where>
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
<if test="feedStage != null and feedStage != ''"> and feed_stage = #{feedStage}</if>
<if test="batchId != null and batchId != ''"> and batch_id = #{batchId}</if>
</where>
</select>
<select id="selectSgFormulaManagementByFormulaId" parameterType="String" resultMap="SgFormulaManagementResult">
<include refid="selectSgFormulaManagementVo"/>
where formula_id = #{formulaId}
</select>
<insert id="insertSgFormulaManagement" parameterType="SgFormulaManagement">
insert into sg_formula_management
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="formulaId != null and formulaId != ''">formula_id,</if>
<if test="feedStage != null and feedStage != ''">feed_stage,</if>
<if test="batchId != null">batch_id,</if>
<if test="useStartDate != null">use_start_date,</if>
<if test="useEndDate != null">use_end_date,</if>
<if test="useState != null">use_state,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="formulaId != null and formulaId != ''">#{formulaId},</if>
<if test="feedStage != null and feedStage != ''">#{feedStage},</if>
<if test="batchId != null">#{batchId},</if>
<if test="useStartDate != null">#{useStartDate},</if>
<if test="useEndDate != null">#{useEndDate},</if>
<if test="useState != null">#{useState},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSgFormulaManagement" parameterType="SgFormulaManagement">
update sg_formula_management
<trim prefix="SET" suffixOverrides=",">
<if test="feedStage != null and feedStage != ''">feed_stage = #{feedStage},</if>
<if test="useStartDate != null">use_start_date = #{useStartDate},</if>
<if test="useEndDate != null">use_end_date = #{useEndDate},</if>
<if test="useState != null">use_state = #{useState},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where formula_id = #{formulaId} AND batch_id = #{batchId}
</update>
<delete id="deleteSgFormulaManagementByFormulaId" parameterType="String">
delete from sg_formula_management where formula_id = #{formulaId}
</delete>
<delete id="deleteSgFormulaManagementByFormulaIds" parameterType="String">
delete from sg_formula_management where formula_id in
<foreach item="formulaId" collection="array" open="(" separator="," close=")">
#{formulaId}
</foreach>
</delete>
<delete id="deleteSgFormulaManagement" parameterType="SgFormulaManagement">
delete from sg_formula_management where formula_id = #{formulaId} and batch_id = #{batchId}
</delete>
</mapper>

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgMaterialMapper">
<resultMap type="SgMaterial" id="SgMaterialResult">
<result property="materialId" column="material_id" />
<result property="materialName" column="material_name" />
<result property="isGranular" column="is_granular" />
</resultMap>
<sql id="selectSgMaterialVo">
select material_id, material_name, is_granular from sg_material
</sql>
<select id="selectSgMaterialList" parameterType="SgMaterial" resultMap="SgMaterialResult">
<include refid="selectSgMaterialVo"/>
<where>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="isGranular != null "> and is_granular = #{isGranular}</if>
</where>
</select>
<select id="selectSgMaterialByMaterialId" parameterType="String" resultMap="SgMaterialResult">
<include refid="selectSgMaterialVo"/>
where material_id = #{materialId}
</select>
<insert id="insertSgMaterial" parameterType="SgMaterial">
insert into sg_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="materialId != null">material_id,</if>
<if test="materialName != null and materialName != ''">material_name,</if>
<if test="isGranular != null">is_granular,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="materialId != null">#{materialId},</if>
<if test="materialName != null and materialName != ''">#{materialName},</if>
<if test="isGranular != null">#{isGranular},</if>
</trim>
</insert>
<update id="updateSgMaterial" parameterType="SgMaterial">
update sg_material
<trim prefix="SET" suffixOverrides=",">
<if test="materialName != null and materialName != ''">material_name = #{materialName},</if>
<if test="isGranular != null">is_granular = #{isGranular},</if>
</trim>
where material_id = #{materialId}
</update>
<delete id="deleteSgMaterialByMaterialId" parameterType="String">
delete from sg_material where material_id = #{materialId}
</delete>
<delete id="deleteSgMaterialByMaterialIds" parameterType="String">
delete from sg_material where material_id in
<foreach item="materialId" collection="array" open="(" separator="," close=")">
#{materialId}
</foreach>
</delete>
</mapper>