冻胚冻精完善

This commit is contained in:
zyh 2025-12-04 16:36:16 +08:00
parent 5ae4af6c44
commit f957987079
14 changed files with 434 additions and 239 deletions

View File

@ -1,17 +1,14 @@
package com.zhyc.module.frozen.controller; package com.zhyc.module.frozen.controller;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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.annotation.Log;
import com.zhyc.common.core.controller.BaseController; import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.core.domain.AjaxResult;
@ -77,6 +74,7 @@ public class DdFeController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody DdFe ddFe) public AjaxResult add(@RequestBody DdFe ddFe)
{ {
ddFe.setCreateBy(SecurityUtils.getUsername());
return toAjax(ddFeService.insertDdFe(ddFe)); return toAjax(ddFeService.insertDdFe(ddFe));
} }
@ -101,4 +99,58 @@ public class DdFeController extends BaseController
{ {
return toAjax(ddFeService.deleteDdFeByIds(ids)); return toAjax(ddFeService.deleteDdFeByIds(ids));
} }
/**
* 根据供体母羊耳号获取最近一次冲胚信息
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:add')")
@GetMapping("/getFlushInfoByEwe/{eweNo}")
public AjaxResult getFlushInfoByEwe(@PathVariable("eweNo") String eweNo) {
if (StringUtils.isBlank(eweNo)) {
return error("耳号不能为空");
}
Map<String, Object> echo = ddFeService.getLastFlushInfoByEwe(eweNo.trim());
return echo == null ? error("该母羊无冲胚记录,请先录入冲胚记录") : success(echo);
}
/**
* 根据母羊耳号 + 胚胎等级 返回该等级数量
* 无记录返回 0
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:add')")
@GetMapping("/getQtyByGrade")
public AjaxResult getQtyByGrade(@RequestParam String eweNo,
@RequestParam String grade) {
Map<String, Object> flush = ddFeService.getLastFlushInfoByEwe(eweNo);
if (flush == null) return success(0);
Integer qty;
switch (grade) {
case "A": qty = (Integer) flush.getOrDefault("gradeA", 0); break;
case "B": qty = (Integer) flush.getOrDefault("gradeB", 0); break;
case "C": qty = (Integer) flush.getOrDefault("gradeC", 0); break;
case "D": qty = (Integer) flush.getOrDefault("gradeD", 0); break;
case "囊胚": qty = (Integer) flush.getOrDefault("cell24", 0); break;
case "桑椹胚": qty = (Integer) flush.getOrDefault("cell8", 0); break;
default: qty = 0;
}
return success(qty);
}
/**
* 批量废弃
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:discard')")
@Log(title = "冻胚库存", businessType = BusinessType.UPDATE)
@PutMapping("/batchDiscard")
public AjaxResult batchDiscard(@RequestBody List<DdFe> list) {
if (list == null || list.isEmpty()) {
return error("请选择要废弃的记录");
}
list.forEach(dto -> {
dto.setStatus("废弃");
ddFeService.discard(dto);
});
return success();
}
} }

View File

@ -101,4 +101,14 @@ public class DdFsController extends BaseController
{ {
return toAjax(ddFsService.deleteDdFsByIds(ids)); return toAjax(ddFsService.deleteDdFsByIds(ids));
} }
/**
* 批量废弃
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:discard')")
@Log(title = "冻精库存", businessType = BusinessType.UPDATE)
@PutMapping("/discard")
public AjaxResult discard(@RequestBody List<DdFs> list) {
return AjaxResult.success(ddFsService.discard(list));
}
} }

View File

@ -21,11 +21,11 @@ public class DdFe extends BaseEntity
private Long id; private Long id;
/** 胚胎编号 YS+日期+序号 */ /** 胚胎编号 YS+日期+序号 */
@Excel(name = "胚胎编号 YS+日期+序号") @Excel(name = "胚胎编号")
private String code; private String code;
/** 冻胚日期(事件录入日) */ /** 冻胚日期(事件录入日) */
@Excel(name = "冻胚日期", readConverterExp = "事=件录入日") @Excel(name = "冻胚日期", dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date freezeDate; private Date freezeDate;
@ -46,11 +46,11 @@ public class DdFe extends BaseEntity
private String deBreed; private String deBreed;
/** 胚胎品种(自动生成) */ /** 胚胎品种(自动生成) */
@Excel(name = "胚胎品种", readConverterExp = "自=动生成") @Excel(name = "胚胎品种")
private String embBreed; private String embBreed;
/** 胚胎阶段等级('A', 'B', 'C', 'D', '囊胚', '桑椹胚') */ /** 胚胎阶段等级('A', 'B', 'C', 'D', '囊胚', '桑椹胚') */
@Excel(name = "胚胎阶段等级('A', 'B', 'C', 'D', '囊胚', '桑椹胚')") @Excel(name = "胚胎阶段等级")
private String grade; private String grade;
/** 胚胎数量 */ /** 胚胎数量 */
@ -58,11 +58,11 @@ public class DdFe extends BaseEntity
private Long qty; private Long qty;
/** 是否性控 1是 0否 */ /** 是否性控 1是 0否 */
@Excel(name = "是否性控 1是 0") @Excel(name = "是否性控",readConverterExp = "1=是,0=")
private Integer sexCtl; private Integer sexCtl;
/** 状态(0正常1销售 2自用3废弃) */ /** 状态(0正常1销售 2自用3废弃) */
@Excel(name = "状态(0正常1销售 2自用3废弃)") @Excel(name = "状态")
private String status; private String status;
/** 技术员 */ /** 技术员 */
@ -82,12 +82,12 @@ public class DdFe extends BaseEntity
private Long rackId; private Long rackId;
/** 出库日期(出库后回写) */ /** 出库日期(出库后回写) */
@Excel(name = "出库日期", readConverterExp = "出=库后回写") @Excel(name = "出库日期", dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date outDate; private Date outDate;
/** 废弃原因(废弃时填写) */ /** 废弃原因(废弃时填写) */
@Excel(name = "废弃原因", readConverterExp = "废=弃时填写") @Excel(name = "废弃原因")
private String discardTxt; private String discardTxt;
public void setId(Long id) public void setId(Long id)

View File

@ -1,6 +1,7 @@
package com.zhyc.module.frozen.domain; package com.zhyc.module.frozen.domain;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -13,222 +14,223 @@ import com.zhyc.common.core.domain.BaseEntity;
* @author ruoyi * @author ruoyi
* @date 2025-11-29 * @date 2025-11-29
*/ */
public class DdFs extends BaseEntity public class DdFs extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 主键 */ /**
* 主键
*/
private Long id; private Long id;
/** 冻精号/公羊耳号 */ /**
@Excel(name = "冻精号/公羊耳号") * 冻精号/公羊耳号
*/
@Excel(name = "冻精号")
private String code; private String code;
/** 冻精日期(事件录入日) */ /**
@Excel(name = "冻精日期", readConverterExp = "事=件录入日") * 冻精日期事件录入日
*/
@Excel(name = "冻精日期", dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date freezeDt; private Date freezeDt;
/** 冻精品种(同公羊品种) */ /**
@Excel(name = "冻精品种", readConverterExp = "同=公羊品种") * 冻精品种同公羊品种
*/
@Excel(name = "冻精品种")
private String breed; private String breed;
/** 生产批次(日期格式) */ /**
@Excel(name = "生产批次", readConverterExp = "日=期格式") * 生产批次日期格式
*/
@Excel(name = "生产批次")
private String batch; private String batch;
/** 规格(0.25mL,0.5mL) */ /**
@Excel(name = "规格(0.25mL,0.5mL)") * 规格(0.25mL,0.5mL)
*/
@Excel(name = "规格")
private String spec; private String spec;
/** 数量(支) */ /**
@Excel(name = "数量", readConverterExp = "支=") * 数量
*/
@Excel(name = "数量")
private Long qty; private Long qty;
/** 是否性控 1是 0否 */ /**
@Excel(name = "是否性控 1是 0否") * 是否性控 1是 0否
*/
@Excel(name = "是否性控", readConverterExp = "1=是,0=否")
private Integer sexCtl; private Integer sexCtl;
/** 状态0正常1销售2自用3废弃 */ /**
@Excel(name = "状态", readConverterExp = "0=正常1销售2自用3废弃") * 状态0正常1销售2自用3废弃
*/
@Excel(name = "状态")
private String stat; private String stat;
/** 技术员 */ /**
* 技术员
*/
@Excel(name = "技术员") @Excel(name = "技术员")
private String tech; private String tech;
/** 液氮罐ID */ /**
* 液氮罐ID
*/
@Excel(name = "液氮罐ID") @Excel(name = "液氮罐ID")
private Long tankId; private Long tankId;
/** 提桶ID */ /**
* 提桶ID
*/
@Excel(name = "提桶ID") @Excel(name = "提桶ID")
private Long bucketId; private Long bucketId;
/** 冷冻架ID */ /**
* 冷冻架ID
*/
@Excel(name = "冷冻架ID") @Excel(name = "冷冻架ID")
private Long rackId; private Long rackId;
/** 出库日期(出库后回写) */ /**
@Excel(name = "出库日期", readConverterExp = "出=库后回写") * 出库日期出库后回写
*/
@Excel(name = "出库日期", dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date outDt; private Date outDt;
/** 废弃原因 */ /**
* 废弃原因
*/
@Excel(name = "废弃原因") @Excel(name = "废弃原因")
private String discardTxt; private String discardTxt;
public void setId(Long id) public void setId(Long id) {
{
this.id = id; this.id = id;
} }
public Long getId() public Long getId() {
{
return id; return id;
} }
public void setCode(String code) public void setCode(String code) {
{
this.code = code; this.code = code;
} }
public String getCode() public String getCode() {
{
return code; return code;
} }
public void setFreezeDt(Date freezeDt) public void setFreezeDt(Date freezeDt) {
{
this.freezeDt = freezeDt; this.freezeDt = freezeDt;
} }
public Date getFreezeDt() public Date getFreezeDt() {
{
return freezeDt; return freezeDt;
} }
public void setBreed(String breed) public void setBreed(String breed) {
{
this.breed = breed; this.breed = breed;
} }
public String getBreed() public String getBreed() {
{
return breed; return breed;
} }
public void setBatch(String batch) public void setBatch(String batch) {
{
this.batch = batch; this.batch = batch;
} }
public String getBatch() public String getBatch() {
{
return batch; return batch;
} }
public void setSpec(String spec) public void setSpec(String spec) {
{
this.spec = spec; this.spec = spec;
} }
public String getSpec() public String getSpec() {
{
return spec; return spec;
} }
public void setQty(Long qty) public void setQty(Long qty) {
{
this.qty = qty; this.qty = qty;
} }
public Long getQty() public Long getQty() {
{
return qty; return qty;
} }
public void setSexCtl(Integer sexCtl) public void setSexCtl(Integer sexCtl) {
{
this.sexCtl = sexCtl; this.sexCtl = sexCtl;
} }
public Integer getSexCtl() public Integer getSexCtl() {
{
return sexCtl; return sexCtl;
} }
public void setStat(String stat) public void setStat(String stat) {
{
this.stat = stat; this.stat = stat;
} }
public String getStat() public String getStat() {
{
return stat; return stat;
} }
public void setTech(String tech) public void setTech(String tech) {
{
this.tech = tech; this.tech = tech;
} }
public String getTech() public String getTech() {
{
return tech; return tech;
} }
public void setTankId(Long tankId) public void setTankId(Long tankId) {
{
this.tankId = tankId; this.tankId = tankId;
} }
public Long getTankId() public Long getTankId() {
{
return tankId; return tankId;
} }
public void setBucketId(Long bucketId) public void setBucketId(Long bucketId) {
{
this.bucketId = bucketId; this.bucketId = bucketId;
} }
public Long getBucketId() public Long getBucketId() {
{
return bucketId; return bucketId;
} }
public void setRackId(Long rackId) public void setRackId(Long rackId) {
{
this.rackId = rackId; this.rackId = rackId;
} }
public Long getRackId() public Long getRackId() {
{
return rackId; return rackId;
} }
public void setOutDt(Date outDt) public void setOutDt(Date outDt) {
{
this.outDt = outDt; this.outDt = outDt;
} }
public Date getOutDt() public Date getOutDt() {
{
return outDt; return outDt;
} }
public void setDiscardTxt(String discardTxt) public void setDiscardTxt(String discardTxt) {
{
this.discardTxt = discardTxt; this.discardTxt = discardTxt;
} }
public String getDiscardTxt() public String getDiscardTxt() {
{
return discardTxt; return discardTxt;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("code", getCode()) .append("code", getCode())
.append("freezeDt", getFreezeDt()) .append("freezeDt", getFreezeDt())

View File

@ -1,7 +1,11 @@
package com.zhyc.module.frozen.mapper; package com.zhyc.module.frozen.mapper;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zhyc.module.frozen.domain.DdFe; import com.zhyc.module.frozen.domain.DdFe;
import com.zhyc.module.produce.breed.domain.ScEmbryoFlush;
import org.apache.ibatis.annotations.Param;
/** /**
* 冻胚库存Mapper接口 * 冻胚库存Mapper接口
@ -58,4 +62,14 @@ public interface DdFeMapper
* @return 结果 * @return 结果
*/ */
public int deleteDdFeByIds(Long[] ids); public int deleteDdFeByIds(Long[] ids);
/**
* 按母羊耳号取最新一条冲胚记录只读
*/
Map<String,Object> selectFlushByEwe(@Param("eweNo") String eweNo);
/**
* 废弃更新只改状态出库日期废弃原因更新人
*/
int updateDiscard(DdFe dto);
} }

View File

@ -1,6 +1,8 @@
package com.zhyc.module.frozen.service; package com.zhyc.module.frozen.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zhyc.module.frozen.domain.DdFe; import com.zhyc.module.frozen.domain.DdFe;
/** /**
@ -9,8 +11,7 @@ import com.zhyc.module.frozen.domain.DdFe;
* @author ruoyi * @author ruoyi
* @date 2025-11-29 * @date 2025-11-29
*/ */
public interface IDdFeService public interface IDdFeService {
{
/** /**
* 查询冻胚库存 * 查询冻胚库存
* *
@ -58,4 +59,12 @@ public interface IDdFeService
* @return 结果 * @return 结果
*/ */
public int deleteDdFeById(Long id); public int deleteDdFeById(Long id);
/**
* 根据母羊耳号取最近一次冲胚信息
*/
Map<String, Object> getLastFlushInfoByEwe(String eweNo);
// 废弃
int discard(DdFe dto);
} }

View File

@ -1,6 +1,7 @@
package com.zhyc.module.frozen.service; package com.zhyc.module.frozen.service;
import java.util.List; import java.util.List;
import com.zhyc.module.frozen.domain.DdFs; import com.zhyc.module.frozen.domain.DdFs;
/** /**
@ -9,8 +10,7 @@ import com.zhyc.module.frozen.domain.DdFs;
* @author ruoyi * @author ruoyi
* @date 2025-11-29 * @date 2025-11-29
*/ */
public interface IDdFsService public interface IDdFsService {
{
/** /**
* 查询冻精库存 * 查询冻精库存
* *
@ -58,4 +58,7 @@ public interface IDdFsService
* @return 结果 * @return 结果
*/ */
public int deleteDdFsById(Long id); public int deleteDdFsById(Long id);
//废弃
int discard(List<DdFs> list);
} }

View File

@ -1,13 +1,22 @@
package com.zhyc.module.frozen.service.impl; package com.zhyc.module.frozen.service.impl;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.produce.breed.domain.ScEmbryoFlush;
import com.zhyc.module.produce.breed.mapper.ScEmbryoFlushMapper;
import com.zhyc.module.produce.breed.service.IScEmbryoFlushService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zhyc.module.frozen.mapper.DdFeMapper; import com.zhyc.module.frozen.mapper.DdFeMapper;
import com.zhyc.module.frozen.domain.DdFe; import com.zhyc.module.frozen.domain.DdFe;
import com.zhyc.module.frozen.service.IDdFeService; import com.zhyc.module.frozen.service.IDdFeService;
import javax.annotation.Resource;
/** /**
* 冻胚库存Service业务层处理 * 冻胚库存Service业务层处理
* *
@ -19,7 +28,10 @@ public class DdFeServiceImpl implements IDdFeService
{ {
@Autowired @Autowired
private DdFeMapper ddFeMapper; private DdFeMapper ddFeMapper;
@Autowired
private ScEmbryoFlushMapper scEmbryoFlushMapper;
@Autowired
private IScEmbryoFlushService scEmbryoFlushService;
/** /**
* 查询冻胚库存 * 查询冻胚库存
* *
@ -92,4 +104,44 @@ public class DdFeServiceImpl implements IDdFeService
{ {
return ddFeMapper.deleteDdFeById(id); return ddFeMapper.deleteDdFeById(id);
} }
@Override
public Map<String, Object> getLastFlushInfoByEwe(String eweNo) {
// 1. 冲胚数据冻胚自己的 SQL
Map<String, Object> flush = ddFeMapper.selectFlushByEwe(eweNo);
if (flush == null) return null;
String ramId = (String) flush.get("ramId");
if (StringUtils.isBlank(ramId)) return null;
// 2. 公羊品种
Map<String, Object> ram = scEmbryoFlushMapper.selectSheepInfoByManageTag(ramId);
String ramBreed = (String) ram.get("variety");
// 3. 母羊品种
Map<String, Object> ewe = scEmbryoFlushMapper.selectSheepInfoByManageTag(eweNo);
String eweBreed = (String) ewe.get("variety");
// 4. 胚胎品种
String embryoBreed = scEmbryoFlushService.calculateEmbryoVariety(ramBreed, eweBreed);
// 5. 封装 4 字段
Map<String, Object> rsp = new HashMap<>(8);
rsp.put("drId", ramId);
rsp.put("drBreed", ramBreed);
rsp.put("deBreed", eweBreed);
rsp.put("embBreed", embryoBreed);
// 如果以后需要等级数量也从这个 flush map 里取
rsp.put("gradeA", flush.get("gradeA"));
rsp.put("gradeB", flush.get("gradeB"));
rsp.put("gradeC", flush.get("gradeC"));
rsp.put("gradeD", flush.get("gradeD"));
return rsp;
}
// 废弃
@Override
public int discard(DdFe dto) {
return ddFeMapper.updateDiscard(dto);
}
} }

View File

@ -1,12 +1,20 @@
package com.zhyc.module.frozen.service.impl; package com.zhyc.module.frozen.service.impl;
import java.util.List; import java.util.List;
import com.zhyc.common.exception.ServiceException;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.BasSheepVariety;
import com.zhyc.module.base.mapper.BasSheepMapper;
import com.zhyc.module.base.mapper.BasSheepVarietyMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zhyc.module.frozen.mapper.DdFsMapper; import com.zhyc.module.frozen.mapper.DdFsMapper;
import com.zhyc.module.frozen.domain.DdFs; import com.zhyc.module.frozen.domain.DdFs;
import com.zhyc.module.frozen.service.IDdFsService; import com.zhyc.module.frozen.service.IDdFsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* 冻精库存Service业务层处理 * 冻精库存Service业务层处理
@ -15,10 +23,13 @@ import com.zhyc.module.frozen.service.IDdFsService;
* @date 2025-11-29 * @date 2025-11-29
*/ */
@Service @Service
public class DdFsServiceImpl implements IDdFsService public class DdFsServiceImpl implements IDdFsService {
{
@Autowired @Autowired
private DdFsMapper ddFsMapper; private DdFsMapper ddFsMapper;
@Autowired
private BasSheepMapper basSheepMapper;
@Autowired
private BasSheepVarietyMapper basSheepVarietyMapper;
/** /**
* 查询冻精库存 * 查询冻精库存
@ -27,8 +38,7 @@ public class DdFsServiceImpl implements IDdFsService
* @return 冻精库存 * @return 冻精库存
*/ */
@Override @Override
public DdFs selectDdFsById(Long id) public DdFs selectDdFsById(Long id) {
{
return ddFsMapper.selectDdFsById(id); return ddFsMapper.selectDdFsById(id);
} }
@ -39,8 +49,7 @@ public class DdFsServiceImpl implements IDdFsService
* @return 冻精库存 * @return 冻精库存
*/ */
@Override @Override
public List<DdFs> selectDdFsList(DdFs ddFs) public List<DdFs> selectDdFsList(DdFs ddFs) {
{
return ddFsMapper.selectDdFsList(ddFs); return ddFsMapper.selectDdFsList(ddFs);
} }
@ -51,8 +60,22 @@ public class DdFsServiceImpl implements IDdFsService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertDdFs(DdFs ddFs) public int insertDdFs(DdFs ddFs) {
{ BasSheep ram = basSheepMapper.selectBasSheepByManageTags(ddFs.getCode());
if (ram == null) {
throw new ServiceException("公羊不存在");
}
if (ram.getStatusId() == null || !ram.getStatusId().equals(1L)) {
throw new ServiceException("羊只不在群");
}
if (ram.getGender() == null || !ram.getGender().equals(2L)) {
throw new ServiceException("该耳号对应不是公羊");
}
if (ddFs.getBreed() == null || ddFs.getBreed().trim().isEmpty()) {
BasSheepVariety variety = basSheepVarietyMapper.selectBasSheepVarietyById(ram.getVarietyId());
ddFs.setBreed(variety == null ? "" : variety.getVariety());
}
ddFs.setCreateTime(DateUtils.getNowDate()); ddFs.setCreateTime(DateUtils.getNowDate());
return ddFsMapper.insertDdFs(ddFs); return ddFsMapper.insertDdFs(ddFs);
} }
@ -64,8 +87,7 @@ public class DdFsServiceImpl implements IDdFsService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateDdFs(DdFs ddFs) public int updateDdFs(DdFs ddFs) {
{
return ddFsMapper.updateDdFs(ddFs); return ddFsMapper.updateDdFs(ddFs);
} }
@ -76,8 +98,7 @@ public class DdFsServiceImpl implements IDdFsService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteDdFsByIds(Long[] ids) public int deleteDdFsByIds(Long[] ids) {
{
return ddFsMapper.deleteDdFsByIds(ids); return ddFsMapper.deleteDdFsByIds(ids);
} }
@ -88,8 +109,21 @@ public class DdFsServiceImpl implements IDdFsService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteDdFsById(Long id) public int deleteDdFsById(Long id) {
{
return ddFsMapper.deleteDdFsById(id); return ddFsMapper.deleteDdFsById(id);
} }
// 废弃
@Override
public int discard(List<DdFs> list) {
return list.stream()
.mapToInt(item -> {
DdFs update = new DdFs();
update.setId(item.getId());
update.setStat("废弃");
update.setDiscardTxt(item.getDiscardTxt());
return ddFsMapper.updateDdFs(update);
})
.sum();
}
} }

View File

@ -1,46 +1,72 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.frozen.mapper.DdFeMapper"> <mapper namespace="com.zhyc.module.frozen.mapper.DdFeMapper">
<resultMap type="com.zhyc.module.frozen.domain.DdFe" id="DdFeResult"> <resultMap type="com.zhyc.module.frozen.domain.DdFe" id="DdFeResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="code" column="code" /> <result property="code" column="code"/>
<result property="freezeDate" column="freeze_date" /> <result property="freezeDate" column="freeze_date"/>
<result property="drId" column="dr_id" /> <result property="drId" column="dr_id"/>
<result property="drBreed" column="dr_breed" /> <result property="drBreed" column="dr_breed"/>
<result property="deId" column="de_id" /> <result property="deId" column="de_id"/>
<result property="deBreed" column="de_breed" /> <result property="deBreed" column="de_breed"/>
<result property="embBreed" column="emb_breed" /> <result property="embBreed" column="emb_breed"/>
<result property="grade" column="grade" /> <result property="grade" column="grade"/>
<result property="qty" column="qty" /> <result property="qty" column="qty"/>
<result property="sexCtl" column="sex_ctl" /> <result property="sexCtl" column="sex_ctl"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="tech" column="tech" /> <result property="tech" column="tech"/>
<result property="tankId" column="tank_id" /> <result property="tankId" column="tank_id"/>
<result property="bucketId" column="bucket_id" /> <result property="bucketId" column="bucket_id"/>
<result property="rackId" column="rack_id" /> <result property="rackId" column="rack_id"/>
<result property="outDate" column="out_date" /> <result property="outDate" column="out_date"/>
<result property="discardTxt" column="discard_txt" /> <result property="discardTxt" column="discard_txt"/>
<result property="remark" column="remark" /> <result property="remark" column="remark"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
</resultMap> </resultMap>
<sql id="selectDdFeVo"> <sql id="selectDdFeVo">
select id, code, freeze_date, dr_id, dr_breed, de_id, de_breed, emb_breed, grade, qty, sex_ctl, status, tech, tank_id, bucket_id, rack_id, out_date, discard_txt, remark, create_by, create_time from dd_fe select id,
code,
freeze_date,
dr_id,
dr_breed,
de_id,
de_breed,
emb_breed,
grade,
qty,
sex_ctl,
status,
tech,
tank_id,
bucket_id,
rack_id,
out_date,
discard_txt,
remark,
create_by,
create_time
from dd_fe
</sql> </sql>
<select id="selectDdFeList" parameterType="DdFe" resultMap="DdFeResult"> <select id="selectDdFeList" parameterType="DdFe" resultMap="DdFeResult">
<include refid="selectDdFeVo"/> <include refid="selectDdFeVo"/>
<where> <where>
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if> <if test="code != null and code != ''">and code like concat('%', #{code}, '%')</if>
<if test="freezeDate != null "> and freeze_date = #{freezeDate}</if> <if test="grade != null and grade != ''">and grade = #{grade}</if>
<if test="grade != null and grade != ''"> and grade = #{grade}</if> <if test="status != null and status != ''">and status = #{status}</if>
<if test="status != null and status != ''"> and status = #{status}</if> <if test="tech != null and tech != ''">and tech = #{tech}</if>
<if test="tech != null and tech != ''"> and tech = #{tech}</if>
<if test="outDate != null "> and out_date = #{outDate}</if> <if test="outDate != null "> and out_date = #{outDate}</if>
<if test="params.beginFreezeDate != null and params.endFreezeDate != null">
and freeze_date between #{params.beginFreezeDate} and #{params.endFreezeDate}
</if>
<if test="params.beginOutDate != null and params.endOutDate != null">
and out_date between #{params.beginOutDate} and #{params.endOutDate}
</if>
</where> </where>
</select> </select>
@ -125,7 +151,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteDdFeById" parameterType="Long"> <delete id="deleteDdFeById" parameterType="Long">
delete from dd_fe where id = #{id} delete
from dd_fe
where id = #{id}
</delete> </delete>
<delete id="deleteDdFeByIds" parameterType="String"> <delete id="deleteDdFeByIds" parameterType="String">
@ -134,4 +162,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="selectFlushByEwe" resultType="map">
SELECT grade_a gradeA,
grade_b gradeB,
grade_c gradeC,
grade_d gradeD,
cell_2_4 cell24,
cell_8 cell8,
donor_male_no ramId
FROM sc_embryo_flush
WHERE donor_female_no = #{eweNo}
ORDER BY flush_time DESC
LIMIT 1
</select>
<update id="updateDiscard" parameterType="DdFe">
UPDATE dd_fe
SET status = #{status},
discard_txt = #{discardTxt}
WHERE id = #{id}
</update>
</mapper> </mapper>

View File

@ -33,9 +33,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDdFsVo"/> <include refid="selectDdFsVo"/>
<where> <where>
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if> <if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
<if test="freezeDt != null "> and freeze_dt = #{freezeDt}</if>
<if test="tech != null and tech != ''"> and tech like concat('%', #{tech}, '%')</if> <if test="tech != null and tech != ''"> and tech like concat('%', #{tech}, '%')</if>
<if test="outDt != null "> and out_dt = #{outDt}</if> <if test="params.beginFreezeDt != null and params.endFreezeDt != null">
and freeze_dt between #{params.beginFreezeDt} and #{params.endFreezeDt}
</if>
<if test="params.beginOutDt != null and params.endOutDt != null">
and out_dt between #{params.beginOutDt} and #{params.endOutDt}
</if>
</where> </where>
</select> </select>

View File

@ -102,30 +102,7 @@
and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime} and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
</where> </where>
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''"> <if test="true">ORDER BY sm.create_time DESC</if>
ORDER BY
<choose>
<when test="orderBy == 'weaningWeight'">bs.weaning_weight</when>
<when test="orderBy == 'bodyLength'">sm.body_length</when>
<when test="orderBy == 'birthWeight'">bs.birth_weight</when>
<when test="orderBy == 'currentWeight'">bs.current_weight</when>
<when test="orderBy == 'lactationDay'">bs.lactation_day</when>
<when test="orderBy == 'gestationDay'">bs.gestation_day</when>
<when test="orderBy == 'postMatingDay'">post_mating_day</when>
<when test="orderBy == 'parity'">bs.parity</when>
<when test="orderBy == 'height'">sm.height</when>
<when test="orderBy == 'bust'">sm.bust</when>
<when test="orderBy == 'pipeLength'">sm.pipe_length</when>
<when test="orderBy == 'chestDepth'">sm.chest_depth</when>
<when test="orderBy == 'hipHeight'">sm.hip_height</when>
<when test="orderBy == 'rumpWidth'">sm.rump_width</when>
<when test="orderBy == 'rumpHeignt'">sm.rump_heignt</when>
<when test="orderBy == 'hipWidth'">sm.hip_width</when>
<when test="orderBy == 'hipCrossHeight'">sm.hip_cross_height</when>
<otherwise>${orderBy}</otherwise>
</choose>
${sortDirection}
</if>
</select> </select>
<select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult"> <select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult">

View File

@ -58,12 +58,7 @@
and bs.manage_tags like concat('%', #{manageTags}, '%') and bs.manage_tags like concat('%', #{manageTags}, '%')
</if> </if>
</where> </where>
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''"> <if test="true">ORDER BY sbs.create_time DESC</if>
ORDER BY sbs.${orderBy} ${sortDirection}
</if>
<if test="(orderBy == null or orderBy == '') or (sortDirection == null or sortDirection == '')">
ORDER BY sbs.create_time DESC
</if>
</select> </select>
<select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult"> <select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult">

View File

@ -56,13 +56,7 @@
and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime} and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
</where> </where>
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''"> <if test="true">ORDER BY sbr.create_time DESC</if>
ORDER BY sbr.${orderBy} ${sortDirection}
</if>
<if test="(orderBy == null or orderBy == '') or (sortDirection == null or sortDirection == '')">
ORDER BY sbr.create_time DESC
</if>
</select> </select>
<select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult"> <select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult">