Merge remote-tracking branch 'main/main'

This commit is contained in:
piaobo 2025-08-20 17:28:08 +08:00
commit a6cce5230d
33 changed files with 946 additions and 70 deletions

View File

@ -0,0 +1,236 @@
package com.zhyc.module.feed.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.feed.domain.SgFeedPlan;
import com.zhyc.module.feed.domain.SgFormulaManagement;
import com.zhyc.module.feed.service.ISgFeedPlanService;
import com.zhyc.module.feed.service.ISgFormulaManagementService;
import org.springframework.beans.factory.annotation.Autowired;
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.SgFeedList;
import com.zhyc.module.feed.service.ISgFeedListService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 配料清单Controller
*
* @author HashMap
* @date 2025-08-19
*/
@RestController
@RequestMapping("/feed/FeedList")
public class SgFeedListController extends BaseController {
private final ISgFeedListService sgFeedListService;
private final ISgFormulaManagementService sgFormulaManagementService;
private final ISgFeedPlanService sgFeedPlanService;
private final Map<String, SgFeedList> sgFeedListMap = new HashMap<>();
public static boolean refresh = true;
@Autowired
public SgFeedListController(ISgFeedListService sgFeedListService, ISgFormulaManagementService sgFormulaManagementService, ISgFeedPlanService sgFeedPlanService) {
this.sgFeedListService = sgFeedListService;
this.sgFormulaManagementService = sgFormulaManagementService;
this.sgFeedPlanService = sgFeedPlanService;
}
/**
* 查询配料清单列表
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:list')")
@GetMapping("/list")
@Transactional(rollbackFor = Exception.class)
public TableDataInfo list(SgFeedList sgFeedList) {
/*
刷新缓存
当配方管理表出现更新 饲喂计划表出现增删改时会将refresh置为true 通知此处进行刷新
*/
if (refresh) {
SyncFeedList();
refresh = false;
}
startPage();
List<SgFeedList> list = sgFeedListService.selectSgFeedListList(sgFeedList);
// map 中已有的数据替换 list 中的元素
List<SgFeedList> replacedList = new ArrayList<>();
for (SgFeedList item : list) {
String key = item.getFormulaId() + "_" + item.getFormulaBatchId();
// 从缓存中取出完整对象
SgFeedList itemInCache = sgFeedListMap.getOrDefault(key, item);
// 将数据库查询的基本信息替换掉缓存中去除的内容 - 前端展示与修改需要
itemInCache.setId(item.getId());
itemInCache.setFormulaBatchId(item.getFormulaBatchId());
itemInCache.setFormulaId(item.getFormulaId());
itemInCache.setZookeeper(item.getZookeeper());
itemInCache.setDeployDate(item.getDeployDate());
// 替换为 map 中的对象
replacedList.add(itemInCache);
}
return getDataTable(replacedList);
}
/**
* 导出配料清单列表
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:export')")
@Log(title = "配料清单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SgFeedList sgFeedList) {
List<SgFeedList> list = sgFeedListService.selectSgFeedListList(sgFeedList);
ExcelUtil<SgFeedList> util = new ExcelUtil<>(SgFeedList.class);
util.exportExcel(response, list, "配料清单数据");
}
/**
* 获取配料清单详细信息
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(sgFeedListService.selectSgFeedListById(id));
}
/**
* 新增配料清单
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:add')")
@Log(title = "配料清单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SgFeedList sgFeedList) {
return toAjax(sgFeedListService.insertSgFeedList(sgFeedList));
}
/**
* 修改配料清单
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:edit')")
@Log(title = "配料清单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SgFeedList sgFeedList) {
return toAjax(sgFeedListService.updateSgFeedList(sgFeedList));
}
/**
* 删除配料清单
*/
@PreAuthorize("@ss.hasPermi('feed:FeedList:remove')")
@Log(title = "配料清单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@Transactional(rollbackFor = Exception.class)
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(sgFeedListService.deleteSgFeedListByIds(ids));
}
public void SyncFeedList() {
// 清空旧缓存
sgFeedListMap.clear();
// 获取配方管理和现有配料清单内容
List<SgFormulaManagement> formulaManagementList = sgFormulaManagementService.selectSgFormulaManagementList(new SgFormulaManagement());
List<SgFeedList> feedLists = sgFeedListService.selectSgFeedListList(new SgFeedList());
// 将最新查询的配料清单加入缓存
for (SgFeedList sgFeedList : feedLists) {
sgFeedListMap.put(sgFeedList.getFormulaId() + "_" + sgFeedList.getFormulaBatchId(), sgFeedList);
}
// 与新的配方管理列表同步 - 如果配料清单没有对应数据则加入
for (SgFormulaManagement sgFormulaManagement : formulaManagementList) {
// 匹配 但忽略模板配方
if (sgFormulaManagement.getFormulaId() != null && sgFormulaManagement.getBatchId() != null && !sgFormulaManagement.getBatchId().equals("0")) {
// 查询当前配方管理项是否存在现有配料计划中 (不论是否存在都要设置,因为缓存被清空,存在则更新,不存在则插入)
boolean isExist = sgFeedListMap.containsKey(sgFormulaManagement.getFormulaId() + "_" + sgFormulaManagement.getBatchId());
// 标志位 : 如果当前配方不在饲喂计划中则不生成配量清单
boolean isPlan = true;
// 设置缓存对象具体值
SgFeedList sgFeedList = new SgFeedList();
sgFeedList.setFormulaId(sgFormulaManagement.getFormulaId());
sgFeedList.setFormulaBatchId(sgFormulaManagement.getBatchId());
sgFeedList.setFormulaList(sgFormulaManagement.getSgFormulaList());
sgFeedList.setRootFormula(sgFormulaManagement);
// 从饲喂计划列表中查出对应值(饲喂量需要计划中的比例计算)
SgFeedPlan rootPlanQuery = new SgFeedPlan();
rootPlanQuery.setFormulaId(sgFormulaManagement.getFormulaId());
rootPlanQuery.setBatchId(sgFormulaManagement.getBatchId());
List<SgFeedPlan> sgFeedPlans = sgFeedPlanService.selectSgFeedPlanList(rootPlanQuery);
// 为空则标识当前配方不在饲喂计划中 && 不在缓存中设置
if (sgFeedPlans.isEmpty()) {
isPlan = false;
} else {
// rootPlan中存储的是该配方批号的总量
SgFeedPlan rootPlan = computePlanTotal(sgFeedPlans);
// 将计划实体对象设置到配料清单中
sgFeedList.setRootPlan(rootPlan);
// 完整的配料清单对象加入缓存
sgFeedListMap.put(sgFormulaManagement.getFormulaId() + "_" + sgFormulaManagement.getBatchId(), sgFeedList);
}
// 不存在则插入
if (!isExist && isPlan) {
sgFeedListService.insertSgFeedList(sgFeedList);
}
}
}
}
/**
* 计算某个配方某个批次的总和值
*
* @param sgFeedPlans 配方计划列表
* @return 各个值总和
*/
private static SgFeedPlan computePlanTotal(List<SgFeedPlan> sgFeedPlans) {
SgFeedPlan rootPlan = new SgFeedPlan();
if (!sgFeedPlans.isEmpty()) {
int sheepCountTotal = 0;
double sheepDailySize = 0.0;
double planFeedMorningSize = 0.0;
double planFeedNoonSize = 0.0;
double planFeedAfternoonSize = 0.0;
double planFeedTotalSize = 0.0;
for (SgFeedPlan sgFeedPlan : sgFeedPlans) {
sheepCountTotal += sgFeedPlan.getSheepCount();
sheepDailySize += sgFeedPlan.getPlanDailySize();
planFeedMorningSize += sgFeedPlan.getPlanMorningSize();
planFeedNoonSize += sgFeedPlan.getPlanNoonSize();
planFeedAfternoonSize += sgFeedPlan.getPlanAfternoonSize();
planFeedTotalSize += sgFeedPlan.getPlanFeedTotal();
}
rootPlan.setSheepCount(sheepCountTotal);
rootPlan.setPlanDailySize(sheepDailySize);
rootPlan.setPlanMorningSize(planFeedMorningSize);
rootPlan.setPlanNoonSize(planFeedNoonSize);
rootPlan.setPlanAfternoonSize(planFeedAfternoonSize);
rootPlan.setPlanFeedTotal(planFeedTotalSize);
// 设置计划日期
rootPlan.setPlanDate(sgFeedPlans.get(0).getPlanDate());
}
return rootPlan;
}
}

View File

@ -82,6 +82,8 @@ public class SgFeedPlanController extends BaseController {
sgFeedPlan.setCreateDate(new Date()); sgFeedPlan.setCreateDate(new Date());
// 计算其他字段值 // 计算其他字段值
setPlan(sgFeedPlan); setPlan(sgFeedPlan);
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
return toAjax(sgFeedPlanService.insertSgFeedPlan(sgFeedPlan)); return toAjax(sgFeedPlanService.insertSgFeedPlan(sgFeedPlan));
} }
@ -94,6 +96,8 @@ public class SgFeedPlanController extends BaseController {
public AjaxResult edit(@RequestBody SgFeedPlan sgFeedPlan) { public AjaxResult edit(@RequestBody SgFeedPlan sgFeedPlan) {
// 根据修改后的值重新计算 // 根据修改后的值重新计算
setPlan(sgFeedPlan); setPlan(sgFeedPlan);
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
return toAjax(sgFeedPlanService.updateSgFeedPlan(sgFeedPlan)); return toAjax(sgFeedPlanService.updateSgFeedPlan(sgFeedPlan));
} }
@ -104,6 +108,8 @@ public class SgFeedPlanController extends BaseController {
@Log(title = "饲喂计划", businessType = BusinessType.DELETE) @Log(title = "饲喂计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{createDates}") @DeleteMapping("/{createDates}")
public AjaxResult remove(@PathVariable Date[] createDates) { public AjaxResult remove(@PathVariable Date[] createDates) {
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
return toAjax(sgFeedPlanService.deleteSgFeedPlanByCreateDates(createDates)); return toAjax(sgFeedPlanService.deleteSgFeedPlanByCreateDates(createDates));
} }
@ -111,7 +117,7 @@ public class SgFeedPlanController extends BaseController {
* 设定计划值 * 设定计划值
* 用于添加和修改 * 用于添加和修改
*/ */
private SgFeedPlan setPlan(SgFeedPlan sgFeedPlan) { private void setPlan(SgFeedPlan sgFeedPlan) {
// 根据羊舍ID获取羊只数量 // 根据羊舍ID获取羊只数量
int countByFoldId = sgFeedPlanService.getSheepCountByFoldId(sgFeedPlan.getSheepHouseId()); int countByFoldId = sgFeedPlanService.getSheepCountByFoldId(sgFeedPlan.getSheepHouseId());
sgFeedPlan.setSheepCount(countByFoldId); sgFeedPlan.setSheepCount(countByFoldId);
@ -121,6 +127,5 @@ public class SgFeedPlanController extends BaseController {
sgFeedPlan.setPlanMorningSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioMorning() / 100)); sgFeedPlan.setPlanMorningSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioMorning() / 100));
sgFeedPlan.setPlanNoonSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioNoon() / 100)); sgFeedPlan.setPlanNoonSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioNoon() / 100));
sgFeedPlan.setPlanAfternoonSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioAfternoon() / 100)); sgFeedPlan.setPlanAfternoonSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioAfternoon() / 100));
return sgFeedPlan;
} }
} }

View File

@ -143,6 +143,9 @@ public class SgFormulaManagementController extends BaseController {
sgFormulaListItem.setFormulaId(sgFormulaManagement.getFormulaId()); sgFormulaListItem.setFormulaId(sgFormulaManagement.getFormulaId());
sgFormulaListService.insertSgFormulaList(sgFormulaListItem); sgFormulaListService.insertSgFormulaList(sgFormulaListItem);
} }
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
return toAjax(sgFormulaManagementService.updateSgFormulaManagement(sgFormulaManagement)); return toAjax(sgFormulaManagementService.updateSgFormulaManagement(sgFormulaManagement));
} }
@ -167,6 +170,9 @@ public class SgFormulaManagementController extends BaseController {
} }
// 前置检查完毕 执行删除 // 前置检查完毕 执行删除
sgFormulaManagement.setBatchId(batchId); sgFormulaManagement.setBatchId(batchId);
// 通知配料清单刷新数据
SgFeedListController.refresh = true;
return toAjax(sgFormulaManagementService.deleteSgFormulaManagement(sgFormulaManagement)); return toAjax(sgFormulaManagementService.deleteSgFormulaManagement(sgFormulaManagement));
} }
} }

View File

@ -0,0 +1,67 @@
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_feed_list
*
* @author HashMap
* @date 2025-08-19
*/
@Setter
@Getter
public class SgFeedList extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 序号 */
private Long id;
/** 配方编号 */
@Excel(name = "配方编号")
private String formulaId;
/** 配方批号 */
@Excel(name = "配方批号")
private String formulaBatchId;
/** 饲草班人员 */
@Excel(name = "饲草班人员")
private String zookeeper;
/** 配料日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "配料日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date deployDate;
private SgFormulaManagement rootFormula;
private SgFeedPlan rootPlan;
private Double morningTotal;
private Double noonTotal;
private Double afternoonTotal;
private List<SgFormulaList> formulaList;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("formulaId", getFormulaId())
.append("formulaBatchId", getFormulaBatchId())
.append("zookeeper", getZookeeper())
.append("deployDate", getDeployDate())
.toString();
}
}

View File

@ -0,0 +1,63 @@
package com.zhyc.module.feed.mapper;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedList;
import org.apache.ibatis.annotations.Mapper;
/**
* 配料清单Mapper接口
*
* @author HashMap
* @date 2025-08-19
*/
@Mapper
public interface SgFeedListMapper
{
/**
* 查询配料清单
*
* @param id 配料清单主键
* @return 配料清单
*/
SgFeedList selectSgFeedListById(Long id);
/**
* 查询配料清单列表
*
* @param sgFeedList 配料清单
* @return 配料清单集合
*/
List<SgFeedList> selectSgFeedListList(SgFeedList sgFeedList);
/**
* 新增配料清单
*
* @param sgFeedList 配料清单
* @return 结果
*/
int insertSgFeedList(SgFeedList sgFeedList);
/**
* 修改配料清单
*
* @param sgFeedList 配料清单
* @return 结果
*/
int updateSgFeedList(SgFeedList sgFeedList);
/**
* 删除配料清单
*
* @param id 配料清单主键
* @return 结果
*/
int deleteSgFeedListById(Long id);
/**
* 批量删除配料清单
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteSgFeedListByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.feed.service;
import java.util.List;
import com.zhyc.module.feed.domain.SgFeedList;
/**
* 配料清单Service接口
*
* @author HashMap
* @date 2025-08-19
*/
public interface ISgFeedListService
{
/**
* 查询配料清单
*
* @param id 配料清单主键
* @return 配料清单
*/
SgFeedList selectSgFeedListById(Long id);
/**
* 查询配料清单列表
*
* @param sgFeedList 配料清单
* @return 配料清单集合
*/
List<SgFeedList> selectSgFeedListList(SgFeedList sgFeedList);
/**
* 新增配料清单
*
* @param sgFeedList 配料清单
* @return 结果
*/
int insertSgFeedList(SgFeedList sgFeedList);
/**
* 修改配料清单
*
* @param sgFeedList 配料清单
* @return 结果
*/
int updateSgFeedList(SgFeedList sgFeedList);
/**
* 批量删除配料清单
*
* @param ids 需要删除的配料清单主键集合
* @return 结果
*/
int deleteSgFeedListByIds(Long[] ids);
/**
* 删除配料清单信息
*
* @param id 配料清单主键
* @return 结果
*/
int deleteSgFeedListById(Long id);
}

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.SgFeedListMapper;
import com.zhyc.module.feed.domain.SgFeedList;
import com.zhyc.module.feed.service.ISgFeedListService;
/**
* 配料清单Service业务层处理
*
* @author HashMap
* @date 2025-08-19
*/
@Service
public class SgFeedListServiceImpl implements ISgFeedListService
{
private final SgFeedListMapper sgFeedListMapper;
public SgFeedListServiceImpl(SgFeedListMapper sgFeedListMapper) {
this.sgFeedListMapper = sgFeedListMapper;
}
/**
* 查询配料清单
*
* @param id 配料清单主键
* @return 配料清单
*/
@Override
public SgFeedList selectSgFeedListById(Long id)
{
return sgFeedListMapper.selectSgFeedListById(id);
}
/**
* 查询配料清单列表
*
* @param sgFeedList 配料清单
* @return 配料清单
*/
@Override
public List<SgFeedList> selectSgFeedListList(SgFeedList sgFeedList)
{
return sgFeedListMapper.selectSgFeedListList(sgFeedList);
}
/**
* 新增配料清单
*
* @param sgFeedList 配料清单
* @return 结果
*/
@Override
public int insertSgFeedList(SgFeedList sgFeedList)
{
return sgFeedListMapper.insertSgFeedList(sgFeedList);
}
/**
* 修改配料清单
*
* @param sgFeedList 配料清单
* @return 结果
*/
@Override
public int updateSgFeedList(SgFeedList sgFeedList)
{
return sgFeedListMapper.updateSgFeedList(sgFeedList);
}
/**
* 批量删除配料清单
*
* @param ids 需要删除的配料清单主键
* @return 结果
*/
@Override
public int deleteSgFeedListByIds(Long[] ids)
{
return sgFeedListMapper.deleteSgFeedListByIds(ids);
}
/**
* 删除配料清单信息
*
* @param id 配料清单主键
* @return 结果
*/
@Override
public int deleteSgFeedListById(Long id)
{
return sgFeedListMapper.deleteSgFeedListById(id);
}
}

View File

@ -5,8 +5,12 @@ import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType; import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.exception.ServiceException; import com.zhyc.common.exception.ServiceException;
import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.module.base.domain.BasSheepType;
import com.zhyc.module.base.domain.BasSheepVariety; import com.zhyc.module.base.domain.BasSheepVariety;
import com.zhyc.module.base.domain.DaRanch;
import com.zhyc.module.base.service.IBasSheepTypeService;
import com.zhyc.module.base.service.IBasSheepVarietyService; import com.zhyc.module.base.service.IBasSheepVarietyService;
import com.zhyc.module.base.service.IDaRanchService;
import com.zhyc.module.produce.manage_sheep.domain.ScAddSheep; import com.zhyc.module.produce.manage_sheep.domain.ScAddSheep;
import com.zhyc.module.produce.manage_sheep.service.IScAddSheepService; import com.zhyc.module.produce.manage_sheep.service.IScAddSheepService;
import com.zhyc.module.base.domain.DaSheepfold; import com.zhyc.module.base.domain.DaSheepfold;
@ -36,6 +40,11 @@ public class ScAddSheepController {
private IDaSheepfoldService daSheepfoldMapper; private IDaSheepfoldService daSheepfoldMapper;
@Autowired @Autowired
private IBasSheepVarietyService basSheepVarietyMapper; private IBasSheepVarietyService basSheepVarietyMapper;
@Autowired
private IBasSheepTypeService basSheepTypeService;
@Autowired
private IDaRanchService daRanchService;
//新增羊只验证 //新增羊只验证
@PreAuthorize("@ss.hasPermi('produce:add_sheep:add')") @PreAuthorize("@ss.hasPermi('produce:add_sheep:add')")
@Log(title = "新增", businessType = BusinessType.INSERT) @Log(title = "新增", businessType = BusinessType.INSERT)
@ -44,6 +53,9 @@ public class ScAddSheepController {
if (scAddSheep.getEarNumber() == null || scAddSheep.getEarNumber().isEmpty()) { if (scAddSheep.getEarNumber() == null || scAddSheep.getEarNumber().isEmpty()) {
return AjaxResult.error("耳号不能为空"); return AjaxResult.error("耳号不能为空");
} }
if (scAddSheep.getRanchId() == null || scAddSheep.getRanchId() == 0) {
return AjaxResult.error("牧场不能为空");
}
if (scAddSheep.getSheepfold() == null || scAddSheep.getSheepfold() == 0) { if (scAddSheep.getSheepfold() == null || scAddSheep.getSheepfold() == 0) {
return AjaxResult.error("羊舍不能为空"); return AjaxResult.error("羊舍不能为空");
} }
@ -79,8 +91,15 @@ public class ScAddSheepController {
public void exportForm(HttpServletResponse response, @RequestBody ScAddSheep scAddSheep) throws IOException { public void exportForm(HttpServletResponse response, @RequestBody ScAddSheep scAddSheep) throws IOException {
ExcelUtil<ScAddSheep> util = new ExcelUtil<>(ScAddSheep.class); ExcelUtil<ScAddSheep> util = new ExcelUtil<>(ScAddSheep.class);
List<ScAddSheep> list = new ArrayList<>(); List<ScAddSheep> list = new ArrayList<>();
//处理牧场名称
// 处理羊舍名称原有逻辑 if (scAddSheep.getRanchId() != null) {
// 根据牧场ID查询牧场信息
DaRanch ranch = daRanchService.selectDaRanchById(scAddSheep.getRanchId().longValue());
if (ranch != null) {
scAddSheep.setRanchName(ranch.getRanch()); // 将牧场名称设置到实体中
}
}
// 处理羊舍名称
if (scAddSheep.getSheepfold() != null) { if (scAddSheep.getSheepfold() != null) {
DaSheepfold fold = daSheepfoldMapper.selectDaSheepfoldById(scAddSheep.getSheepfold().longValue()); DaSheepfold fold = daSheepfoldMapper.selectDaSheepfoldById(scAddSheep.getSheepfold().longValue());
if (fold != null) { if (fold != null) {
@ -88,6 +107,7 @@ public class ScAddSheepController {
} }
} }
//处理羊只品种名称
if (scAddSheep.getVarietyId() != null) { if (scAddSheep.getVarietyId() != null) {
BasSheepVariety variety = basSheepVarietyMapper.selectBasSheepVarietyById(scAddSheep.getVarietyId().longValue()); BasSheepVariety variety = basSheepVarietyMapper.selectBasSheepVarietyById(scAddSheep.getVarietyId().longValue());
if (variety != null) { if (variety != null) {
@ -95,9 +115,17 @@ public class ScAddSheepController {
} }
} }
//处理羊只类型名称
if (scAddSheep.getTypeId() != null) {
BasSheepType sheepType = basSheepTypeService.selectBasSheepTypeById(scAddSheep.getTypeId().intValue());
if (sheepType != null) {
scAddSheep.setTypeName(sheepType.getName());
}
}
list.add(scAddSheep); list.add(scAddSheep);
util.exportExcel(response, list, "羊只信息"); util.exportExcel(response, list, "羊只信息");
} }
//导入 //导入
@PostMapping("/importData") @PostMapping("/importData")
@PreAuthorize("@ss.hasPermi('produce:add_sheep:import')") @PreAuthorize("@ss.hasPermi('produce:add_sheep:import')")

View File

@ -101,8 +101,8 @@ public class ScTransGroupController extends BaseController {
/** /**
* 审批转群记录 * 审批转群记录
*/ */
@PutMapping("/approve") // @PutMapping("/approve")
public AjaxResult approve(@RequestBody ScTransGroup scTransGroup) { // public AjaxResult approve(@RequestBody ScTransGroup scTransGroup) {
return toAjax(scTransGroupService.approveScTransGroup(scTransGroup)); // return toAjax(scTransGroupService.approveScTransGroup(scTransGroup));
} // }
} }

View File

@ -110,6 +110,9 @@ public class ScTransitionInfoController extends BaseController {
@PutMapping("/approve") @PutMapping("/approve")
public AjaxResult approveScTransitionInfo(@RequestBody ScTransitionInfo scTransitionInfo) { public AjaxResult approveScTransitionInfo(@RequestBody ScTransitionInfo scTransitionInfo) {
if ("转场转入".equals(scTransitionInfo.getEventType()) && scTransitionInfo.getSheepfoldId() == null) {
return AjaxResult.error("转场转入时接收羊舍ID不能为空");
}
int rows = scTransitionInfoService.approveScTransitionInfo(scTransitionInfo); int rows = scTransitionInfoService.approveScTransitionInfo(scTransitionInfo);
return toAjax(rows); return toAjax(rows);
} }

View File

@ -27,6 +27,11 @@ public class ScAddSheep extends BaseEntity {
@Excel(name = "耳号") @Excel(name = "耳号")
private String earNumber; private String earNumber;
/** 牧场 */
private Integer ranchId;
@Excel(name = "牧场名称")
private String ranchName;
/** 羊舍编号 */ /** 羊舍编号 */
private Integer sheepfold; private Integer sheepfold;
@ -68,6 +73,11 @@ public class ScAddSheep extends BaseEntity {
@Excel(name = "品种") @Excel(name = "品种")
private String varietyName; private String varietyName;
/** 羊只类别 */
private Long typeId;
@Excel(name = "羊只类型")
private String typeName;
/** 入群日期 */ /** 入群日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "入群日期", dateFormat = "yyyy-MM-dd") @Excel(name = "入群日期", dateFormat = "yyyy-MM-dd")

View File

@ -27,8 +27,20 @@ public class ScChangeComment extends BaseEntity {
* 羊只id * 羊只id
*/ */
private String sheepId; private String sheepId;
@Excel(name = "管理耳号")
private String manageTags; private String manageTags;
/** 羊舍 */
private Long sheepfoldId;
@Excel(name = "羊舍")
private String sheepfoldName;
/**
* 事件类型
*/
@Excel(name = "事件类型")
private String eventType;
/** /**
* 新备注 * 新备注
*/ */

View File

@ -28,6 +28,15 @@ public class ScChangeEar extends BaseEntity
@Excel(name = "管理耳号") @Excel(name = "管理耳号")
private String manageTags; private String manageTags;
/** 羊舍 */
private Long sheepfoldId;
@Excel(name = "羊舍")
private String sheepfoldName;
/** 事件类型(改管理耳号/改电子耳号) */
@Excel(name = "事件类型")
private String eventType;
/** 选择更改耳号类型0电子耳号1管理耳号 */ /** 选择更改耳号类型0电子耳号1管理耳号 */
@Excel(name = "耳号类型", readConverterExp = "0=电子耳号,1=管理耳号") @Excel(name = "耳号类型", readConverterExp = "0=电子耳号,1=管理耳号")
private Integer earType; private Integer earType;

View File

@ -29,6 +29,17 @@ public class ScChangeVariety extends BaseEntity
@Excel(name = "耳号") @Excel(name = "耳号")
private String manageTags; private String manageTags;
/** 羊舍 */
private Long sheepfoldId;
@Excel(name = "羊舍")
private String sheepfoldName;
/**
* 事件类型
*/
@Excel(name = "事件类型")
private String eventType;
/** 原品种 */ /** 原品种 */
@Excel(name = "原品种") @Excel(name = "原品种")
private String varietyOld; private String varietyOld;
@ -41,10 +52,5 @@ public class ScChangeVariety extends BaseEntity
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
/** 创建日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date createTime;
} }

View File

@ -30,6 +30,14 @@ public class ScTransGroup extends BaseEntity {
@Excel(name = "耳号") @Excel(name = "耳号")
private String manageTags; private String manageTags;
/**
* 事件类型1-围产转群2-普通转群3-育肥转群4-预售转群
*/
private Integer eventType;
@Excel(name = "事件类型")
private String eventTypeText;
/** /**
* 转入羊舍 * 转入羊舍
*/ */
@ -40,18 +48,19 @@ public class ScTransGroup extends BaseEntity {
*/ */
private String foldFrom; private String foldFrom;
/**
* 羊只类型
*/
private Integer sheepTypeId;
@Excel(name = "羊只类型")
private String sheepTypeName;
/** /**
* 转出羊舍名称 * 转出羊舍名称
*/ */
@Excel(name = "转出羊舍") @Excel(name = "转出羊舍")
private String foldFromName; private String foldFromName;
/**
* 羊只类型ID
*/
private Integer sheepTypeId;
// 羊只类型名称
private String sheepTypeName;
/** /**
* 转入羊舍名称 * 转入羊舍名称
*/ */
@ -77,6 +86,9 @@ public class ScTransGroup extends BaseEntity {
@Excel(name = "转群原因") @Excel(name = "转群原因")
private String reasonText; private String reasonText;
/** 转群日期 */
@Excel(name = "转群日期")
private String transDate;
/** /**
* 技术员 * 技术员
*/ */

View File

@ -6,6 +6,8 @@ import lombok.NoArgsConstructor;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
import java.time.LocalDate;
/** /**
* 转场对象 sc_transition_info * 转场对象 sc_transition_info
* *
@ -27,9 +29,27 @@ public class ScTransitionInfo extends BaseEntity {
* 羊只id * 羊只id
*/ */
private Integer sheepId; private Integer sheepId;
@Excel(name = "耳号") @Excel(name = "耳号")
private String manageTags; private String manageTags;
/**
* 事件类型
*/
@Excel(name = "事件类型")
private String eventType;
/**
* 转场类型
*/
private Integer transType;
@Excel(name = "转场类型")
private String transTypeText;
/** 转场日期 */
@Excel(name = "转场日期")
private LocalDate transitionDate;
/** /**
* 品种id * 品种id
*/ */
@ -54,16 +74,9 @@ public class ScTransitionInfo extends BaseEntity {
private String transFrom; private String transFrom;
/** /**
* 转场类型 * 接收羊舍
*/ */
private Integer transType; private Long sheepfoldId;
/**
* 转场类型名称 只用于导出
*/
@Excel(name = "转场类型")
private String transTypeText;
/** /**
* 技术员 * 技术员
*/ */
@ -76,6 +89,7 @@ public class ScTransitionInfo extends BaseEntity {
private Integer status; private Integer status;
@Excel(name = "状态") @Excel(name = "状态")
private String statusText; private String statusText;
/** /**
* 备注 * 备注
*/ */

View File

@ -63,4 +63,5 @@ public interface ScTransitionInfoMapper
//批量转场 //批量转场
int insertScTransitionInfoBatch(@Param("list") List<ScTransitionInfo> transitionInfoList); int insertScTransitionInfoBatch(@Param("list") List<ScTransitionInfo> transitionInfoList);
} }

View File

@ -70,4 +70,5 @@ public interface IScTransitionInfoService {
//审批转场 //审批转场
public int approveScTransitionInfo(ScTransitionInfo scTransitionInfo); public int approveScTransitionInfo(ScTransitionInfo scTransitionInfo);
} }

View File

@ -2,7 +2,11 @@ package com.zhyc.module.produce.manage_sheep.service.impl;
import com.zhyc.common.exception.ServiceException; import com.zhyc.common.exception.ServiceException;
import com.zhyc.common.utils.StringUtils; import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.base.domain.BasSheepType;
import com.zhyc.module.base.domain.DaRanch;
import com.zhyc.module.base.mapper.BasSheepVarietyMapper; import com.zhyc.module.base.mapper.BasSheepVarietyMapper;
import com.zhyc.module.base.service.IBasSheepTypeService;
import com.zhyc.module.base.service.IDaRanchService;
import com.zhyc.module.produce.manage_sheep.domain.ScAddSheep; import com.zhyc.module.produce.manage_sheep.domain.ScAddSheep;
import com.zhyc.module.produce.manage_sheep.mapper.ScAddSheepMapper; import com.zhyc.module.produce.manage_sheep.mapper.ScAddSheepMapper;
import com.zhyc.module.produce.manage_sheep.service.IScAddSheepService; import com.zhyc.module.produce.manage_sheep.service.IScAddSheepService;
@ -32,6 +36,11 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
@Autowired @Autowired
private BasSheepVarietyMapper basSheepVarietyMapper; private BasSheepVarietyMapper basSheepVarietyMapper;
@Autowired
private IBasSheepTypeService basSheepTypeService;
@Autowired
private IDaRanchService daRanchService;
//新增 //新增
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -47,6 +56,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
BasSheep bs = new BasSheep(); BasSheep bs = new BasSheep();
bs.setManageTags(scAddSheep.getEarNumber()); bs.setManageTags(scAddSheep.getEarNumber());
// bs.setElectronicTags(scAddSheep.getEarNumber()); // bs.setElectronicTags(scAddSheep.getEarNumber());
bs.setRanchId(scAddSheep.getRanchId().longValue());
bs.setSheepfoldId(scAddSheep.getSheepfold().longValue()); bs.setSheepfoldId(scAddSheep.getSheepfold().longValue());
bs.setFatherId(null); bs.setFatherId(null);
bs.setMotherId(null); bs.setMotherId(null);
@ -64,7 +74,10 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
bs.setComment(scAddSheep.getComment()); bs.setComment(scAddSheep.getComment());
bs.setCreateBy(scAddSheep.getCreateBy()); bs.setCreateBy(scAddSheep.getCreateBy());
bs.setCreateTime(new Date()); bs.setCreateTime(new Date());
if (scAddSheep.getTypeId() != null) {
bs.setTypeId(scAddSheep.getTypeId().longValue());
}
bs.setStatusId(1L);
basSheepService.insertBasSheep(bs); basSheepService.insertBasSheep(bs);
return true; return true;
} }
@ -101,7 +114,23 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
ScAddSheep sheep = list.get(i); ScAddSheep sheep = list.get(i);
try { try {
// 处理品种名称转换为品种ID if (StringUtils.isBlank(sheep.getRanchName())) {
failure++;
failureMsg.append("<br/>第").append(i + 1).append("行:牧场名称不能为空");
continue;
}
DaRanch ranchParam = new DaRanch();
ranchParam.setRanch(sheep.getRanchName().trim());
List<DaRanch> ranchList = daRanchService.selectDaRanchList(ranchParam);
if (ranchList == null || ranchList.isEmpty()) {
failure++;
failureMsg.append("<br/>第").append(i + 1)
.append("行:牧场名称不存在【").append(sheep.getRanchName()).append("");
continue;
}
sheep.setRanchId(ranchList.get(0).getId().intValue());
if (StringUtils.isNotBlank(sheep.getVarietyName())) { if (StringUtils.isNotBlank(sheep.getVarietyName())) {
Long varietyId = basSheepVarietyMapper.selectIdByName(sheep.getVarietyName()); Long varietyId = basSheepVarietyMapper.selectIdByName(sheep.getVarietyName());
if (varietyId == null) { if (varietyId == null) {
@ -122,10 +151,10 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
continue; continue;
} }
// 处理羊舍名称转换为羊舍ID
if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) { if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) {
DaSheepfold param = new DaSheepfold(); DaSheepfold param = new DaSheepfold();
param.setSheepfoldName(sheep.getSheepfoldNameExcel()); param.setSheepfoldName(sheep.getSheepfoldNameExcel());
param.setRanchId(sheep.getRanchId().longValue());
List<DaSheepfold> foldList = daSheepfoldMapper.selectDaSheepfoldList(param); List<DaSheepfold> foldList = daSheepfoldMapper.selectDaSheepfoldList(param);
if (foldList == null || foldList.isEmpty()) { if (foldList == null || foldList.isEmpty()) {
failure++; failure++;
@ -139,7 +168,23 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
sheep.setSheepfold(foldList.get(0).getId().intValue()); sheep.setSheepfold(foldList.get(0).getId().intValue());
} }
// 校验耳号是否为空 if (StringUtils.isNotBlank(sheep.getTypeName())) {
BasSheepType typeQuery = new BasSheepType();
typeQuery.setName(sheep.getTypeName().trim());
List<BasSheepType> typeList = basSheepTypeService.selectBasSheepTypeList(typeQuery);
if (typeList == null || typeList.isEmpty()) {
failure++;
failureMsg.append("<br/>第")
.append(i + 1)
.append("行:羊只类型名称不存在【")
.append(sheep.getTypeName())
.append("");
continue;
}
sheep.setTypeId(typeList.get(0).getId().longValue());
}
if (StringUtils.isBlank(sheep.getEarNumber())) { if (StringUtils.isBlank(sheep.getEarNumber())) {
failure++; failure++;
failureMsg.append("<br/>第") failureMsg.append("<br/>第")
@ -148,7 +193,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
continue; continue;
} }
// 核心校验判断羊只基本信息表中是否存在未删除的同名耳号
BasSheep existSheep = basSheepService.selectBasSheepByManageTags(sheep.getEarNumber().trim()); BasSheep existSheep = basSheepService.selectBasSheepByManageTags(sheep.getEarNumber().trim());
if (existSheep != null) { if (existSheep != null) {
failure++; failure++;
@ -160,7 +204,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
continue; continue;
} }
// 执行导入新增或更新
if (updateSupport && sheep.getId() != null) { if (updateSupport && sheep.getId() != null) {
sheep.setUpdateBy(operName); sheep.setUpdateBy(operName);
updateScAddSheep(sheep); updateScAddSheep(sheep);

View File

@ -31,6 +31,7 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
private BasSheepMapper basSheepMapper; private BasSheepMapper basSheepMapper;
@Autowired @Autowired
private IBasSheepService basSheepService; private IBasSheepService basSheepService;
/** /**
* 查询转群记录 * 查询转群记录
* *
@ -42,6 +43,7 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
ScTransGroup group = scTransGroupMapper.selectScTransGroupById(id); ScTransGroup group = scTransGroupMapper.selectScTransGroupById(id);
group.setReasonText(convertReason(group.getReason())); group.setReasonText(convertReason(group.getReason()));
group.setStatusText(convertStatus(group.getStatus())); group.setStatusText(convertStatus(group.getStatus()));
group.setEventTypeText(convertEventType(group.getEventType()));
return group; return group;
} }
@ -58,6 +60,7 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
list.forEach(group -> { list.forEach(group -> {
group.setReasonText(convertReason(group.getReason())); group.setReasonText(convertReason(group.getReason()));
group.setStatusText(convertStatus(group.getStatus())); group.setStatusText(convertStatus(group.getStatus()));
group.setEventTypeText(convertEventType(group.getEventType()));
}); });
return list; return list;
} }
@ -70,11 +73,21 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public int insertScTransGroup(ScTransGroup scTransGroup) { public int insertScTransGroup(ScTransGroup scTransGroup) {
scTransGroup.setStatus(0); scTransGroup.setStatus(0);
scTransGroup.setCreateTime(DateUtils.getNowDate()); scTransGroup.setCreateTime(DateUtils.getNowDate());
scTransGroup.setCreateBy(SecurityUtils.getUsername()); scTransGroup.setCreateBy(SecurityUtils.getUsername());
return scTransGroupMapper.insertScTransGroup(scTransGroup); int rows = scTransGroupMapper.insertScTransGroup(scTransGroup);
if (rows > 0) {
try {
updateSheepFold(scTransGroup);
} catch (Exception e) {
throw new RuntimeException("新增转群记录后更新羊舍失败:" + e.getMessage(), e);
}
}
return rows;
// return scTransGroupMapper.insertScTransGroup(scTransGroup);
} }
/** /**
@ -130,9 +143,15 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
* 更新羊只所在羊舍 * 更新羊只所在羊舍
*/ */
private void updateSheepFold(ScTransGroup transGroup) { private void updateSheepFold(ScTransGroup transGroup) {
Long foldTo = Long.valueOf(transGroup.getFoldTo()); Object foldToObj = transGroup.getFoldTo();
if (foldTo == null) { if (foldToObj == null) {
throw new RuntimeException("转入羊舍不能为空"); throw new RuntimeException("转入羊舍ID为空请检查前端提交的foldTo参数");
}
Long foldTo;
try {
foldTo = Long.valueOf(foldToObj.toString());
} catch (NumberFormatException e) {
throw new RuntimeException("转入羊舍ID格式错误应为数字实际值" + foldToObj);
} }
String manageTags = transGroup.getManageTags(); String manageTags = transGroup.getManageTags();
@ -177,4 +196,18 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
return statusMap.getOrDefault(statusCode, "未知状态"); return statusMap.getOrDefault(statusCode, "未知状态");
} }
/**
* 转换事件类型1-围产转群2-普通转群3-育肥转群4-预售转群
*/
private String convertEventType(Integer eventType) {
if (eventType == null) {
return "未知";
}
Map<Integer, String> eventTypeMap = new HashMap<>();
eventTypeMap.put(1, "围产转群");
eventTypeMap.put(2, "普通转群");
eventTypeMap.put(3, "育肥转群");
eventTypeMap.put(4, "预售转群");
return eventTypeMap.getOrDefault(eventType, "未知");
}
} }

View File

@ -127,8 +127,16 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int approveScTransitionInfo(ScTransitionInfo scTransitionInfo) { public int approveScTransitionInfo(ScTransitionInfo scTransitionInfo) {
// 1. 查询当前记录的原始状态
ScTransitionInfo existing = scTransitionInfoMapper.selectScTransitionInfoById(scTransitionInfo.getId());
if (existing == null) {
throw new RuntimeException("转场记录不存在");
}
// 2. 校验状态仅允许审批待审批的记录
if (existing.getStatus() != 0) {
throw new RuntimeException("该记录已完成审批,无法重复操作");
}
int rows = scTransitionInfoMapper.updateScTransitionInfo(scTransitionInfo); int rows = scTransitionInfoMapper.updateScTransitionInfo(scTransitionInfo);
if (rows > 0 && scTransitionInfo.getStatus() == 1) { if (rows > 0 && scTransitionInfo.getStatus() == 1) {
updateSheepRanch(scTransitionInfo); updateSheepRanch(scTransitionInfo);
} }
@ -157,6 +165,12 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
} }
Long targetRanchId = matchedRanch.get().getId(); Long targetRanchId = matchedRanch.get().getId();
//获取接收羊舍
Long targetSheepfoldId = transitionInfo.getSheepfoldId();
if ("转场转入".equals(transitionInfo.getEventType()) && targetSheepfoldId == null) {
throw new RuntimeException("转场转入时,接收羊舍不能为空");
}
String manageTags = transitionInfo.getManageTags(); String manageTags = transitionInfo.getManageTags();
if (StringUtils.isBlank(manageTags)) { if (StringUtils.isBlank(manageTags)) {
throw new RuntimeException("耳号不能为空"); throw new RuntimeException("耳号不能为空");
@ -172,6 +186,9 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
BasSheep updateSheep = new BasSheep(); BasSheep updateSheep = new BasSheep();
updateSheep.setId(sheep.getId()); updateSheep.setId(sheep.getId());
updateSheep.setRanchId(targetRanchId); updateSheep.setRanchId(targetRanchId);
if ("转场转入".equals(transitionInfo.getEventType())) {
updateSheep.setSheepfoldId(targetSheepfoldId);
}
basSheepMapper.updateBasSheep(updateSheep); basSheepMapper.updateBasSheep(updateSheep);
} }
} }

View File

@ -31,6 +31,12 @@ public class ScCastrate extends BaseEntity {
@Excel(name = "耳号") @Excel(name = "耳号")
private String manageTags; private String manageTags;
/**
* 事件类型
*/
@Excel(name = "事件类型")
private String eventType;
/** /**
* 羊舍id * 羊舍id
*/ */

View File

@ -24,10 +24,15 @@ public class ScFixHoof extends BaseEntity
/** 羊只id */ /** 羊只id */
private Integer sheepId; private Integer sheepId;
/** 管理耳号(仅用于接收参数/返回视图) */
@Excel(name = "管理耳号") @Excel(name = "管理耳号")
private String manageTags; private String manageTags;
/**
* 事件类型
*/
@Excel(name = "事件类型")
private String eventType;
/** 羊舍id */ /** 羊舍id */
private Integer sheepfold; private Integer sheepfold;

View File

@ -328,7 +328,7 @@
SELECT COUNT(*) SELECT COUNT(*)
FROM bas_sheep FROM bas_sheep
WHERE manage_tags = #{tag} WHERE manage_tags = #{tag}
AND s.is_delete = 0 AND is_delete = 0
</select> </select>
<select id="existsByElectronicTag" resultType="int"> <select id="existsByElectronicTag" resultType="int">

View File

@ -0,0 +1,70 @@
<?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.SgFeedListMapper">
<resultMap type="SgFeedList" id="SgFeedListResult">
<result property="id" column="id" />
<result property="formulaId" column="formula_id" />
<result property="formulaBatchId" column="formula_batch_id" />
<result property="zookeeper" column="zookeeper" />
<result property="deployDate" column="deploy_date" />
</resultMap>
<sql id="selectSgFeedListVo">
select id, formula_id, formula_batch_id, zookeeper, deploy_date from sg_feed_list
</sql>
<select id="selectSgFeedListList" parameterType="SgFeedList" resultMap="SgFeedListResult">
<include refid="selectSgFeedListVo"/>
<where>
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
<if test="zookeeper != null and zookeeper != ''"> and zookeeper = #{zookeeper}</if>
<if test="deployDate != null "> and deploy_date = #{deployDate}</if>
</where>
</select>
<select id="selectSgFeedListById" parameterType="Long" resultMap="SgFeedListResult">
<include refid="selectSgFeedListVo"/>
where id = #{id}
</select>
<insert id="insertSgFeedList" parameterType="SgFeedList" useGeneratedKeys="true" keyProperty="id">
insert into sg_feed_list
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="formulaId != null">formula_id,</if>
<if test="formulaBatchId != null">formula_batch_id,</if>
<if test="zookeeper != null">zookeeper,</if>
<if test="deployDate != null">deploy_date,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="formulaId != null">#{formulaId},</if>
<if test="formulaBatchId != null">#{formulaBatchId},</if>
<if test="zookeeper != null">#{zookeeper},</if>
<if test="deployDate != null">#{deployDate},</if>
</trim>
</insert>
<update id="updateSgFeedList" parameterType="SgFeedList">
update sg_feed_list
<trim prefix="SET" suffixOverrides=",">
<if test="formulaId != null">formula_id = #{formulaId},</if>
<if test="formulaBatchId != null">formula_batch_id = #{formulaBatchId},</if>
<if test="zookeeper != null">zookeeper = #{zookeeper},</if>
<if test="deployDate != null">deploy_date = #{deployDate},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSgFeedListById" parameterType="Long">
delete from sg_feed_list where id = #{id}
</delete>
<delete id="deleteSgFeedListByIds" parameterType="String">
delete from sg_feed_list where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -18,6 +18,8 @@
<result property="parity" column="parity"/> <result property="parity" column="parity"/>
<result property="varietyId" column="variety_id"/> <result property="varietyId" column="variety_id"/>
<result property="varietyName" column="varietyName"/> <result property="varietyName" column="varietyName"/>
<result property="typeId" column="type_id"/>
<result property="typeName" column="type_name"/>
<result property="joinDate" column="join_date"/> <result property="joinDate" column="join_date"/>
<result property="comment" column="comment"/> <result property="comment" column="comment"/>
<result property="technician" column="technician"/> <result property="technician" column="technician"/>
@ -29,10 +31,12 @@
SELECT SELECT
sas.*, sas.*,
sf.sheepfold_name AS sheepfoldName, sf.sheepfold_name AS sheepfoldName,
bv.variety AS varietyName bv.variety AS varietyName,
st.type_name AS typeName
FROM sc_add_sheep sas FROM sc_add_sheep sas
LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id
LEFT JOIN bas_sheep_variety bv ON sas.variety_id = bv.id LEFT JOIN bas_sheep_variety bv ON sas.variety_id = bv.id
LEFT JOIN bas_sheep_type st ON sas.type_id = st.id
<where> <where>
<if test="earNumber != null and earNumber != ''"> <if test="earNumber != null and earNumber != ''">
AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%') AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%')
@ -43,6 +47,9 @@
<if test="varietyId != null"> <if test="varietyId != null">
AND sas.variety_id = #{varietyId} AND sas.variety_id = #{varietyId}
</if> </if>
<if test="typeId != null">
AND sas.type_id = #{typeId}
</if>
</where> </where>
</select> </select>
@ -54,18 +61,19 @@
<insert id="insert" parameterType="ScAddSheep" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="ScAddSheep" useGeneratedKeys="true" keyProperty="id">
INSERT INTO sc_add_sheep INSERT INTO sc_add_sheep
(ear_number, sheepfold, father, mother, born_weight, birthday, (ear_number, sheepfold, ranch_id, father, mother, born_weight, birthday,
gender, parity, variety_id, join_date, comment, technician, gender, parity, variety_id, type_id, join_date, comment, technician,
create_by, create_time) create_by, create_time)
VALUES (#{earNumber}, #{sheepfold}, #{father}, #{mother}, #{bornWeight}, VALUES (#{earNumber}, #{sheepfold}, #{ranchId}, #{father}, #{mother}, #{bornWeight},
#{birthday}, #{gender}, #{parity}, #{varietyId}, #{joinDate}, #{birthday}, #{gender}, #{parity}, #{varietyId}, #{typeId}, #{joinDate},
#{comment}, #{technician}, #{createBy}, #{createTime}) #{comment}, #{technician}, #{createBy}, #{createTime})
</insert> </insert>
<update id="updateScAddSheep" parameterType="ScAddSheep"> <update id="updateScAddSheep" parameterType="ScAddSheep">
UPDATE sc_add_sheep UPDATE sc_add_sheep
<set> <set>
ear_number = #{earNumber}, ear_number = #{earNumber},
ranch_id = #{ranchId},
sheepfold = #{sheepfold}, sheepfold = #{sheepfold},
father = #{father}, father = #{father},
mother = #{mother}, mother = #{mother},
@ -74,6 +82,7 @@
gender = #{gender}, gender = #{gender},
parity = #{parity}, parity = #{parity},
variety_id = #{varietyId}, variety_id = #{varietyId},
type_id = #{typeId},
join_date = #{joinDate}, join_date = #{joinDate},
comment = #{comment}, comment = #{comment},
technician = #{technician}, technician = #{technician},

View File

@ -8,6 +8,8 @@
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/> <result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/> <result property="manageTags" column="manage_tags"/>
<result property="sheepfoldName" column="sheepfold_name"/>
<result property="eventType" column="event_type"/>
<result property="newComment" column="new_comment"/> <result property="newComment" column="new_comment"/>
<result property="oldComment" column="old_comment"/> <result property="oldComment" column="old_comment"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
@ -17,13 +19,16 @@
<sql id="selectScChangeCommentVo"> <sql id="selectScChangeCommentVo">
select scc.id, select scc.id,
scc.sheep_id, scc.sheep_id,
bs.manage_tags as manage_tags, bs.manage_tags as manage_tags,
sf.sheepfold_name as sheepfold_name,
'改备注' as event_type,
scc.new_comment, scc.new_comment,
scc.old_comment, scc.old_comment,
scc.create_by, scc.create_by,
scc.create_time scc.create_time
from sc_change_comment scc from sc_change_comment scc
left join bas_sheep bs on scc.sheep_id = bs.id left join bas_sheep bs on scc.sheep_id = bs.id
left join da_sheepfold sf on bs.sheepfold_id = sf.id
</sql> </sql>
<select id="selectScChangeCommentList" parameterType="ScChangeComment" resultMap="ScChangeCommentResult"> <select id="selectScChangeCommentList" parameterType="ScChangeComment" resultMap="ScChangeCommentResult">
@ -32,6 +37,7 @@
<if test="manageTags != null and manageTags != ''"> <if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%') and bs.manage_tags like concat('%', #{manageTags}, '%')
</if> </if>
<if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if>
<if test="newComment != null and newComment != ''"> <if test="newComment != null and newComment != ''">
and scc.new_comment like concat('%', #{newComment}, '%') and scc.new_comment like concat('%', #{newComment}, '%')
</if> </if>

View File

@ -8,6 +8,8 @@
<result property="id" column="sce_id"/> <result property="id" column="sce_id"/>
<result property="sheepId" column="sheep_id"/> <result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/> <result property="manageTags" column="manage_tags"/>
<result property="sheepfoldName" column="sheepfold_name"/>
<result property="eventType" column="event_type"/>
<result property="earType" column="ear_type"/> <result property="earType" column="ear_type"/>
<result property="newTag" column="newTag"/> <result property="newTag" column="newTag"/>
<result property="oldTag" column="oldTag"/> <result property="oldTag" column="oldTag"/>
@ -20,6 +22,12 @@
select sce.id as sce_id, select sce.id as sce_id,
sce.sheep_id, sce.sheep_id,
bs.manage_tags as manage_tags, bs.manage_tags as manage_tags,
sf.sheepfold_name as sheepfold_name,
case
when sce.ear_type = 0 then '改电子耳号'
when sce.ear_type = 1 then '改管理耳号'
else ''
end as event_type,
sce.ear_type, sce.ear_type,
sce.newTag, sce.newTag,
sce.oldTag as oldTag, sce.oldTag as oldTag,
@ -28,6 +36,7 @@
sce.create_time sce.create_time
from sc_change_ear sce from sc_change_ear sce
LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id
LEFT JOIN da_sheepfold sf ON bs.sheepfold_id = sf.id
</sql> </sql>
<select id="selectScChangeEarList" parameterType="ScChangeEar" resultMap="ScChangeEarResult"> <select id="selectScChangeEarList" parameterType="ScChangeEar" resultMap="ScChangeEarResult">
@ -37,6 +46,10 @@
<if test="manageTags != null and manageTags != ''"> <if test="manageTags != null and manageTags != ''">
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%') and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
</if> </if>
<if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if>
<if test="sheepfoldName != null and sheepfoldName != ''">
and sf.sheepfold_name LIKE CONCAT('%', #{sheepfoldName}, '%')
</if>
<if test="earType != null ">and sce.ear_type = #{earType}</if> <if test="earType != null ">and sce.ear_type = #{earType}</if>
<if test="newTag != null and newTag != ''"> <if test="newTag != null and newTag != ''">
and sce.newTag LIKE CONCAT('%', #{newTag}, '%') and sce.newTag LIKE CONCAT('%', #{newTag}, '%')

View File

@ -8,6 +8,8 @@
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/> <result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/> <result property="manageTags" column="manage_tags"/>
<result property="sheepfoldName" column="sheepfold_name"/>
<result property="eventType" column="event_type"/>
<result property="varietyOld" column="variety_old"/> <result property="varietyOld" column="variety_old"/>
<result property="varietyNew" column="variety_new"/> <result property="varietyNew" column="variety_new"/>
<result property="comment" column="comment"/> <result property="comment" column="comment"/>
@ -18,7 +20,9 @@
<sql id="selectScChangeVarietyVo"> <sql id="selectScChangeVarietyVo">
select scv.id, select scv.id,
scv.sheep_id, scv.sheep_id,
bs.manage_tags as manage_tags, bs.manage_tags as manage_tags,
sf.sheepfold_name as sheepfold_name,
'改品种' as event_type,
scv.variety_old, scv.variety_old,
scv.variety_new, scv.variety_new,
scv.comment, scv.comment,
@ -26,6 +30,7 @@
scv.create_time scv.create_time
from sc_change_variety scv from sc_change_variety scv
left join bas_sheep bs on scv.sheep_id = bs.id left join bas_sheep bs on scv.sheep_id = bs.id
left join da_sheepfold sf on bs.sheepfold_id = sf.id
</sql> </sql>
<select id="selectScChangeVarietyList" parameterType="ScChangeVariety" resultMap="ScChangeVarietyResult"> <select id="selectScChangeVarietyList" parameterType="ScChangeVariety" resultMap="ScChangeVarietyResult">
@ -35,6 +40,7 @@
<if test="manageTags != null and manageTags != ''"> <if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%') and bs.manage_tags like concat('%', #{manageTags}, '%')
</if> </if>
<if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if>
<if test="varietyOld != null and varietyOld != ''"> <if test="varietyOld != null and varietyOld != ''">
and scv.variety_old like concat('%', #{varietyOld}, '%') and scv.variety_old like concat('%', #{varietyOld}, '%')
</if> </if>

View File

@ -25,18 +25,22 @@
SELECT tg.id, SELECT tg.id,
tg.sheep_id, tg.sheep_id,
s.manage_tags AS manageTags, s.manage_tags AS manageTags,
tg.event_type AS eventType,
tg.trans_date AS transDate,
tg.fold_to, tg.fold_to,
tg.fold_from, tg.fold_from,
tg.reason, tg.reason,
tg.variety_id, tg.variety_id,
bv.variety AS varietyName, bv.variety AS varietyName,
tg.technician, st.id AS sheepTypeId,
st.name AS sheepTypeName,
tg.status, tg.status,
tg.comment, tg.comment,
tg.create_by, tg.create_by,
tg.create_time, tg.create_time,
sf_from.sheepfold_name AS foldFromName, sf_from.sheepfold_name AS foldFromName,
sf_to.sheepfold_name AS foldToName, sf_to.sheepfold_name AS foldToName,
tg.technician,
st.id AS sheepTypeId, st.id AS sheepTypeId,
st.name AS sheepTypeName st.name AS sheepTypeName
FROM sc_trans_group tg FROM sc_trans_group tg
@ -54,10 +58,15 @@
<if test="manageTags != null and manageTags != ''"> <if test="manageTags != null and manageTags != ''">
and s.manage_tags like concat('%', #{manageTags}, '%') and s.manage_tags like concat('%', #{manageTags}, '%')
</if> </if>
<if test="eventType != null">and tg.event_type = #{eventType}</if>
<if test="params.beginTransDate != null and params.beginTransDate != '' and params.endTransDate != null and params.endTransDate != ''">
and tg.trans_date between #{params.beginTransDate} and #{params.endTransDate}
</if>
<if test="foldTo != null and foldTo != ''">and fold_to = #{foldTo}</if> <if test="foldTo != null and foldTo != ''">and fold_to = #{foldTo}</if>
<if test="foldFrom != null and foldFrom != ''">and fold_from = #{foldFrom}</if> <if test="foldFrom != null and foldFrom != ''">and fold_from = #{foldFrom}</if>
<if test="status != null">and status = #{status}</if> <if test="status != null">and status = #{status}</if>
<if test="varietyId != null">and tg.variety_id = #{varietyId}</if> <if test="varietyId != null">and tg.variety_id = #{varietyId}</if>
<if test="sheepTypeId != null">and st.id = #{sheepTypeId}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and tg.create_time between #{params.beginCreateTime} and #{params.endCreateTime} and tg.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
@ -75,6 +84,8 @@
insert into sc_trans_group insert into sc_trans_group
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if> <if test="sheepId != null">sheep_id,</if>
<if test="eventType != null">event_type,</if>
<if test="transDate != null and transDate != ''">trans_date,</if>
<if test="foldTo != null and foldTo != ''">fold_to,</if> <if test="foldTo != null and foldTo != ''">fold_to,</if>
<if test="foldFrom != null and foldFrom != ''">fold_from,</if> <if test="foldFrom != null and foldFrom != ''">fold_from,</if>
<if test="varietyId != null">variety_id,</if> <if test="varietyId != null">variety_id,</if>
@ -87,6 +98,8 @@
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if> <if test="sheepId != null">#{sheepId},</if>
<if test="eventType != null">#{eventType},</if>
<if test="transDate != null and transDate != ''">#{transDate},</if>
<if test="foldTo != null and foldTo != ''">#{foldTo},</if> <if test="foldTo != null and foldTo != ''">#{foldTo},</if>
<if test="foldFrom != null and foldFrom != ''">#{foldFrom},</if> <if test="foldFrom != null and foldFrom != ''">#{foldFrom},</if>
<if test="varietyId != null">#{varietyId},</if> <if test="varietyId != null">#{varietyId},</if>
@ -103,6 +116,8 @@
update sc_trans_group update sc_trans_group
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if> <if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="eventType != null">event_type = #{eventType},</if>
<if test="transDate != null and transDate != ''">trans_date = #{transDate},</if>
<if test="foldTo != null and foldTo != ''">fold_to = #{foldTo},</if> <if test="foldTo != null and foldTo != ''">fold_to = #{foldTo},</if>
<if test="foldFrom != null and foldFrom != ''">fold_from = #{foldFrom},</if> <if test="foldFrom != null and foldFrom != ''">fold_from = #{foldFrom},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if> <if test="varietyId != null">variety_id = #{varietyId},</if>

View File

@ -6,12 +6,14 @@
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScTransitionInfo" id="ScTransitionInfoResult"> <resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScTransitionInfo" id="ScTransitionInfoResult">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/> <result property="sheepId" column="sheep_id"/>
<result property="eventType" column="event_type"/>
<result property="varietyId" column="variety_id"/> <result property="varietyId" column="variety_id"/>
<result property="varietyName" column="varietyName"/> <result property="varietyName" column="varietyName"/>
<result property="transTo" column="trans_to"/> <result property="transTo" column="trans_to"/>
<result property="transFrom" column="trans_from"/> <result property="transFrom" column="trans_from"/>
<result property="transType" column="trans_type"/> <result property="transType" column="trans_type"/>
<result property="transTypeText" column="transTypeText"/> <result property="transTypeText" column="transTypeText"/>
<result property="transitionDate" column="transition_date"/>
<result property="technician" column="technician"/> <result property="technician" column="technician"/>
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="comment" column="comment"/> <result property="comment" column="comment"/>
@ -21,20 +23,22 @@
<sql id="selectScTransitionInfoVo"> <sql id="selectScTransitionInfoVo">
SELECT t.*, SELECT t.*,
bv.variety AS varietyName, bv.variety AS varietyName,
bs.manage_tags AS manageTags, bs.manage_tags AS manageTags,
t.event_type AS eventType,
t.transition_date AS transitionDate,
CASE t.trans_type CASE t.trans_type
WHEN 0 THEN '内部调拨' WHEN 0 THEN '内部调拨'
WHEN 1 THEN '内部销售' WHEN 1 THEN '内部销售'
WHEN 2 THEN '育肥调拨' WHEN 2 THEN '育肥调拨'
ELSE '未知' ELSE '未知'
END AS transTypeText, END AS transTypeText,
CASE t.status CASE t.status
WHEN 0 THEN '待审批' WHEN 0 THEN '待审批'
WHEN 1 THEN '已通过' WHEN 1 THEN '已通过'
WHEN 2 THEN '已驳回' WHEN 2 THEN '已驳回'
ELSE '未知状态' ELSE '未知状态'
END AS statusText END AS statusText
FROM sc_transition_info t FROM sc_transition_info t
LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id
LEFT JOIN bas_sheep_variety bv ON bs.variety_id = bv.id LEFT JOIN bas_sheep_variety bv ON bs.variety_id = bv.id
@ -47,6 +51,14 @@
<if test="manageTags != null and manageTags != ''"> <if test="manageTags != null and manageTags != ''">
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%') and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
</if> </if>
<if test="eventType != null and eventType != ''">
and t.event_type = #{eventType}
</if>
<if test="transType != null">and t.trans_type = #{transType}</if>
<if test="params.beginTransitionDate != null and params.beginTransitionDate != ''
and params.endTransitionDate != null and params.endTransitionDate != ''">
and t.transition_date between #{params.beginTransitionDate} and #{params.endTransitionDate}
</if>
<if test="varietyId != null">and bs.variety_id = #{varietyId}</if> <if test="varietyId != null">and bs.variety_id = #{varietyId}</if>
<if test="transTo != null and transTo != ''">and trans_to = #{transTo}</if> <if test="transTo != null and transTo != ''">and trans_to = #{transTo}</if>
<if test="transFrom != null and transFrom != ''">and trans_from = #{transFrom}</if> <if test="transFrom != null and transFrom != ''">and trans_from = #{transFrom}</if>
@ -69,7 +81,9 @@
<if test="varietyId != null">variety_id,</if> <if test="varietyId != null">variety_id,</if>
<if test="transTo != null and transTo != ''">trans_to,</if> <if test="transTo != null and transTo != ''">trans_to,</if>
<if test="transFrom != null and transFrom != ''">trans_from,</if> <if test="transFrom != null and transFrom != ''">trans_from,</if>
<if test="eventType != null and eventType != ''">event_type,</if>
<if test="transType != null">trans_type,</if> <if test="transType != null">trans_type,</if>
<if test="transitionDate != null">transition_date,</if>
<if test="technician != null and technician != ''">technician,</if> <if test="technician != null and technician != ''">technician,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="comment != null">comment,</if> <if test="comment != null">comment,</if>
@ -81,7 +95,9 @@
<if test="varietyId != null">#{varietyId},</if> <if test="varietyId != null">#{varietyId},</if>
<if test="transTo != null and transTo != ''">#{transTo},</if> <if test="transTo != null and transTo != ''">#{transTo},</if>
<if test="transFrom != null and transFrom != ''">#{transFrom},</if> <if test="transFrom != null and transFrom != ''">#{transFrom},</if>
<if test="eventType != null and eventType != ''">#{eventType},</if>
<if test="transType != null">#{transType},</if> <if test="transType != null">#{transType},</if>
<if test="transitionDate != null">#{transitionDate},</if>
<if test="technician != null and technician != ''">#{technician},</if> <if test="technician != null and technician != ''">#{technician},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="comment != null">#{comment},</if> <if test="comment != null">#{comment},</if>
@ -93,13 +109,13 @@
<insert id="insertScTransitionInfoBatch"> <insert id="insertScTransitionInfoBatch">
INSERT INTO sc_transition_info ( INSERT INTO sc_transition_info (
sheep_id, variety_id, trans_to, trans_from, sheep_id, variety_id, trans_to, trans_from,
trans_type, technician, status, comment, event_type,trans_type, transition_date, technician, status, comment,
create_by, create_time create_by, create_time
) VALUES ) VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
( (
#{item.sheepId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom}, #{item.sheepId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom}, #{item.eventType},
#{item.transType}, #{item.technician}, #{item.status}, #{item.comment}, #{item.transType},#{item.transitionDate}, #{item.technician}, #{item.status}, #{item.comment},
#{item.createBy}, now() #{item.createBy}, now()
) )
</foreach> </foreach>
@ -110,9 +126,12 @@
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if> <if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if> <if test="varietyId != null">variety_id = #{varietyId},</if>
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
<if test="transTo != null and transTo != ''">trans_to = #{transTo},</if> <if test="transTo != null and transTo != ''">trans_to = #{transTo},</if>
<if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if> <if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if>
<if test="eventType != null and eventType != ''">event_type = #{eventType},</if>
<if test="transType != null">trans_type = #{transType},</if> <if test="transType != null">trans_type = #{transType},</if>
<if test="transitionDate != null">transition_date = #{transitionDate},</if>
<if test="technician != null and technician != ''">technician = #{technician},</if> <if test="technician != null and technician != ''">technician = #{technician},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="comment != null">comment = #{comment},</if> <if test="comment != null">comment = #{comment},</if>

View File

@ -4,10 +4,11 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.other.mapper.ScCastrateMapper"> <mapper namespace="com.zhyc.module.produce.other.mapper.ScCastrateMapper">
<resultMap type="ScCastrate" id="ScCastrateResult"> <resultMap type="com.zhyc.module.produce.other.domain.ScCastrate" id="ScCastrateResult">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/> <result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manageTags"/> <result property="manageTags" column="manageTags"/>
<result property="eventType" column="event_type"/>
<result property="sheepfold" column="sheepfold"/> <result property="sheepfold" column="sheepfold"/>
<result property="sheepfoldName" column="sheepfoldName"/> <result property="sheepfoldName" column="sheepfoldName"/>
<result property="varietyId" column="variety_id"/> <result property="varietyId" column="variety_id"/>
@ -22,6 +23,7 @@
select sc.id, select sc.id,
sc.sheep_id, sc.sheep_id,
bs.manage_tags as manageTags, bs.manage_tags as manageTags,
'去势' as event_type,
bs.sheepfold_id as sheepfold, bs.sheepfold_id as sheepfold,
sf.sheepfold_name as sheepfoldName, sf.sheepfold_name as sheepfoldName,
bs.variety_id as varietyId, bs.variety_id as varietyId,

View File

@ -4,9 +4,10 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.other.mapper.ScFixHoofMapper"> <mapper namespace="com.zhyc.module.produce.other.mapper.ScFixHoofMapper">
<resultMap type="ScFixHoof" id="ScFixHoofResult"> <resultMap type="com.zhyc.module.produce.other.domain.ScFixHoof" id="ScFixHoofResult">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="manageTags" column="manageTags"/> <result property="manageTags" column="manageTags"/>
<result property="eventType" column="event_type"/>
<result property="sheepfold" column="sheepfold"/> <result property="sheepfold" column="sheepfold"/>
<result property="varietyId" column="variety_id"/> <result property="varietyId" column="variety_id"/>
<result property="sheepfoldName" column="sheepfoldName"/> <result property="sheepfoldName" column="sheepfoldName"/>
@ -19,6 +20,7 @@
<sql id="selectScFixHoofVo"> <sql id="selectScFixHoofVo">
select fh.id, select fh.id,
bs.manage_tags as manageTags, bs.manage_tags as manageTags,
'修蹄' as event_type,
bs.sheepfold_id as sheepfold, bs.sheepfold_id as sheepfold,
sf.sheepfold_name as sheepfoldName, sf.sheepfold_name as sheepfoldName,
bs.variety_id as varietyId, bs.variety_id as varietyId,