Merge remote-tracking branch 'origin/main'

This commit is contained in:
wyt 2025-07-21 18:17:20 +08:00
commit e1dab09512
12 changed files with 186 additions and 763 deletions

View File

@ -6,6 +6,7 @@ import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.core.page.TableDataInfo; import com.zhyc.common.core.page.TableDataInfo;
import com.zhyc.common.enums.BusinessType; import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.DaSheepfold; import com.zhyc.module.base.domain.DaSheepfold;
import com.zhyc.module.base.service.IDaSheepfoldService; import com.zhyc.module.base.service.IDaSheepfoldService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -39,6 +40,17 @@ public class DaSheepfoldController extends BaseController
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldList(daSheepfold); List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldList(daSheepfold);
return getDataTable(list); return getDataTable(list);
} }
/*
* 根据羊舍ids查询羊只id
* */
@GetMapping("/getSheepById")
public AjaxResult getSheepfold(@RequestParam String id) {
List<BasSheep> list = daSheepfoldService.sheepListById(id);
return AjaxResult.success(list);
}
/** /**
* 导出羊舍管理列表 * 导出羊舍管理列表

View File

@ -3,6 +3,7 @@ package com.zhyc.module.base.domain;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -14,6 +15,7 @@ import java.util.Date;
* @author wyt * @author wyt
* @date 2025-07-13 * @date 2025-07-13
*/ */
@Data
public class SheepFile extends BaseEntity public class SheepFile extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -263,673 +265,5 @@ public class SheepFile extends BaseEntity
/** 是否删除 */ /** 是否删除 */
private Long isDelete; private Long isDelete;
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 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;
}
@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("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())
.toString();
}
} }

View File

@ -67,4 +67,5 @@ public interface BasSheepMapper
BasSheep selectBasSheepByManageTags(String manageTags); BasSheep selectBasSheepByManageTags(String manageTags);
List<BasSheep> selectBasSheepBySheepfold(String id);
} }

View File

@ -1,5 +1,6 @@
package com.zhyc.module.base.service; package com.zhyc.module.base.service;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.DaSheepfold; import com.zhyc.module.base.domain.DaSheepfold;
import java.util.List; import java.util.List;
@ -69,4 +70,7 @@ public interface IDaSheepfoldService
* @return 是否已存在 * @return 是否已存在
*/ */
boolean checkSheepfoldNoExist(Long ranchId, Long sheepfoldTypeId, String sheepfoldNo); boolean checkSheepfoldNoExist(Long ranchId, Long sheepfoldTypeId, String sheepfoldNo);
// 根据羊舍id获取该羊舍的羊
List<BasSheep> sheepListById(String id);
} }

View File

@ -1,6 +1,8 @@
package com.zhyc.module.base.service.impl; package com.zhyc.module.base.service.impl;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.DaSheepfold; import com.zhyc.module.base.domain.DaSheepfold;
import com.zhyc.module.base.mapper.BasSheepMapper;
import com.zhyc.module.base.mapper.DaSheepfoldMapper; import com.zhyc.module.base.mapper.DaSheepfoldMapper;
import com.zhyc.module.base.service.IDaSheepfoldService; import com.zhyc.module.base.service.IDaSheepfoldService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -19,6 +21,8 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
{ {
@Autowired @Autowired
private DaSheepfoldMapper daSheepfoldMapper; private DaSheepfoldMapper daSheepfoldMapper;
@Autowired
private BasSheepMapper basSheepMapper;
/** /**
* 查询羊舍管理 * 查询羊舍管理
@ -101,4 +105,10 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
query.setSheepfoldNo(sheepfoldNo); query.setSheepfoldNo(sheepfoldNo);
return daSheepfoldMapper.selectCount(query) > 0; return daSheepfoldMapper.selectCount(query) > 0;
} }
@Override
public List<BasSheep> sheepListById(String id) {
List<BasSheep> basSheep = basSheepMapper.selectBasSheepBySheepfold(id);
return basSheep;
}
} }

View File

@ -24,6 +24,10 @@ public class QuarantineReport extends BaseEntity
/** id */ /** id */
private Long id; private Long id;
// 羊只耳号
private String[] ids;
/** 羊只 */ /** 羊只 */
private Long sheepId; private Long sheepId;
@ -34,9 +38,9 @@ public class QuarantineReport extends BaseEntity
@Excel(name = "羊只性别") @Excel(name = "羊只性别")
private String gender; private String gender;
@Excel(name = "月龄") @Excel(name = "月龄")
private Integer monthAge; private Long monthAge;
@Excel(name = "胎次") @Excel(name = "胎次")
private Integer parity; private Long parity;
@Excel(name = "繁育状态") @Excel(name = "繁育状态")
private String breed; private String breed;
@ -73,11 +77,15 @@ public class QuarantineReport extends BaseEntity
/** 检疫结果 */ /** 检疫结果 */
@Excel(name = "检疫结果") @Excel(name = "检疫结果")
private Long result; private String result;
/** 状态 */ /** 状态 */
@Excel(name = "状态") @Excel(name = "状态")
private Long status; private Integer status;
/** 备注*/
@Excel(name = "备注")
private String comment;
} }

View File

@ -34,7 +34,7 @@ public interface QuarantineReportMapper
* @param quarantineReport 检疫记录 * @param quarantineReport 检疫记录
* @return 结果 * @return 结果
*/ */
public int insertQuarantineReport(QuarantineReport quarantineReport); public int insertQuarantineReport(List<QuarantineReport> quarantineReport);
/** /**
* 修改检疫记录 * 修改检疫记录

View File

@ -1,7 +1,12 @@
package com.zhyc.module.biosafety.service.impl; package com.zhyc.module.biosafety.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.common.utils.bean.BeanUtils;
import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.service.impl.SheepFileServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zhyc.module.biosafety.mapper.QuarantineReportMapper; import com.zhyc.module.biosafety.mapper.QuarantineReportMapper;
@ -19,6 +24,8 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
{ {
@Autowired @Autowired
private QuarantineReportMapper quarantineReportMapper; private QuarantineReportMapper quarantineReportMapper;
@Autowired
private SheepFileServiceImpl sheepFileService;
/** /**
* 查询检疫记录 * 查询检疫记录
@ -54,7 +61,28 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService
public int insertQuarantineReport(QuarantineReport quarantineReport) public int insertQuarantineReport(QuarantineReport quarantineReport)
{ {
quarantineReport.setCreateTime(DateUtils.getNowDate()); quarantineReport.setCreateTime(DateUtils.getNowDate());
return quarantineReportMapper.insertQuarantineReport(quarantineReport); if (quarantineReport.getResult()==null){
quarantineReport.setStatus(0);
}else {
quarantineReport.setStatus(1);
}
List<QuarantineReport> list = new ArrayList<QuarantineReport>();
for (String sheepId : quarantineReport.getIds()) {
SheepFile sheepFile = sheepFileService.selectSheepFileById(Long.parseLong(sheepId));
QuarantineReport quarantine= new QuarantineReport();
BeanUtils.copyProperties(quarantineReport, quarantine);
quarantine.setSheepId(sheepFile.getId());
quarantine.setSheepNo(sheepFile.getElectronicTags());
quarantine.setSheepType(sheepFile.getName());
// 性别前端处理
quarantine.setGender(String.valueOf(sheepFile.getGender()));
quarantine.setMonthAge(sheepFile.getMonthAge());
quarantine.setParity(sheepFile.getParity());
quarantine.setBreed(sheepFile.getBreed());
list.add(quarantine);
}
return quarantineReportMapper.insertQuarantineReport(list);
} }
/** /**

View File

@ -104,12 +104,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE s.id = #{id} WHERE s.id = #{id}
</select> </select>
<select id="selectBasSheepByManageTags" parameterType="string" resultType="com.zhyc.module.base.domain.BasSheep"> <select id="selectBasSheepByManageTags" parameterType="BasSheep" resultMap="BasSheepResult">
SELECT id, sheepfold_id AS sheepfoldId, variety_id AS varietyId <include refid="selectBasSheepVo"/>
FROM bas_sheep <where>
WHERE LOWER(TRIM(manage_tags)) = LOWER(TRIM(#{manageTags})) manage_tags = #{manageTags}
AND is_delete = 0 </where>
LIMIT 1
</select>
<select id="selectBasSheepBySheepfold" parameterType="BasSheep" resultMap="BasSheepResult">
<include refid="selectBasSheepVo"/>
<where>
sheepfold_id = #{id}
</where>
</select> </select>
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id"> <insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">

View File

@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="quarOfficer" column="quar_officer" /> <result property="quarOfficer" column="quar_officer" />
<result property="result" column="result" /> <result property="result" column="result" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="comment" column="comment"/>
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
@ -56,7 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectQuarantineReportById" parameterType="Long" resultMap="QuarantineReportResult"> <select id="selectQuarantineReportById" parameterType="Long" resultMap="QuarantineReportResult">
select sqr.id, sheep_type,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status, select sqr.id, sheep_type,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status,
sqr.update_by, sqr.update_time, sqr.create_by, sqr.create_time, sqr.comment
,sqr.update_by, sqr.update_time, sqr.create_by, sqr.create_time,
sqi.name as item_name, sqi.name as item_name,
sqs.name as sample, sqs.name as sample,
sf.bs_manage_tags sheep_no sf.bs_manage_tags sheep_no
@ -67,36 +69,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sqr.id = #{id} where sqr.id = #{id}
</select> </select>
<insert id="insertQuarantineReport" parameterType="QuarantineReport" useGeneratedKeys="true" keyProperty="id"> <insert id="insertQuarantineReport" parameterType="java.util.List">
insert into sw_quarantine_report INSERT INTO sw_quarantine_report
<trim prefix="(" suffix=")" suffixOverrides=","> (
<if test="sheepId != null">sheep_id,</if> sheep_id,
<if test="datetime != null">datetime,</if> sheep_type,
<if test="quarItem != null">quar_item,</if> month_age,
<if test="sampleType != null">sample_type,</if> parity,
<if test="sampler != null">sampler,</if> breed,
<if test="quarOfficer != null">quar_officer,</if> gender,
<if test="result != null">result,</if> datetime,
<if test="status != null">status,</if> quar_item,
<if test="updateBy != null">update_by,</if> sample_type,
<if test="updateTime != null">update_time,</if> sampler,
<if test="createBy != null">create_by,</if> quar_officer,
<if test="createTime != null">create_time,</if> result,
</trim> status,
<trim prefix="values (" suffix=")" suffixOverrides=","> update_by,
<if test="sheepId != null">#{sheepId},</if> update_time,
<if test="datetime != null">#{datetime},</if> create_by,
<if test="quarItem != null">#{quarItem},</if> create_time
<if test="sampleType != null">#{sampleType},</if> )
<if test="sampler != null">#{sampler},</if> VALUES
<if test="quarOfficer != null">#{quarOfficer},</if> <foreach collection="list" item="item" separator=",">
<if test="result != null">#{result},</if> (
<if test="status != null">#{status},</if> #{item.sheepId},
<if test="updateBy != null">#{updateBy},</if> #{item.sheepType},
<if test="updateTime != null">#{updateTime},</if> #{item.monthAge},
<if test="createBy != null">#{createBy},</if> #{item.parity},
<if test="createTime != null">#{createTime},</if> #{item.breed},
</trim> #{item.gender},
#{item.datetime},
#{item.quarItem},
#{item.sampleType},
#{item.sampler},
#{item.quarOfficer},
#{item.result},
#{item.status},
#{item.updateBy},
#{item.updateTime},
#{item.createBy},
#{item.createTime}
)
</foreach>
</insert> </insert>
<update id="updateQuarantineReport" parameterType="QuarantineReport"> <update id="updateQuarantineReport" parameterType="QuarantineReport">

View File

@ -1,62 +1,61 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.dairyProducts.mapper.NpFreshMilkInspMapper"> <mapper namespace="com.zhyc.module.dairyProducts.mapper.NpFreshMilkInspMapper">
<resultMap type="NpFreshMilkInsp" id="NpFreshMilkInspResult"> <resultMap type="NpFreshMilkInsp" id="NpFreshMilkInspResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="source" column="source" /> <result property="source" column="source" />
<result property="datetime" column="datetime" /> <result property="datetime" column="datetime" />
<result property="fat" column="fat" /> <result property="fat" column="fat" />
<result property="protein" column="protein" /> <result property="protein" column="protein" />
<result property="nonFat" column="non_fat" /> <result property="nonFat" column="non_fat" />
<result property="acidity" column="acidity" /> <result property="acidity" column="acidity" />
<result property="bacterialColony1" column="bacterial_colony_1" /> <result property="bacterialColony1" column="bacterial_colony_1" />
<result property="bacterialColony2" column="bacterial_colony_2" /> <result property="bacterialColony2" column="bacterial_colony_2" />
<result property="bacterialColony3" column="bacterial_colony_3" /> <result property="bacterialColony3" column="bacterial_colony_3" />
<result property="bacterialColony4" column="bacterial_colony_4" /> <result property="bacterialColony4" column="bacterial_colony_4" />
<result property="bacterialColony5" column="bacterial_colony_5" /> <result property="bacterialColony5" column="bacterial_colony_5" />
<result property="coli" column="coli" /> <result property="coli" column="coli" />
<result property="lactoferrin" column="lactoferrin" /> <result property="lactoferrin" column="lactoferrin" />
<result property="ig" column="ig" /> <result property="ig" column="ig" />
<result property="commnet" column="commnet" /> <result property="commnet" column="commnet" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
</resultMap> </resultMap>
<sql id="selectNpFreshMilkInspVo"> <sql id="selectNpFreshMilkInspVo">
select id, source, datetime, fat, protein, non_fat, acidity, bacterial_colony_1, bacterial_colony_2, bacterial_colony_3, bacterial_colony_4, bacterial_colony_5, coli, lactoferrin, ig, commnet, create_by, create_time from np_fresh_milk_insp SELECT
id, source, datetime, fat, protein, non_fat, acidity,
bacterial_colony_1, bacterial_colony_2, bacterial_colony_3,
bacterial_colony_4, bacterial_colony_5, coli, lactoferrin,
ig, commnet, create_by, create_time
FROM np_fresh_milk_insp
</sql> </sql>
<!-- 查询列表(已修改为只按来源和日期查询) -->
<select id="selectNpFreshMilkInspList" parameterType="NpFreshMilkInsp" resultMap="NpFreshMilkInspResult"> <select id="selectNpFreshMilkInspList" parameterType="NpFreshMilkInsp" resultMap="NpFreshMilkInspResult">
<include refid="selectNpFreshMilkInspVo"/> <include refid="selectNpFreshMilkInspVo"/>
<where> <where>
<if test="source != null and source != ''"> and source = #{source}</if> <if test="source != null and source != ''">
<if test="datetime != null "> and datetime = #{datetime}</if> AND source LIKE CONCAT('%', #{source}, '%')
<if test="fat != null "> and fat = #{fat}</if> </if>
<if test="protein != null "> and protein = #{protein}</if> <if test="datetime != null">
<if test="nonFat != null "> and non_fat = #{nonFat}</if> AND datetime = #{datetime}
<if test="acidity != null "> and acidity = #{acidity}</if> </if>
<if test="bacterialColony1 != null "> and bacterial_colony_1 = #{bacterialColony1}</if>
<if test="bacterialColony2 != null "> and bacterial_colony_2 = #{bacterialColony2}</if>
<if test="bacterialColony3 != null "> and bacterial_colony_3 = #{bacterialColony3}</if>
<if test="bacterialColony4 != null "> and bacterial_colony_4 = #{bacterialColony4}</if>
<if test="bacterialColony5 != null "> and bacterial_colony_5 = #{bacterialColony5}</if>
<if test="coli != null "> and coli = #{coli}</if>
<if test="lactoferrin != null "> and lactoferrin = #{lactoferrin}</if>
<if test="ig != null "> and ig = #{ig}</if>
<if test="commnet != null and commnet != ''"> and commnet = #{commnet}</if>
</where> </where>
</select> </select>
<!-- 根据ID查询 -->
<select id="selectNpFreshMilkInspById" parameterType="Long" resultMap="NpFreshMilkInspResult"> <select id="selectNpFreshMilkInspById" parameterType="Long" resultMap="NpFreshMilkInspResult">
<include refid="selectNpFreshMilkInspVo"/> <include refid="selectNpFreshMilkInspVo"/>
where id = #{id} WHERE id = #{id}
</select> </select>
<!-- 新增 -->
<insert id="insertNpFreshMilkInsp" parameterType="NpFreshMilkInsp" useGeneratedKeys="true" keyProperty="id"> <insert id="insertNpFreshMilkInsp" parameterType="NpFreshMilkInsp" useGeneratedKeys="true" keyProperty="id">
insert into np_fresh_milk_insp INSERT INTO np_fresh_milk_insp
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="source != null">source,</if> <if test="source != null">source,</if>
<if test="datetime != null">datetime,</if> <if test="datetime != null">datetime,</if>
@ -75,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="commnet != null">commnet,</if> <if test="commnet != null">commnet,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="source != null">#{source},</if> <if test="source != null">#{source},</if>
<if test="datetime != null">#{datetime},</if> <if test="datetime != null">#{datetime},</if>
@ -94,11 +93,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="commnet != null">#{commnet},</if> <if test="commnet != null">#{commnet},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
</trim> </trim>
</insert> </insert>
<!-- 修改 -->
<update id="updateNpFreshMilkInsp" parameterType="NpFreshMilkInsp"> <update id="updateNpFreshMilkInsp" parameterType="NpFreshMilkInsp">
update np_fresh_milk_insp UPDATE np_fresh_milk_insp
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="source != null">source = #{source},</if> <if test="source != null">source = #{source},</if>
<if test="datetime != null">datetime = #{datetime},</if> <if test="datetime != null">datetime = #{datetime},</if>
@ -115,18 +115,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="lactoferrin != null">lactoferrin = #{lactoferrin},</if> <if test="lactoferrin != null">lactoferrin = #{lactoferrin},</if>
<if test="ig != null">ig = #{ig},</if> <if test="ig != null">ig = #{ig},</if>
<if test="commnet != null">commnet = #{commnet},</if> <if test="commnet != null">commnet = #{commnet},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim> </trim>
where id = #{id} WHERE id = #{id}
</update> </update>
<!-- 单个删除 -->
<delete id="deleteNpFreshMilkInspById" parameterType="Long"> <delete id="deleteNpFreshMilkInspById" parameterType="Long">
delete from np_fresh_milk_insp where id = #{id} DELETE FROM np_fresh_milk_insp WHERE id = #{id}
</delete> </delete>
<!-- 批量删除 -->
<delete id="deleteNpFreshMilkInspByIds" parameterType="String"> <delete id="deleteNpFreshMilkInspByIds" parameterType="String">
delete from np_fresh_milk_insp where id in DELETE FROM np_fresh_milk_insp WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

View File

@ -26,7 +26,11 @@
</resultMap> </resultMap>
<sql id="selectNpYogurtInspVo"> <sql id="selectNpYogurtInspVo">
select id, source, datetime, fat, protein, non_fat, acidity, bacterial_colony_1, bacterial_clony_2, bacterial_clony_3, bacterial_clony_4, bacterial_clony_5, yeast, mould, lacto, comment, create_by, create_time from np_yogurt_insp select id, source, datetime, fat, protein, non_fat,
acidity, bacterial_colony_1, bacterial_clony_2,
bacterial_clony_3, bacterial_clony_4, bacterial_clony_5,
yeast, mould, lacto, comment, create_by, create_time
from np_yogurt_insp
</sql> </sql>
<select id="selectNpYogurtInspList" parameterType="NpYogurtInsp" resultMap="NpYogurtInspResult"> <select id="selectNpYogurtInspList" parameterType="NpYogurtInsp" resultMap="NpYogurtInspResult">