死亡管理
This commit is contained in:
parent
2083325e40
commit
9f9eef5f98
@ -0,0 +1,120 @@
|
||||
package com.zhyc.module.produce.breed.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import 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.produce.breed.domain.ScSheepDeath;
|
||||
import com.zhyc.module.produce.breed.service.IScSheepDeathService;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 羊只死淘记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sheep_death/death")
|
||||
public class ScSheepDeathController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IScSheepDeathService scSheepDeathService;
|
||||
|
||||
/**
|
||||
* 查询羊只死淘记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScSheepDeath scSheepDeath)
|
||||
{
|
||||
startPage();
|
||||
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据管理耳号查询羊只信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:query')")
|
||||
@GetMapping("/sheepInfo/{manageTags}")
|
||||
public AjaxResult getSheepInfo(@PathVariable("manageTags") String manageTags)
|
||||
{
|
||||
Map<String, Object> sheepInfo = scSheepDeathService.selectSheepFileByManageTags(manageTags);
|
||||
if (sheepInfo != null) {
|
||||
return success(sheepInfo);
|
||||
} else {
|
||||
return error("未找到该耳号对应的羊只信息");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出羊只死淘记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:export')")
|
||||
@Log(title = "羊只死淘记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScSheepDeath scSheepDeath)
|
||||
{
|
||||
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
||||
ExcelUtil<ScSheepDeath> util = new ExcelUtil<ScSheepDeath>(ScSheepDeath.class);
|
||||
util.exportExcel(response, list, "羊只死淘记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取羊只死淘记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(scSheepDeathService.selectScSheepDeathById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增羊只死淘记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:add')")
|
||||
@Log(title = "羊只死淘记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScSheepDeath scSheepDeath)
|
||||
{
|
||||
return toAjax(scSheepDeathService.insertScSheepDeath(scSheepDeath));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改羊只死淘记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:edit')")
|
||||
@Log(title = "羊只死淘记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScSheepDeath scSheepDeath)
|
||||
{
|
||||
return toAjax(scSheepDeathService.updateScSheepDeath(scSheepDeath));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除羊只死淘记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_death:death:remove')")
|
||||
@Log(title = "羊只死淘记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(scSheepDeathService.deleteScSheepDeathByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,356 @@
|
||||
package com.zhyc.module.produce.breed.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;
|
||||
|
||||
/**
|
||||
* 羊只死淘记录对象 sc_sheep_death
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-06
|
||||
*/
|
||||
public class ScSheepDeath extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 羊只ID */
|
||||
@Excel(name = "羊只ID")
|
||||
private Long sheepId;
|
||||
|
||||
/** 管理耳号 */
|
||||
@Excel(name = "管理耳号")
|
||||
private String manageTags;
|
||||
|
||||
/** 事件类型 */
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/** 死亡日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "死亡日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date deathDate;
|
||||
|
||||
/** 疾病类型ID */
|
||||
@Excel(name = "疾病类型ID")
|
||||
private Long diseaseTypeId;
|
||||
|
||||
/** 疾病子类型ID */
|
||||
@Excel(name = "疾病子类型ID")
|
||||
private Long diseaseSubtypeId;
|
||||
|
||||
/** 死淘去向 */
|
||||
@Excel(name = "死淘去向")
|
||||
private String disposalDirection;
|
||||
|
||||
/** 技术员 */
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/** 处理人 */
|
||||
@Excel(name = "处理人")
|
||||
private String handler;
|
||||
|
||||
/** 班组 */
|
||||
@Excel(name = "班组")
|
||||
private String workGroup;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/** 是否删除(0:未删除 1:已删除) */
|
||||
@Excel(name = "是否删除(0:未删除 1:已删除)")
|
||||
private Long isDelete;
|
||||
|
||||
// 以下字段仅用于前端显示,不存储到数据库
|
||||
/** 品种 */
|
||||
private String variety;
|
||||
|
||||
/** 死亡时羊只类别 */
|
||||
private String sheepType;
|
||||
|
||||
/** 性别 */
|
||||
private Integer gender;
|
||||
|
||||
/** 日龄 */
|
||||
private Long dayAge;
|
||||
|
||||
/** 胎次 */
|
||||
private Integer parity;
|
||||
|
||||
/** 羊舍 */
|
||||
private String sheepfoldName;
|
||||
|
||||
/** 繁育状态 */
|
||||
private String breedStatus;
|
||||
|
||||
/** 死亡时产后天数 */
|
||||
private Integer postLambingDay;
|
||||
|
||||
/** 死亡时泌乳天数 */
|
||||
private Integer lactationDay;
|
||||
|
||||
/** 死亡时怀孕天数 */
|
||||
private Integer gestationDay;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setSheepId(Long sheepId)
|
||||
{
|
||||
this.sheepId = sheepId;
|
||||
}
|
||||
|
||||
public Long getSheepId()
|
||||
{
|
||||
return sheepId;
|
||||
}
|
||||
|
||||
public void setManageTags(String manageTags)
|
||||
{
|
||||
this.manageTags = manageTags;
|
||||
}
|
||||
|
||||
public String getManageTags()
|
||||
{
|
||||
return manageTags;
|
||||
}
|
||||
|
||||
public void setEventType(String eventType)
|
||||
{
|
||||
this.eventType = eventType;
|
||||
}
|
||||
|
||||
public String getEventType()
|
||||
{
|
||||
return eventType;
|
||||
}
|
||||
|
||||
public void setDeathDate(Date deathDate)
|
||||
{
|
||||
this.deathDate = deathDate;
|
||||
}
|
||||
|
||||
public Date getDeathDate()
|
||||
{
|
||||
return deathDate;
|
||||
}
|
||||
|
||||
public void setDiseaseTypeId(Long diseaseTypeId)
|
||||
{
|
||||
this.diseaseTypeId = diseaseTypeId;
|
||||
}
|
||||
|
||||
public Long getDiseaseTypeId()
|
||||
{
|
||||
return diseaseTypeId;
|
||||
}
|
||||
|
||||
public void setDiseaseSubtypeId(Long diseaseSubtypeId)
|
||||
{
|
||||
this.diseaseSubtypeId = diseaseSubtypeId;
|
||||
}
|
||||
|
||||
public Long getDiseaseSubtypeId()
|
||||
{
|
||||
return diseaseSubtypeId;
|
||||
}
|
||||
|
||||
public void setDisposalDirection(String disposalDirection)
|
||||
{
|
||||
this.disposalDirection = disposalDirection;
|
||||
}
|
||||
|
||||
public String getDisposalDirection()
|
||||
{
|
||||
return disposalDirection;
|
||||
}
|
||||
|
||||
public void setTechnician(String technician)
|
||||
{
|
||||
this.technician = technician;
|
||||
}
|
||||
|
||||
public String getTechnician()
|
||||
{
|
||||
return technician;
|
||||
}
|
||||
|
||||
public void setHandler(String handler)
|
||||
{
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public String getHandler()
|
||||
{
|
||||
return handler;
|
||||
}
|
||||
|
||||
public void setWorkGroup(String workGroup)
|
||||
{
|
||||
this.workGroup = workGroup;
|
||||
}
|
||||
|
||||
public String getWorkGroup()
|
||||
{
|
||||
return workGroup;
|
||||
}
|
||||
|
||||
public void setComment(String comment)
|
||||
{
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getComment()
|
||||
{
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setIsDelete(Long isDelete)
|
||||
{
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public Long getIsDelete()
|
||||
{
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
// 以下为仅用于显示的字段的getter/setter
|
||||
public void setVariety(String variety)
|
||||
{
|
||||
this.variety = variety;
|
||||
}
|
||||
|
||||
public String getVariety()
|
||||
{
|
||||
return variety;
|
||||
}
|
||||
|
||||
public void setSheepType(String sheepType)
|
||||
{
|
||||
this.sheepType = sheepType;
|
||||
}
|
||||
|
||||
public String getSheepType()
|
||||
{
|
||||
return sheepType;
|
||||
}
|
||||
|
||||
public void setGender(Integer gender)
|
||||
{
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public Integer getGender()
|
||||
{
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setDayAge(Long dayAge)
|
||||
{
|
||||
this.dayAge = dayAge;
|
||||
}
|
||||
|
||||
public Long getDayAge()
|
||||
{
|
||||
return dayAge;
|
||||
}
|
||||
|
||||
public void setParity(Integer parity)
|
||||
{
|
||||
this.parity = parity;
|
||||
}
|
||||
|
||||
public Integer getParity()
|
||||
{
|
||||
return parity;
|
||||
}
|
||||
|
||||
public void setSheepfoldName(String sheepfoldName)
|
||||
{
|
||||
this.sheepfoldName = sheepfoldName;
|
||||
}
|
||||
|
||||
public String getSheepfoldName()
|
||||
{
|
||||
return sheepfoldName;
|
||||
}
|
||||
|
||||
public void setBreedStatus(String breedStatus)
|
||||
{
|
||||
this.breedStatus = breedStatus;
|
||||
}
|
||||
|
||||
public String getBreedStatus()
|
||||
{
|
||||
return breedStatus;
|
||||
}
|
||||
|
||||
public void setPostLambingDay(Integer postLambingDay)
|
||||
{
|
||||
this.postLambingDay = postLambingDay;
|
||||
}
|
||||
|
||||
public Integer getPostLambingDay()
|
||||
{
|
||||
return postLambingDay;
|
||||
}
|
||||
|
||||
public void setLactationDay(Integer lactationDay)
|
||||
{
|
||||
this.lactationDay = lactationDay;
|
||||
}
|
||||
|
||||
public Integer getLactationDay()
|
||||
{
|
||||
return lactationDay;
|
||||
}
|
||||
|
||||
public void setGestationDay(Integer gestationDay)
|
||||
{
|
||||
this.gestationDay = gestationDay;
|
||||
}
|
||||
|
||||
public Integer getGestationDay()
|
||||
{
|
||||
return gestationDay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("sheepId", getSheepId())
|
||||
.append("manageTags", getManageTags())
|
||||
.append("eventType", getEventType())
|
||||
.append("deathDate", getDeathDate())
|
||||
.append("diseaseTypeId", getDiseaseTypeId())
|
||||
.append("diseaseSubtypeId", getDiseaseSubtypeId())
|
||||
.append("disposalDirection", getDisposalDirection())
|
||||
.append("technician", getTechnician())
|
||||
.append("handler", getHandler())
|
||||
.append("workGroup", getWorkGroup())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("comment", getComment())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("isDelete", getIsDelete())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.zhyc.module.produce.breed.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
||||
|
||||
/**
|
||||
* 羊只死淘记录Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-06
|
||||
*/
|
||||
public interface ScSheepDeathMapper
|
||||
{
|
||||
/**
|
||||
* 查询羊只死淘记录
|
||||
*
|
||||
* @param id 羊只死淘记录主键
|
||||
* @return 羊只死淘记录
|
||||
*/
|
||||
public ScSheepDeath selectScSheepDeathById(Long id);
|
||||
|
||||
/**
|
||||
* 查询羊只死淘记录列表
|
||||
*
|
||||
* @param scSheepDeath 羊只死淘记录
|
||||
* @return 羊只死淘记录集合
|
||||
*/
|
||||
public List<ScSheepDeath> selectScSheepDeathList(ScSheepDeath scSheepDeath);
|
||||
|
||||
/**
|
||||
* 根据管理耳号查询sheep_file视图信息
|
||||
*
|
||||
* @param manageTags 管理耳号
|
||||
* @return 羊只信息
|
||||
*/
|
||||
public Map<String, Object> selectSheepFileByManageTags(String manageTags);
|
||||
|
||||
/**
|
||||
* 新增羊只死淘记录
|
||||
*
|
||||
* @param scSheepDeath 羊只死淘记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScSheepDeath(ScSheepDeath scSheepDeath);
|
||||
|
||||
/**
|
||||
* 修改羊只死淘记录
|
||||
*
|
||||
* @param scSheepDeath 羊只死淘记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScSheepDeath(ScSheepDeath scSheepDeath);
|
||||
|
||||
/**
|
||||
* 删除羊只死淘记录
|
||||
*
|
||||
* @param id 羊只死淘记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScSheepDeathById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除羊只死淘记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScSheepDeathByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.zhyc.module.produce.breed.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
||||
|
||||
/**
|
||||
* 羊只死淘记录Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-06
|
||||
*/
|
||||
public interface IScSheepDeathService
|
||||
{
|
||||
/**
|
||||
* 查询羊只死淘记录
|
||||
*
|
||||
* @param id 羊只死淘记录主键
|
||||
* @return 羊只死淘记录
|
||||
*/
|
||||
public ScSheepDeath selectScSheepDeathById(Long id);
|
||||
|
||||
/**
|
||||
* 查询羊只死淘记录列表
|
||||
*
|
||||
* @param scSheepDeath 羊只死淘记录
|
||||
* @return 羊只死淘记录集合
|
||||
*/
|
||||
public List<ScSheepDeath> selectScSheepDeathList(ScSheepDeath scSheepDeath);
|
||||
|
||||
/**
|
||||
* 根据管理耳号查询sheep_file视图信息
|
||||
*
|
||||
* @param manageTags 管理耳号
|
||||
* @return 羊只信息
|
||||
*/
|
||||
public Map<String, Object> selectSheepFileByManageTags(String manageTags);
|
||||
|
||||
/**
|
||||
* 新增羊只死淘记录
|
||||
*
|
||||
* @param scSheepDeath 羊只死淘记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScSheepDeath(ScSheepDeath scSheepDeath);
|
||||
|
||||
/**
|
||||
* 修改羊只死淘记录
|
||||
*
|
||||
* @param scSheepDeath 羊只死淘记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScSheepDeath(ScSheepDeath scSheepDeath);
|
||||
|
||||
/**
|
||||
* 批量删除羊只死淘记录
|
||||
*
|
||||
* @param ids 需要删除的羊只死淘记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScSheepDeathByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除羊只死淘记录信息
|
||||
*
|
||||
* @param id 羊只死淘记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScSheepDeathById(Long id);
|
||||
}
|
@ -0,0 +1,166 @@
|
||||
package com.zhyc.module.produce.breed.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.produce.breed.mapper.ScSheepDeathMapper;
|
||||
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
||||
import com.zhyc.module.produce.breed.service.IScSheepDeathService;
|
||||
|
||||
/**
|
||||
* 羊只死淘记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-06
|
||||
*/
|
||||
@Service
|
||||
public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
||||
{
|
||||
@Autowired
|
||||
private ScSheepDeathMapper scSheepDeathMapper;
|
||||
|
||||
/**
|
||||
* 查询羊只死淘记录
|
||||
*
|
||||
* @param id 羊只死淘记录主键
|
||||
* @return 羊只死淘记录
|
||||
*/
|
||||
@Override
|
||||
public ScSheepDeath selectScSheepDeathById(Long id)
|
||||
{
|
||||
ScSheepDeath scSheepDeath = scSheepDeathMapper.selectScSheepDeathById(id);
|
||||
// 查询时也需要填充显示字段
|
||||
if (scSheepDeath != null && scSheepDeath.getManageTags() != null) {
|
||||
Map<String, Object> sheepInfo = selectSheepFileByManageTags(scSheepDeath.getManageTags());
|
||||
if (sheepInfo != null) {
|
||||
scSheepDeath.setVariety(sheepInfo.get("variety") != null ? sheepInfo.get("variety").toString() : null);
|
||||
scSheepDeath.setSheepType(sheepInfo.get("sheepType") != null ? sheepInfo.get("sheepType").toString() : null);
|
||||
scSheepDeath.setGender(sheepInfo.get("gender") != null ? Integer.valueOf(sheepInfo.get("gender").toString()) : null);
|
||||
scSheepDeath.setDayAge(sheepInfo.get("dayAge") != null ? Long.valueOf(sheepInfo.get("dayAge").toString()) : null);
|
||||
scSheepDeath.setParity(sheepInfo.get("parity") != null ? Integer.valueOf(sheepInfo.get("parity").toString()) : null);
|
||||
scSheepDeath.setSheepfoldName(sheepInfo.get("sheepfoldName") != null ? sheepInfo.get("sheepfoldName").toString() : null);
|
||||
scSheepDeath.setBreedStatus(sheepInfo.get("breedStatus") != null ? sheepInfo.get("breedStatus").toString() : null);
|
||||
scSheepDeath.setPostLambingDay(sheepInfo.get("postLambingDay") != null ? Integer.valueOf(sheepInfo.get("postLambingDay").toString()) : null);
|
||||
scSheepDeath.setLactationDay(sheepInfo.get("lactationDay") != null ? Integer.valueOf(sheepInfo.get("lactationDay").toString()) : null);
|
||||
scSheepDeath.setGestationDay(sheepInfo.get("gestationDay") != null ? Integer.valueOf(sheepInfo.get("gestationDay").toString()) : null);
|
||||
}
|
||||
}
|
||||
return scSheepDeath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询羊只死淘记录列表
|
||||
*
|
||||
* @param scSheepDeath 羊只死淘记录
|
||||
* @return 羊只死淘记录
|
||||
*/
|
||||
@Override
|
||||
public List<ScSheepDeath> selectScSheepDeathList(ScSheepDeath scSheepDeath)
|
||||
{
|
||||
List<ScSheepDeath> list = scSheepDeathMapper.selectScSheepDeathList(scSheepDeath);
|
||||
// 为列表中的每条记录填充显示字段
|
||||
for (ScSheepDeath death : list) {
|
||||
if (death.getManageTags() != null) {
|
||||
Map<String, Object> sheepInfo = selectSheepFileByManageTags(death.getManageTags());
|
||||
if (sheepInfo != null) {
|
||||
death.setVariety(sheepInfo.get("variety") != null ? sheepInfo.get("variety").toString() : null);
|
||||
death.setSheepType(sheepInfo.get("sheepType") != null ? sheepInfo.get("sheepType").toString() : null);
|
||||
death.setGender(sheepInfo.get("gender") != null ? Integer.valueOf(sheepInfo.get("gender").toString()) : null);
|
||||
death.setDayAge(sheepInfo.get("dayAge") != null ? Long.valueOf(sheepInfo.get("dayAge").toString()) : null);
|
||||
death.setParity(sheepInfo.get("parity") != null ? Integer.valueOf(sheepInfo.get("parity").toString()) : null);
|
||||
death.setSheepfoldName(sheepInfo.get("sheepfoldName") != null ? sheepInfo.get("sheepfoldName").toString() : null);
|
||||
death.setBreedStatus(sheepInfo.get("breedStatus") != null ? sheepInfo.get("breedStatus").toString() : null);
|
||||
death.setPostLambingDay(sheepInfo.get("postLambingDay") != null ? Integer.valueOf(sheepInfo.get("postLambingDay").toString()) : null);
|
||||
death.setLactationDay(sheepInfo.get("lactationDay") != null ? Integer.valueOf(sheepInfo.get("lactationDay").toString()) : null);
|
||||
death.setGestationDay(sheepInfo.get("gestationDay") != null ? Integer.valueOf(sheepInfo.get("gestationDay").toString()) : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据管理耳号查询sheep_file视图信息
|
||||
*
|
||||
* @param manageTags 管理耳号
|
||||
* @return 羊只信息
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> selectSheepFileByManageTags(String manageTags)
|
||||
{
|
||||
return scSheepDeathMapper.selectSheepFileByManageTags(manageTags);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增羊只死淘记录
|
||||
*
|
||||
* @param scSheepDeath 羊只死淘记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertScSheepDeath(ScSheepDeath scSheepDeath)
|
||||
{
|
||||
// 设置事件类型默认为"死亡"
|
||||
if (scSheepDeath.getEventType() == null || scSheepDeath.getEventType().isEmpty()) {
|
||||
scSheepDeath.setEventType("死亡");
|
||||
}
|
||||
|
||||
// 如果有管理耳号,查询并设置羊只ID
|
||||
if (scSheepDeath.getManageTags() != null && !scSheepDeath.getManageTags().isEmpty()) {
|
||||
Map<String, Object> sheepInfo = selectSheepFileByManageTags(scSheepDeath.getManageTags());
|
||||
if (sheepInfo != null) {
|
||||
scSheepDeath.setSheepId(sheepInfo.get("sheepId") != null ? Long.valueOf(sheepInfo.get("sheepId").toString()) : null);
|
||||
}
|
||||
}
|
||||
|
||||
scSheepDeath.setCreateTime(DateUtils.getNowDate());
|
||||
return scSheepDeathMapper.insertScSheepDeath(scSheepDeath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改羊只死淘记录
|
||||
*
|
||||
* @param scSheepDeath 羊只死淘记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateScSheepDeath(ScSheepDeath scSheepDeath)
|
||||
{
|
||||
// 如果管理耳号发生变化,重新查询并设置羊只ID
|
||||
if (scSheepDeath.getManageTags() != null && !scSheepDeath.getManageTags().isEmpty()) {
|
||||
Map<String, Object> sheepInfo = selectSheepFileByManageTags(scSheepDeath.getManageTags());
|
||||
if (sheepInfo != null) {
|
||||
scSheepDeath.setSheepId(sheepInfo.get("sheepId") != null ? Long.valueOf(sheepInfo.get("sheepId").toString()) : null);
|
||||
}
|
||||
}
|
||||
|
||||
scSheepDeath.setUpdateTime(DateUtils.getNowDate());
|
||||
return scSheepDeathMapper.updateScSheepDeath(scSheepDeath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除羊只死淘记录
|
||||
*
|
||||
* @param ids 需要删除的羊只死淘记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScSheepDeathByIds(Long[] ids)
|
||||
{
|
||||
return scSheepDeathMapper.deleteScSheepDeathByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除羊只死淘记录信息
|
||||
*
|
||||
* @param id 羊只死淘记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScSheepDeathById(Long id)
|
||||
{
|
||||
return scSheepDeathMapper.deleteScSheepDeathById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
<?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.produce.breed.mapper.ScSheepDeathMapper">
|
||||
|
||||
<resultMap type="ScSheepDeath" id="ScSheepDeathResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="manageTags" column="manage_tags" />
|
||||
<result property="eventType" column="event_type" />
|
||||
<result property="deathDate" column="death_date" />
|
||||
<result property="diseaseTypeId" column="disease_type_id" />
|
||||
<result property="diseaseSubtypeId" column="disease_subtype_id" />
|
||||
<result property="disposalDirection" column="disposal_direction" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="handler" column="handler" />
|
||||
<result property="workGroup" column="work_group" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScSheepDeathVo">
|
||||
select id, sheep_id, manage_tags, event_type, death_date, disease_type_id, disease_subtype_id, disposal_direction, technician, handler, work_group, create_by, create_time, comment, update_by, update_time, is_delete from sc_sheep_death
|
||||
</sql>
|
||||
|
||||
<select id="selectScSheepDeathList" parameterType="ScSheepDeath" resultMap="ScSheepDeathResult">
|
||||
<include refid="selectScSheepDeathVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''"> and manage_tags = #{manageTags}</if>
|
||||
<if test="eventType != null and eventType != ''"> and event_type = #{eventType}</if>
|
||||
<if test="deathDate != null "> and death_date = #{deathDate}</if>
|
||||
<if test="diseaseTypeId != null "> and disease_type_id = #{diseaseTypeId}</if>
|
||||
<if test="diseaseSubtypeId != null "> and disease_subtype_id = #{diseaseSubtypeId}</if>
|
||||
<if test="disposalDirection != null and disposalDirection != ''"> and disposal_direction = #{disposalDirection}</if>
|
||||
<if test="technician != null and technician != ''"> and technician = #{technician}</if>
|
||||
<if test="handler != null and handler != ''"> and handler = #{handler}</if>
|
||||
<if test="workGroup != null and workGroup != ''"> and work_group = #{workGroup}</if>
|
||||
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScSheepDeathById" parameterType="Long" resultMap="ScSheepDeathResult">
|
||||
<include refid="selectScSheepDeathVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据管理耳号查询sheep_file视图信息 -->
|
||||
<select id="selectSheepFileByManageTags" parameterType="String" resultType="java.util.Map">
|
||||
select id as sheepId, variety, name as sheepType, gender, day_age as dayAge, parity, sheepfold_name as sheepfoldName, breed as breedStatus, post_lambing_day as postLambingDay, lactation_day as lactationDay, gestation_day as gestationDay
|
||||
from sheep_file
|
||||
where bs_manage_tags = #{manageTags} and is_delete = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertScSheepDeath" parameterType="ScSheepDeath" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_sheep_death
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="manageTags != null and manageTags != ''">manage_tags,</if>
|
||||
<if test="eventType != null">event_type,</if>
|
||||
<if test="deathDate != null">death_date,</if>
|
||||
<if test="diseaseTypeId != null">disease_type_id,</if>
|
||||
<if test="diseaseSubtypeId != null">disease_subtype_id,</if>
|
||||
<if test="disposalDirection != null">disposal_direction,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="handler != null">handler,</if>
|
||||
<if test="workGroup != null">work_group,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="manageTags != null and manageTags != ''">#{manageTags},</if>
|
||||
<if test="eventType != null">#{eventType},</if>
|
||||
<if test="deathDate != null">#{deathDate},</if>
|
||||
<if test="diseaseTypeId != null">#{diseaseTypeId},</if>
|
||||
<if test="diseaseSubtypeId != null">#{diseaseSubtypeId},</if>
|
||||
<if test="disposalDirection != null">#{disposalDirection},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="handler != null">#{handler},</if>
|
||||
<if test="workGroup != null">#{workGroup},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScSheepDeath" parameterType="ScSheepDeath">
|
||||
update sc_sheep_death
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="manageTags != null and manageTags != ''">manage_tags = #{manageTags},</if>
|
||||
<if test="eventType != null">event_type = #{eventType},</if>
|
||||
<if test="deathDate != null">death_date = #{deathDate},</if>
|
||||
<if test="diseaseTypeId != null">disease_type_id = #{diseaseTypeId},</if>
|
||||
<if test="diseaseSubtypeId != null">disease_subtype_id = #{diseaseSubtypeId},</if>
|
||||
<if test="disposalDirection != null">disposal_direction = #{disposalDirection},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="handler != null">handler = #{handler},</if>
|
||||
<if test="workGroup != null">work_group = #{workGroup},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScSheepDeathById" parameterType="Long">
|
||||
delete from sc_sheep_death where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScSheepDeathByIds" parameterType="String">
|
||||
delete from sc_sheep_death where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user