Merge remote-tracking branch 'origin/main'

This commit is contained in:
ll
2026-02-05 21:57:23 +08:00
7 changed files with 2245 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
package com.zhyc.module.base.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.base.util.SheepPedigreeExcelUtils;
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.base.domain.SheepPedigree;
import com.zhyc.module.base.service.ISheepPedigreeService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* VIEWController
*
* @author ruoyi
* @date 2026-02-04
*/
@RestController
@RequestMapping("/system/pedigree")
public class SheepPedigreeController extends BaseController
{
@Autowired
private ISheepPedigreeService sheepPedigreeService;
/**
* 查询VIEW列表
*/
@PreAuthorize("@ss.hasPermi('system:pedigree:list')")
@GetMapping("/list")
public TableDataInfo list(SheepPedigree sheepPedigree)
{
startPage();
List<SheepPedigree> list = sheepPedigreeService.selectSheepPedigreeList(sheepPedigree);
return getDataTable(list);
}
/**
* 导出VIEW列表
*/
// 在Controller/Service中注入工具类
@Autowired
private SheepPedigreeExcelUtils sheepPedigreeExcelUtils;
@PreAuthorize("@ss.hasPermi('system:pedigree:export')")
@Log(title = "VIEW", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SheepPedigree sheepPedigree) throws Exception {
List<SheepPedigree> dataList = sheepPedigreeService.selectSheepPedigreeList(sheepPedigree);
// 调用实例方法(而非静态方法)
sheepPedigreeExcelUtils.export(response, dataList);
}
/**
* 获取VIEW详细信息
*/
@PreAuthorize("@ss.hasPermi('system:pedigree:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sheepPedigreeService.selectSheepPedigreeById(id));
}
/**
* 新增VIEW
*/
@PreAuthorize("@ss.hasPermi('system:pedigree:add')")
@Log(title = "VIEW", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SheepPedigree sheepPedigree)
{
return toAjax(sheepPedigreeService.insertSheepPedigree(sheepPedigree));
}
/**
* 修改VIEW
*/
@PreAuthorize("@ss.hasPermi('system:pedigree:edit')")
@Log(title = "VIEW", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SheepPedigree sheepPedigree)
{
return toAjax(sheepPedigreeService.updateSheepPedigree(sheepPedigree));
}
/**
* 删除VIEW
*/
@PreAuthorize("@ss.hasPermi('system:pedigree:remove')")
@Log(title = "VIEW", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sheepPedigreeService.deleteSheepPedigreeByIds(ids));
}
}

View File

@@ -0,0 +1,996 @@
package com.zhyc.module.base.domain;
import java.math.BigDecimal;
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;
/**
* VIEW对象 sheep_pedigree
*
* @author ruoyi
* @date 2026-02-04
*/
public class SheepPedigree extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 管理耳号 */
@Excel(name = "管理耳号")
private String bsManageTags;
/** 牧场id */
@Excel(name = "牧场id")
private Long ranchId;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String drRanch;
/** 羊舍id */
@Excel(name = "羊舍id")
private Long sheepfoldId;
/** 羊舍名称 */
@Excel(name = "羊舍名称")
private String sheepfoldName;
/** 电子耳号 */
@Excel(name = "电子耳号")
private String electronicTags;
/** 品种id */
@Excel(name = "品种id")
private Long varietyId;
/** 品种 */
@Excel(name = "品种")
private String variety;
/** 家系 */
@Excel(name = "家系")
private String family;
/** 羊只类型 */
@Excel(name = "羊只类型")
private String name;
/** 性别 */
@Excel(name = "性别")
private Long gender;
/** 出生日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出生日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date birthday;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long dayAge;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long monthAge;
/** 胎次 */
@Excel(name = "胎次")
private Long parity;
/** 出生体重 */
@Excel(name = "出生体重")
private Long birthWeight;
/** 断奶日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "断奶日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date weaningDate;
/** 羊只状态 */
@Excel(name = "羊只状态")
private Long statusId;
/** 断奶体重 */
@Excel(name = "断奶体重")
private Long weaningWeight;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long weaningDayAge;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private BigDecimal weaningDailyGain;
/** 当前体重 */
@Excel(name = "当前体重")
private Long currentWeight;
/** 繁育状态id */
@Excel(name = "繁育状态id")
private Long breedStatusId;
/** 繁殖状态 */
@Excel(name = "繁殖状态")
private String breed;
/** 父号id */
@Excel(name = "父号id")
private Long bsFatherId;
/** 管理耳号 */
@Excel(name = "管理耳号")
private String fatherManageTags;
/** 母号id */
@Excel(name = "母号id")
private Long bsMotherId;
/** 管理耳号 */
@Excel(name = "管理耳号")
private String motherManageTags;
/** 受体id */
@Excel(name = "受体id")
private Long receptorId;
/** 管理耳号 */
@Excel(name = "管理耳号")
private String receptorManageTags;
/** 父号id */
@Excel(name = "父号id")
private Long fatherFatherId;
/** 管理耳号 */
@Excel(name = "祖父管理耳号")
private String grandfatherManageTags;
/** 母号id */
@Excel(name = "母号id")
private Long fatherMotherId;
/** 管理耳号 */
@Excel(name = "祖母管理耳号")
private String grandmotherManageTags;
/** 父号id */
@Excel(name = "父号id")
private Long fatherId;
/** 管理耳号 */
@Excel(name = "管理耳号")
private String maternalGrandfatherManageTags;
/** 母号id */
@Excel(name = "母号id")
private Long motherId;
/** 管理耳号 */
@Excel(name = "管理耳号")
private String maternalGrandmotherManageTags;
/** 配种日期 */
@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;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long matingDay;
/** 怀孕天数 */
@Excel(name = "怀孕天数")
private Long gestationDay;
/** 预产日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "预产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date expectedDate;
/** 产后天数 */
@Excel(name = "产后天数")
private Long postLambingDay;
/** 泌乳天数 */
@Excel(name = "泌乳天数")
private Long lactationDay;
/** 空怀天数 */
@Excel(name = "空怀天数")
private Long anestrousDay;
/** 配种次数 */
@Excel(name = "配种次数")
private Long matingCounts;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long matingTotal;
/** 累计流产次数 */
@Excel(name = "累计流产次数")
private Long miscarriageCounts;
/** 备注 */
@Excel(name = "备注")
private String comment;
/** 是否性控 */
@Excel(name = "是否性控")
private Long controlled;
/** 体况评分 */
@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;
/** $column.columnComment */
@Excel(name = "来源牧场", readConverterExp = "$column.readConverterExp()")
private String sourceRanch;
/** 是否删除 */
@Excel(name = "是否删除")
private Long isDelete;
/** $column.columnComment */
@Excel(name = "毛色", readConverterExp = "$column.readConverterExp()")
private String sheepColor;
/** $column.columnComment */
@Excel(name = "等级", readConverterExp = "$column.readConverterExp()")
private String groupName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setBsManageTags(String bsManageTags)
{
this.bsManageTags = bsManageTags;
}
public String getBsManageTags()
{
return bsManageTags;
}
public void setRanchId(Long ranchId)
{
this.ranchId = ranchId;
}
public Long getRanchId()
{
return ranchId;
}
public void setDrRanch(String drRanch)
{
this.drRanch = drRanch;
}
public String getDrRanch()
{
return drRanch;
}
public void setSheepfoldId(Long sheepfoldId)
{
this.sheepfoldId = sheepfoldId;
}
public Long getSheepfoldId()
{
return sheepfoldId;
}
public void setSheepfoldName(String sheepfoldName)
{
this.sheepfoldName = sheepfoldName;
}
public String getSheepfoldName()
{
return sheepfoldName;
}
public void setElectronicTags(String electronicTags)
{
this.electronicTags = electronicTags;
}
public String getElectronicTags()
{
return electronicTags;
}
public void setVarietyId(Long varietyId)
{
this.varietyId = varietyId;
}
public Long getVarietyId()
{
return varietyId;
}
public void setVariety(String variety)
{
this.variety = variety;
}
public String getVariety()
{
return variety;
}
public void setFamily(String family)
{
this.family = family;
}
public String getFamily()
{
return family;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setGender(Long gender)
{
this.gender = gender;
}
public Long getGender()
{
return gender;
}
public void setBirthday(Date birthday)
{
this.birthday = birthday;
}
public Date getBirthday()
{
return birthday;
}
public void setDayAge(Long dayAge)
{
this.dayAge = dayAge;
}
public Long getDayAge()
{
return dayAge;
}
public void setMonthAge(Long monthAge)
{
this.monthAge = monthAge;
}
public Long getMonthAge()
{
return monthAge;
}
public void setParity(Long parity)
{
this.parity = parity;
}
public Long getParity()
{
return parity;
}
public void setBirthWeight(Long birthWeight)
{
this.birthWeight = birthWeight;
}
public Long getBirthWeight()
{
return birthWeight;
}
public void setWeaningDate(Date weaningDate)
{
this.weaningDate = weaningDate;
}
public Date getWeaningDate()
{
return weaningDate;
}
public void setStatusId(Long statusId)
{
this.statusId = statusId;
}
public Long getStatusId()
{
return statusId;
}
public void setWeaningWeight(Long weaningWeight)
{
this.weaningWeight = weaningWeight;
}
public Long getWeaningWeight()
{
return weaningWeight;
}
public void setWeaningDayAge(Long weaningDayAge)
{
this.weaningDayAge = weaningDayAge;
}
public Long getWeaningDayAge()
{
return weaningDayAge;
}
public void setWeaningDailyGain(BigDecimal weaningDailyGain)
{
this.weaningDailyGain = weaningDailyGain;
}
public BigDecimal getWeaningDailyGain()
{
return weaningDailyGain;
}
public void setCurrentWeight(Long currentWeight)
{
this.currentWeight = currentWeight;
}
public Long getCurrentWeight()
{
return currentWeight;
}
public void setBreedStatusId(Long breedStatusId)
{
this.breedStatusId = breedStatusId;
}
public Long getBreedStatusId()
{
return breedStatusId;
}
public void setBreed(String breed)
{
this.breed = breed;
}
public String getBreed()
{
return breed;
}
public void setBsFatherId(Long bsFatherId)
{
this.bsFatherId = bsFatherId;
}
public Long getBsFatherId()
{
return bsFatherId;
}
public void setFatherManageTags(String fatherManageTags)
{
this.fatherManageTags = fatherManageTags;
}
public String getFatherManageTags()
{
return fatherManageTags;
}
public void setBsMotherId(Long bsMotherId)
{
this.bsMotherId = bsMotherId;
}
public Long getBsMotherId()
{
return bsMotherId;
}
public void setMotherManageTags(String motherManageTags)
{
this.motherManageTags = motherManageTags;
}
public String getMotherManageTags()
{
return motherManageTags;
}
public void setReceptorId(Long receptorId)
{
this.receptorId = receptorId;
}
public Long getReceptorId()
{
return receptorId;
}
public void setReceptorManageTags(String receptorManageTags)
{
this.receptorManageTags = receptorManageTags;
}
public String getReceptorManageTags()
{
return receptorManageTags;
}
public void setFatherFatherId(Long fatherFatherId)
{
this.fatherFatherId = fatherFatherId;
}
public Long getFatherFatherId()
{
return fatherFatherId;
}
public void setGrandfatherManageTags(String grandfatherManageTags)
{
this.grandfatherManageTags = grandfatherManageTags;
}
public String getGrandfatherManageTags()
{
return grandfatherManageTags;
}
public void setFatherMotherId(Long fatherMotherId)
{
this.fatherMotherId = fatherMotherId;
}
public Long getFatherMotherId()
{
return fatherMotherId;
}
public void setGrandmotherManageTags(String grandmotherManageTags)
{
this.grandmotherManageTags = grandmotherManageTags;
}
public String getGrandmotherManageTags()
{
return grandmotherManageTags;
}
public void setFatherId(Long fatherId)
{
this.fatherId = fatherId;
}
public Long getFatherId()
{
return fatherId;
}
public void setMaternalGrandfatherManageTags(String maternalGrandfatherManageTags)
{
this.maternalGrandfatherManageTags = maternalGrandfatherManageTags;
}
public String getMaternalGrandfatherManageTags()
{
return maternalGrandfatherManageTags;
}
public void setMotherId(Long motherId)
{
this.motherId = motherId;
}
public Long getMotherId()
{
return motherId;
}
public void setMaternalGrandmotherManageTags(String maternalGrandmotherManageTags)
{
this.maternalGrandmotherManageTags = maternalGrandmotherManageTags;
}
public String getMaternalGrandmotherManageTags()
{
return maternalGrandmotherManageTags;
}
public void setMatingDate(Date matingDate)
{
this.matingDate = matingDate;
}
public Date getMatingDate()
{
return matingDate;
}
public void setMatingTypeId(Long matingTypeId)
{
this.matingTypeId = matingTypeId;
}
public Long getMatingTypeId()
{
return matingTypeId;
}
public void setPregDate(Date pregDate)
{
this.pregDate = pregDate;
}
public Date getPregDate()
{
return pregDate;
}
public void setLambingDate(Date lambingDate)
{
this.lambingDate = lambingDate;
}
public Date getLambingDate()
{
return lambingDate;
}
public void setLambingDay(Long lambingDay)
{
this.lambingDay = lambingDay;
}
public Long getLambingDay()
{
return lambingDay;
}
public void setMatingDay(Long matingDay)
{
this.matingDay = matingDay;
}
public Long getMatingDay()
{
return matingDay;
}
public void setGestationDay(Long gestationDay)
{
this.gestationDay = gestationDay;
}
public Long getGestationDay()
{
return gestationDay;
}
public void setExpectedDate(Date expectedDate)
{
this.expectedDate = expectedDate;
}
public Date getExpectedDate()
{
return expectedDate;
}
public void setPostLambingDay(Long postLambingDay)
{
this.postLambingDay = postLambingDay;
}
public Long getPostLambingDay()
{
return postLambingDay;
}
public void setLactationDay(Long lactationDay)
{
this.lactationDay = lactationDay;
}
public Long getLactationDay()
{
return lactationDay;
}
public void setAnestrousDay(Long anestrousDay)
{
this.anestrousDay = anestrousDay;
}
public Long getAnestrousDay()
{
return anestrousDay;
}
public void setMatingCounts(Long matingCounts)
{
this.matingCounts = matingCounts;
}
public Long getMatingCounts()
{
return matingCounts;
}
public void setMatingTotal(Long matingTotal)
{
this.matingTotal = matingTotal;
}
public Long getMatingTotal()
{
return matingTotal;
}
public void setMiscarriageCounts(Long miscarriageCounts)
{
this.miscarriageCounts = miscarriageCounts;
}
public Long getMiscarriageCounts()
{
return miscarriageCounts;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
public void setControlled(Long controlled)
{
this.controlled = controlled;
}
public Long getControlled()
{
return controlled;
}
public void setBody(Long body)
{
this.body = body;
}
public Long getBody()
{
return body;
}
public void setBreast(Long breast)
{
this.breast = breast;
}
public Long getBreast()
{
return breast;
}
public void setSource(String source)
{
this.source = source;
}
public String getSource()
{
return source;
}
public void setSourceDate(Date sourceDate)
{
this.sourceDate = sourceDate;
}
public Date getSourceDate()
{
return sourceDate;
}
public void setSourceRanchId(Long sourceRanchId)
{
this.sourceRanchId = sourceRanchId;
}
public Long getSourceRanchId()
{
return sourceRanchId;
}
public void setSourceRanch(String sourceRanch)
{
this.sourceRanch = sourceRanch;
}
public String getSourceRanch()
{
return sourceRanch;
}
public void setIsDelete(Long isDelete)
{
this.isDelete = isDelete;
}
public Long getIsDelete()
{
return isDelete;
}
public void setSheepColor(String sheepColor)
{
this.sheepColor = sheepColor;
}
public String getSheepColor()
{
return sheepColor;
}
public void setGroupName(String groupName)
{
this.groupName = groupName;
}
public String getGroupName()
{
return groupName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("bsManageTags", getBsManageTags())
.append("ranchId", getRanchId())
.append("drRanch", getDrRanch())
.append("sheepfoldId", getSheepfoldId())
.append("sheepfoldName", getSheepfoldName())
.append("electronicTags", getElectronicTags())
.append("varietyId", getVarietyId())
.append("variety", getVariety())
.append("family", getFamily())
.append("name", getName())
.append("gender", getGender())
.append("birthday", getBirthday())
.append("dayAge", getDayAge())
.append("monthAge", getMonthAge())
.append("parity", getParity())
.append("birthWeight", getBirthWeight())
.append("weaningDate", getWeaningDate())
.append("statusId", getStatusId())
.append("weaningWeight", getWeaningWeight())
.append("weaningDayAge", getWeaningDayAge())
.append("weaningDailyGain", getWeaningDailyGain())
.append("currentWeight", getCurrentWeight())
.append("breedStatusId", getBreedStatusId())
.append("breed", getBreed())
.append("bsFatherId", getBsFatherId())
.append("fatherManageTags", getFatherManageTags())
.append("bsMotherId", getBsMotherId())
.append("motherManageTags", getMotherManageTags())
.append("receptorId", getReceptorId())
.append("receptorManageTags", getReceptorManageTags())
.append("fatherFatherId", getFatherFatherId())
.append("grandfatherManageTags", getGrandfatherManageTags())
.append("fatherMotherId", getFatherMotherId())
.append("grandmotherManageTags", getGrandmotherManageTags())
.append("fatherId", getFatherId())
.append("maternalGrandfatherManageTags", getMaternalGrandfatherManageTags())
.append("motherId", getMotherId())
.append("maternalGrandmotherManageTags", getMaternalGrandmotherManageTags())
.append("matingDate", getMatingDate())
.append("matingTypeId", getMatingTypeId())
.append("pregDate", getPregDate())
.append("lambingDate", getLambingDate())
.append("lambingDay", getLambingDay())
.append("matingDay", getMatingDay())
.append("gestationDay", getGestationDay())
.append("expectedDate", getExpectedDate())
.append("postLambingDay", getPostLambingDay())
.append("lactationDay", getLactationDay())
.append("anestrousDay", getAnestrousDay())
.append("matingCounts", getMatingCounts())
.append("matingTotal", getMatingTotal())
.append("miscarriageCounts", getMiscarriageCounts())
.append("comment", getComment())
.append("controlled", getControlled())
.append("body", getBody())
.append("breast", getBreast())
.append("source", getSource())
.append("sourceDate", getSourceDate())
.append("sourceRanchId", getSourceRanchId())
.append("sourceRanch", getSourceRanch())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("isDelete", getIsDelete())
.append("sheepColor", getSheepColor())
.append("groupName", getGroupName())
.toString();
}
}

View File

@@ -0,0 +1,70 @@
package com.zhyc.module.base.mapper;
import java.util.List;
import com.zhyc.module.base.domain.SheepPedigree;
import org.apache.ibatis.annotations.Param;
/**
* VIEWMapper接口
*
* @author ruoyi
* @date 2026-02-04
*/
public interface SheepPedigreeMapper
{
/**
* 查询VIEW
*
* @param id VIEW主键
* @return VIEW
*/
public SheepPedigree selectSheepPedigreeById(Long id);
/**
* 查询VIEW列表
*
* @param sheepPedigree VIEW
* @return VIEW集合
*/
public List<SheepPedigree> selectSheepPedigreeList(SheepPedigree sheepPedigree);
/**
* 新增VIEW
*
* @param sheepPedigree VIEW
* @return 结果
*/
public int insertSheepPedigree(SheepPedigree sheepPedigree);
/**
* 修改VIEW
*
* @param sheepPedigree VIEW
* @return 结果
*/
public int updateSheepPedigree(SheepPedigree sheepPedigree);
/**
* 删除VIEW
*
* @param id VIEW主键
* @return 结果
*/
public int deleteSheepPedigreeById(Long id);
/**
* 批量删除VIEW
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSheepPedigreeByIds(Long[] ids);
/**
* 根据int类型id查询繁育状态名称
* @param id 主键idint类型
* @return 繁育状态名称breed列的值
*/
String selectBreedNameById(@Param("id") Long id);
}

View File

@@ -0,0 +1,63 @@
package com.zhyc.module.base.service;
import java.util.List;
import com.zhyc.module.base.domain.SheepPedigree;
/**
* VIEWService接口
*
* @author ruoyi
* @date 2026-02-04
*/
public interface ISheepPedigreeService
{
/**
* 查询VIEW
*
* @param id VIEW主键
* @return VIEW
*/
public SheepPedigree selectSheepPedigreeById(Long id);
/**
* 查询VIEW列表
*
* @param sheepPedigree VIEW
* @return VIEW集合
*/
public List<SheepPedigree> selectSheepPedigreeList(SheepPedigree sheepPedigree);
/**
* 新增VIEW
*
* @param sheepPedigree VIEW
* @return 结果
*/
public int insertSheepPedigree(SheepPedigree sheepPedigree);
/**
* 修改VIEW
*
* @param sheepPedigree VIEW
* @return 结果
*/
public int updateSheepPedigree(SheepPedigree sheepPedigree);
/**
* 批量删除VIEW
*
* @param ids 需要删除的VIEW主键集合
* @return 结果
*/
public int deleteSheepPedigreeByIds(Long[] ids);
/**
* 删除VIEW信息
*
* @param id VIEW主键
* @return 结果
*/
public int deleteSheepPedigreeById(Long id);
public String getBreedNameById(Long id);
}

View File

@@ -0,0 +1,104 @@
package com.zhyc.module.base.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.base.mapper.SheepPedigreeMapper;
import com.zhyc.module.base.domain.SheepPedigree;
import com.zhyc.module.base.service.ISheepPedigreeService;
/**
* VIEWService业务层处理
*
* @author ruoyi
* @date 2026-02-04
*/
@Service
public class SheepPedigreeServiceImpl implements ISheepPedigreeService
{
@Autowired
private SheepPedigreeMapper sheepPedigreeMapper;
/**
* 查询VIEW
*
* @param id VIEW主键
* @return VIEW
*/
@Override
public SheepPedigree selectSheepPedigreeById(Long id)
{
return sheepPedigreeMapper.selectSheepPedigreeById(id);
}
/**
* 查询VIEW列表
*
* @param sheepPedigree VIEW
* @return VIEW
*/
@Override
public List<SheepPedigree> selectSheepPedigreeList(SheepPedigree sheepPedigree)
{
return sheepPedigreeMapper.selectSheepPedigreeList(sheepPedigree);
}
/**
* 新增VIEW
*
* @param sheepPedigree VIEW
* @return 结果
*/
@Override
public int insertSheepPedigree(SheepPedigree sheepPedigree)
{
sheepPedigree.setCreateTime(DateUtils.getNowDate());
return sheepPedigreeMapper.insertSheepPedigree(sheepPedigree);
}
/**
* 修改VIEW
*
* @param sheepPedigree VIEW
* @return 结果
*/
@Override
public int updateSheepPedigree(SheepPedigree sheepPedigree)
{
sheepPedigree.setUpdateTime(DateUtils.getNowDate());
return sheepPedigreeMapper.updateSheepPedigree(sheepPedigree);
}
/**
* 批量删除VIEW
*
* @param ids 需要删除的VIEW主键
* @return 结果
*/
@Override
public int deleteSheepPedigreeByIds(Long[] ids)
{
return sheepPedigreeMapper.deleteSheepPedigreeByIds(ids);
}
/**
* 删除VIEW信息
*
* @param id VIEW主键
* @return 结果
*/
@Override
public int deleteSheepPedigreeById(Long id)
{
return sheepPedigreeMapper.deleteSheepPedigreeById(id);
}
@Override
public String getBreedNameById(Long id) {
if (id == null) { // int类型id为空直接返回空
return "";
}
return sheepPedigreeMapper.selectBreedNameById(id);
}
}

View File

@@ -0,0 +1,511 @@
package com.zhyc.module.base.util;
import com.zhyc.module.base.domain.SheepPedigree;
import com.zhyc.module.base.service.ISheepPedigreeService;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.zhyc.common.utils.DictUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 羊只系谱自定义Excel导出工具适配羊只系谱表2样式
*/
@Component
public class SheepPedigreeExcelUtils {
// 日期格式化
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
// 注入Service接口
@Autowired
private ISheepPedigreeService sheepPedigreeService;
/**
* 导出指定bsManageTags的羊只系谱符合羊只系谱表2样式
*/
public void export(HttpServletResponse response, List<SheepPedigree> dataList) throws Exception {
// 1. 创建Excel工作簿和工作表
Workbook workbook = new XSSFWorkbook();
Sheet sheet = workbook.createSheet("羊只系谱");
// 设置列宽6列索引0-5
sheet.setColumnWidth(0, 15 * 256); // 第1列
sheet.setColumnWidth(1, 15 * 256); // 第2列
sheet.setColumnWidth(2, 15 * 256); // 第3列
sheet.setColumnWidth(3, 15 * 256); // 第4列
sheet.setColumnWidth(4, 15 * 256); // 第5列
sheet.setColumnWidth(5, 15 * 256); // 第6列
// 2. 定义样式(新增:通用边框样式,所有单元格都应用)
CellStyle titleStyle = createTitleStyle(workbook);
CellStyle blockTitleStyle = createBlockTitleStyle(workbook);
CellStyle contentStyle = createContentStyle(workbook);
CellStyle borderStyle = createBorderStyle(workbook); // 纯边框样式,用于空单元格
int rowNum = 0;
// 遍历数据
for (SheepPedigree pedigree : dataList) {
// ========== 1. 大标题:羊只系谱 ==========
Row titleRow = sheet.createRow(rowNum++);
titleRow.setHeightInPoints(25);
Cell titleCell = titleRow.createCell(0);
titleCell.setCellValue("羊只系谱");
titleCell.setCellStyle(titleStyle);
// 给标题行所有列应用边框
fillRowWithBorder(titleRow, 0, 5, borderStyle);
sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 0, 5));
// ========== 2. 基础信息区块 ==========
// 普通耳号
Row earTagRow = sheet.createRow(rowNum++);
earTagRow.setHeightInPoints(20);
Cell earTagLabelCell = earTagRow.createCell(0);
earTagLabelCell.setCellValue("普通耳号");
earTagLabelCell.setCellStyle(contentStyle);
String earTagContent = pedigree.getBsManageTags() != null ? pedigree.getBsManageTags() : "";
Cell earTagValueCell = earTagRow.createCell(1);
earTagValueCell.setCellValue(earTagContent);
earTagValueCell.setCellStyle(contentStyle);
// 给当前行所有列填充边框
fillRowWithBorder(earTagRow, 0, 5, borderStyle);
CellRangeAddress earTagMerge = new CellRangeAddress(
rowNum - 1,
rowNum - 1,
1,
5
);
sheet.addMergedRegion(earTagMerge);
// 品种 + 类别
Row varietyRow = sheet.createRow(rowNum++);
varietyRow.setHeightInPoints(20);
Cell varietyLabelCell = varietyRow.createCell(0);
varietyLabelCell.setCellValue("品种");
varietyLabelCell.setCellStyle(contentStyle);
String varietyContent = pedigree.getVariety() != null ? pedigree.getVariety() : "";
Cell varietyValueCell = varietyRow.createCell(1);
varietyValueCell.setCellValue(varietyContent);
varietyValueCell.setCellStyle(contentStyle);
Cell categoryLabelCell = varietyRow.createCell(2);
categoryLabelCell.setCellValue("类别");
categoryLabelCell.setCellStyle(contentStyle);
String categoryContent = pedigree.getName() != null ? pedigree.getName() : "";
Cell categoryValueCell = varietyRow.createCell(3);
categoryValueCell.setCellValue(categoryContent);
categoryValueCell.setCellStyle(contentStyle);
// 填充边框
fillRowWithBorder(varietyRow, 0, 5, borderStyle);
CellRangeAddress categoryMerge = new CellRangeAddress(
rowNum - 1,
rowNum - 1,
3,
5
);
sheet.addMergedRegion(categoryMerge);
// 性别 + 出生重量 + 出生日期
Row genderRow = sheet.createRow(rowNum++);
genderRow.setHeightInPoints(20);
Cell genderLabelCell = genderRow.createCell(0);
genderLabelCell.setCellValue("性别");
genderLabelCell.setCellStyle(contentStyle);
Cell genderValueCell = genderRow.createCell(1);
genderValueCell.setCellValue(getGenderText(pedigree.getGender()));
genderValueCell.setCellStyle(contentStyle);
Cell birthWeightLabelCell = genderRow.createCell(2);
birthWeightLabelCell.setCellValue("出生重量");
birthWeightLabelCell.setCellStyle(contentStyle);
Cell birthWeightValueCell = genderRow.createCell(3);
String birthWeightContent = pedigree.getBirthWeight() != null ? pedigree.getBirthWeight() + "kg" : "";
birthWeightValueCell.setCellValue(birthWeightContent);
birthWeightValueCell.setCellStyle(contentStyle);
Cell birthDateLabelCell = genderRow.createCell(4);
birthDateLabelCell.setCellValue("出生日期");
birthDateLabelCell.setCellStyle(contentStyle);
Cell birthDateValueCell = genderRow.createCell(5);
String birthDate = pedigree.getBirthday() != null ? DATE_FORMAT.format(pedigree.getBirthday()) : "";
birthDateValueCell.setCellValue(birthDate);
birthDateValueCell.setCellStyle(contentStyle);
// 填充边框
fillRowWithBorder(genderRow, 0, 5, borderStyle);
// 毛色 + 月龄 + 状态
Row furColorRow = sheet.createRow(rowNum++);
furColorRow.setHeightInPoints(20);
Cell furColorLabelCell = furColorRow.createCell(0);
furColorLabelCell.setCellValue("毛色");
furColorLabelCell.setCellStyle(contentStyle);
Cell furColorValueCell = furColorRow.createCell(1);
String furColorContent = pedigree.getSheepColor() != null ? pedigree.getSheepColor() : "";
furColorValueCell.setCellValue(furColorContent);
furColorValueCell.setCellStyle(contentStyle);
Cell monthAgeLabelCell = furColorRow.createCell(2);
monthAgeLabelCell.setCellValue("月龄");
monthAgeLabelCell.setCellStyle(contentStyle);
Cell monthAgeValueCell = furColorRow.createCell(3);
String monthAgeContent = pedigree.getMonthAge() != null ? pedigree.getMonthAge() + "" : "";
monthAgeValueCell.setCellValue(monthAgeContent);
monthAgeValueCell.setCellStyle(contentStyle);
Cell statusLabelCell = furColorRow.createCell(4);
statusLabelCell.setCellValue("状态");
statusLabelCell.setCellStyle(contentStyle);
Map<Object, String> statusDict = new HashMap<>();
statusDict.put(1L, "在群");
statusDict.put(2L, "不在群");
statusDict.put(null, "");
Object statusId = pedigree.getStatusId();
String statusContent = statusDict.getOrDefault(statusId, "未知状态");
Cell statusValueCell = furColorRow.createCell(5);
statusValueCell.setCellValue(statusContent);
statusValueCell.setCellStyle(contentStyle);
// 填充边框
fillRowWithBorder(furColorRow, 0, 5, borderStyle);
// 繁育状态 + 来源
Row breedStatusRow = sheet.createRow(rowNum++);
breedStatusRow.setHeightInPoints(20);
int currentRow = rowNum - 1;
Cell breedStatusLabelCell = breedStatusRow.createCell(0);
breedStatusLabelCell.setCellValue("繁育状态");
breedStatusLabelCell.setCellStyle(contentStyle);
Cell breedStatusValueCell = breedStatusRow.createCell(1);
String breedStatusContent = "";
try {
Object breedObj = pedigree.getBreed();
if (breedObj != null) {
breedStatusContent = breedObj.toString().trim();
}
if (breedStatusContent == null || breedStatusContent.isEmpty()) {
breedStatusContent = "";
}
} catch (Exception e) {
breedStatusContent = "";
}
breedStatusValueCell.setCellValue(breedStatusContent);
breedStatusValueCell.setCellStyle(contentStyle);
Cell sourceLabelCell = breedStatusRow.createCell(2);
sourceLabelCell.setCellValue("来源");
sourceLabelCell.setCellStyle(contentStyle);
Cell sourceValueCell = breedStatusRow.createCell(3);
String sourceCode = pedigree.getSource() != null ? pedigree.getSource().toString() : "";
String sourceContent = "";
try {
sourceContent = DictUtils.getDictLabel("source", sourceCode, "");
} catch (Exception e) {
sourceContent = "";
System.err.println("来源字典映射失败:" + e.getMessage());
}
sourceValueCell.setCellValue(sourceContent);
sourceValueCell.setCellStyle(contentStyle);
// 填充边框
fillRowWithBorder(breedStatusRow, 0, 5, borderStyle);
CellRangeAddress sourceMerge = new CellRangeAddress(
currentRow,
currentRow,
3,
5
);
sheet.addMergedRegion(sourceMerge);
// 等级 + 家系
Row levelRow = sheet.createRow(rowNum++);
levelRow.setHeightInPoints(20);
int currentLevelRow = rowNum - 1;
Cell levelLabelCell = levelRow.createCell(0);
levelLabelCell.setCellValue("等级");
levelLabelCell.setCellStyle(contentStyle);
Cell levelValueCell = levelRow.createCell(1);
String levelContent = pedigree.getGroupName() != null ? pedigree.getGroupName() : "";
levelValueCell.setCellValue(levelContent);
levelValueCell.setCellStyle(contentStyle);
Cell familyLabelCell = levelRow.createCell(2);
familyLabelCell.setCellValue("家系");
familyLabelCell.setCellStyle(contentStyle);
Cell familyValueCell = levelRow.createCell(3);
String familyContent = pedigree.getFamily() != null ? pedigree.getFamily() : "";
familyValueCell.setCellValue(familyContent);
familyValueCell.setCellStyle(contentStyle);
// 填充边框
fillRowWithBorder(levelRow, 0, 5, borderStyle);
CellRangeAddress familyMerge = new CellRangeAddress(
currentLevelRow,
currentLevelRow,
3,
5
);
sheet.addMergedRegion(familyMerge);
// ========== 3. 系谱信息区块(最终修复版) ==========
Row pedigreeTitleRow = sheet.createRow(rowNum++);
pedigreeTitleRow.setHeightInPoints(25); // 区块标题行高
Cell pedigreeTitleCell = pedigreeTitleRow.createCell(0);
pedigreeTitleCell.setCellValue("系谱信息");
pedigreeTitleCell.setCellStyle(blockTitleStyle);
// 填充标题行边框
fillRowWithBorder(pedigreeTitleRow, 0, 5, borderStyle);
sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 0, 5));
// 系谱区块起始行此时rowNum是系谱内容第1行
int pedigreeStartRow = rowNum;
int pedigreeTotalRows = 12;
// 统一设置系谱12行的行高+填充边框
for (int i = 0; i < pedigreeTotalRows; i++) {
Row tempRow = sheet.createRow(pedigreeStartRow + i);
tempRow.setHeightInPoints(20);
// 给每行的0-5列都填充边框样式
fillRowWithBorder(tempRow, 0, 5, borderStyle);
}
// ========== 1. 羊只列第1列合并12行 ==========
Row sheepRow = sheet.getRow(pedigreeStartRow);
Cell sheepCell = sheepRow.createCell(0);
String sheepValue = pedigree.getBsManageTags() != null && !pedigree.getBsManageTags().isEmpty()
? "羊只:" + pedigree.getBsManageTags()
: "羊只:无";
sheepCell.setCellValue(sheepValue);
sheepCell.setCellStyle(contentStyle); // 覆盖为内容样式(带边框+字体)
sheet.addMergedRegion(new CellRangeAddress(
pedigreeStartRow,
pedigreeStartRow + 11,
0,
0
));
// ========== 2. 父耳号第2-3列合并前6行 ==========
Row fatherRow = sheet.getRow(pedigreeStartRow);
Cell fatherCell = fatherRow.createCell(1);
String fatherValue = pedigree.getFatherManageTags() != null && !pedigree.getFatherManageTags().isEmpty()
? "父耳号:" + pedigree.getFatherManageTags()
: "父耳号:无";
fatherCell.setCellValue(fatherValue);
fatherCell.setCellStyle(contentStyle);
sheet.addMergedRegion(new CellRangeAddress(
pedigreeStartRow,
pedigreeStartRow + 5,
1,
2
));
// ========== 3. 母耳号第2-3列合并后6行 ==========
Row motherRow = sheet.getRow(pedigreeStartRow + 6);
Cell motherCell = motherRow.createCell(1);
String motherValue = pedigree.getMotherManageTags() != null && !pedigree.getMotherManageTags().isEmpty()
? "母耳号:" + pedigree.getMotherManageTags()
: "母耳号:无";
motherCell.setCellValue(motherValue);
motherCell.setCellStyle(contentStyle);
sheet.addMergedRegion(new CellRangeAddress(
pedigreeStartRow + 6,
pedigreeStartRow + 11,
1,
2
));
// ========== 4. 祖父耳号第4-6列合并1-3行 ==========
Row grandFatherRow = sheet.getRow(pedigreeStartRow);
Cell grandFatherCell = grandFatherRow.createCell(3);
String grandFatherValue = pedigree.getGrandfatherManageTags() != null && !pedigree.getGrandfatherManageTags().isEmpty()
? "祖父耳号:" + pedigree.getGrandfatherManageTags()
: "祖父耳号:无";
grandFatherCell.setCellValue(grandFatherValue);
grandFatherCell.setCellStyle(contentStyle);
sheet.addMergedRegion(new CellRangeAddress(
pedigreeStartRow,
pedigreeStartRow + 2,
3,
5
));
// ========== 5. 祖母耳号第4-6列合并4-6行 ==========
Row grandMotherRow = sheet.getRow(pedigreeStartRow + 3);
Cell grandMotherCell = grandMotherRow.createCell(3);
String grandMotherValue = pedigree.getGrandmotherManageTags() != null && !pedigree.getGrandmotherManageTags().isEmpty()
? "祖母耳号:" + pedigree.getGrandmotherManageTags()
: "祖母耳号:无";
grandMotherCell.setCellValue(grandMotherValue);
grandMotherCell.setCellStyle(contentStyle);
sheet.addMergedRegion(new CellRangeAddress(
pedigreeStartRow + 3,
pedigreeStartRow + 5,
3,
5
));
// ========== 6. 外祖父耳号第4-6列合并7-9行 ==========
Row maternalGrandFatherRow = sheet.getRow(pedigreeStartRow + 6);
Cell maternalGrandFatherCell = maternalGrandFatherRow.createCell(3);
String maternalGrandFatherValue = pedigree.getMaternalGrandfatherManageTags() != null && !pedigree.getMaternalGrandfatherManageTags().isEmpty()
? "外祖父耳号:" + pedigree.getMaternalGrandfatherManageTags()
: "外祖父耳号:无";
maternalGrandFatherCell.setCellValue(maternalGrandFatherValue);
maternalGrandFatherCell.setCellStyle(contentStyle);
sheet.addMergedRegion(new CellRangeAddress(
pedigreeStartRow + 6,
pedigreeStartRow + 8,
3,
5
));
// ========== 7. 外祖母耳号第4-6列合并10-12行 ==========
Row maternalGrandMotherRow = sheet.getRow(pedigreeStartRow + 9);
Cell maternalGrandMotherCell = maternalGrandMotherRow.createCell(3);
String maternalGrandMotherValue = pedigree.getMaternalGrandmotherManageTags() != null && !pedigree.getMaternalGrandmotherManageTags().isEmpty()
? "外祖母耳号:" + pedigree.getMaternalGrandmotherManageTags()
: "外祖母耳号:无";
maternalGrandMotherCell.setCellValue(maternalGrandMotherValue);
maternalGrandMotherCell.setCellStyle(contentStyle);
sheet.addMergedRegion(new CellRangeAddress(
pedigreeStartRow + 9,
pedigreeStartRow + 11,
3,
5
));
// 更新rowNum到系谱区块结束行+1
rowNum = pedigreeStartRow + pedigreeTotalRows;
}
// ========== 4. 输出Excel ==========
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
String fileName = URLEncoder.encode("羊只系谱_" + System.currentTimeMillis(), "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
OutputStream os = response.getOutputStream();
workbook.write(os);
os.flush();
os.close();
workbook.close();
}
// ========== 新增:填充整行边框的工具方法 ==========
private void fillRowWithBorder(Row row, int startCol, int endCol, CellStyle borderStyle) {
for (int col = startCol; col <= endCol; col++) {
Cell cell = row.getCell(col);
if (cell == null) {
cell = row.createCell(col);
}
// 仅当单元格无样式时设置边框样式(避免覆盖已有内容样式)
if (cell.getCellStyle() == null || cell.getCellStyle().getBorderTop() == BorderStyle.NONE) {
cell.setCellStyle(borderStyle);
}
}
}
// ========== 样式定义 ==========
private static CellStyle createTitleStyle(Workbook workbook) {
CellStyle style = workbook.createCellStyle();
Font font = workbook.createFont();
font.setFontName("微软雅黑");
font.setFontHeightInPoints((short) 16);
font.setBold(true);
style.setFont(font);
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
// 标题样式带完整边框
style.setBorderTop(BorderStyle.THIN);
style.setBorderBottom(BorderStyle.THIN);
style.setBorderLeft(BorderStyle.THIN);
style.setBorderRight(BorderStyle.THIN);
return style;
}
private static CellStyle createBlockTitleStyle(Workbook workbook) {
CellStyle style = workbook.createCellStyle();
Font font = workbook.createFont();
font.setFontName("微软雅黑");
font.setFontHeightInPoints((short) 14);
font.setBold(true);
style.setFont(font);
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 区块标题带完整边框
style.setBorderTop(BorderStyle.THIN);
style.setBorderBottom(BorderStyle.THIN);
style.setBorderLeft(BorderStyle.THIN);
style.setBorderRight(BorderStyle.THIN);
return style;
}
private static CellStyle createContentStyle(Workbook workbook) {
CellStyle style = workbook.createCellStyle();
Font font = workbook.createFont();
font.setFontName("微软雅黑");
font.setFontHeightInPoints((short) 12);
style.setFont(font);
style.setAlignment(HorizontalAlignment.LEFT);
style.setVerticalAlignment(VerticalAlignment.CENTER);
// 内容样式带完整边框
style.setBorderTop(BorderStyle.THIN);
style.setBorderBottom(BorderStyle.THIN);
style.setBorderLeft(BorderStyle.THIN);
style.setBorderRight(BorderStyle.THIN);
return style;
}
// 新增:纯边框样式(用于空单元格)
private static CellStyle createBorderStyle(Workbook workbook) {
CellStyle style = workbook.createCellStyle();
// 仅设置边框,无字体/背景色(避免覆盖内容样式)
style.setBorderTop(BorderStyle.THIN);
style.setBorderBottom(BorderStyle.THIN);
style.setBorderLeft(BorderStyle.THIN);
style.setBorderRight(BorderStyle.THIN);
style.setAlignment(HorizontalAlignment.LEFT);
style.setVerticalAlignment(VerticalAlignment.CENTER);
return style;
}
// 性别数字转文字
private static String getGenderText(Long gender) {
if (gender == null) return "";
switch (gender.intValue()) {
case 1: return "";
case 2: return "";
case 3: return "阉羊";
case 4: return "兼性";
default: return "";
}
}
}

View File

@@ -0,0 +1,391 @@
<?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.base.mapper.SheepPedigreeMapper">
<resultMap type="SheepPedigree" id="SheepPedigreeResult">
<result property="id" column="id" />
<result property="bsManageTags" column="bs_manage_tags" />
<result property="ranchId" column="ranch_id" />
<result property="drRanch" column="dr_ranch" />
<result property="sheepfoldId" column="sheepfold_id" />
<result property="sheepfoldName" column="sheepfold_name" />
<result property="electronicTags" column="electronic_tags" />
<result property="varietyId" column="variety_id" />
<result property="variety" column="variety" />
<result property="family" column="family" />
<result property="name" column="name" />
<result property="gender" column="gender" />
<result property="birthday" column="birthday" />
<result property="dayAge" column="day_age" />
<result property="monthAge" column="month_age" />
<result property="parity" column="parity" />
<result property="birthWeight" column="birth_weight" />
<result property="weaningDate" column="weaning_date" />
<result property="statusId" column="status_id" />
<result property="weaningWeight" column="weaning_weight" />
<result property="weaningDayAge" column="weaning_day_age" />
<result property="weaningDailyGain" column="weaning_daily_gain" />
<result property="currentWeight" column="current_weight" />
<result property="breedStatusId" column="breed_status_id" />
<result property="breed" column="breed" />
<result property="bsFatherId" column="bs_father_id" />
<result property="fatherManageTags" column="father_manage_tags" />
<result property="bsMotherId" column="bs_mother_id" />
<result property="motherManageTags" column="mother_manage_tags" />
<result property="receptorId" column="receptor_id" />
<result property="receptorManageTags" column="receptor_manage_tags" />
<result property="fatherFatherId" column="father_father_id" />
<result property="grandfatherManageTags" column="grandfather_manage_tags" />
<result property="fatherMotherId" column="father_mother_id" />
<result property="grandmotherManageTags" column="grandmother_manage_tags" />
<result property="fatherId" column="father_id" />
<result property="maternalGrandfatherManageTags" column="maternal_grandfather_manage_tags" />
<result property="motherId" column="mother_id" />
<result property="maternalGrandmotherManageTags" column="maternal_grandmother_manage_tags" />
<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="matingDay" column="mating_day" />
<result property="gestationDay" column="gestation_day" />
<result property="expectedDate" column="expected_date" />
<result property="postLambingDay" column="post_lambing_day" />
<result property="lactationDay" column="lactation_day" />
<result property="anestrousDay" column="anestrous_day" />
<result property="matingCounts" column="mating_counts" />
<result property="matingTotal" column="mating_total" />
<result property="miscarriageCounts" column="miscarriage_counts" />
<result property="comment" column="comment" />
<result property="controlled" column="controlled" />
<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="sourceRanch" column="source_ranch" />
<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" />
<result property="sheepColor" column="sheep_color" />
<result property="groupName" column="group_name" />
</resultMap>
<sql id="selectSheepPedigreeVo">
select id, bs_manage_tags, ranch_id, dr_ranch, sheepfold_id, sheepfold_name, electronic_tags, variety_id, variety, family, name, gender, birthday, day_age, month_age, parity, birth_weight, weaning_date, status_id, weaning_weight, weaning_day_age, weaning_daily_gain, current_weight, breed_status_id, breed, bs_father_id, father_manage_tags, bs_mother_id, mother_manage_tags, receptor_id, receptor_manage_tags, father_father_id, grandfather_manage_tags, father_mother_id, grandmother_manage_tags, father_id, maternal_grandfather_manage_tags, mother_id, maternal_grandmother_manage_tags, mating_date, mating_type_id, preg_date, lambing_date, lambing_day, mating_day, gestation_day, expected_date, post_lambing_day, lactation_day, anestrous_day, mating_counts, mating_total, miscarriage_counts, comment, controlled, body, breast, source, source_date, source_ranch_id, source_ranch, update_by, update_time, create_by, create_time, is_delete, sheep_color, group_name from sheep_pedigree
</sql>
<select id="selectSheepPedigreeList" parameterType="SheepPedigree" resultMap="SheepPedigreeResult">
<include refid="selectSheepPedigreeVo"/>
<where>
<if test="bsManageTags != null and bsManageTags != ''"> and bs_manage_tags = #{bsManageTags}</if>
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
<if test="drRanch != null and drRanch != ''"> and dr_ranch = #{drRanch}</if>
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
<if test="sheepfoldName != null and sheepfoldName != ''"> and sheepfold_name like concat('%', #{sheepfoldName}, '%')</if>
<if test="electronicTags != null and electronicTags != ''"> and electronic_tags = #{electronicTags}</if>
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
<if test="variety != null and variety != ''"> and variety = #{variety}</if>
<if test="family != null and family != ''"> and family = #{family}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="gender != null "> and gender = #{gender}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="dayAge != null "> and day_age = #{dayAge}</if>
<if test="monthAge != null "> and month_age = #{monthAge}</if>
<if test="parity != null "> and parity = #{parity}</if>
<if test="birthWeight != null "> and birth_weight = #{birthWeight}</if>
<if test="weaningDate != null "> and weaning_date = #{weaningDate}</if>
<if test="statusId != null "> and status_id = #{statusId}</if>
<if test="weaningWeight != null "> and weaning_weight = #{weaningWeight}</if>
<if test="weaningDayAge != null "> and weaning_day_age = #{weaningDayAge}</if>
<if test="weaningDailyGain != null "> and weaning_daily_gain = #{weaningDailyGain}</if>
<if test="currentWeight != null "> and current_weight = #{currentWeight}</if>
<if test="breedStatusId != null "> and breed_status_id = #{breedStatusId}</if>
<if test="breed != null and breed != ''"> and breed = #{breed}</if>
<if test="bsFatherId != null "> and bs_father_id = #{bsFatherId}</if>
<if test="fatherManageTags != null and fatherManageTags != ''"> and father_manage_tags = #{fatherManageTags}</if>
<if test="bsMotherId != null "> and bs_mother_id = #{bsMotherId}</if>
<if test="motherManageTags != null and motherManageTags != ''"> and mother_manage_tags = #{motherManageTags}</if>
<if test="receptorId != null "> and receptor_id = #{receptorId}</if>
<if test="receptorManageTags != null and receptorManageTags != ''"> and receptor_manage_tags = #{receptorManageTags}</if>
<if test="fatherFatherId != null "> and father_father_id = #{fatherFatherId}</if>
<if test="grandfatherManageTags != null and grandfatherManageTags != ''"> and grandfather_manage_tags = #{grandfatherManageTags}</if>
<if test="fatherMotherId != null "> and father_mother_id = #{fatherMotherId}</if>
<if test="grandmotherManageTags != null and grandmotherManageTags != ''"> and grandmother_manage_tags = #{grandmotherManageTags}</if>
<if test="fatherId != null "> and father_id = #{fatherId}</if>
<if test="maternalGrandfatherManageTags != null and maternalGrandfatherManageTags != ''"> and maternal_grandfather_manage_tags = #{maternalGrandfatherManageTags}</if>
<if test="motherId != null "> and mother_id = #{motherId}</if>
<if test="maternalGrandmotherManageTags != null and maternalGrandmotherManageTags != ''"> and maternal_grandmother_manage_tags = #{maternalGrandmotherManageTags}</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="matingDay != null "> and mating_day = #{matingDay}</if>
<if test="gestationDay != null "> and gestation_day = #{gestationDay}</if>
<if test="expectedDate != null "> and expected_date = #{expectedDate}</if>
<if test="postLambingDay != null "> and post_lambing_day = #{postLambingDay}</if>
<if test="lactationDay != null "> and lactation_day = #{lactationDay}</if>
<if test="anestrousDay != null "> and anestrous_day = #{anestrousDay}</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="comment != null and comment != ''"> and comment = #{comment}</if>
<if test="controlled != null "> and controlled = #{controlled}</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="sourceRanch != null and sourceRanch != ''"> and source_ranch = #{sourceRanch}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="sheepColor != null and sheepColor != ''"> and sheep_color = #{sheepColor}</if>
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
</where>
</select>
<select id="selectSheepPedigreeById" parameterType="Long" resultMap="SheepPedigreeResult">
<include refid="selectSheepPedigreeVo"/>
where id = #{id}
</select>
<insert id="insertSheepPedigree" parameterType="SheepPedigree">
insert into sheep_pedigree
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="bsManageTags != null">bs_manage_tags,</if>
<if test="ranchId != null">ranch_id,</if>
<if test="drRanch != null">dr_ranch,</if>
<if test="sheepfoldId != null">sheepfold_id,</if>
<if test="sheepfoldName != null">sheepfold_name,</if>
<if test="electronicTags != null">electronic_tags,</if>
<if test="varietyId != null">variety_id,</if>
<if test="variety != null">variety,</if>
<if test="family != null">family,</if>
<if test="name != null">name,</if>
<if test="gender != null">gender,</if>
<if test="birthday != null">birthday,</if>
<if test="dayAge != null">day_age,</if>
<if test="monthAge != null">month_age,</if>
<if test="parity != null">parity,</if>
<if test="birthWeight != null">birth_weight,</if>
<if test="weaningDate != null">weaning_date,</if>
<if test="statusId != null">status_id,</if>
<if test="weaningWeight != null">weaning_weight,</if>
<if test="weaningDayAge != null">weaning_day_age,</if>
<if test="weaningDailyGain != null">weaning_daily_gain,</if>
<if test="currentWeight != null">current_weight,</if>
<if test="breedStatusId != null">breed_status_id,</if>
<if test="breed != null">breed,</if>
<if test="bsFatherId != null">bs_father_id,</if>
<if test="fatherManageTags != null">father_manage_tags,</if>
<if test="bsMotherId != null">bs_mother_id,</if>
<if test="motherManageTags != null">mother_manage_tags,</if>
<if test="receptorId != null">receptor_id,</if>
<if test="receptorManageTags != null">receptor_manage_tags,</if>
<if test="fatherFatherId != null">father_father_id,</if>
<if test="grandfatherManageTags != null">grandfather_manage_tags,</if>
<if test="fatherMotherId != null">father_mother_id,</if>
<if test="grandmotherManageTags != null">grandmother_manage_tags,</if>
<if test="fatherId != null">father_id,</if>
<if test="maternalGrandfatherManageTags != null">maternal_grandfather_manage_tags,</if>
<if test="motherId != null">mother_id,</if>
<if test="maternalGrandmotherManageTags != null">maternal_grandmother_manage_tags,</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="matingDay != null">mating_day,</if>
<if test="gestationDay != null">gestation_day,</if>
<if test="expectedDate != null">expected_date,</if>
<if test="postLambingDay != null">post_lambing_day,</if>
<if test="lactationDay != null">lactation_day,</if>
<if test="anestrousDay != null">anestrous_day,</if>
<if test="matingCounts != null">mating_counts,</if>
<if test="matingTotal != null">mating_total,</if>
<if test="miscarriageCounts != null">miscarriage_counts,</if>
<if test="comment != null">comment,</if>
<if test="controlled != null">controlled,</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="sourceRanch != null">source_ranch,</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>
<if test="sheepColor != null and sheepColor != ''">sheep_color,</if>
<if test="groupName != null and groupName != ''">group_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="bsManageTags != null">#{bsManageTags},</if>
<if test="ranchId != null">#{ranchId},</if>
<if test="drRanch != null">#{drRanch},</if>
<if test="sheepfoldId != null">#{sheepfoldId},</if>
<if test="sheepfoldName != null">#{sheepfoldName},</if>
<if test="electronicTags != null">#{electronicTags},</if>
<if test="varietyId != null">#{varietyId},</if>
<if test="variety != null">#{variety},</if>
<if test="family != null">#{family},</if>
<if test="name != null">#{name},</if>
<if test="gender != null">#{gender},</if>
<if test="birthday != null">#{birthday},</if>
<if test="dayAge != null">#{dayAge},</if>
<if test="monthAge != null">#{monthAge},</if>
<if test="parity != null">#{parity},</if>
<if test="birthWeight != null">#{birthWeight},</if>
<if test="weaningDate != null">#{weaningDate},</if>
<if test="statusId != null">#{statusId},</if>
<if test="weaningWeight != null">#{weaningWeight},</if>
<if test="weaningDayAge != null">#{weaningDayAge},</if>
<if test="weaningDailyGain != null">#{weaningDailyGain},</if>
<if test="currentWeight != null">#{currentWeight},</if>
<if test="breedStatusId != null">#{breedStatusId},</if>
<if test="breed != null">#{breed},</if>
<if test="bsFatherId != null">#{bsFatherId},</if>
<if test="fatherManageTags != null">#{fatherManageTags},</if>
<if test="bsMotherId != null">#{bsMotherId},</if>
<if test="motherManageTags != null">#{motherManageTags},</if>
<if test="receptorId != null">#{receptorId},</if>
<if test="receptorManageTags != null">#{receptorManageTags},</if>
<if test="fatherFatherId != null">#{fatherFatherId},</if>
<if test="grandfatherManageTags != null">#{grandfatherManageTags},</if>
<if test="fatherMotherId != null">#{fatherMotherId},</if>
<if test="grandmotherManageTags != null">#{grandmotherManageTags},</if>
<if test="fatherId != null">#{fatherId},</if>
<if test="maternalGrandfatherManageTags != null">#{maternalGrandfatherManageTags},</if>
<if test="motherId != null">#{motherId},</if>
<if test="maternalGrandmotherManageTags != null">#{maternalGrandmotherManageTags},</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="matingDay != null">#{matingDay},</if>
<if test="gestationDay != null">#{gestationDay},</if>
<if test="expectedDate != null">#{expectedDate},</if>
<if test="postLambingDay != null">#{postLambingDay},</if>
<if test="lactationDay != null">#{lactationDay},</if>
<if test="anestrousDay != null">#{anestrousDay},</if>
<if test="matingCounts != null">#{matingCounts},</if>
<if test="matingTotal != null">#{matingTotal},</if>
<if test="miscarriageCounts != null">#{miscarriageCounts},</if>
<if test="comment != null">#{comment},</if>
<if test="controlled != null">#{controlled},</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="sourceRanch != null">#{sourceRanch},</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>
<if test="sheepColor != null and sheepColor != ''">#{sheepColor},</if>
<if test="groupName != null and groupName != ''">#{groupName},</if>
</trim>
</insert>
<update id="updateSheepPedigree" parameterType="SheepPedigree">
update sheep_pedigree
<trim prefix="SET" suffixOverrides=",">
<if test="bsManageTags != null">bs_manage_tags = #{bsManageTags},</if>
<if test="ranchId != null">ranch_id = #{ranchId},</if>
<if test="drRanch != null">dr_ranch = #{drRanch},</if>
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
<if test="sheepfoldName != null">sheepfold_name = #{sheepfoldName},</if>
<if test="electronicTags != null">electronic_tags = #{electronicTags},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if>
<if test="variety != null">variety = #{variety},</if>
<if test="family != null">family = #{family},</if>
<if test="name != null">name = #{name},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="dayAge != null">day_age = #{dayAge},</if>
<if test="monthAge != null">month_age = #{monthAge},</if>
<if test="parity != null">parity = #{parity},</if>
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
<if test="weaningDate != null">weaning_date = #{weaningDate},</if>
<if test="statusId != null">status_id = #{statusId},</if>
<if test="weaningWeight != null">weaning_weight = #{weaningWeight},</if>
<if test="weaningDayAge != null">weaning_day_age = #{weaningDayAge},</if>
<if test="weaningDailyGain != null">weaning_daily_gain = #{weaningDailyGain},</if>
<if test="currentWeight != null">current_weight = #{currentWeight},</if>
<if test="breedStatusId != null">breed_status_id = #{breedStatusId},</if>
<if test="breed != null">breed = #{breed},</if>
<if test="bsFatherId != null">bs_father_id = #{bsFatherId},</if>
<if test="fatherManageTags != null">father_manage_tags = #{fatherManageTags},</if>
<if test="bsMotherId != null">bs_mother_id = #{bsMotherId},</if>
<if test="motherManageTags != null">mother_manage_tags = #{motherManageTags},</if>
<if test="receptorId != null">receptor_id = #{receptorId},</if>
<if test="receptorManageTags != null">receptor_manage_tags = #{receptorManageTags},</if>
<if test="fatherFatherId != null">father_father_id = #{fatherFatherId},</if>
<if test="grandfatherManageTags != null">grandfather_manage_tags = #{grandfatherManageTags},</if>
<if test="fatherMotherId != null">father_mother_id = #{fatherMotherId},</if>
<if test="grandmotherManageTags != null">grandmother_manage_tags = #{grandmotherManageTags},</if>
<if test="fatherId != null">father_id = #{fatherId},</if>
<if test="maternalGrandfatherManageTags != null">maternal_grandfather_manage_tags = #{maternalGrandfatherManageTags},</if>
<if test="motherId != null">mother_id = #{motherId},</if>
<if test="maternalGrandmotherManageTags != null">maternal_grandmother_manage_tags = #{maternalGrandmotherManageTags},</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="matingDay != null">mating_day = #{matingDay},</if>
<if test="gestationDay != null">gestation_day = #{gestationDay},</if>
<if test="expectedDate != null">expected_date = #{expectedDate},</if>
<if test="postLambingDay != null">post_lambing_day = #{postLambingDay},</if>
<if test="lactationDay != null">lactation_day = #{lactationDay},</if>
<if test="anestrousDay != null">anestrous_day = #{anestrousDay},</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="comment != null">comment = #{comment},</if>
<if test="controlled != null">controlled = #{controlled},</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="sourceRanch != null">source_ranch = #{sourceRanch},</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>
<if test="sheepColor != null and sheepColor != ''">sheep_color = #{sheepColor},</if>
<if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSheepPedigreeById" parameterType="Long">
delete from sheep_pedigree where id = #{id}
</delete>
<delete id="deleteSheepPedigreeByIds" parameterType="String">
delete from sheep_pedigree where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectBreedNameById" resultType="java.lang.String">
SELECT breed
FROM bas_breed_status
WHERE id = #{id} <!-- #{id}会自动适配int类型 -->
</select>
</mapper>