Compare commits

..

2 Commits

Author SHA1 Message Date
zyh
b9e37fb14a Merge remote-tracking branch 'origin/main' 2025-07-15 18:45:04 +08:00
zyh
e6826f64f9 新增羊只,转群功能完善 2025-07-15 18:40:22 +08:00
25 changed files with 1134 additions and 524 deletions

View File

@ -6,15 +6,15 @@ import java.util.List;
/**
* 羊只档案Mapper接口
*
*
* @author wyt
* @date 2025-07-13
*/
public interface SheepFileMapper
public interface SheepFileMapper
{
/**
* 查询羊只档案
*
*
* @param id 羊只档案主键
* @return 羊只档案
*/
@ -22,7 +22,7 @@ public interface SheepFileMapper
/**
* 查询羊只档案列表
*
*
* @param sheepFile 羊只档案
* @return 羊只档案集合
*/
@ -30,7 +30,7 @@ public interface SheepFileMapper
/**
* 新增羊只档案
*
*
* @param sheepFile 羊只档案
* @return 结果
*/
@ -38,7 +38,7 @@ public interface SheepFileMapper
/**
* 修改羊只档案
*
*
* @param sheepFile 羊只档案
* @return 结果
*/
@ -46,7 +46,7 @@ public interface SheepFileMapper
/**
* 删除羊只档案
*
*
* @param id 羊只档案主键
* @return 结果
*/
@ -54,9 +54,10 @@ public interface SheepFileMapper
/**
* 批量删除羊只档案
*
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSheepFileByIds(Long[] ids);
}

View File

@ -3,9 +3,12 @@ package com.zhyc.module.produce.manage_sheep.add_sheep.controller;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.exception.ServiceException;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep;
import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService;
import com.zhyc.module.sheepfold_management.domain.DaSheepfold;
import com.zhyc.module.sheepfold_management.service.IDaSheepfoldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
@ -27,14 +30,16 @@ import static com.zhyc.common.utils.SecurityUtils.getUsername;
public class ScAddSheepController {
@Autowired
private IScAddSheepService scAddSheepService;
@Autowired
private IDaSheepfoldService daSheepfoldMapper;
//新增羊只验证
@PreAuthorize("@ss.hasPermi('produce:add_sheep:add')")
@Log(title = "新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult addSheep(@RequestBody ScAddSheep scAddSheep) {
if (scAddSheep.getSheepId() == null || scAddSheep.getSheepId().isEmpty()) {
return AjaxResult.error("羊只id不能为空");
if (scAddSheep.getEarNumber() == null || scAddSheep.getEarNumber().isEmpty()) {
return AjaxResult.error("耳号不能为空");
}
if (scAddSheep.getSheepfold() == null || scAddSheep.getSheepfold() == 0) {
return AjaxResult.error("羊舍不能为空");
@ -52,20 +57,33 @@ public class ScAddSheepController {
return AjaxResult.error("品种不能为空");
}
boolean success = scAddSheepService.insertScAddSheep(scAddSheep);
if (success) {
return success("新增成功");
} else {
return AjaxResult.error("新增失败");
try {
boolean success = scAddSheepService.insertScAddSheep(scAddSheep);
if (success) {
return success("新增成功");
} else {
return AjaxResult.error("新增失败");
}
} catch (ServiceException e) {
return AjaxResult.error(e.getMessage());
}
}
//导出表单
@PostMapping("/exportForm")
@Log(title = "羊只信息", businessType = BusinessType.EXPORT)
public void exportForm(HttpServletResponse response, @RequestBody ScAddSheep scAddSheep) throws IOException {
ExcelUtil<ScAddSheep> util = new ExcelUtil<>(ScAddSheep.class);
List<ScAddSheep> list = new ArrayList<>();
// 设置羊舍名称从数据库查
if (scAddSheep.getSheepfold() != null) {
DaSheepfold fold = daSheepfoldMapper.selectDaSheepfoldById(scAddSheep.getSheepfold().longValue());
if (fold != null) {
scAddSheep.setSheepfoldNameExcel(fold.getSheepfoldName());
}
}
list.add(scAddSheep);
util.exportExcel(response, list, "羊只信息");
}

View File

@ -2,10 +2,16 @@ package com.zhyc.module.produce.manage_sheep.add_sheep.domain;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ScAddSheep extends BaseEntity {
/**
* 羊只
@ -15,15 +21,21 @@ public class ScAddSheep extends BaseEntity {
*/
private static final long serialVersionUID = 1L;
@Excel(name = "主键")
private Long id; // 如果数据库主键叫 id就加这一行
/** 羊只ID */
@Excel(name = "羊只ID")
private String sheepId;
private Integer id; // 如果数据库主键叫 id就加这一行
/** 羊只耳号 */
@Excel(name = "耳号")
private String earNumber;
/** 羊舍编号 */
@Excel(name = "羊舍")
private Integer sheepfold;
// @Excel(name = "羊舍名称")
private String sheepfoldName;
// 导出时生成羊舍名称 Excel 不映射到数据库
@Excel(name = "羊舍名称")
private String sheepfoldNameExcel;
/** 父号 */
@Excel(name = "父号")
private String father;
@ -68,125 +80,6 @@ public class ScAddSheep extends BaseEntity {
private String createBy;
private Date createTime;
// Getters and Setters
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getSheepId() {
return sheepId;
}
public void setSheepId(String sheepId) {
this.sheepId = sheepId;
}
public Integer getSheepfold() {
return sheepfold;
}
public void setSheepfold(Integer sheepfold) {
this.sheepfold = sheepfold;
}
public String getFather() {
return father;
}
public void setFather(String father) {
this.father = father;
}
public String getMother() {
return mother;
}
public void setMother(String mother) {
this.mother = mother;
}
public BigDecimal getBornWeight() {
return bornWeight;
}
public void setBornWeight(BigDecimal bornWeight) {
this.bornWeight = bornWeight;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public Integer getGender() {
return gender;
}
public void setGender(Integer gender) {
this.gender = gender;
}
public Integer getParity() {
return parity;
}
public void setParity(Integer parity) {
this.parity = parity;
}
public Integer getVarietyId() {
return varietyId;
}
public void setVarietyId(Integer varietyId) {
this.varietyId = varietyId;
}
public Date getJoinDate() {
return joinDate;
}
public void setJoinDate(Date joinDate) {
this.joinDate = joinDate;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getTechnician() {
return technician;
}
public void setTechnician(String technician) {
this.technician = technician;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -10,6 +10,8 @@ public interface ScAddSheepMapper {
int insert(ScAddSheep scAddSheep);
List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep);
int updateScAddSheep(ScAddSheep scAddSheep);
int deleteScAddSheepByIds(Long[] ids);
int deleteScAddSheepByIds(Integer[] ids);
ScAddSheep selectByEarNumber(String earNumber);
}

View File

@ -7,11 +7,14 @@ import java.util.List;
public interface IScAddSheepService {
boolean insertScAddSheep(ScAddSheep scAddSheep);
List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep);
boolean updateScAddSheep(ScAddSheep scAddSheep);
boolean deleteScAddSheepByIds(Long[] ids);
boolean deleteScAddSheepByIds(Integer[] ids);
String importSheep(List<ScAddSheep> list, boolean updateSupport, String operName);
}

View File

@ -5,22 +5,63 @@ import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep;
import com.zhyc.module.produce.manage_sheep.add_sheep.mapper.ScAddSheepMapper;
import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService;
import com.zhyc.module.produce.sheep.domain.BasSheep;
import com.zhyc.module.produce.sheep.mapper.BasSheepMapper;
import com.zhyc.module.produce.sheep.service.IBasSheepService;
import com.zhyc.module.produce.sheep.service.impl.BasSheepServiceImpl;
import com.zhyc.module.sheepfold_management.domain.DaSheepfold;
import com.zhyc.module.sheepfold_management.mapper.DaSheepfoldMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class ScAddSheepServiceImpl implements IScAddSheepService {
@Autowired
private ScAddSheepMapper scAddSheepMapper;
@Autowired
private DaSheepfoldMapper daSheepfoldMapper;
@Autowired
private IBasSheepService basSheepService;
@Override
public boolean insertScAddSheep(ScAddSheep scAddSheep) {
return scAddSheepMapper.insert(scAddSheep) > 0;
// 1. 重复校验
ScAddSheep exist = scAddSheepMapper.selectByEarNumber(scAddSheep.getEarNumber());
if (exist != null) {
throw new ServiceException("添加失败,耳号重复");
}
// 2. 写入 sc_add_sheep
boolean ok = scAddSheepMapper.insert(scAddSheep) > 0;
if (!ok) return false;
// 3. 字段映射 BasSheep
BasSheep bs = new BasSheep();
bs.setManageTags(scAddSheep.getEarNumber()); // 管理耳号
bs.setElectronicTags(scAddSheep.getEarNumber()); // 电子耳号
bs.setSheepfoldId(scAddSheep.getSheepfold().longValue()); // 羊舍
bs.setFatherId(null); // 父号/母号可后续补全
bs.setMotherId(null);
bs.setBirthWeight(scAddSheep.getBornWeight().longValue());
bs.setBirthday(scAddSheep.getBirthday());
bs.setGender(scAddSheep.getGender().longValue());
bs.setParity(scAddSheep.getParity().longValue());
bs.setVarietyId(scAddSheep.getVarietyId().longValue());
bs.setSourceDate(scAddSheep.getJoinDate());
bs.setComment(scAddSheep.getComment());
bs.setCreateBy(scAddSheep.getCreateBy());
bs.setCreateTime(new Date());
// 4. 写入 bas_sheep
basSheepService.insertBasSheep(bs);
return true;
}
@Override
public List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep) {
return scAddSheepMapper.selectScAddSheepList(scAddSheep);
@ -32,22 +73,63 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
}
@Override
public boolean deleteScAddSheepByIds(Long[] ids) {
public boolean deleteScAddSheepByIds(Integer[] ids) {
return scAddSheepMapper.deleteScAddSheepByIds(ids) > 0;
}
/* ------------------ 导入:羊舍名称 → ID ------------------ */
@Override
public String importSheep(List<ScAddSheep> list, boolean updateSupport, String operName) {
if (list == null || list.isEmpty()) {
throw new ServiceException("导入数据不能为空!");
}
int success = 0, failure = 0;
StringBuilder failureMsg = new StringBuilder();
for (ScAddSheep sheep : list) {
for (int i = 0; i < list.size(); i++) {
ScAddSheep sheep = list.get(i);
try {
if (StringUtils.isBlank(sheep.getSheepId())) {
failure++; failureMsg.append("<br/>第").append(success + failure + 1).append("羊只ID不能为空"); continue;
/* 1. 羊舍名称 → ID */
if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) {
DaSheepfold param = new DaSheepfold();
param.setSheepfoldName(sheep.getSheepfoldNameExcel());
List<DaSheepfold> foldList = daSheepfoldMapper.selectDaSheepfoldList(param);
if (foldList == null || foldList.isEmpty()) {
failure++;
failureMsg.append("<br/>第")
.append(i + 1)
.append("行:羊舍名称不存在【")
.append(sheep.getSheepfoldNameExcel())
.append("");
continue;
}
sheep.setSheepfold(foldList.get(0).getId().intValue());
}
/* 2. 耳号非空校验 */
if (StringUtils.isBlank(sheep.getEarNumber())) {
failure++;
failureMsg.append("<br/>第")
.append(i + 1)
.append("行:耳号不能为空");
continue;
}
/* 3. 耳号重复校验(增量导入核心) */
ScAddSheep exist = scAddSheepMapper.selectByEarNumber(sheep.getEarNumber());
if (exist != null) {
failure++;
failureMsg.append("<br/>第")
.append(i + 1)
.append("行:耳号已存在【")
.append(sheep.getEarNumber())
.append("");
continue;
}
/* 4. 插入或更新 */
if (updateSupport && sheep.getId() != null) {
sheep.setUpdateBy(operName);
updateScAddSheep(sheep);
@ -57,11 +139,19 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
}
success++;
} catch (Exception e) {
failure++; failureMsg.append("<br/>第").append(success + failure + 1).append("行:").append(e.getMessage());
failure++;
failureMsg.append("<br/>第")
.append(i + 1)
.append("行:")
.append(e.getMessage());
}
}
if (failure > 0) throw new ServiceException("导入失败!共 " + failure + " 条:" + failureMsg);
if (failure > 0) {
throw new ServiceException("导入失败!共 " + failure + " 条:" + failureMsg);
}
return "导入成功!共 " + success + "";
}
}
}

View File

@ -1,5 +1,6 @@
package com.zhyc.module.produce.manage_sheep.trans_group.controller;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@ -53,10 +54,9 @@ public class ScTransGroupController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:trans_group:export')")
@Log(title = "转群记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScTransGroup scTransGroup)
{
public void export(HttpServletResponse response, ScTransGroup scTransGroup) throws IOException {
List<ScTransGroup> list = scTransGroupService.selectScTransGroupList(scTransGroup);
ExcelUtil<ScTransGroup> util = new ExcelUtil<ScTransGroup>(ScTransGroup.class);
ExcelUtil<ScTransGroup> util = new ExcelUtil<>(ScTransGroup.class);
util.exportExcel(response, list, "转群记录数据");
}

View File

@ -1,9 +1,13 @@
package com.zhyc.module.produce.manage_sheep.trans_group.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
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;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 转群记录对象 sc_trans_group
@ -11,6 +15,9 @@ import com.zhyc.common.core.domain.BaseEntity;
* @author ruoyi
* @date 2025-07-10
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ScTransGroup extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -23,122 +30,40 @@ public class ScTransGroup extends BaseEntity
private Integer sheepId;
/** 转入羊舍 */
@Excel(name = "转入羊舍")
private String foldTo;
/** 转出羊舍 */
@Excel(name = "转出羊舍")
private String foldFrom;
/** 转出羊舍名称 */
@Excel(name = "转出羊舍")
private String foldFromName;
/** 转入羊舍名称 */
@Excel(name = "转入羊舍")
private String foldToName;
/** 转群原因 */
private Integer reason;
/** 转群原因描述 用于导出*/
@Excel(name = "转群原因")
private String reason;
private String reasonText;
/** 技术员 */
@Excel(name = "技术员")
private String technician;
/** 状态 */
@Excel(name = "状态")
private Integer status;
/** 状态描述 用于导出*/
@Excel(name = "状态")
private String statusText;
/** 备注 */
@Excel(name = "备注")
private String comment;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setSheepId(Integer sheepId)
{
this.sheepId = sheepId;
}
public Integer getSheepId()
{
return sheepId;
}
public void setFoldTo(String foldTo)
{
this.foldTo = foldTo;
}
public String getFoldTo()
{
return foldTo;
}
public void setFoldFrom(String foldFrom)
{
this.foldFrom = foldFrom;
}
public String getFoldFrom()
{
return foldFrom;
}
public void setReason(String reason)
{
this.reason = reason;
}
public String getReason()
{
return reason;
}
public void setTechnician(String technician)
{
this.technician = technician;
}
public String getTechnician()
{
return technician;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sheepId", getSheepId())
.append("foldTo", getFoldTo())
.append("foldFrom", getFoldFrom())
.append("reason", getReason())
.append("technician", getTechnician())
.append("status", getStatus())
.append("comment", getComment())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -1,6 +1,9 @@
package com.zhyc.module.produce.manage_sheep.trans_group.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
import com.zhyc.module.produce.manage_sheep.trans_group.mapper.ScTransGroupMapper;
@ -10,49 +13,57 @@ import org.springframework.stereotype.Service;
/**
* 转群记录Service业务层处理
*
*
* @author ruoyi
* @date 2025-07-10
*/
@Service
public class ScTransGroupServiceImpl implements IScTransGroupService
{
public class ScTransGroupServiceImpl implements IScTransGroupService {
@Autowired
private ScTransGroupMapper scTransGroupMapper;
/**
* 查询转群记录
*
*
* @param id 转群记录主键
* @return 转群记录
*/
@Override
public ScTransGroup selectScTransGroupById(Integer id)
{
return scTransGroupMapper.selectScTransGroupById(id);
public ScTransGroup selectScTransGroupById(Integer id) {
ScTransGroup group = scTransGroupMapper.selectScTransGroupById(id);
group.setReasonText(convertReason(group.getReason()));
group.setStatusText(convertStatus(group.getStatus()));
return group;
}
/**
* 查询转群记录列表
*
*
* @param scTransGroup 转群记录
* @return 转群记录
*/
@Override
public List<ScTransGroup> selectScTransGroupList(ScTransGroup scTransGroup)
{
return scTransGroupMapper.selectScTransGroupList(scTransGroup);
public List<ScTransGroup> selectScTransGroupList(ScTransGroup scTransGroup) {
List<ScTransGroup> list = scTransGroupMapper.selectScTransGroupList(scTransGroup);
list.forEach(group -> {
group.setReasonText(convertReason(group.getReason()));
group.setStatusText(convertStatus(group.getStatus()));
});
return list;
// return scTransGroupMapper.selectScTransGroupList(scTransGroup);
}
/**
* 新增转群记录
*
*
* @param scTransGroup 转群记录
* @return 结果
*/
@Override
public int insertScTransGroup(ScTransGroup scTransGroup)
{
public int insertScTransGroup(ScTransGroup scTransGroup) {
scTransGroup.setStatus(0);
scTransGroup.setCreateTime(DateUtils.getNowDate());
return scTransGroupMapper.insertScTransGroup(scTransGroup);
@ -60,37 +71,57 @@ public class ScTransGroupServiceImpl implements IScTransGroupService
/**
* 修改转群记录
*
*
* @param scTransGroup 转群记录
* @return 结果
*/
@Override
public int updateScTransGroup(ScTransGroup scTransGroup)
{
public int updateScTransGroup(ScTransGroup scTransGroup) {
return scTransGroupMapper.updateScTransGroup(scTransGroup);
}
/**
* 批量删除转群记录
*
*
* @param ids 需要删除的转群记录主键
* @return 结果
*/
@Override
public int deleteScTransGroupByIds(Integer[] ids)
{
public int deleteScTransGroupByIds(Integer[] ids) {
return scTransGroupMapper.deleteScTransGroupByIds(ids);
}
/**
* 删除转群记录信息
*
*
* @param id 转群记录主键
* @return 结果
*/
@Override
public int deleteScTransGroupById(Integer id)
{
public int deleteScTransGroupById(Integer id) {
return scTransGroupMapper.deleteScTransGroupById(id);
}
/**
* 转换转群原因
*/
private String convertReason(Integer reasonCode) {
Map<Integer, String> reasonMap = new HashMap<>();
reasonMap.put(0, "新产羊过抗转群");
reasonMap.put(1, "治愈转群");
reasonMap.put(2, "病羊过抗转群");
return reasonMap.getOrDefault(reasonCode, "未知原因");
}
/**
* 转换状态
*/
private String convertStatus(Integer statusCode) {
Map<Integer, String> statusMap = new HashMap<>();
statusMap.put(0, "待批准");
statusMap.put(1, "通过");
statusMap.put(2, "驳回");
return statusMap.getOrDefault(statusCode, "未知状态");
}
}

View File

@ -1,5 +1,8 @@
package com.zhyc.module.produce.manage_sheep.transition_info.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
@ -11,6 +14,9 @@ import com.zhyc.common.core.domain.BaseEntity;
* @author ruoyi
* @date 2025-07-10
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ScTransitionInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -32,7 +38,7 @@ public class ScTransitionInfo extends BaseEntity
/** 转场类型 */
@Excel(name = "转场类型")
private Long transType;
private Integer transType;
/** 技术员 */
@Excel(name = "技术员")
@ -46,99 +52,5 @@ public class ScTransitionInfo extends BaseEntity
@Excel(name = "备注")
private String comment;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setSheepId(Integer sheepId)
{
this.sheepId = sheepId;
}
public Integer getSheepId()
{
return sheepId;
}
public void setTransTo(String transTo)
{
this.transTo = transTo;
}
public String getTransTo()
{
return transTo;
}
public void setTransFrom(String transFrom)
{
this.transFrom = transFrom;
}
public String getTransFrom()
{
return transFrom;
}
public void setTransType(Long transType)
{
this.transType = transType;
}
public Long getTransType()
{
return transType;
}
public void setTechnician(String technician)
{
this.technician = technician;
}
public String getTechnician()
{
return technician;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sheepId", getSheepId())
.append("transTo", getTransTo())
.append("transFrom", getTransFrom())
.append("transType", getTransType())
.append("technician", getTechnician())
.append("status", getStatus())
.append("comment", getComment())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -66,7 +66,7 @@ public class ScFixHoofController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('produce:fixHoof:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
public AjaxResult getInfo(@PathVariable("id") Integer id)
{
return success(scFixHoofService.selectScFixHoofById(id));
}
@ -99,7 +99,7 @@ public class ScFixHoofController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:fixHoof:remove')")
@Log(title = "修蹄", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
public AjaxResult remove(@PathVariable Integer[] ids)
{
return toAjax(scFixHoofService.deleteScFixHoofByIds(ids));
}

View File

@ -1,5 +1,8 @@
package com.zhyc.module.produce.other.fixHoof.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
@ -11,20 +14,26 @@ import com.zhyc.common.core.domain.BaseEntity;
* @author ruoyi
* @date 2025-07-10
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ScFixHoof extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
private Integer id;
/** 羊只id */
@Excel(name = "羊只id")
private Long sheepId;
private Integer sheepId;
/** 羊舍id */
@Excel(name = "羊舍id")
private Long sheepfold;
private Integer sheepfold;
/** 羊舍名称 */
@Excel(name = "羊舍名称")
private String sheepfoldName;
/** 备注 */
@Excel(name = "备注")
@ -34,66 +43,4 @@ public class ScFixHoof extends BaseEntity
@Excel(name = "技术员")
private String technician;
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 setSheepfold(Long sheepfold)
{
this.sheepfold = sheepfold;
}
public Long getSheepfold()
{
return sheepfold;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
public void setTechnician(String technician)
{
this.technician = technician;
}
public String getTechnician()
{
return technician;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sheepId", getSheepId())
.append("sheepfold", getSheepfold())
.append("comment", getComment())
.append("technician", getTechnician())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -17,7 +17,7 @@ public interface ScFixHoofMapper
* @param id 修蹄主键
* @return 修蹄
*/
public ScFixHoof selectScFixHoofById(Long id);
public ScFixHoof selectScFixHoofById(Integer id);
/**
* 查询修蹄列表
@ -49,7 +49,7 @@ public interface ScFixHoofMapper
* @param id 修蹄主键
* @return 结果
*/
public int deleteScFixHoofById(Long id);
public int deleteScFixHoofById(Integer id);
/**
* 批量删除修蹄
@ -57,5 +57,5 @@ public interface ScFixHoofMapper
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteScFixHoofByIds(Long[] ids);
public int deleteScFixHoofByIds(Integer[] ids);
}

View File

@ -17,7 +17,7 @@ public interface IScFixHoofService
* @param id 修蹄主键
* @return 修蹄
*/
public ScFixHoof selectScFixHoofById(Long id);
public ScFixHoof selectScFixHoofById(Integer id);
/**
* 查询修蹄列表
@ -49,7 +49,7 @@ public interface IScFixHoofService
* @param ids 需要删除的修蹄主键集合
* @return 结果
*/
public int deleteScFixHoofByIds(Long[] ids);
public int deleteScFixHoofByIds(Integer[] ids);
/**
* 删除修蹄信息
@ -57,5 +57,5 @@ public interface IScFixHoofService
* @param id 修蹄主键
* @return 结果
*/
public int deleteScFixHoofById(Long id);
public int deleteScFixHoofById(Integer id);
}

View File

@ -27,7 +27,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 修蹄
*/
@Override
public ScFixHoof selectScFixHoofById(Long id)
public ScFixHoof selectScFixHoofById(Integer id)
{
return scFixHoofMapper.selectScFixHoofById(id);
}
@ -76,7 +76,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 结果
*/
@Override
public int deleteScFixHoofByIds(Long[] ids)
public int deleteScFixHoofByIds(Integer[] ids)
{
return scFixHoofMapper.deleteScFixHoofByIds(ids);
}
@ -88,7 +88,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 结果
*/
@Override
public int deleteScFixHoofById(Long id)
public int deleteScFixHoofById(Integer id)
{
return scFixHoofMapper.deleteScFixHoofById(id);
}

View File

@ -0,0 +1,105 @@
package com.zhyc.module.produce.sheep.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.produce.sheep.domain.BasSheep;
import com.zhyc.module.produce.sheep.service.IBasSheepService;
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.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 羊只基本信息Controller
*
* @author ruoyi
* @date 2025-07-15
*/
@RestController
@RequestMapping("/sheep/sheep")
public class BasSheepController extends BaseController
{
@Autowired
private IBasSheepService basSheepService;
/**
* 查询羊只基本信息列表
*/
@PreAuthorize("@ss.hasPermi('sheep:sheep:list')")
@GetMapping("/list")
public TableDataInfo list(BasSheep basSheep)
{
startPage();
List<BasSheep> list = basSheepService.selectBasSheepList(basSheep);
return getDataTable(list);
}
/**
* 导出羊只基本信息列表
*/
@PreAuthorize("@ss.hasPermi('sheep:sheep:export')")
@Log(title = "羊只基本信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BasSheep basSheep)
{
List<BasSheep> list = basSheepService.selectBasSheepList(basSheep);
ExcelUtil<BasSheep> util = new ExcelUtil<BasSheep>(BasSheep.class);
util.exportExcel(response, list, "羊只基本信息数据");
}
/**
* 获取羊只基本信息详细信息
*/
@PreAuthorize("@ss.hasPermi('sheep:sheep:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(basSheepService.selectBasSheepById(id));
}
/**
* 新增羊只基本信息
*/
@PreAuthorize("@ss.hasPermi('sheep:sheep:add')")
@Log(title = "羊只基本信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BasSheep basSheep)
{
return toAjax(basSheepService.insertBasSheep(basSheep));
}
/**
* 修改羊只基本信息
*/
@PreAuthorize("@ss.hasPermi('sheep:sheep:edit')")
@Log(title = "羊只基本信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BasSheep basSheep)
{
return toAjax(basSheepService.updateBasSheep(basSheep));
}
/**
* 删除羊只基本信息
*/
@PreAuthorize("@ss.hasPermi('sheep:sheep:remove')")
@Log(title = "羊只基本信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(basSheepService.deleteBasSheepByIds(ids));
}
}

View File

@ -0,0 +1,178 @@
package com.zhyc.module.produce.sheep.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
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;
/**
* 羊只基本信息对象 bas_sheep
*
* @author ruoyi
* @date 2025-07-15
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BasSheep extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 管理耳号 */
@Excel(name = "管理耳号")
private String manageTags;
/** 牧场id */
@Excel(name = "牧场id")
private Long ranchId;
/** 羊舍id */
@Excel(name = "羊舍id")
private Long sheepfoldId;
/** 电子耳号 */
@Excel(name = "电子耳号")
private String electronicTags;
/** 品种id */
@Excel(name = "品种id")
private Long varietyId;
/** 家系 */
@Excel(name = "家系")
private String family;
/** 羊只类别 */
@Excel(name = "羊只类别")
private Long typeId;
/** 性别 */
@Excel(name = "性别")
private Long gender;
/** 出生日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出生日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date birthday;
/** 出生体重 */
@Excel(name = "出生体重")
private Long birthWeight;
/** 胎次 */
@Excel(name = "胎次")
private Long parity;
/** 羊只状态 */
@Excel(name = "羊只状态")
private Long statusId;
/** 断奶日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "断奶日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date weaningDate;
/** 断奶体重 */
@Excel(name = "断奶体重")
private Long weaningWeight;
/** 繁育状态id */
@Excel(name = "繁育状态id")
private Long breedStatusId;
/** 父号id */
@Excel(name = "父号id")
private Long fatherId;
/** 母号id */
@Excel(name = "母号id")
private Long motherId;
/** 受体id */
@Excel(name = "受体id")
private Long receptorId;
/** 配种日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "配种日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date matingDate;
/** 配种类型 */
@Excel(name = "配种类型")
private Long matingTypeId;
/** 孕检日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "孕检日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date pregDate;
/** 产羔日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "产羔日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date lambingDate;
/** 产羔时怀孕天数 */
@Excel(name = "产羔时怀孕天数")
private Long lambingDay;
/** 预产日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "预产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date expectedDate;
/** 是否性控 */
@Excel(name = "是否性控")
private Long controlled;
/** 配种次数 */
@Excel(name = "配种次数")
private Long matingCounts;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long matingTotal;
/** 累计流产次数 */
@Excel(name = "累计流产次数")
private Long miscarriageCounts;
/** 体况评分 */
@Excel(name = "体况评分")
private Long body;
/** 乳房评分 */
@Excel(name = "乳房评分")
private Long breast;
/** 入群来源 */
@Excel(name = "入群来源")
private String source;
/** 入群日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "入群日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date sourceDate;
/** 来源牧场id */
@Excel(name = "来源牧场id")
private Long sourceRanchId;
/** 备注 */
@Excel(name = "备注")
private String comment;
/** 是否删除 */
@Excel(name = "是否删除")
private Long isDelete;
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.produce.sheep.mapper;
import java.util.List;
import com.zhyc.module.produce.sheep.domain.BasSheep;
/**
* 羊只基本信息Mapper接口
*
* @author ruoyi
* @date 2025-07-15
*/
public interface BasSheepMapper
{
/**
* 查询羊只基本信息
*
* @param id 羊只基本信息主键
* @return 羊只基本信息
*/
public BasSheep selectBasSheepById(Long id);
/**
* 查询羊只基本信息列表
*
* @param basSheep 羊只基本信息
* @return 羊只基本信息集合
*/
public List<BasSheep> selectBasSheepList(BasSheep basSheep);
/**
* 新增羊只基本信息
*
* @param basSheep 羊只基本信息
* @return 结果
*/
public int insertBasSheep(BasSheep basSheep);
/**
* 修改羊只基本信息
*
* @param basSheep 羊只基本信息
* @return 结果
*/
public int updateBasSheep(BasSheep basSheep);
/**
* 删除羊只基本信息
*
* @param id 羊只基本信息主键
* @return 结果
*/
public int deleteBasSheepById(Long id);
/**
* 批量删除羊只基本信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBasSheepByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.produce.sheep.service;
import java.util.List;
import com.zhyc.module.produce.sheep.domain.BasSheep;
/**
* 羊只基本信息Service接口
*
* @author ruoyi
* @date 2025-07-15
*/
public interface IBasSheepService
{
/**
* 查询羊只基本信息
*
* @param id 羊只基本信息主键
* @return 羊只基本信息
*/
public BasSheep selectBasSheepById(Long id);
/**
* 查询羊只基本信息列表
*
* @param basSheep 羊只基本信息
* @return 羊只基本信息集合
*/
public List<BasSheep> selectBasSheepList(BasSheep basSheep);
/**
* 新增羊只基本信息
*
* @param basSheep 羊只基本信息
* @return 结果
*/
public int insertBasSheep(BasSheep basSheep);
/**
* 修改羊只基本信息
*
* @param basSheep 羊只基本信息
* @return 结果
*/
public int updateBasSheep(BasSheep basSheep);
/**
* 批量删除羊只基本信息
*
* @param ids 需要删除的羊只基本信息主键集合
* @return 结果
*/
public int deleteBasSheepByIds(Long[] ids);
/**
* 删除羊只基本信息信息
*
* @param id 羊只基本信息主键
* @return 结果
*/
public int deleteBasSheepById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.zhyc.module.produce.sheep.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.produce.sheep.mapper.BasSheepMapper;
import com.zhyc.module.produce.sheep.domain.BasSheep;
import com.zhyc.module.produce.sheep.service.IBasSheepService;
/**
* 羊只基本信息Service业务层处理
*
* @author ruoyi
* @date 2025-07-15
*/
@Service
public class BasSheepServiceImpl implements IBasSheepService
{
@Autowired
private BasSheepMapper basSheepMapper;
/**
* 查询羊只基本信息
*
* @param id 羊只基本信息主键
* @return 羊只基本信息
*/
@Override
public BasSheep selectBasSheepById(Long id)
{
return basSheepMapper.selectBasSheepById(id);
}
/**
* 查询羊只基本信息列表
*
* @param basSheep 羊只基本信息
* @return 羊只基本信息
*/
@Override
public List<BasSheep> selectBasSheepList(BasSheep basSheep)
{
return basSheepMapper.selectBasSheepList(basSheep);
}
/**
* 新增羊只基本信息
*
* @param basSheep 羊只基本信息
* @return 结果
*/
@Override
public int insertBasSheep(BasSheep basSheep)
{
basSheep.setCreateTime(DateUtils.getNowDate());
return basSheepMapper.insertBasSheep(basSheep);
}
/**
* 修改羊只基本信息
*
* @param basSheep 羊只基本信息
* @return 结果
*/
@Override
public int updateBasSheep(BasSheep basSheep)
{
basSheep.setUpdateTime(DateUtils.getNowDate());
return basSheepMapper.updateBasSheep(basSheep);
}
/**
* 批量删除羊只基本信息
*
* @param ids 需要删除的羊只基本信息主键
* @return 结果
*/
@Override
public int deleteBasSheepByIds(Long[] ids)
{
return basSheepMapper.deleteBasSheepByIds(ids);
}
/**
* 删除羊只基本信息信息
*
* @param id 羊只基本信息主键
* @return 结果
*/
@Override
public int deleteBasSheepById(Long id)
{
return basSheepMapper.deleteBasSheepById(id);
}
}

View File

@ -311,4 +311,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
</mapper>

View File

@ -5,45 +5,52 @@
<mapper namespace="com.zhyc.module.produce.manage_sheep.add_sheep.mapper.ScAddSheepMapper">
<resultMap type="com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep" id="ScAddSheepResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="sheepfold" column="sheepfold" />
<result property="father" column="father" />
<result property="mother" column="mother" />
<result property="bornWeight" column="born_weight" />
<result property="birthday" column="birthday" />
<result property="gender" column="gender" />
<result property="parity" column="parity" />
<result property="varietyId" column="variety_id" />
<result property="joinDate" column="join_date" />
<result property="comment" column="comment" />
<result property="technician" column="technician" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="id" column="id"/>
<result property="earNumber" column="ear_number"/>
<result property="sheepfold" column="sheepfold"/>
<result property="sheepfoldName" column="sheepfoldName"/>
<result property="sheepfoldNameExcel" column="sheepfoldName"/>
<result property="father" column="father"/>
<result property="mother" column="mother"/>
<result property="bornWeight" column="born_weight"/>
<result property="birthday" column="birthday"/>
<result property="gender" column="gender"/>
<result property="parity" column="parity"/>
<result property="varietyId" column="variety_id"/>
<result property="joinDate" column="join_date"/>
<result property="comment" column="comment"/>
<result property="technician" column="technician"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<insert id="insert" parameterType="ScAddSheep" useGeneratedKeys="true" keyProperty="id">
INSERT INTO sc_add_sheep
(sheep_id, sheepfold, father, mother, born_weight, birthday, gender, parity,
(ear_number, sheepfold, father, mother, born_weight, birthday, gender, parity,
variety_id, join_date, comment, technician, create_by, create_time)
VALUES
(#{sheepId}, #{sheepfold}, #{father}, #{mother}, #{bornWeight}, #{birthday},
#{gender}, #{parity}, #{varietyId}, #{joinDate}, #{comment}, #{technician},
#{createBy}, #{createTime})
VALUES (#{earNumber}, #{sheepfold}, #{father}, #{mother}, #{bornWeight}, #{birthday},
#{gender}, #{parity}, #{varietyId}, #{joinDate}, #{comment}, #{technician},
#{createBy}, #{createTime})
</insert>
<select id="selectScAddSheepList" parameterType="ScAddSheep" resultMap="ScAddSheepResult">
SELECT * FROM sc_add_sheep
SELECT
sas.*,
sf.sheepfold_name AS sheepfoldName
FROM sc_add_sheep sas
LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id
<where>
<if test="sheepId != null and sheepId != ''">AND sheep_id LIKE CONCAT('%', #{sheepId}, '%')</if>
<!-- 其他字段同理,按需扩展 -->
<if test="earNumber != null and earNumber != ''">
AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%')
</if>
</where>
</select>
<update id="updateScAddSheep" parameterType="ScAddSheep">
UPDATE sc_add_sheep
<set>
sheep_id = #{sheepId},
ear_number = #{earNumber},
sheepfold = #{sheepfold},
father = #{father},
mother = #{mother},
@ -68,4 +75,7 @@
</foreach>
</delete>
<select id="selectByEarNumber" parameterType="string" resultMap="ScAddSheepResult">
SELECT * FROM sc_add_sheep WHERE ear_number = #{earNumber}
</select>
</mapper>

View File

@ -1,40 +1,57 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.manage_sheep.trans_group.mapper.ScTransGroupMapper">
<resultMap type="ScTransGroup" id="ScTransGroupResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="foldTo" column="fold_to" />
<result property="foldFrom" column="fold_from" />
<result property="reason" column="reason" />
<result property="technician" column="technician" />
<result property="status" column="status" />
<result property="comment" column="comment" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="foldTo" column="fold_to"/>
<result property="foldFrom" column="fold_from"/>
<result property="reason" column="reason"/>
<result property="technician" column="technician"/>
<result property="status" column="status"/>
<result property="comment" column="comment"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectScTransGroupVo">
select id, sheep_id, fold_to, fold_from, reason, technician, status, comment, create_by, create_time from sc_trans_group
SELECT tg.id,
tg.sheep_id,
tg.fold_to,
tg.fold_from,
tg.reason,
tg.technician,
tg.status,
tg.comment,
tg.create_by,
tg.create_time,
sf_from.sheepfold_name AS foldFromName,
sf_to.sheepfold_name AS foldToName
FROM sc_trans_group tg
LEFT JOIN da_sheepfold sf_from ON tg.fold_from = sf_from.id
LEFT JOIN da_sheepfold sf_to ON tg.fold_to = sf_to.id
</sql>
<select id="selectScTransGroupList" parameterType="ScTransGroup" resultMap="ScTransGroupResult">
<include refid="selectScTransGroupVo"/>
<where>
<if test="sheepId != null "> and sheep_id = #{sheepId}</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="status != null "> and status = #{status}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</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="status != null ">and status = #{status}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
<select id="selectScTransGroupById" parameterType="Integer" resultMap="ScTransGroupResult">
<include refid="selectScTransGroupVo"/>
where id = #{id}
where tg.id = #{id}
</select>
<insert id="insertScTransGroup" parameterType="ScTransGroup" useGeneratedKeys="true" keyProperty="id">
@ -49,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="foldTo != null and foldTo != ''">#{foldTo},</if>
@ -60,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</trim>
</insert>
<update id="updateScTransGroup" parameterType="ScTransGroup">
@ -76,15 +93,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
where sc_trans_group.id = #{id}
</update>
<delete id="deleteScTransGroupById" parameterType="Integer">
delete from sc_trans_group where id = #{id}
delete
from sc_trans_group
where tg.id = #{id}
</delete>
<delete id="deleteScTransGroupByIds" parameterType="String">
delete from sc_trans_group where id in
delete from sc_trans_group where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

View File

@ -1,47 +1,59 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.other.fixHoof.mapper.ScFixHoofMapper">
<resultMap type="ScFixHoof" id="ScFixHoofResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="sheepfold" column="sheepfold" />
<result property="comment" column="comment" />
<result property="technician" column="technician" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="sheepfold" column="sheepfold"/>
<result property="sheepfoldName" column="sheepfoldName"/>
<result property="comment" column="comment"/>
<result property="technician" column="technician"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectScFixHoofVo">
select id, sheep_id, sheepfold, comment, technician, create_by, create_time from sc_fix_hoof
select fh.id,
fh.sheep_id,
fh.sheepfold,
sf.sheepfold_name as sheepfoldName,
fh.comment,
fh.technician,
fh.create_by,
fh.create_time
from sc_fix_hoof fh
left join da_sheepfold sf on fh.sheepfold = sf.id
</sql>
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
<include refid="selectScFixHoofVo"/>
<where>
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
<if test="sheepfold != null "> and sheepfold = #{sheepfold}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
<select id="selectScFixHoofById" parameterType="Long" resultMap="ScFixHoofResult">
<select id="selectScFixHoofById" parameterType="java.lang.Integer" resultMap="ScFixHoofResult">
<include refid="selectScFixHoofVo"/>
where id = #{id}
where fh.id = #{id}
</select>
<insert id="insertScFixHoof" parameterType="ScFixHoof" useGeneratedKeys="true" keyProperty="id">
insert into sc_fix_hoof
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="sheepfold != null">sheepfold,</if>
<if test="sheepId != null and sheepId != ''">and fh.sheep_id like concat('%', #{sheepId}, '%')</if>
<if test="sheepfold != null">and fh.sheepfold = #{sheepfold}</if>
<if test="comment != null">comment,</if>
<if test="technician != null and technician != ''">technician,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="sheepfold != null">#{sheepfold},</if>
@ -49,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="technician != null and technician != ''">#{technician},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</trim>
</insert>
<update id="updateScFixHoof" parameterType="ScFixHoof">
@ -65,12 +77,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteScFixHoofById" parameterType="Long">
delete from sc_fix_hoof where id = #{id}
<delete id="deleteScFixHoofById" parameterType="java.lang.Integer">
delete
from sc_fix_hoof
where id = #{id}
</delete>
<delete id="deleteScFixHoofByIds" parameterType="String">
delete from sc_fix_hoof where id in
<delete id="deleteScFixHoofByIds" parameterType="java.lang.Integer">
delete from sc_fix_hoof where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

View File

@ -0,0 +1,242 @@
<?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.sheep.mapper.BasSheepMapper">
<resultMap type="BasSheep" id="BasSheepResult">
<result property="id" column="id" />
<result property="manageTags" column="manage_tags" />
<result property="ranchId" column="ranch_id" />
<result property="sheepfoldId" column="sheepfold_id" />
<result property="electronicTags" column="electronic_tags" />
<result property="varietyId" column="variety_id" />
<result property="family" column="family" />
<result property="typeId" column="type_id" />
<result property="gender" column="gender" />
<result property="birthday" column="birthday" />
<result property="birthWeight" column="birth_weight" />
<result property="parity" column="parity" />
<result property="statusId" column="status_id" />
<result property="weaningDate" column="weaning_date" />
<result property="weaningWeight" column="weaning_weight" />
<result property="breedStatusId" column="breed_status_id" />
<result property="fatherId" column="father_id" />
<result property="motherId" column="mother_id" />
<result property="receptorId" column="receptor_id" />
<result property="matingDate" column="mating_date" />
<result property="matingTypeId" column="mating_type_id" />
<result property="pregDate" column="preg_date" />
<result property="lambingDate" column="lambing_date" />
<result property="lambingDay" column="lambing_day" />
<result property="expectedDate" column="expected_date" />
<result property="controlled" column="controlled" />
<result property="matingCounts" column="mating_counts" />
<result property="matingTotal" column="mating_total" />
<result property="miscarriageCounts" column="miscarriage_counts" />
<result property="body" column="body" />
<result property="breast" column="breast" />
<result property="source" column="source" />
<result property="sourceDate" column="source_date" />
<result property="sourceRanchId" column="source_ranch_id" />
<result property="comment" column="comment" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="isDelete" column="is_delete" />
</resultMap>
<sql id="selectBasSheepVo">
select id, manage_tags, ranch_id, sheepfold_id, electronic_tags, variety_id, family, type_id, gender, birthday, birth_weight, parity, status_id, weaning_date, weaning_weight, breed_status_id, father_id, mother_id, receptor_id, mating_date, mating_type_id, preg_date, lambing_date, lambing_day, expected_date, controlled, mating_counts, mating_total, miscarriage_counts, body, breast, source, source_date, source_ranch_id, comment, update_by, update_time, create_by, create_time, is_delete from bas_sheep
</sql>
<select id="selectBasSheepList" parameterType="BasSheep" resultMap="BasSheepResult">
<include refid="selectBasSheepVo"/>
<where>
<if test="manageTags != null and manageTags != ''"> and manage_tags = #{manageTags}</if>
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
<if test="electronicTags != null and electronicTags != ''"> and electronic_tags = #{electronicTags}</if>
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
<if test="family != null and family != ''"> and family = #{family}</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
<if test="gender != null "> and gender = #{gender}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="birthWeight != null "> and birth_weight = #{birthWeight}</if>
<if test="parity != null "> and parity = #{parity}</if>
<if test="statusId != null "> and status_id = #{statusId}</if>
<if test="weaningDate != null "> and weaning_date = #{weaningDate}</if>
<if test="weaningWeight != null "> and weaning_weight = #{weaningWeight}</if>
<if test="breedStatusId != null "> and breed_status_id = #{breedStatusId}</if>
<if test="fatherId != null "> and father_id = #{fatherId}</if>
<if test="motherId != null "> and mother_id = #{motherId}</if>
<if test="receptorId != null "> and receptor_id = #{receptorId}</if>
<if test="matingDate != null "> and mating_date = #{matingDate}</if>
<if test="matingTypeId != null "> and mating_type_id = #{matingTypeId}</if>
<if test="pregDate != null "> and preg_date = #{pregDate}</if>
<if test="lambingDate != null "> and lambing_date = #{lambingDate}</if>
<if test="lambingDay != null "> and lambing_day = #{lambingDay}</if>
<if test="expectedDate != null "> and expected_date = #{expectedDate}</if>
<if test="controlled != null "> and controlled = #{controlled}</if>
<if test="matingCounts != null "> and mating_counts = #{matingCounts}</if>
<if test="matingTotal != null "> and mating_total = #{matingTotal}</if>
<if test="miscarriageCounts != null "> and miscarriage_counts = #{miscarriageCounts}</if>
<if test="body != null "> and body = #{body}</if>
<if test="breast != null "> and breast = #{breast}</if>
<if test="source != null and source != ''"> and source = #{source}</if>
<if test="sourceDate != null "> and source_date = #{sourceDate}</if>
<if test="sourceRanchId != null "> and source_ranch_id = #{sourceRanchId}</if>
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectBasSheepById" parameterType="Long" resultMap="BasSheepResult">
<include refid="selectBasSheepVo"/>
where id = #{id}
</select>
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
insert into bas_sheep
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="manageTags != null">manage_tags,</if>
<if test="ranchId != null">ranch_id,</if>
<if test="sheepfoldId != null">sheepfold_id,</if>
<if test="electronicTags != null">electronic_tags,</if>
<if test="varietyId != null">variety_id,</if>
<if test="family != null">family,</if>
<if test="typeId != null">type_id,</if>
<if test="gender != null">gender,</if>
<if test="birthday != null">birthday,</if>
<if test="birthWeight != null">birth_weight,</if>
<if test="parity != null">parity,</if>
<if test="statusId != null">status_id,</if>
<if test="weaningDate != null">weaning_date,</if>
<if test="weaningWeight != null">weaning_weight,</if>
<if test="breedStatusId != null">breed_status_id,</if>
<if test="fatherId != null">father_id,</if>
<if test="motherId != null">mother_id,</if>
<if test="receptorId != null">receptor_id,</if>
<if test="matingDate != null">mating_date,</if>
<if test="matingTypeId != null">mating_type_id,</if>
<if test="pregDate != null">preg_date,</if>
<if test="lambingDate != null">lambing_date,</if>
<if test="lambingDay != null">lambing_day,</if>
<if test="expectedDate != null">expected_date,</if>
<if test="controlled != null">controlled,</if>
<if test="matingCounts != null">mating_counts,</if>
<if test="matingTotal != null">mating_total,</if>
<if test="miscarriageCounts != null">miscarriage_counts,</if>
<if test="body != null">body,</if>
<if test="breast != null">breast,</if>
<if test="source != null">source,</if>
<if test="sourceDate != null">source_date,</if>
<if test="sourceRanchId != null">source_ranch_id,</if>
<if test="comment != null">comment,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="manageTags != null">#{manageTags},</if>
<if test="ranchId != null">#{ranchId},</if>
<if test="sheepfoldId != null">#{sheepfoldId},</if>
<if test="electronicTags != null">#{electronicTags},</if>
<if test="varietyId != null">#{varietyId},</if>
<if test="family != null">#{family},</if>
<if test="typeId != null">#{typeId},</if>
<if test="gender != null">#{gender},</if>
<if test="birthday != null">#{birthday},</if>
<if test="birthWeight != null">#{birthWeight},</if>
<if test="parity != null">#{parity},</if>
<if test="statusId != null">#{statusId},</if>
<if test="weaningDate != null">#{weaningDate},</if>
<if test="weaningWeight != null">#{weaningWeight},</if>
<if test="breedStatusId != null">#{breedStatusId},</if>
<if test="fatherId != null">#{fatherId},</if>
<if test="motherId != null">#{motherId},</if>
<if test="receptorId != null">#{receptorId},</if>
<if test="matingDate != null">#{matingDate},</if>
<if test="matingTypeId != null">#{matingTypeId},</if>
<if test="pregDate != null">#{pregDate},</if>
<if test="lambingDate != null">#{lambingDate},</if>
<if test="lambingDay != null">#{lambingDay},</if>
<if test="expectedDate != null">#{expectedDate},</if>
<if test="controlled != null">#{controlled},</if>
<if test="matingCounts != null">#{matingCounts},</if>
<if test="matingTotal != null">#{matingTotal},</if>
<if test="miscarriageCounts != null">#{miscarriageCounts},</if>
<if test="body != null">#{body},</if>
<if test="breast != null">#{breast},</if>
<if test="source != null">#{source},</if>
<if test="sourceDate != null">#{sourceDate},</if>
<if test="sourceRanchId != null">#{sourceRanchId},</if>
<if test="comment != null">#{comment},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
<update id="updateBasSheep" parameterType="BasSheep">
update bas_sheep
<trim prefix="SET" suffixOverrides=",">
<if test="manageTags != null">manage_tags = #{manageTags},</if>
<if test="ranchId != null">ranch_id = #{ranchId},</if>
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
<if test="electronicTags != null">electronic_tags = #{electronicTags},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if>
<if test="family != null">family = #{family},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
<if test="parity != null">parity = #{parity},</if>
<if test="statusId != null">status_id = #{statusId},</if>
<if test="weaningDate != null">weaning_date = #{weaningDate},</if>
<if test="weaningWeight != null">weaning_weight = #{weaningWeight},</if>
<if test="breedStatusId != null">breed_status_id = #{breedStatusId},</if>
<if test="fatherId != null">father_id = #{fatherId},</if>
<if test="motherId != null">mother_id = #{motherId},</if>
<if test="receptorId != null">receptor_id = #{receptorId},</if>
<if test="matingDate != null">mating_date = #{matingDate},</if>
<if test="matingTypeId != null">mating_type_id = #{matingTypeId},</if>
<if test="pregDate != null">preg_date = #{pregDate},</if>
<if test="lambingDate != null">lambing_date = #{lambingDate},</if>
<if test="lambingDay != null">lambing_day = #{lambingDay},</if>
<if test="expectedDate != null">expected_date = #{expectedDate},</if>
<if test="controlled != null">controlled = #{controlled},</if>
<if test="matingCounts != null">mating_counts = #{matingCounts},</if>
<if test="matingTotal != null">mating_total = #{matingTotal},</if>
<if test="miscarriageCounts != null">miscarriage_counts = #{miscarriageCounts},</if>
<if test="body != null">body = #{body},</if>
<if test="breast != null">breast = #{breast},</if>
<if test="source != null">source = #{source},</if>
<if test="sourceDate != null">source_date = #{sourceDate},</if>
<if test="sourceRanchId != null">source_ranch_id = #{sourceRanchId},</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="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBasSheepById" parameterType="Long">
delete from bas_sheep where id = #{id}
</delete>
<delete id="deleteBasSheepByIds" parameterType="String">
delete from bas_sheep where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>