Merge remote-tracking branch 'origin/main'

This commit is contained in:
zyk 2025-07-18 14:32:23 +08:00
commit b88c7fc95a
43 changed files with 1925 additions and 442 deletions

1
.gitignore vendored
View File

@ -45,3 +45,4 @@ nbdist/
!*/build/*.java !*/build/*.java
!*/build/*.html !*/build/*.html
!*/build/*.xml !*/build/*.xml
/zhyc-module/src/main/java/com/zhyc/module/group_management/service/impl/GroupServiceImpl.java

View File

@ -23,6 +23,10 @@
<version>1.18.38</version> <!-- 使用最新版本 --> <version>1.18.38</version> <!-- 使用最新版本 -->
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -28,7 +28,7 @@ public class SwPrescription extends BaseEntity
private String name; private String name;
/** 类型(免疫/保健/驱虫/消毒/疾病治疗) */ /** 类型(免疫/保健/驱虫/消毒/疾病治疗) */
@Excel(name = "类型", readConverterExp = "=疫/保健/驱虫/消毒/疾病治疗") @Excel(name = "类型", readConverterExp = "疫/保健/驱虫/消毒/疾病治疗")
private Integer persType; private Integer persType;
/** 备注 */ /** 备注 */

View File

@ -1,7 +1,11 @@
package com.zhyc.module.biosafety.domain; package com.zhyc.module.biosafety.domain;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
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;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
@ -13,6 +17,7 @@ import com.zhyc.common.core.domain.BaseEntity;
* @author ruoyi * @author ruoyi
* @date 2025-07-15 * @date 2025-07-15
*/ */
@Data
public class Treatment extends BaseEntity public class Treatment extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -80,204 +85,11 @@ public class Treatment extends BaseEntity
@Excel(name = "药品使用记录id") @Excel(name = "药品使用记录id")
private Long usageId; private Long usageId;
// 药品使用
private List<SwMedicineUsageDetails> usageDetails;
/** 备注 */ /** 备注 */
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDiagId(Long diagId)
{
this.diagId = diagId;
}
public Long getDiagId()
{
return diagId;
}
public void setSheepId(Long sheepId)
{
this.sheepId = sheepId;
}
public Long getSheepId()
{
return sheepId;
}
public void setVariety(String variety)
{
this.variety = variety;
}
public String getVariety()
{
return variety;
}
public void setSheepType(String sheepType)
{
this.sheepType = sheepType;
}
public String getSheepType()
{
return sheepType;
}
public void setMonthAge(Long monthAge)
{
this.monthAge = monthAge;
}
public Long getMonthAge()
{
return monthAge;
}
public void setGender(String gender)
{
this.gender = gender;
}
public String getGender()
{
return gender;
}
public void setParity(Long parity)
{
this.parity = parity;
}
public Long getParity()
{
return parity;
}
public void setBreed(String breed)
{
this.breed = breed;
}
public String getBreed()
{
return breed;
}
public void setLactDay(Long lactDay)
{
this.lactDay = lactDay;
}
public Long getLactDay()
{
return lactDay;
}
public void setGestDay(Long gestDay)
{
this.gestDay = gestDay;
}
public Long getGestDay()
{
return gestDay;
}
public void setDatetime(Date datetime)
{
this.datetime = datetime;
}
public Date getDatetime()
{
return datetime;
}
public void setDiseaseId(Long diseaseId)
{
this.diseaseId = diseaseId;
}
public Long getDiseaseId()
{
return diseaseId;
}
public void setDiseasePid(String diseasePid)
{
this.diseasePid = diseasePid;
}
public String getDiseasePid()
{
return diseasePid;
}
public void setVeterinary(String veterinary)
{
this.veterinary = veterinary;
}
public String getVeterinary()
{
return veterinary;
}
public void setUsageId(Long usageId)
{
this.usageId = usageId;
}
public Long getUsageId()
{
return usageId;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("diagId", getDiagId())
.append("sheepId", getSheepId())
.append("variety", getVariety())
.append("sheepType", getSheepType())
.append("monthAge", getMonthAge())
.append("gender", getGender())
.append("parity", getParity())
.append("breed", getBreed())
.append("lactDay", getLactDay())
.append("gestDay", getGestDay())
.append("datetime", getDatetime())
.append("diseaseId", getDiseaseId())
.append("diseasePid", getDiseasePid())
.append("veterinary", getVeterinary())
.append("usageId", getUsageId())
.append("comment", getComment())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
} }

View File

@ -2,11 +2,14 @@ package com.zhyc.module.biosafety.service.impl;
import java.util.List; import java.util.List;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.domain.SwPrescription;
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.TreatmentMapper; import com.zhyc.module.biosafety.mapper.TreatmentMapper;
import com.zhyc.module.biosafety.domain.Treatment; import com.zhyc.module.biosafety.domain.Treatment;
import com.zhyc.module.biosafety.service.ITreatmentService; import com.zhyc.module.biosafety.service.ITreatmentService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 治疗记录Service业务层处理 * 治疗记录Service业务层处理
@ -19,6 +22,8 @@ public class TreatmentServiceImpl implements ITreatmentService
{ {
@Autowired @Autowired
private TreatmentMapper treatmentMapper; private TreatmentMapper treatmentMapper;
@Autowired
private SwMedicineUsageServiceImpl medicineUsageService;
/** /**
* 查询治疗记录 * 查询治疗记录
@ -51,8 +56,15 @@ public class TreatmentServiceImpl implements ITreatmentService
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional
public int insertTreatment(Treatment treatment) public int insertTreatment(Treatment treatment)
{ {
SwMedicineUsage medicineUsage = new SwMedicineUsage();
medicineUsage.setName("羊只治疗");
medicineUsage.setUseType("4");
// 药品使用记录
medicineUsage.setSwMedicineUsageDetailsList(treatment.getUsageDetails());
medicineUsageService.insertSwMedicineUsage(medicineUsage);
treatment.setCreateTime(DateUtils.getNowDate()); treatment.setCreateTime(DateUtils.getNowDate());
return treatmentMapper.insertTreatment(treatment); return treatmentMapper.insertTreatment(treatment);
} }

View File

@ -0,0 +1,104 @@
package com.zhyc.module.dairyProducts.freshMilkTest.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.dairyProducts.freshMilkTest.domain.NpFreshMilkInsp;
import com.zhyc.module.dairyProducts.freshMilkTest.service.INpFreshMilkInspService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 鲜奶生产成品检验记录Controller
*
* @author ruoyi
* @date 2025-07-18
*/
@RestController
@RequestMapping("/freshMilkTest/freshMilkTest")
public class NpFreshMilkInspController extends BaseController
{
@Autowired
private INpFreshMilkInspService npFreshMilkInspService;
/**
* 查询鲜奶生产成品检验记录列表
*/
@PreAuthorize("@ss.hasPermi('freshMilkTest:freshMilkTest:list')")
@GetMapping("/list")
public TableDataInfo list(NpFreshMilkInsp npFreshMilkInsp)
{
startPage();
List<NpFreshMilkInsp> list = npFreshMilkInspService.selectNpFreshMilkInspList(npFreshMilkInsp);
return getDataTable(list);
}
/**
* 导出鲜奶生产成品检验记录列表
*/
@PreAuthorize("@ss.hasPermi('freshMilkTest:freshMilkTest:export')")
@Log(title = "鲜奶生产,成品检验记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, NpFreshMilkInsp npFreshMilkInsp)
{
List<NpFreshMilkInsp> list = npFreshMilkInspService.selectNpFreshMilkInspList(npFreshMilkInsp);
ExcelUtil<NpFreshMilkInsp> util = new ExcelUtil<NpFreshMilkInsp>(NpFreshMilkInsp.class);
util.exportExcel(response, list, "鲜奶生产,成品检验记录数据");
}
/**
* 获取鲜奶生产成品检验记录详细信息
*/
@PreAuthorize("@ss.hasPermi('freshMilkTest:freshMilkTest:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(npFreshMilkInspService.selectNpFreshMilkInspById(id));
}
/**
* 新增鲜奶生产成品检验记录
*/
@PreAuthorize("@ss.hasPermi('freshMilkTest:freshMilkTest:add')")
@Log(title = "鲜奶生产,成品检验记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody NpFreshMilkInsp npFreshMilkInsp)
{
return toAjax(npFreshMilkInspService.insertNpFreshMilkInsp(npFreshMilkInsp));
}
/**
* 修改鲜奶生产成品检验记录
*/
@PreAuthorize("@ss.hasPermi('freshMilkTest:freshMilkTest:edit')")
@Log(title = "鲜奶生产,成品检验记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody NpFreshMilkInsp npFreshMilkInsp)
{
return toAjax(npFreshMilkInspService.updateNpFreshMilkInsp(npFreshMilkInsp));
}
/**
* 删除鲜奶生产成品检验记录
*/
@PreAuthorize("@ss.hasPermi('freshMilkTest:freshMilkTest:remove')")
@Log(title = "鲜奶生产,成品检验记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(npFreshMilkInspService.deleteNpFreshMilkInspByIds(ids));
}
}

View File

@ -0,0 +1,267 @@
package com.zhyc.module.dairyProducts.freshMilkTest.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 鲜奶生产成品检验记录对象 np_fresh_milk_insp
*
* @author ruoyi
* @date 2025-07-18
*/
public class NpFreshMilkInsp extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 来源 */
@Excel(name = "来源")
private String source;
/** 检测日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "检测日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date datetime;
/** 脂肪g/100g */
@Excel(name = "脂肪g/100g")
private Double fat;
/** 蛋白质g/100g */
@Excel(name = "蛋白质g/100g")
private Double protein;
/** 非脂g/100g */
@Excel(name = "非脂g/100g")
private Double nonFat;
/** 酸度oT */
@Excel(name = "酸度oT")
private Double acidity;
/** 菌落总数CFU/ml_1 */
@Excel(name = "菌落总数CFU/ml_1")
private Double bacterialColony1;
/** 菌落总数CFU/ml_2 */
@Excel(name = "菌落总数CFU/ml_2")
private Double bacterialColony2;
/** 菌落总数CFU/ml_3 */
@Excel(name = "菌落总数CFU/ml_3")
private Double bacterialColony3;
/** 菌落总数CFU/ml_4 */
@Excel(name = "菌落总数CFU/ml_4")
private Double bacterialColony4;
/** 菌落总数CFU/ml_5 */
@Excel(name = "菌落总数CFU/ml_5")
private Double bacterialColony5;
/** 大肠菌群CFU/ml */
@Excel(name = "大肠菌群CFU/ml")
private Double coli;
/** 乳铁蛋白mg/L */
@Excel(name = "乳铁蛋白", readConverterExp = "m=g/L")
private Double lactoferrin;
/** 免疫球蛋白mg/l */
@Excel(name = "免疫球蛋白", readConverterExp = "m=g/l")
private Double ig;
/** 备注 */
@Excel(name = "备注")
private String commnet;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSource(String source)
{
this.source = source;
}
public String getSource()
{
return source;
}
public void setDatetime(Date datetime)
{
this.datetime = datetime;
}
public Date getDatetime()
{
return datetime;
}
public void setFat(Double fat)
{
this.fat = fat;
}
public Double getFat()
{
return fat;
}
public void setProtein(Double protein)
{
this.protein = protein;
}
public Double getProtein()
{
return protein;
}
public void setNonFat(Double nonFat)
{
this.nonFat = nonFat;
}
public Double getNonFat()
{
return nonFat;
}
public void setAcidity(Double acidity)
{
this.acidity = acidity;
}
public Double getAcidity()
{
return acidity;
}
public void setBacterialColony1(Double bacterialColony1)
{
this.bacterialColony1 = bacterialColony1;
}
public Double getBacterialColony1()
{
return bacterialColony1;
}
public void setBacterialColony2(Double bacterialColony2)
{
this.bacterialColony2 = bacterialColony2;
}
public Double getBacterialColony2()
{
return bacterialColony2;
}
public void setBacterialColony3(Double bacterialColony3)
{
this.bacterialColony3 = bacterialColony3;
}
public Double getBacterialColony3()
{
return bacterialColony3;
}
public void setBacterialColony4(Double bacterialColony4)
{
this.bacterialColony4 = bacterialColony4;
}
public Double getBacterialColony4()
{
return bacterialColony4;
}
public void setBacterialColony5(Double bacterialColony5)
{
this.bacterialColony5 = bacterialColony5;
}
public Double getBacterialColony5()
{
return bacterialColony5;
}
public void setColi(Double coli)
{
this.coli = coli;
}
public Double getColi()
{
return coli;
}
public void setLactoferrin(Double lactoferrin)
{
this.lactoferrin = lactoferrin;
}
public Double getLactoferrin()
{
return lactoferrin;
}
public void setIg(Double ig)
{
this.ig = ig;
}
public Double getIg()
{
return ig;
}
public void setCommnet(String commnet)
{
this.commnet = commnet;
}
public String getCommnet()
{
return commnet;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("source", getSource())
.append("datetime", getDatetime())
.append("fat", getFat())
.append("protein", getProtein())
.append("nonFat", getNonFat())
.append("acidity", getAcidity())
.append("bacterialColony1", getBacterialColony1())
.append("bacterialColony2", getBacterialColony2())
.append("bacterialColony3", getBacterialColony3())
.append("bacterialColony4", getBacterialColony4())
.append("bacterialColony5", getBacterialColony5())
.append("coli", getColi())
.append("lactoferrin", getLactoferrin())
.append("ig", getIg())
.append("commnet", getCommnet())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.dairyProducts.freshMilkTest.mapper;
import java.util.List;
import com.zhyc.module.dairyProducts.freshMilkTest.domain.NpFreshMilkInsp;
/**
* 鲜奶生产成品检验记录Mapper接口
*
* @author ruoyi
* @date 2025-07-18
*/
public interface NpFreshMilkInspMapper
{
/**
* 查询鲜奶生产成品检验记录
*
* @param id 鲜奶生产成品检验记录主键
* @return 鲜奶生产成品检验记录
*/
public NpFreshMilkInsp selectNpFreshMilkInspById(Long id);
/**
* 查询鲜奶生产成品检验记录列表
*
* @param npFreshMilkInsp 鲜奶生产成品检验记录
* @return 鲜奶生产成品检验记录集合
*/
public List<NpFreshMilkInsp> selectNpFreshMilkInspList(NpFreshMilkInsp npFreshMilkInsp);
/**
* 新增鲜奶生产成品检验记录
*
* @param npFreshMilkInsp 鲜奶生产成品检验记录
* @return 结果
*/
public int insertNpFreshMilkInsp(NpFreshMilkInsp npFreshMilkInsp);
/**
* 修改鲜奶生产成品检验记录
*
* @param npFreshMilkInsp 鲜奶生产成品检验记录
* @return 结果
*/
public int updateNpFreshMilkInsp(NpFreshMilkInsp npFreshMilkInsp);
/**
* 删除鲜奶生产成品检验记录
*
* @param id 鲜奶生产成品检验记录主键
* @return 结果
*/
public int deleteNpFreshMilkInspById(Long id);
/**
* 批量删除鲜奶生产成品检验记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteNpFreshMilkInspByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.dairyProducts.freshMilkTest.service;
import java.util.List;
import com.zhyc.module.dairyProducts.freshMilkTest.domain.NpFreshMilkInsp;
/**
* 鲜奶生产成品检验记录Service接口
*
* @author ruoyi
* @date 2025-07-18
*/
public interface INpFreshMilkInspService
{
/**
* 查询鲜奶生产成品检验记录
*
* @param id 鲜奶生产成品检验记录主键
* @return 鲜奶生产成品检验记录
*/
public NpFreshMilkInsp selectNpFreshMilkInspById(Long id);
/**
* 查询鲜奶生产成品检验记录列表
*
* @param npFreshMilkInsp 鲜奶生产成品检验记录
* @return 鲜奶生产成品检验记录集合
*/
public List<NpFreshMilkInsp> selectNpFreshMilkInspList(NpFreshMilkInsp npFreshMilkInsp);
/**
* 新增鲜奶生产成品检验记录
*
* @param npFreshMilkInsp 鲜奶生产成品检验记录
* @return 结果
*/
public int insertNpFreshMilkInsp(NpFreshMilkInsp npFreshMilkInsp);
/**
* 修改鲜奶生产成品检验记录
*
* @param npFreshMilkInsp 鲜奶生产成品检验记录
* @return 结果
*/
public int updateNpFreshMilkInsp(NpFreshMilkInsp npFreshMilkInsp);
/**
* 批量删除鲜奶生产成品检验记录
*
* @param ids 需要删除的鲜奶生产成品检验记录主键集合
* @return 结果
*/
public int deleteNpFreshMilkInspByIds(Long[] ids);
/**
* 删除鲜奶生产成品检验记录信息
*
* @param id 鲜奶生产成品检验记录主键
* @return 结果
*/
public int deleteNpFreshMilkInspById(Long id);
}

View File

@ -0,0 +1,95 @@
package com.zhyc.module.dairyProducts.freshMilkTest.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.dairyProducts.freshMilkTest.mapper.NpFreshMilkInspMapper;
import com.zhyc.module.dairyProducts.freshMilkTest.domain.NpFreshMilkInsp;
import com.zhyc.module.dairyProducts.freshMilkTest.service.INpFreshMilkInspService;
/**
* 鲜奶生产成品检验记录Service业务层处理
*
* @author ruoyi
* @date 2025-07-18
*/
@Service
public class NpFreshMilkInspServiceImpl implements INpFreshMilkInspService
{
@Autowired
private NpFreshMilkInspMapper npFreshMilkInspMapper;
/**
* 查询鲜奶生产成品检验记录
*
* @param id 鲜奶生产成品检验记录主键
* @return 鲜奶生产成品检验记录
*/
@Override
public NpFreshMilkInsp selectNpFreshMilkInspById(Long id)
{
return npFreshMilkInspMapper.selectNpFreshMilkInspById(id);
}
/**
* 查询鲜奶生产成品检验记录列表
*
* @param npFreshMilkInsp 鲜奶生产成品检验记录
* @return 鲜奶生产成品检验记录
*/
@Override
public List<NpFreshMilkInsp> selectNpFreshMilkInspList(NpFreshMilkInsp npFreshMilkInsp)
{
return npFreshMilkInspMapper.selectNpFreshMilkInspList(npFreshMilkInsp);
}
/**
* 新增鲜奶生产成品检验记录
*
* @param npFreshMilkInsp 鲜奶生产成品检验记录
* @return 结果
*/
@Override
public int insertNpFreshMilkInsp(NpFreshMilkInsp npFreshMilkInsp)
{
npFreshMilkInsp.setCreateTime(DateUtils.getNowDate());
return npFreshMilkInspMapper.insertNpFreshMilkInsp(npFreshMilkInsp);
}
/**
* 修改鲜奶生产成品检验记录
*
* @param npFreshMilkInsp 鲜奶生产成品检验记录
* @return 结果
*/
@Override
public int updateNpFreshMilkInsp(NpFreshMilkInsp npFreshMilkInsp)
{
return npFreshMilkInspMapper.updateNpFreshMilkInsp(npFreshMilkInsp);
}
/**
* 批量删除鲜奶生产成品检验记录
*
* @param ids 需要删除的鲜奶生产成品检验记录主键
* @return 结果
*/
@Override
public int deleteNpFreshMilkInspByIds(Long[] ids)
{
return npFreshMilkInspMapper.deleteNpFreshMilkInspByIds(ids);
}
/**
* 删除鲜奶生产成品检验记录信息
*
* @param id 鲜奶生产成品检验记录主键
* @return 结果
*/
@Override
public int deleteNpFreshMilkInspById(Long id)
{
return npFreshMilkInspMapper.deleteNpFreshMilkInspById(id);
}
}

View File

@ -0,0 +1,104 @@
package com.zhyc.module.dairyProducts.yogurtTest.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.module.dairyProducts.yogurtTest.domain.NpYogurtInsp;
import com.zhyc.module.dairyProducts.yogurtTest.service.INpYogurtInspService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 酸奶生产成品检疫记录Controller
*
* @author ruoyi
* @date 2025-07-17
*/
@RestController
@RequestMapping("/yogurtTest/yogurtTest")
public class NpYogurtInspController extends BaseController
{
@Autowired
private INpYogurtInspService npYogurtInspService;
/**
* 查询酸奶生产成品检疫记录列表
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:list')")
@GetMapping("/list")
public TableDataInfo list(NpYogurtInsp npYogurtInsp)
{
startPage();
List<NpYogurtInsp> list = npYogurtInspService.selectNpYogurtInspList(npYogurtInsp);
return getDataTable(list);
}
/**
* 导出酸奶生产成品检疫记录列表
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:export')")
@Log(title = "酸奶生产,成品检疫记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, NpYogurtInsp npYogurtInsp)
{
List<NpYogurtInsp> list = npYogurtInspService.selectNpYogurtInspList(npYogurtInsp);
ExcelUtil<NpYogurtInsp> util = new ExcelUtil<NpYogurtInsp>(NpYogurtInsp.class);
util.exportExcel(response, list, "酸奶生产,成品检疫记录数据");
}
/**
* 获取酸奶生产成品检疫记录详细信息
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(npYogurtInspService.selectNpYogurtInspById(id));
}
/**
* 新增酸奶生产成品检疫记录
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:add')")
@Log(title = "酸奶生产,成品检疫记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody NpYogurtInsp npYogurtInsp)
{
return toAjax(npYogurtInspService.insertNpYogurtInsp(npYogurtInsp));
}
/**
* 修改酸奶生产成品检疫记录
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:edit')")
@Log(title = "酸奶生产,成品检疫记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody NpYogurtInsp npYogurtInsp)
{
return toAjax(npYogurtInspService.updateNpYogurtInsp(npYogurtInsp));
}
/**
* 删除酸奶生产成品检疫记录
*/
@PreAuthorize("@ss.hasPermi('yogurtTest:yogurtTest:remove')")
@Log(title = "酸奶生产,成品检疫记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(npYogurtInspService.deleteNpYogurtInspByIds(ids));
}
}

View File

@ -0,0 +1,268 @@
package com.zhyc.module.dairyProducts.yogurtTest.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 酸奶生产成品检疫记录对象 np_yogurt_insp
*
* @author ruoyi
* @date 2025-07-17
*/
public class NpYogurtInsp extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 来源 */
@Excel(name = "来源")
private String source;
/** 检测日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "检测日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date datetime;
/** 脂肪g/100g */
@Excel(name = "脂肪g/100g")
private Double fat;
/** 蛋白质g/100g */
@Excel(name = "蛋白质g/100g")
private Double protein;
/** 非脂g/100g
*/
@Excel(name = "非脂g/100g")
private Double nonFat;
/** 酸度oT */
@Excel(name = "酸度oT")
private Double acidity;
/** 菌落总数CFU/g_1 */
@Excel(name = "菌落总数", readConverterExp = "C=FU/g")
private Double bacterialColony1;
/** 菌落总数CFU/g_2 */
@Excel(name = "菌落总数", readConverterExp = "C=FU/g")
private Double bacterialClony2;
/** 菌落总数CFU/g_3 */
@Excel(name = "菌落总数", readConverterExp = "C=FU/g")
private Double bacterialClony3;
/** 菌落总数CFU/g_4 */
@Excel(name = "菌落总数", readConverterExp = "C=FU/g")
private Double bacterialClony4;
/** 菌落总数CFU/g_5 */
@Excel(name = "菌落总数", readConverterExp = "C=FU/g")
private Double bacterialClony5;
/** 酵母菌(CFU/g) */
@Excel(name = "酵母菌(CFU/g)")
private Double yeast;
/** 霉菌CFU/g */
@Excel(name = "霉菌", readConverterExp = "C=FU/g")
private Double mould;
/** 乳酸菌数CFU/g */
@Excel(name = "乳酸菌数", readConverterExp = "C=FU/g")
private Double lacto;
/** 备注 */
@Excel(name = "备注")
private String comment;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSource(String source)
{
this.source = source;
}
public String getSource()
{
return source;
}
public void setDatetime(Date datetime)
{
this.datetime = datetime;
}
public Date getDatetime()
{
return datetime;
}
public void setFat(Double fat)
{
this.fat = fat;
}
public Double getFat()
{
return fat;
}
public void setProtein(Double protein)
{
this.protein = protein;
}
public Double getProtein()
{
return protein;
}
public void setNonFat(Double nonFat)
{
this.nonFat = nonFat;
}
public Double getNonFat()
{
return nonFat;
}
public void setAcidity(Double acidity)
{
this.acidity = acidity;
}
public Double getAcidity()
{
return acidity;
}
public void setBacterialColony1(Double bacterialColony1)
{
this.bacterialColony1 = bacterialColony1;
}
public Double getBacterialColony1()
{
return bacterialColony1;
}
public void setBacterialClony2(Double bacterialClony2)
{
this.bacterialClony2 = bacterialClony2;
}
public Double getBacterialClony2()
{
return bacterialClony2;
}
public void setBacterialClony3(Double bacterialClony3)
{
this.bacterialClony3 = bacterialClony3;
}
public Double getBacterialClony3()
{
return bacterialClony3;
}
public void setBacterialClony4(Double bacterialClony4)
{
this.bacterialClony4 = bacterialClony4;
}
public Double getBacterialClony4()
{
return bacterialClony4;
}
public void setBacterialClony5(Double bacterialClony5)
{
this.bacterialClony5 = bacterialClony5;
}
public Double getBacterialClony5()
{
return bacterialClony5;
}
public void setYeast(Double yeast)
{
this.yeast = yeast;
}
public Double getYeast()
{
return yeast;
}
public void setMould(Double mould)
{
this.mould = mould;
}
public Double getMould()
{
return mould;
}
public void setLacto(Double lacto)
{
this.lacto = lacto;
}
public Double getLacto()
{
return lacto;
}
public void setComment(String comment)
{
this.comment = comment;
}
public String getComment()
{
return comment;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("source", getSource())
.append("datetime", getDatetime())
.append("fat", getFat())
.append("protein", getProtein())
.append("nonFat", getNonFat())
.append("acidity", getAcidity())
.append("bacterialColony1", getBacterialColony1())
.append("bacterialClony2", getBacterialClony2())
.append("bacterialClony3", getBacterialClony3())
.append("bacterialClony4", getBacterialClony4())
.append("bacterialClony5", getBacterialClony5())
.append("yeast", getYeast())
.append("mould", getMould())
.append("lacto", getLacto())
.append("comment", getComment())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.dairyProducts.yogurtTest.mapper;
import java.util.List;
import com.zhyc.module.dairyProducts.yogurtTest.domain.NpYogurtInsp;
/**
* 酸奶生产成品检疫记录Mapper接口
*
* @author ruoyi
* @date 2025-07-17
*/
public interface NpYogurtInspMapper
{
/**
* 查询酸奶生产成品检疫记录
*
* @param id 酸奶生产成品检疫记录主键
* @return 酸奶生产成品检疫记录
*/
public NpYogurtInsp selectNpYogurtInspById(Long id);
/**
* 查询酸奶生产成品检疫记录列表
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 酸奶生产成品检疫记录集合
*/
public List<NpYogurtInsp> selectNpYogurtInspList(NpYogurtInsp npYogurtInsp);
/**
* 新增酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
public int insertNpYogurtInsp(NpYogurtInsp npYogurtInsp);
/**
* 修改酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
public int updateNpYogurtInsp(NpYogurtInsp npYogurtInsp);
/**
* 删除酸奶生产成品检疫记录
*
* @param id 酸奶生产成品检疫记录主键
* @return 结果
*/
public int deleteNpYogurtInspById(Long id);
/**
* 批量删除酸奶生产成品检疫记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteNpYogurtInspByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.dairyProducts.yogurtTest.service;
import java.util.List;
import com.zhyc.module.dairyProducts.yogurtTest.domain.NpYogurtInsp;
/**
* 酸奶生产成品检疫记录Service接口
*
* @author ruoyi
* @date 2025-07-17
*/
public interface INpYogurtInspService
{
/**
* 查询酸奶生产成品检疫记录
*
* @param id 酸奶生产成品检疫记录主键
* @return 酸奶生产成品检疫记录
*/
public NpYogurtInsp selectNpYogurtInspById(Long id);
/**
* 查询酸奶生产成品检疫记录列表
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 酸奶生产成品检疫记录集合
*/
public List<NpYogurtInsp> selectNpYogurtInspList(NpYogurtInsp npYogurtInsp);
/**
* 新增酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
public int insertNpYogurtInsp(NpYogurtInsp npYogurtInsp);
/**
* 修改酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
public int updateNpYogurtInsp(NpYogurtInsp npYogurtInsp);
/**
* 批量删除酸奶生产成品检疫记录
*
* @param ids 需要删除的酸奶生产成品检疫记录主键集合
* @return 结果
*/
public int deleteNpYogurtInspByIds(Long[] ids);
/**
* 删除酸奶生产成品检疫记录信息
*
* @param id 酸奶生产成品检疫记录主键
* @return 结果
*/
public int deleteNpYogurtInspById(Long id);
}

View File

@ -0,0 +1,95 @@
package com.zhyc.module.dairyProducts.yogurtTest.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.dairyProducts.yogurtTest.mapper.NpYogurtInspMapper;
import com.zhyc.module.dairyProducts.yogurtTest.domain.NpYogurtInsp;
import com.zhyc.module.dairyProducts.yogurtTest.service.INpYogurtInspService;
/**
* 酸奶生产成品检疫记录Service业务层处理
*
* @author ruoyi
* @date 2025-07-17
*/
@Service
public class NpYogurtInspServiceImpl implements INpYogurtInspService
{
@Autowired
private NpYogurtInspMapper npYogurtInspMapper;
/**
* 查询酸奶生产成品检疫记录
*
* @param id 酸奶生产成品检疫记录主键
* @return 酸奶生产成品检疫记录
*/
@Override
public NpYogurtInsp selectNpYogurtInspById(Long id)
{
return npYogurtInspMapper.selectNpYogurtInspById(id);
}
/**
* 查询酸奶生产成品检疫记录列表
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 酸奶生产成品检疫记录
*/
@Override
public List<NpYogurtInsp> selectNpYogurtInspList(NpYogurtInsp npYogurtInsp)
{
return npYogurtInspMapper.selectNpYogurtInspList(npYogurtInsp);
}
/**
* 新增酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
@Override
public int insertNpYogurtInsp(NpYogurtInsp npYogurtInsp)
{
npYogurtInsp.setCreateTime(DateUtils.getNowDate());
return npYogurtInspMapper.insertNpYogurtInsp(npYogurtInsp);
}
/**
* 修改酸奶生产成品检疫记录
*
* @param npYogurtInsp 酸奶生产成品检疫记录
* @return 结果
*/
@Override
public int updateNpYogurtInsp(NpYogurtInsp npYogurtInsp)
{
return npYogurtInspMapper.updateNpYogurtInsp(npYogurtInsp);
}
/**
* 批量删除酸奶生产成品检疫记录
*
* @param ids 需要删除的酸奶生产成品检疫记录主键
* @return 结果
*/
@Override
public int deleteNpYogurtInspByIds(Long[] ids)
{
return npYogurtInspMapper.deleteNpYogurtInspByIds(ids);
}
/**
* 删除酸奶生产成品检疫记录信息
*
* @param id 酸奶生产成品检疫记录主键
* @return 结果
*/
@Override
public int deleteNpYogurtInspById(Long id)
{
return npYogurtInspMapper.deleteNpYogurtInspById(id);
}
}

View File

@ -1,17 +1,14 @@
package com.zhyc.module.fileManagement.controller; package com.zhyc.module.fileManagement.controller;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zhyc.common.utils.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log; import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController; import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.core.domain.AjaxResult;
@ -46,6 +43,24 @@ public class BasSheepGroupMappingController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
@PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:list')")
@GetMapping("/listJoin")
public TableDataInfo list(
@RequestParam(required = false) Long sheepId,
@RequestParam(required = false) Long groupId,
@RequestParam(required = false) String bsManageTags) {
List<String> earList = null;
if (StringUtils.hasText(bsManageTags)) {
earList = Arrays.asList(bsManageTags.split("[,\\s]+"));
}
startPage();
List<Map<String,Object>> list = basSheepGroupMappingService
.selectBasSheepGroupMappingList(sheepId, groupId, earList);
return getDataTable(list);
}
/** /**
* 导出羊只分组关联列表 * 导出羊只分组关联列表
*/ */

View File

@ -1,8 +1,10 @@
package com.zhyc.module.fileManagement.mapper; package com.zhyc.module.fileManagement.mapper;
import java.util.List; import java.util.List;
import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping; import java.util.Map;
import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping;
import org.apache.ibatis.annotations.Param;
/** /**
* 羊只分组关联Mapper接口 * 羊只分组关联Mapper接口
* *
@ -27,6 +29,20 @@ public interface BasSheepGroupMappingMapper
*/ */
public List<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping); public List<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping);
/**
* 联表查询羊只分组关联列表支持耳号列表
*/
List<Map<String, Object>> selectBasSheepGroupMappingList(
@Param("sheepId") Long sheepId,
@Param("groupId") Long groupId,
@Param("bsManageTags") List<String> bsManageTags
);
/** /**
* 新增羊只分组关联 * 新增羊只分组关联
* *

View File

@ -1,6 +1,8 @@
package com.zhyc.module.fileManagement.service; package com.zhyc.module.fileManagement.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping; import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping;
/** /**
@ -27,6 +29,13 @@ public interface IBasSheepGroupMappingService
*/ */
public List<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping); public List<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping);
/**
* 联表查询羊只分组关联列表支持耳号列表
*/
List<Map<String, Object>> selectBasSheepGroupMappingList(Long sheepId, Long groupId, List<String> bsManageTags);
/** /**
* 新增羊只分组关联 * 新增羊只分组关联
* *
@ -58,6 +67,4 @@ public interface IBasSheepGroupMappingService
* @return 结果 * @return 结果
*/ */
public int deleteBasSheepGroupMappingById(Long id); public int deleteBasSheepGroupMappingById(Long id);
} }

View File

@ -1,6 +1,8 @@
package com.zhyc.module.fileManagement.service.impl; package com.zhyc.module.fileManagement.service.impl;
import java.util.List; import java.util.List;
import java.util.Map;
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.fileManagement.mapper.BasSheepGroupMappingMapper; import com.zhyc.module.fileManagement.mapper.BasSheepGroupMappingMapper;
@ -43,6 +45,13 @@ public class BasSheepGroupMappingServiceImpl implements IBasSheepGroupMappingSer
return basSheepGroupMappingMapper.selectBasSheepGroupMappingList(basSheepGroupMapping); return basSheepGroupMappingMapper.selectBasSheepGroupMappingList(basSheepGroupMapping);
} }
@Override
public List<Map<String, Object>> selectBasSheepGroupMappingList(
Long sheepId, Long groupId, List<String> bsManageTags) {
return basSheepGroupMappingMapper.selectBasSheepGroupMappingList(sheepId, groupId, bsManageTags);
}
/** /**
* 新增羊只分组关联 * 新增羊只分组关联
* *
@ -91,6 +100,4 @@ public class BasSheepGroupMappingServiceImpl implements IBasSheepGroupMappingSer
return basSheepGroupMappingMapper.deleteBasSheepGroupMappingById(id); return basSheepGroupMappingMapper.deleteBasSheepGroupMappingById(id);
} }
} }

View File

@ -5,12 +5,10 @@ import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType; import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.exception.ServiceException; import com.zhyc.common.exception.ServiceException;
import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.module.base.variety.domain.BasSheepVariety;
import com.zhyc.module.base.variety.service.IBasSheepVarietyService;
import com.zhyc.module.fileManagement.domain.DaSheepfold;
import com.zhyc.module.fileManagement.service.IDaSheepfoldService;
import com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep; import com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep;
import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService; import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService;
import com.zhyc.module.fileManagement.domain.DaSheepfold;
import com.zhyc.module.fileManagement.service.IDaSheepfoldService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -35,8 +33,6 @@ public class ScAddSheepController {
@Autowired @Autowired
private IDaSheepfoldService daSheepfoldMapper; private IDaSheepfoldService daSheepfoldMapper;
@Autowired
private IBasSheepVarietyService basSheepVarietyService;
//新增羊只验证 //新增羊只验证
@PreAuthorize("@ss.hasPermi('produce:add_sheep:add')") @PreAuthorize("@ss.hasPermi('produce:add_sheep:add')")
@Log(title = "新增", businessType = BusinessType.INSERT) @Log(title = "新增", businessType = BusinessType.INSERT)
@ -87,12 +83,7 @@ public class ScAddSheepController {
scAddSheep.setSheepfoldNameExcel(fold.getSheepfoldName()); scAddSheep.setSheepfoldNameExcel(fold.getSheepfoldName());
} }
} }
if (scAddSheep.getVarietyId() != null) {
BasSheepVariety variety = basSheepVarietyService.selectBasSheepVarietyById(scAddSheep.getVarietyId().longValue());
if (variety != null) {
scAddSheep.setVarietyName(variety.getVariety());
}
}
list.add(scAddSheep); list.add(scAddSheep);
util.exportExcel(response, list, "羊只信息"); util.exportExcel(response, list, "羊只信息");
} }

View File

@ -2,23 +2,20 @@ package com.zhyc.module.produce.manage_sheep.add_sheep.service.impl;
import com.zhyc.common.exception.ServiceException; import com.zhyc.common.exception.ServiceException;
import com.zhyc.common.utils.StringUtils; import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.base.variety.domain.BasSheepVariety;
import com.zhyc.module.base.variety.service.IBasSheepVarietyService;
import com.zhyc.module.fileManagement.domain.DaSheepfold;
import com.zhyc.module.fileManagement.mapper.DaSheepfoldMapper;
import com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep; import com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep;
import com.zhyc.module.produce.manage_sheep.add_sheep.mapper.ScAddSheepMapper; import com.zhyc.module.produce.manage_sheep.add_sheep.mapper.ScAddSheepMapper;
import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService; import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService;
import com.zhyc.module.produce.sheep.domain.BasSheep; import com.zhyc.module.produce.sheep.domain.BasSheep;
import com.zhyc.module.produce.sheep.mapper.BasSheepMapper;
import com.zhyc.module.produce.sheep.service.IBasSheepService; import com.zhyc.module.produce.sheep.service.IBasSheepService;
import com.zhyc.module.produce.sheep.service.impl.BasSheepServiceImpl;
import com.zhyc.module.fileManagement.domain.DaSheepfold;
import com.zhyc.module.fileManagement.mapper.DaSheepfoldMapper;
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 org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
public class ScAddSheepServiceImpl implements IScAddSheepService { public class ScAddSheepServiceImpl implements IScAddSheepService {
@ -32,9 +29,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
@Autowired @Autowired
private IBasSheepService basSheepService; private IBasSheepService basSheepService;
@Autowired
private IBasSheepVarietyService basSheepVarietyService;
@Override @Override
public boolean insertScAddSheep(ScAddSheep scAddSheep) { public boolean insertScAddSheep(ScAddSheep scAddSheep) {
// 1. 重复校验 // 1. 重复校验
@ -68,7 +62,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
basSheepService.insertBasSheep(bs); basSheepService.insertBasSheep(bs);
return true; return true;
} }
@Override @Override
public List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep) { public List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep) {
return scAddSheepMapper.selectScAddSheepList(scAddSheep); return scAddSheepMapper.selectScAddSheepList(scAddSheep);
@ -86,7 +79,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
/* ------------------ 导入:羊舍名称 → ID ------------------ */ /* ------------------ 导入:羊舍名称 → ID ------------------ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public String importSheep(List<ScAddSheep> list, boolean updateSupport, String operName) { public String importSheep(List<ScAddSheep> list, boolean updateSupport, String operName) {
if (list == null || list.isEmpty()) { if (list == null || list.isEmpty()) {
throw new ServiceException("导入数据不能为空!"); throw new ServiceException("导入数据不能为空!");
@ -95,58 +87,50 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
int success = 0, failure = 0; int success = 0, failure = 0;
StringBuilder failureMsg = new StringBuilder(); StringBuilder failureMsg = new StringBuilder();
// 1. 一次性加载全部品种和羊舍避免循环查库
Map<String, Long> varietyNameToIdMap = basSheepVarietyService
.selectBasSheepVarietyList(new BasSheepVariety())
.stream()
.collect(Collectors.toMap(
BasSheepVariety::getVariety,
BasSheepVariety::getId,
(existing, replacement) -> existing // 保留第一个
));
Map<String, Long> sheepfoldNameToIdMap = daSheepfoldMapper
.selectDaSheepfoldList(new DaSheepfold())
.stream()
.collect(Collectors.toMap(
DaSheepfold::getSheepfoldName,
DaSheepfold::getId,
(existing, replacement) -> existing // 保留第一个
));
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
ScAddSheep sheep = list.get(i); ScAddSheep sheep = list.get(i);
try { try {
// 2. 羊舍名称 ID /* 1. 羊舍名称 → ID */
if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) { if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) {
Long sheepfoldId = sheepfoldNameToIdMap.get(sheep.getSheepfoldNameExcel()); DaSheepfold param = new DaSheepfold();
if (sheepfoldId == null) { param.setSheepfoldName(sheep.getSheepfoldNameExcel());
throw new ServiceException("羊舍名称不存在:" + sheep.getSheepfoldNameExcel()); List<DaSheepfold> foldList = daSheepfoldMapper.selectDaSheepfoldList(param);
if (foldList == null || foldList.isEmpty()) {
failure++;
failureMsg.append("<br/>第")
.append(i + 1)
.append("行:羊舍名称不存在【")
.append(sheep.getSheepfoldNameExcel())
.append("");
continue;
} }
sheep.setSheepfold(sheepfoldId.intValue()); sheep.setSheepfold(foldList.get(0).getId().intValue());
} }
// 3. 品种名称 ID /* 2. 耳号非空校验 */
if (StringUtils.isNotBlank(sheep.getVarietyName())) {
Long varietyId = varietyNameToIdMap.get(sheep.getVarietyName());
if (varietyId == null) {
throw new ServiceException("品种名称不存在:" + sheep.getVarietyName());
}
sheep.setVarietyId(varietyId.intValue());
}
// 4. 耳号非空校验
if (StringUtils.isBlank(sheep.getEarNumber())) { if (StringUtils.isBlank(sheep.getEarNumber())) {
throw new ServiceException("耳号不能为空"); failure++;
failureMsg.append("<br/>第")
.append(i + 1)
.append("行:耳号不能为空");
continue;
} }
// 5. 耳号重复校验 /* 3. 耳号重复校验(增量导入核心) */
ScAddSheep exist = scAddSheepMapper.selectByEarNumber(sheep.getEarNumber()); ScAddSheep exist = scAddSheepMapper.selectByEarNumber(sheep.getEarNumber());
if (exist != null) { if (exist != null) {
if (!updateSupport) { failure++;
throw new ServiceException("耳号已存在:" + sheep.getEarNumber()); failureMsg.append("<br/>第")
.append(i + 1)
.append("行:耳号已存在【")
.append(sheep.getEarNumber())
.append("");
continue;
} }
sheep.setId(exist.getId());
/* 4. 插入或更新 */
if (updateSupport && sheep.getId() != null) {
sheep.setUpdateBy(operName); sheep.setUpdateBy(operName);
updateScAddSheep(sheep); updateScAddSheep(sheep);
} else { } else {
@ -156,7 +140,10 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
success++; success++;
} catch (Exception e) { } catch (Exception e) {
failure++; failure++;
failureMsg.append("<br/>第").append(i + 1).append("行:").append(e.getMessage()); failureMsg.append("<br/>第")
.append(i + 1)
.append("行:")
.append(e.getMessage());
} }
} }

View File

@ -31,8 +31,7 @@ import com.zhyc.common.core.page.TableDataInfo;
*/ */
@RestController @RestController
@RequestMapping("produce/manage_sheep/trans_group") @RequestMapping("produce/manage_sheep/trans_group")
public class ScTransGroupController extends BaseController public class ScTransGroupController extends BaseController {
{
@Autowired @Autowired
private IScTransGroupService scTransGroupService; private IScTransGroupService scTransGroupService;
@ -41,8 +40,7 @@ public class ScTransGroupController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('produce:trans_group:list')") @PreAuthorize("@ss.hasPermi('produce:trans_group:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(ScTransGroup scTransGroup) public TableDataInfo list(ScTransGroup scTransGroup) {
{
startPage(); startPage();
List<ScTransGroup> list = scTransGroupService.selectScTransGroupList(scTransGroup); List<ScTransGroup> list = scTransGroupService.selectScTransGroupList(scTransGroup);
return getDataTable(list); return getDataTable(list);
@ -65,8 +63,7 @@ public class ScTransGroupController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('produce:trans_group:query')") @PreAuthorize("@ss.hasPermi('produce:trans_group:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id) public AjaxResult getInfo(@PathVariable("id") Integer id) {
{
return success(scTransGroupService.selectScTransGroupById(id)); return success(scTransGroupService.selectScTransGroupById(id));
} }
@ -76,8 +73,7 @@ public class ScTransGroupController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:trans_group:add')") @PreAuthorize("@ss.hasPermi('produce:trans_group:add')")
@Log(title = "转群记录", businessType = BusinessType.INSERT) @Log(title = "转群记录", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ScTransGroup scTransGroup) public AjaxResult add(@RequestBody ScTransGroup scTransGroup) {
{
return toAjax(scTransGroupService.insertScTransGroup(scTransGroup)); return toAjax(scTransGroupService.insertScTransGroup(scTransGroup));
} }
@ -87,8 +83,7 @@ public class ScTransGroupController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:trans_group:edit')") @PreAuthorize("@ss.hasPermi('produce:trans_group:edit')")
@Log(title = "转群记录", businessType = BusinessType.UPDATE) @Log(title = "转群记录", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ScTransGroup scTransGroup) public AjaxResult edit(@RequestBody ScTransGroup scTransGroup) {
{
return toAjax(scTransGroupService.updateScTransGroup(scTransGroup)); return toAjax(scTransGroupService.updateScTransGroup(scTransGroup));
} }
@ -98,8 +93,7 @@ public class ScTransGroupController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:trans_group:remove')") @PreAuthorize("@ss.hasPermi('produce:trans_group:remove')")
@Log(title = "转群记录", businessType = BusinessType.DELETE) @Log(title = "转群记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids) public AjaxResult remove(@PathVariable Integer[] ids) {
{
return toAjax(scTransGroupService.deleteScTransGroupByIds(ids)); return toAjax(scTransGroupService.deleteScTransGroupByIds(ids));
} }
} }

View File

@ -18,32 +18,54 @@ import org.springframework.beans.factory.annotation.Autowired;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class ScTransGroup extends BaseEntity public class ScTransGroup extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /**
* $column.columnComment
*/
private Integer id; private Integer id;
/** 羊只id */ /**
* 羊只id
*/
@Excel(name = "羊只id") @Excel(name = "羊只id")
private Integer sheepId; private Integer sheepId;
/** 转入羊舍 */ /**
* 转入羊舍
*/
private String foldTo; private String foldTo;
/** 转出羊舍 */ /**
* 转出羊舍
*/
private String foldFrom; private String foldFrom;
/** 转出羊舍名称 */ /**
* 转出羊舍名称
*/
@Excel(name = "转出羊舍") @Excel(name = "转出羊舍")
private String foldFromName; private String foldFromName;
/** 转入羊舍名称 */ /**
* 转入羊舍名称
*/
@Excel(name = "转入羊舍") @Excel(name = "转入羊舍")
private String foldToName; private String foldToName;
/** 转群原因 */ /** 转群原因 */
/**
* 品种id
*/
private Long varietyId;
/**
* 品种名称联表查询返回非数据库字段
*/
@Excel(name = "品种")
private String varietyName;
/** 品种id */ /** 品种id */
private Long varietyId; private Long varietyId;
@ -52,25 +74,34 @@ public class ScTransGroup extends BaseEntity
private String varietyName; private String varietyName;
private Integer reason; private Integer reason;
/** 转群原因描述 用于导出*/ /**
* 转群原因描述 用于导出
*/
@Excel(name = "转群原因") @Excel(name = "转群原因")
private String reasonText; private String reasonText;
/** 技术员 */ /**
* 技术员
*/
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/** 状态 */ /**
* 状态
*/
private Integer status; private Integer status;
/** 状态描述 用于导出*/ /**
* 状态描述 用于导出
*/
@Excel(name = "状态") @Excel(name = "状态")
private String statusText; private String statusText;
/** 备注 */ /**
* 备注
*/
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
} }

View File

@ -1,6 +1,7 @@
package com.zhyc.module.produce.manage_sheep.trans_group.mapper; package com.zhyc.module.produce.manage_sheep.trans_group.mapper;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup; import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
/** /**
@ -9,8 +10,7 @@ import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
* @author ruoyi * @author ruoyi
* @date 2025-07-10 * @date 2025-07-10
*/ */
public interface ScTransGroupMapper public interface ScTransGroupMapper {
{
/** /**
* 查询转群记录 * 查询转群记录
* *

View File

@ -1,6 +1,7 @@
package com.zhyc.module.produce.manage_sheep.trans_group.service; package com.zhyc.module.produce.manage_sheep.trans_group.service;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup; import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
/** /**
@ -9,8 +10,7 @@ import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
* @author ruoyi * @author ruoyi
* @date 2025-07-10 * @date 2025-07-10
*/ */
public interface IScTransGroupService public interface IScTransGroupService {
{
/** /**
* 查询转群记录 * 查询转群记录
* *

View File

@ -17,38 +17,69 @@ import com.zhyc.common.core.domain.BaseEntity;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class ScTransitionInfo extends BaseEntity public class ScTransitionInfo extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** */ /**
*
*/
private Integer id; private Integer id;
/** 羊只id */ /**
* 羊只id
*/
@Excel(name = "羊只id") @Excel(name = "羊只id")
private Integer sheepId; private Integer sheepId;
/** 转入牧场 */ /**
* 品种id
*/
private Long varietyId;
/**
* 品种名称联表返回非数据库字段
*/
@Excel(name = "品种")
private String varietyName;
/**
* 转入牧场
*/
@Excel(name = "转入牧场") @Excel(name = "转入牧场")
private String transTo; private String transTo;
/** 当前牧场 */ /**
* 当前牧场
*/
@Excel(name = "当前牧场") @Excel(name = "当前牧场")
private String transFrom; private String transFrom;
/** 转场类型 */ /**
@Excel(name = "转场类型") * 转场类型
*/
private Integer transType; private Integer transType;
/** 技术员 */ /**
* 转场类型名称 只用于导出
*/
@Excel(name = "转场类型")
private String transTypeText;
/**
* 技术员
*/
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/** 状态 */ /**
* 状态
*/
@Excel(name = "状态") @Excel(name = "状态")
private Integer status; private Integer status;
/** 备注 */ /**
* 备注
*/
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;

View File

@ -77,9 +77,9 @@ public class ScFixHoofController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:fixHoof:add')") @PreAuthorize("@ss.hasPermi('produce:fixHoof:add')")
@Log(title = "修蹄", businessType = BusinessType.INSERT) @Log(title = "修蹄", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ScFixHoof scFixHoof) public AjaxResult add(@RequestBody ScFixHoof dto){
{ dto.setSheepId(scFixHoofService.findIdByManageTags(dto.getManageTags()).intValue());
return toAjax(scFixHoofService.insertScFixHoof(scFixHoof)); return toAjax(scFixHoofService.insertScFixHoof(dto));
} }
/** /**
@ -88,9 +88,9 @@ public class ScFixHoofController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:fixHoof:edit')") @PreAuthorize("@ss.hasPermi('produce:fixHoof:edit')")
@Log(title = "修蹄", businessType = BusinessType.UPDATE) @Log(title = "修蹄", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ScFixHoof scFixHoof) public AjaxResult edit(@RequestBody ScFixHoof dto){
{ dto.setSheepId(scFixHoofService.findIdByManageTags(dto.getManageTags()).intValue());
return toAjax(scFixHoofService.updateScFixHoof(scFixHoof)); return toAjax(scFixHoofService.updateScFixHoof(dto));
} }
/** /**

View File

@ -25,8 +25,11 @@ public class ScFixHoof extends BaseEntity
private Integer id; private Integer id;
/** 羊只id */ /** 羊只id */
@Excel(name = "羊只id")
private Integer sheepId; private Integer sheepId;
/** 管理耳号(仅用于接收参数/返回视图,不存库) */
@Excel(name = "管理耳号")
// @TableField(exist = false) // 非数据库字段
private String manageTags;
/** 羊舍id */ /** 羊舍id */
private Integer sheepfold; private Integer sheepfold;

View File

@ -1,7 +1,10 @@
package com.zhyc.module.produce.other.fixHoof.mapper; package com.zhyc.module.produce.other.fixHoof.mapper;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof; import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof;
import com.zhyc.module.produce.sheep.domain.BasSheep;
import org.apache.ibatis.annotations.Param;
/** /**
* 修蹄Mapper接口 * 修蹄Mapper接口
@ -9,8 +12,7 @@ import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof;
* @author ruoyi * @author ruoyi
* @date 2025-07-10 * @date 2025-07-10
*/ */
public interface ScFixHoofMapper public interface ScFixHoofMapper {
{
/** /**
* 查询修蹄 * 查询修蹄
* *
@ -58,4 +60,6 @@ public interface ScFixHoofMapper
* @return 结果 * @return 结果
*/ */
public int deleteScFixHoofByIds(Integer[] ids); public int deleteScFixHoofByIds(Integer[] ids);
} }

View File

@ -58,4 +58,13 @@ public interface IScFixHoofService
* @return 结果 * @return 结果
*/ */
public int deleteScFixHoofById(Integer id); public int deleteScFixHoofById(Integer id);
/**
* 根据管理耳号查询
* @param manageTags
* @return
*/
Long findIdByManageTags(String manageTags);
} }

View File

@ -1,12 +1,18 @@
package com.zhyc.module.produce.other.fixHoof.service.impl; package com.zhyc.module.produce.other.fixHoof.service.impl;
import java.util.List; import java.util.List;
import com.zhyc.common.exception.ServiceException;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof; import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof;
import com.zhyc.module.produce.other.fixHoof.mapper.ScFixHoofMapper; import com.zhyc.module.produce.other.fixHoof.mapper.ScFixHoofMapper;
import com.zhyc.module.produce.sheep.domain.BasSheep;
import com.zhyc.module.produce.sheep.mapper.BasSheepMapper;
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.produce.other.fixHoof.service.IScFixHoofService; import com.zhyc.module.produce.other.fixHoof.service.IScFixHoofService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 修蹄Service业务层处理 * 修蹄Service业务层处理
@ -15,11 +21,13 @@ import com.zhyc.module.produce.other.fixHoof.service.IScFixHoofService;
* @date 2025-07-10 * @date 2025-07-10
*/ */
@Service @Service
public class ScFixHoofServiceImpl implements IScFixHoofService public class ScFixHoofServiceImpl implements IScFixHoofService {
{
@Autowired @Autowired
private ScFixHoofMapper scFixHoofMapper; private ScFixHoofMapper scFixHoofMapper;
@Autowired
private BasSheepMapper basSheepMapper;
/** /**
* 查询修蹄 * 查询修蹄
* *
@ -27,8 +35,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 修蹄 * @return 修蹄
*/ */
@Override @Override
public ScFixHoof selectScFixHoofById(Integer id) public ScFixHoof selectScFixHoofById(Integer id) {
{
return scFixHoofMapper.selectScFixHoofById(id); return scFixHoofMapper.selectScFixHoofById(id);
} }
@ -39,8 +46,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 修蹄 * @return 修蹄
*/ */
@Override @Override
public List<ScFixHoof> selectScFixHoofList(ScFixHoof scFixHoof) public List<ScFixHoof> selectScFixHoofList(ScFixHoof scFixHoof) {
{
return scFixHoofMapper.selectScFixHoofList(scFixHoof); return scFixHoofMapper.selectScFixHoofList(scFixHoof);
} }
@ -51,8 +57,12 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertScFixHoof(ScFixHoof scFixHoof) public int insertScFixHoof(ScFixHoof scFixHoof) {
{ // 校验羊只是否存在
BasSheep sheep = basSheepMapper.selectBasSheepById(scFixHoof.getSheepId().longValue());
if (sheep == null) {
throw new ServiceException("该羊只ID不存在请检查后再添加");
}
scFixHoof.setCreateTime(DateUtils.getNowDate()); scFixHoof.setCreateTime(DateUtils.getNowDate());
return scFixHoofMapper.insertScFixHoof(scFixHoof); return scFixHoofMapper.insertScFixHoof(scFixHoof);
} }
@ -64,8 +74,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateScFixHoof(ScFixHoof scFixHoof) public int updateScFixHoof(ScFixHoof scFixHoof) {
{
return scFixHoofMapper.updateScFixHoof(scFixHoof); return scFixHoofMapper.updateScFixHoof(scFixHoof);
} }
@ -76,8 +85,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteScFixHoofByIds(Integer[] ids) public int deleteScFixHoofByIds(Integer[] ids) {
{
return scFixHoofMapper.deleteScFixHoofByIds(ids); return scFixHoofMapper.deleteScFixHoofByIds(ids);
} }
@ -88,8 +96,24 @@ public class ScFixHoofServiceImpl implements IScFixHoofService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteScFixHoofById(Integer id) public int deleteScFixHoofById(Integer id) {
{
return scFixHoofMapper.deleteScFixHoofById(id); return scFixHoofMapper.deleteScFixHoofById(id);
} }
/**
* 根据管理耳号查询
*/
@Override
public Long findIdByManageTags(String manageTags){
if(StringUtils.isBlank(manageTags))
throw new ServiceException("管理耳号不能为空");
BasSheep sheep = basSheepMapper.selectBasSheepByManageTags(manageTags.trim());
if(sheep == null)
throw new ServiceException("管理耳号不存在:" + manageTags);
return sheep.getId();
}
} }

View File

@ -1,20 +1,17 @@
package com.zhyc.module.produce.sheep.controller; package com.zhyc.module.produce.sheep.controller;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.produce.sheep.domain.BasSheep; import com.zhyc.module.produce.sheep.domain.BasSheep;
import com.zhyc.module.produce.sheep.mapper.BasSheepMapper;
import com.zhyc.module.produce.sheep.service.IBasSheepService; import com.zhyc.module.produce.sheep.service.IBasSheepService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhyc.common.annotation.Log; import com.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController; import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.core.domain.AjaxResult;
@ -35,6 +32,8 @@ public class BasSheepController extends BaseController
@Autowired @Autowired
private IBasSheepService basSheepService; private IBasSheepService basSheepService;
@Autowired
private BasSheepMapper basSheepMapper;
/** /**
* 查询羊只基本信息列表 * 查询羊只基本信息列表
*/ */
@ -102,4 +101,14 @@ public class BasSheepController extends BaseController
{ {
return toAjax(basSheepService.deleteBasSheepByIds(ids)); return toAjax(basSheepService.deleteBasSheepByIds(ids));
} }
@GetMapping("/byManageTags/{manageTags}")
public AjaxResult byManageTags(@PathVariable String manageTags){
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
return success(sheep);
}
} }

View File

@ -38,6 +38,7 @@ public class BasSheep extends BaseEntity
/** 羊舍id */ /** 羊舍id */
@Excel(name = "羊舍id") @Excel(name = "羊舍id")
private Long sheepfoldId; private Long sheepfoldId;
private String sheepfoldName;
/** 电子耳号 */ /** 电子耳号 */
@Excel(name = "电子耳号") @Excel(name = "电子耳号")

View File

@ -2,6 +2,7 @@ package com.zhyc.module.produce.sheep.mapper;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.sheep.domain.BasSheep; import com.zhyc.module.produce.sheep.domain.BasSheep;
import org.apache.ibatis.annotations.Param;
/** /**
* 羊只基本信息Mapper接口 * 羊只基本信息Mapper接口
@ -58,4 +59,12 @@ public interface BasSheepMapper
* @return 结果 * @return 结果
*/ */
public int deleteBasSheepByIds(Long[] ids); public int deleteBasSheepByIds(Long[] ids);
/**
* 根据管理耳号查询
*/
BasSheep selectBasSheepByManageTags(String manageTags);
} }

View File

@ -58,4 +58,6 @@ public interface IBasSheepService
* @return 结果 * @return 结果
*/ */
public int deleteBasSheepById(Long id); public int deleteBasSheepById(Long id);
BasSheep selectBasSheepByManageTags(String trim);
} }

View File

@ -93,4 +93,10 @@ public class BasSheepServiceImpl implements IBasSheepService
{ {
return basSheepMapper.deleteBasSheepById(id); return basSheepMapper.deleteBasSheepById(id);
} }
@Override
public BasSheep selectBasSheepByManageTags(String manageTags){
return basSheepMapper.selectBasSheepByManageTags(manageTags);
}
} }

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.dairyProducts.freshMilkTest.mapper.NpFreshMilkInspMapper">
<resultMap type="NpFreshMilkInsp" id="NpFreshMilkInspResult">
<result property="id" column="id" />
<result property="source" column="source" />
<result property="datetime" column="datetime" />
<result property="fat" column="fat" />
<result property="protein" column="protein" />
<result property="nonFat" column="non_fat" />
<result property="acidity" column="acidity" />
<result property="bacterialColony1" column="bacterial_colony_1" />
<result property="bacterialColony2" column="bacterial_colony_2" />
<result property="bacterialColony3" column="bacterial_colony_3" />
<result property="bacterialColony4" column="bacterial_colony_4" />
<result property="bacterialColony5" column="bacterial_colony_5" />
<result property="coli" column="coli" />
<result property="lactoferrin" column="lactoferrin" />
<result property="ig" column="ig" />
<result property="commnet" column="commnet" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<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
</sql>
<select id="selectNpFreshMilkInspList" parameterType="NpFreshMilkInsp" resultMap="NpFreshMilkInspResult">
<include refid="selectNpFreshMilkInspVo"/>
<where>
<if test="source != null and source != ''"> and source = #{source}</if>
<if test="datetime != null "> and datetime = #{datetime}</if>
<if test="fat != null "> and fat = #{fat}</if>
<if test="protein != null "> and protein = #{protein}</if>
<if test="nonFat != null "> and non_fat = #{nonFat}</if>
<if test="acidity != null "> and acidity = #{acidity}</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>
</select>
<select id="selectNpFreshMilkInspById" parameterType="Long" resultMap="NpFreshMilkInspResult">
<include refid="selectNpFreshMilkInspVo"/>
where id = #{id}
</select>
<insert id="insertNpFreshMilkInsp" parameterType="NpFreshMilkInsp" useGeneratedKeys="true" keyProperty="id">
insert into np_fresh_milk_insp
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="source != null">source,</if>
<if test="datetime != null">datetime,</if>
<if test="fat != null">fat,</if>
<if test="protein != null">protein,</if>
<if test="nonFat != null">non_fat,</if>
<if test="acidity != null">acidity,</if>
<if test="bacterialColony1 != null">bacterial_colony_1,</if>
<if test="bacterialColony2 != null">bacterial_colony_2,</if>
<if test="bacterialColony3 != null">bacterial_colony_3,</if>
<if test="bacterialColony4 != null">bacterial_colony_4,</if>
<if test="bacterialColony5 != null">bacterial_colony_5,</if>
<if test="coli != null">coli,</if>
<if test="lactoferrin != null">lactoferrin,</if>
<if test="ig != null">ig,</if>
<if test="commnet != null">commnet,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="source != null">#{source},</if>
<if test="datetime != null">#{datetime},</if>
<if test="fat != null">#{fat},</if>
<if test="protein != null">#{protein},</if>
<if test="nonFat != null">#{nonFat},</if>
<if test="acidity != null">#{acidity},</if>
<if test="bacterialColony1 != null">#{bacterialColony1},</if>
<if test="bacterialColony2 != null">#{bacterialColony2},</if>
<if test="bacterialColony3 != null">#{bacterialColony3},</if>
<if test="bacterialColony4 != null">#{bacterialColony4},</if>
<if test="bacterialColony5 != null">#{bacterialColony5},</if>
<if test="coli != null">#{coli},</if>
<if test="lactoferrin != null">#{lactoferrin},</if>
<if test="ig != null">#{ig},</if>
<if test="commnet != null">#{commnet},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateNpFreshMilkInsp" parameterType="NpFreshMilkInsp">
update np_fresh_milk_insp
<trim prefix="SET" suffixOverrides=",">
<if test="source != null">source = #{source},</if>
<if test="datetime != null">datetime = #{datetime},</if>
<if test="fat != null">fat = #{fat},</if>
<if test="protein != null">protein = #{protein},</if>
<if test="nonFat != null">non_fat = #{nonFat},</if>
<if test="acidity != null">acidity = #{acidity},</if>
<if test="bacterialColony1 != null">bacterial_colony_1 = #{bacterialColony1},</if>
<if test="bacterialColony2 != null">bacterial_colony_2 = #{bacterialColony2},</if>
<if test="bacterialColony3 != null">bacterial_colony_3 = #{bacterialColony3},</if>
<if test="bacterialColony4 != null">bacterial_colony_4 = #{bacterialColony4},</if>
<if test="bacterialColony5 != null">bacterial_colony_5 = #{bacterialColony5},</if>
<if test="coli != null">coli = #{coli},</if>
<if test="lactoferrin != null">lactoferrin = #{lactoferrin},</if>
<if test="ig != null">ig = #{ig},</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>
where id = #{id}
</update>
<delete id="deleteNpFreshMilkInspById" parameterType="Long">
delete from np_fresh_milk_insp where id = #{id}
</delete>
<delete id="deleteNpFreshMilkInspByIds" parameterType="String">
delete from np_fresh_milk_insp where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,125 @@
<?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.dairyProducts.yogurtTest.mapper.NpYogurtInspMapper">
<resultMap type="NpYogurtInsp" id="NpYogurtInspResult">
<result property="id" column="id" />
<result property="source" column="source" />
<result property="datetime" column="datetime" />
<result property="fat" column="fat" />
<result property="protein" column="protein" />
<result property="nonFat" column="non_fat" />
<result property="acidity" column="acidity" />
<result property="bacterialColony1" column="bacterial_colony_1" />
<result property="bacterialClony2" column="bacterial_clony_2" />
<result property="bacterialClony3" column="bacterial_clony_3" />
<result property="bacterialClony4" column="bacterial_clony_4" />
<result property="bacterialClony5" column="bacterial_clony_5" />
<result property="yeast" column="yeast" />
<result property="mould" column="mould" />
<result property="lacto" column="lacto" />
<result property="comment" column="comment" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<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
</sql>
<select id="selectNpYogurtInspList" parameterType="NpYogurtInsp" resultMap="NpYogurtInspResult">
<include refid="selectNpYogurtInspVo"/>
<where>
<if test="source != null and source != ''">
and source like concat('%', #{source}, '%')
</if>
<if test="datetime != null ">
and datetime = #{datetime}
</if>
</where>
</select>
<select id="selectNpYogurtInspById" parameterType="Long" resultMap="NpYogurtInspResult">
<include refid="selectNpYogurtInspVo"/>
where id = #{id}
</select>
<insert id="insertNpYogurtInsp" parameterType="NpYogurtInsp" useGeneratedKeys="true" keyProperty="id">
insert into np_yogurt_insp
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="source != null">source,</if>
<if test="datetime != null">datetime,</if>
<if test="fat != null">fat,</if>
<if test="protein != null">protein,</if>
<if test="nonFat != null">non_fat,</if>
<if test="acidity != null">acidity,</if>
<if test="bacterialColony1 != null">bacterial_colony_1,</if>
<if test="bacterialClony2 != null">bacterial_clony_2,</if>
<if test="bacterialClony3 != null">bacterial_clony_3,</if>
<if test="bacterialClony4 != null">bacterial_clony_4,</if>
<if test="bacterialClony5 != null">bacterial_clony_5,</if>
<if test="yeast != null">yeast,</if>
<if test="mould != null">mould,</if>
<if test="lacto != null">lacto,</if>
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="source != null">#{source},</if>
<if test="datetime != null">#{datetime},</if>
<if test="fat != null">#{fat},</if>
<if test="protein != null">#{protein},</if>
<if test="nonFat != null">#{nonFat},</if>
<if test="acidity != null">#{acidity},</if>
<if test="bacterialColony1 != null">#{bacterialColony1},</if>
<if test="bacterialClony2 != null">#{bacterialClony2},</if>
<if test="bacterialClony3 != null">#{bacterialClony3},</if>
<if test="bacterialClony4 != null">#{bacterialClony4},</if>
<if test="bacterialClony5 != null">#{bacterialClony5},</if>
<if test="yeast != null">#{yeast},</if>
<if test="mould != null">#{mould},</if>
<if test="lacto != null">#{lacto},</if>
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateNpYogurtInsp" parameterType="NpYogurtInsp">
update np_yogurt_insp
<trim prefix="SET" suffixOverrides=",">
<if test="source != null">source = #{source},</if>
<if test="datetime != null">datetime = #{datetime},</if>
<if test="fat != null">fat = #{fat},</if>
<if test="protein != null">protein = #{protein},</if>
<if test="nonFat != null">non_fat = #{nonFat},</if>
<if test="acidity != null">acidity = #{acidity},</if>
<if test="bacterialColony1 != null">bacterial_colony_1 = #{bacterialColony1},</if>
<if test="bacterialClony2 != null">bacterial_clony_2 = #{bacterialClony2},</if>
<if test="bacterialClony3 != null">bacterial_clony_3 = #{bacterialClony3},</if>
<if test="bacterialClony4 != null">bacterial_clony_4 = #{bacterialClony4},</if>
<if test="bacterialClony5 != null">bacterial_clony_5 = #{bacterialClony5},</if>
<if test="yeast != null">yeast = #{yeast},</if>
<if test="mould != null">mould = #{mould},</if>
<if test="lacto != null">lacto = #{lacto},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNpYogurtInspById" parameterType="Long">
delete from np_yogurt_insp where id = #{id}
</delete>
<delete id="deleteNpYogurtInspByIds" parameterType="String">
delete from np_yogurt_insp where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -14,14 +14,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, sheep_id, group_id from bas_sheep_group_mapping select id, sheep_id, group_id from bas_sheep_group_mapping
</sql> </sql>
<select id="selectBasSheepGroupMappingList" parameterType="BasSheepGroupMapping" resultMap="BasSheepGroupMappingResult"> <!-- <select id="selectBasSheepGroupMappingList" parameterType="BasSheepGroupMapping" resultMap="BasSheepGroupMappingResult">-->
<include refid="selectBasSheepGroupMappingVo"/> <!-- <include refid="selectBasSheepGroupMappingVo"/>-->
<!-- <where> -->
<!-- <if test="sheepId != null "> and sheep_id = #{sheepId}</if>-->
<!-- <if test="groupId != null "> and group_id = #{groupId}</if>-->
<!-- </where>-->
<!-- </select>-->
<select id="selectBasSheepGroupMappingList"
parameterType="map"
resultType="map"> <!-- 1. 返回 map 方便前端直接取值 -->
SELECT
m.id,
m.sheep_id,
m.group_id,
s.id AS bs_sheep_id,
s.bs_manage_tags,
s.variety,
s.gender,
s.name,
s.birthday,
s.parity,
s.month_age,
s.breed,
s.birth_weight,
s.weaning_weight,
s.current_weight,
s.father_manage_tags,
s.mother_manage_tags,
s.family
FROM bas_sheep_group_mapping m
JOIN sheep_file s ON s.id = m.sheep_id
<where> <where>
<if test="sheepId != null "> and sheep_id = #{sheepId}</if> <if test="sheepId != null"> AND m.sheep_id = #{sheepId}</if>
<if test="groupId != null "> and group_id = #{groupId}</if> <if test="groupId != null"> AND m.group_id = #{groupId}</if>
<if test="bsManageTags != null and bsManageTags.size > 0">
AND s.bs_manage_tags IN
<foreach collection="bsManageTags" item="bsManageTag " open="(" separator="," close=")">
#{bsManageTag}
</foreach>
</if>
</where> </where>
ORDER BY m.id
</select> </select>
<select id="selectBasSheepGroupMappingById" parameterType="Long" resultMap="BasSheepGroupMappingResult"> <select id="selectBasSheepGroupMappingById" parameterType="Long" resultMap="BasSheepGroupMappingResult">
<include refid="selectBasSheepGroupMappingVo"/> <include refid="selectBasSheepGroupMappingVo"/>
where id = #{id} where id = #{id}

View File

@ -1,45 +1,60 @@
<?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.produce.manage_sheep.transition_info.mapper.ScTransitionInfoMapper"> <mapper namespace="com.zhyc.module.produce.manage_sheep.transition_info.mapper.ScTransitionInfoMapper">
<resultMap type="ScTransitionInfo" id="ScTransitionInfoResult"> <resultMap type="ScTransitionInfo" id="ScTransitionInfoResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="sheepId" column="sheep_id" /> <result property="sheepId" column="sheep_id"/>
<result property="transTo" column="trans_to" /> <result property="varietyId" column="variety_id"/>
<result property="transFrom" column="trans_from" /> <result property="varietyName" column="varietyName"/>
<result property="transType" column="trans_type" /> <result property="transTo" column="trans_to"/>
<result property="technician" column="technician" /> <result property="transFrom" column="trans_from"/>
<result property="status" column="status" /> <result property="transType" column="trans_type"/>
<result property="comment" column="comment" /> <result property="transTypeText" column="trans_type_text"/>
<result property="createBy" column="create_by" /> <result property="technician" column="technician"/>
<result property="createTime" column="create_time" /> <result property="status" column="status"/>
<result property="comment" column="comment"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap> </resultMap>
<sql id="selectScTransitionInfoVo"> <sql id="selectScTransitionInfoVo">
select id, sheep_id, trans_to, trans_from, trans_type, technician, status, comment, create_by, create_time from sc_transition_info SELECT t.*, bv.variety AS varietyName,
CASE t.trans_type
WHEN 0 THEN '内部转场'
WHEN 1 THEN '跨场转场'
WHEN 2 THEN '销售转场'
ELSE '未知'
END AS trans_type_text
FROM sc_transition_info t
LEFT JOIN bas_sheep_variety bv ON t.variety_id = bv.id
</sql> </sql>
<select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult"> <select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult">
<include refid="selectScTransitionInfoVo"/> <include refid="selectScTransitionInfoVo"/>
<where> <where>
<if test="sheepId != null "> and sheep_id = #{sheepId}</if> <if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<if test="transTo != null and transTo != ''"> and trans_to = #{transTo}</if> <if test="varietyId != null">and t.variety_id = #{varietyId}</if>
<if test="transFrom != null and transFrom != ''"> and trans_from = #{transFrom}</if> <if test="transTo != null and transTo != ''">and trans_to = #{transTo}</if>
<if test="status != null "> and status = #{status}</if> <if test="transFrom != null and transFrom != ''">and trans_from = #{transFrom}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> <if test="status != null ">and status = #{status}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where> </where>
</select> </select>
<select id="selectScTransitionInfoById" parameterType="Integer" resultMap="ScTransitionInfoResult"> <select id="selectScTransitionInfoById" parameterType="Integer" resultMap="ScTransitionInfoResult">
<include refid="selectScTransitionInfoVo"/> <include refid="selectScTransitionInfoVo"/>
where id = #{id} WHERE t.id = #{id}
</select> </select>
<insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id">
insert into sc_transition_info insert into sc_transition_info
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if> <if test="sheepId != null">sheep_id,</if>
<if test="varietyId != null">variety_id,</if>
<if test="transTo != null and transTo != ''">trans_to,</if> <if test="transTo != null and transTo != ''">trans_to,</if>
<if test="transFrom != null and transFrom != ''">trans_from,</if> <if test="transFrom != null and transFrom != ''">trans_from,</if>
<if test="transType != null">trans_type,</if> <if test="transType != null">trans_type,</if>
@ -51,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if> <if test="sheepId != null">#{sheepId},</if>
<if test="varietyId != null">#{varietyId},</if>
<if test="transTo != null and transTo != ''">#{transTo},</if> <if test="transTo != null and transTo != ''">#{transTo},</if>
<if test="transFrom != null and transFrom != ''">#{transFrom},</if> <if test="transFrom != null and transFrom != ''">#{transFrom},</if>
<if test="transType != null">#{transType},</if> <if test="transType != null">#{transType},</if>
@ -66,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sc_transition_info update sc_transition_info
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if> <if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if>
<if test="transTo != null and transTo != ''">trans_to = #{transTo},</if> <if test="transTo != null and transTo != ''">trans_to = #{transTo},</if>
<if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if> <if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if>
<if test="transType != null">trans_type = #{transType},</if> <if test="transType != null">trans_type = #{transType},</if>
@ -79,7 +96,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteScTransitionInfoById" parameterType="Integer"> <delete id="deleteScTransitionInfoById" parameterType="Integer">
delete from sc_transition_info where id = #{id} delete
from sc_transition_info
where id = #{id}
</delete> </delete>
<delete id="deleteScTransitionInfoByIds" parameterType="String"> <delete id="deleteScTransitionInfoByIds" parameterType="String">

View File

@ -8,7 +8,6 @@
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/> <result property="sheepId" column="sheep_id"/>
<result property="sheepfold" column="sheepfold"/> <result property="sheepfold" column="sheepfold"/>
<result property="varietyId" column="variety_id"/>
<result property="sheepfoldName" column="sheepfoldName"/> <result property="sheepfoldName" column="sheepfoldName"/>
<result property="comment" column="comment"/> <result property="comment" column="comment"/>
<result property="technician" column="technician"/> <result property="technician" column="technician"/>
@ -21,15 +20,12 @@
fh.sheep_id, fh.sheep_id,
fh.sheepfold, fh.sheepfold,
sf.sheepfold_name as sheepfoldName, sf.sheepfold_name as sheepfoldName,
fh.variety_id,
bv.variety as varietyName,
fh.comment, fh.comment,
fh.technician, fh.technician,
fh.create_by, fh.create_by,
fh.create_time fh.create_time
from sc_fix_hoof fh from sc_fix_hoof fh
left join da_sheepfold sf on fh.sheepfold = sf.id left join da_sheepfold sf on fh.sheepfold = sf.id
left join bas_sheep_variety bv on fh.variety_id = bv.id
</sql> </sql>
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult"> <select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
@ -37,9 +33,6 @@
<where> <where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</if> <if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if> <if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
<if test="varietyId != null">
and fh.variety_id = #{varietyId}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime} and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
@ -51,24 +44,24 @@
where fh.id = #{id} where fh.id = #{id}
</select> </select>
<insert id="insertScFixHoof" parameterType="ScFixHoof" <insert id="insertScFixHoof" parameterType="ScFixHoof" useGeneratedKeys="true" keyProperty="id">
useGeneratedKeys="true" keyProperty="id"> insert into sc_fix_hoof
INSERT INTO sc_fix_hoof <trim prefix="(" suffix=")" suffixOverrides=",">
(sheep_id, <if test="sheepId != null and sheepId != ''">and fh.sheep_id like concat('%', #{sheepId}, '%')</if>
sheepfold, <if test="sheepfold != null">and fh.sheepfold = #{sheepfold}</if>
variety_id,
<if test="comment != null">comment,</if> <if test="comment != null">comment,</if>
<if test="technician != null and technician != ''">technician,</if> <if test="technician != null and technician != ''">technician,</if>
create_by, <if test="createBy != null">create_by,</if>
create_time) <if test="createTime != null">create_time,</if>
VALUES </trim>
(#{sheepId}, <trim prefix="values (" suffix=")" suffixOverrides=",">
#{sheepfold}, <if test="sheepId != null">#{sheepId},</if>
<if test="varietyId != null">#{varietyId},</if> <if test="sheepfold != null">#{sheepfold},</if>
<if test="comment != null">#{comment},</if> <if test="comment != null">#{comment},</if>
<if test="technician != null and technician != ''">#{technician},</if> <if test="technician != null and technician != ''">#{technician},</if>
#{createBy}, <if test="createBy != null">#{createBy},</if>
#{createTime}) <if test="createTime != null">#{createTime},</if>
</trim>
</insert> </insert>
<update id="updateScFixHoof" parameterType="ScFixHoof"> <update id="updateScFixHoof" parameterType="ScFixHoof">
@ -76,7 +69,6 @@
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if> <if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="sheepfold != null">sheepfold = #{sheepfold},</if> <if test="sheepfold != null">sheepfold = #{sheepfold},</if>
<if test="varietyId != null">variety_id=#{varietyId},</if>
<if test="comment != null">comment = #{comment},</if> <if test="comment != null">comment = #{comment},</if>
<if test="technician != null and technician != ''">technician = #{technician},</if> <if test="technician != null and technician != ''">technician = #{technician},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>

View File

@ -92,9 +92,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectBasSheepById" parameterType="Long" resultMap="BasSheepResult"> <select id="selectBasSheepById" parameterType="java.lang.Long" resultType="BasSheep">
<include refid="selectBasSheepVo"/> SELECT s.id,
where id = #{id} s.sheepfold_id AS sheepfoldId,
sf.sheepfold_name AS sheepfoldName,
s.variety_id AS varietyId,
bv.variety AS varietyName
FROM bas_sheep s
LEFT JOIN da_sheepfold sf ON s.sheepfold_id = sf.id
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
WHERE s.id = #{id}
</select>
<select id="selectBasSheepByManageTags" parameterType="string" resultType="com.zhyc.module.produce.sheep.domain.BasSheep">
SELECT id, sheepfold_id AS sheepfoldId, variety_id AS varietyId
FROM bas_sheep
WHERE LOWER(TRIM(manage_tags)) = LOWER(TRIM(#{manageTags}))
AND is_delete = 0
LIMIT 1
</select> </select>
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id"> <insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
@ -239,4 +254,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>