新增羊只时的羊只类型,各页面导出功能需求,改品种功能的原品种回显需求,完成

This commit is contained in:
zyh
2026-03-01 14:13:34 +08:00
parent 404fd4837a
commit 3443f080fb
28 changed files with 531 additions and 690 deletions

View File

@@ -133,7 +133,9 @@ public class BasSheepController extends BaseController {
// 查询所有存在的羊只
List<BasSheep> existingSheep = basSheepService.selectBasSheepByManageTagsList(validTags);
if (validTags.size() == 1 && existingSheep.size() == 1) {
return success(existingSheep.get(0)); //直接返回羊只对象
}
Set<String> existingTagSet = existingSheep.stream()
.map(BasSheep::getManageTags)
.collect(Collectors.toSet());

View File

@@ -2,6 +2,9 @@ package com.zhyc.module.frozen.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
@@ -13,13 +16,16 @@ import com.zhyc.common.core.domain.BaseEntity;
* @author ruoyi
* @date 2025-11-29
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DdFe extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
private Long[] ids;
/** 胚胎编号 YS+日期+序号 */
@Excel(name = "胚胎编号")
private String code;
@@ -95,205 +101,5 @@ public class DdFe extends BaseEntity
this.id = id;
}
public Long getId()
{
return id;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setFreezeDate(Date freezeDate)
{
this.freezeDate = freezeDate;
}
public Date getFreezeDate()
{
return freezeDate;
}
public void setDrId(String drId)
{
this.drId = drId;
}
public String getDrId()
{
return drId;
}
public void setDrBreed(String drBreed)
{
this.drBreed = drBreed;
}
public String getDrBreed()
{
return drBreed;
}
public void setDeId(String deId)
{
this.deId = deId;
}
public String getDeId()
{
return deId;
}
public void setDeBreed(String deBreed)
{
this.deBreed = deBreed;
}
public String getDeBreed()
{
return deBreed;
}
public void setEmbBreed(String embBreed)
{
this.embBreed = embBreed;
}
public String getEmbBreed()
{
return embBreed;
}
public void setGrade(String grade)
{
this.grade = grade;
}
public String getGrade()
{
return grade;
}
public void setQty(Long qty)
{
this.qty = qty;
}
public Long getQty()
{
return qty;
}
public void setSexCtl(Integer sexCtl)
{
this.sexCtl = sexCtl;
}
public Integer getSexCtl()
{
return sexCtl;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setTech(String tech)
{
this.tech = tech;
}
public String getTech()
{
return tech;
}
public void setTankId(Long tankId)
{
this.tankId = tankId;
}
public Long getTankId()
{
return tankId;
}
public void setBucketId(Long bucketId)
{
this.bucketId = bucketId;
}
public Long getBucketId()
{
return bucketId;
}
public void setRackId(Long rackId)
{
this.rackId = rackId;
}
public Long getRackId()
{
return rackId;
}
public void setOutDate(Date outDate)
{
this.outDate = outDate;
}
public Date getOutDate()
{
return outDate;
}
public void setDiscardTxt(String discardTxt)
{
this.discardTxt = discardTxt;
}
public String getDiscardTxt()
{
return discardTxt;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("freezeDate", getFreezeDate())
.append("drId", getDrId())
.append("drBreed", getDrBreed())
.append("deId", getDeId())
.append("deBreed", getDeBreed())
.append("embBreed", getEmbBreed())
.append("grade", getGrade())
.append("qty", getQty())
.append("sexCtl", getSexCtl())
.append("status", getStatus())
.append("tech", getTech())
.append("tankId", getTankId())
.append("bucketId", getBucketId())
.append("rackId", getRackId())
.append("outDate", getOutDate())
.append("discardTxt", getDiscardTxt())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@@ -3,6 +3,9 @@ package com.zhyc.module.frozen.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
@@ -14,6 +17,9 @@ import com.zhyc.common.core.domain.BaseEntity;
* @author ruoyi
* @date 2025-11-29
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DdFs extends BaseEntity {
private static final long serialVersionUID = 1L;
@@ -21,7 +27,7 @@ public class DdFs extends BaseEntity {
* 主键
*/
private Long id;
private Long[] ids;
/**
* 冻精号/公羊耳号
*/
@@ -107,148 +113,4 @@ public class DdFs extends BaseEntity {
*/
@Excel(name = "废弃原因")
private String discardTxt;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setFreezeDt(Date freezeDt) {
this.freezeDt = freezeDt;
}
public Date getFreezeDt() {
return freezeDt;
}
public void setBreed(String breed) {
this.breed = breed;
}
public String getBreed() {
return breed;
}
public void setBatch(String batch) {
this.batch = batch;
}
public String getBatch() {
return batch;
}
public void setSpec(String spec) {
this.spec = spec;
}
public String getSpec() {
return spec;
}
public void setQty(Long qty) {
this.qty = qty;
}
public Long getQty() {
return qty;
}
public void setSexCtl(Integer sexCtl) {
this.sexCtl = sexCtl;
}
public Integer getSexCtl() {
return sexCtl;
}
public void setStat(String stat) {
this.stat = stat;
}
public String getStat() {
return stat;
}
public void setTech(String tech) {
this.tech = tech;
}
public String getTech() {
return tech;
}
public void setTankId(Long tankId) {
this.tankId = tankId;
}
public Long getTankId() {
return tankId;
}
public void setBucketId(Long bucketId) {
this.bucketId = bucketId;
}
public Long getBucketId() {
return bucketId;
}
public void setRackId(Long rackId) {
this.rackId = rackId;
}
public Long getRackId() {
return rackId;
}
public void setOutDt(Date outDt) {
this.outDt = outDt;
}
public Date getOutDt() {
return outDt;
}
public void setDiscardTxt(String discardTxt) {
this.discardTxt = discardTxt;
}
public String getDiscardTxt() {
return discardTxt;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("freezeDt", getFreezeDt())
.append("breed", getBreed())
.append("batch", getBatch())
.append("spec", getSpec())
.append("qty", getQty())
.append("sexCtl", getSexCtl())
.append("stat", getStat())
.append("tech", getTech())
.append("tankId", getTankId())
.append("bucketId", getBucketId())
.append("rackId", getRackId())
.append("outDt", getOutDt())
.append("discardTxt", getDiscardTxt())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@@ -29,7 +29,7 @@ public class ScBodyMeasure extends BaseEntity {
* $column.columnComment
*/
private Long id;
private Long[] ids;
/**
* 耳号
*/

View File

@@ -26,7 +26,7 @@ public class ScBodyScore extends BaseEntity {
* $column.columnComment
*/
private Long id;
private Long[] ids;
/**
* 羊只id
*/

View File

@@ -26,7 +26,7 @@ public class ScBreastRating extends BaseEntity {
* $column.columnComment
*/
private Long id;
private Long[] ids;
/**
* 羊只id
*/

View File

@@ -26,7 +26,7 @@ public class ScChangeComment extends BaseEntity {
* $column.columnComment
*/
private Long id;
private Long[] ids;
/**
* 羊只id
*/

View File

@@ -26,7 +26,7 @@ public class ScChangeEar extends BaseEntity {
* id
*/
private Integer id;
private Integer[] ids;
/**
* 羊只id
*/

View File

@@ -26,7 +26,7 @@ public class ScChangeVariety extends BaseEntity {
* $column.columnComment
*/
private Integer id;
private Integer[] ids;
/**
* 羊只id
*/

View File

@@ -24,7 +24,7 @@ public class ScTransGroup extends BaseEntity {
* $column.columnComment
*/
private Integer id;
private Integer[] ids;
/**
* 羊只id
*/

View File

@@ -25,7 +25,7 @@ public class ScTransitionInfo extends BaseEntity {
*主键
*/
private Integer id;
private Integer[] ids;
/**
* 羊只id
*/

View File

@@ -22,11 +22,10 @@ public interface ScChangeCommentMapper
/**
* 查询改备注列表
*
* @param scChangeComment 改备注
* @return 改备注集合
*/
// public List<ScChangeComment> selectScChangeCommentList(ScChangeComment scChangeComment);
List<ScChangeComment> selectScChangeCommentList(
@Param("sc") ScChangeComment sc,
@Param("manageTagsList") List<String> manageTagsList);
/**
* 新增改备注
@@ -60,10 +59,6 @@ public interface ScChangeCommentMapper
*/
public int deleteScChangeCommentByIds(Long[] ids);
List<ScChangeComment> selectScChangeCommentList(
@Param("sc") ScChangeComment sc,
@Param("manageTagsList") List<String> manageTagsList);
/**
* 模糊搜索耳号
*/

View File

@@ -19,6 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -122,6 +124,61 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
return scAddSheepMapper.deleteScAddSheepByIds(ids) > 0;
}
/**
* 根据出生日期计算月龄
*/
private int calculateMonthAge(Date birthday) {
if (birthday == null) return 0;
Calendar birthCal = Calendar.getInstance();
birthCal.setTime(birthday);
Calendar nowCal = Calendar.getInstance();
int yearDiff = nowCal.get(Calendar.YEAR) - birthCal.get(Calendar.YEAR);
int monthDiff = nowCal.get(Calendar.MONTH) - birthCal.get(Calendar.MONTH);
return yearDiff * 12 + monthDiff;
}
/**
* 根据月龄、断奶体重、性别自动判断羊只类别ID
*/
private Long determineSheepType(BigDecimal weaningWeight, int monthAge, Integer gender) {
// 1. 断奶体重为空 -> 哺乳羊
if (weaningWeight == null) {
return 1L; // 哺乳羊
}
// 2. 断奶体重不为空 且 月龄 0-4 -> 断奶羊
if (monthAge >= 0 && monthAge <= 4) {
return 2L; // 断奶羊
}
// 3. 断奶体重不为空 且 月龄 4-7 -> 育成羊
if (monthAge > 4 && monthAge <= 7) {
return 3L; // 育成羊
}
// 4. 月龄 7-12 且 母羊 -> 青年羊
if (monthAge > 7 && monthAge < 12 && gender != null && gender == 1) { // 1=母
return 4L; // 青年羊
}
// 5. 月龄 >=12 且 公羊 -> 成年公羊
if (monthAge >= 12 && gender != null && gender == 2) { // 2=公
return 8L; // 成年公羊
}
// 6. 月龄 >=12 且 母羊 -> 超龄羊
if (monthAge >= 12 && gender != null && gender == 1) { // 1=母
return 5L; // 超龄羊
}
// 默认返回哺乳羊
return 1L;
}
//导入羊只
@Override
@Transactional(rollbackFor = Exception.class)
@@ -136,6 +193,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
for (int i = 0; i < list.size(); i++) {
ScAddSheep sheep = list.get(i);
try {
// 校验牧场名称
if (StringUtils.isBlank(sheep.getRanchName())) {
failure++;
failureMsg.append("<br/>第").append(i + 1).append("行:牧场名称不能为空");
@@ -153,6 +211,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
}
sheep.setRanchId(ranchList.get(0).getId().intValue());
// 校验品种名称
if (StringUtils.isNotBlank(sheep.getVarietyName())) {
Long varietyId = basSheepVarietyMapper.selectIdByName(sheep.getVarietyName());
if (varietyId == null) {
@@ -173,6 +232,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
continue;
}
// 校验羊舍名称
if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) {
DaSheepfold param = new DaSheepfold();
param.setSheepfoldName(sheep.getSheepfoldNameExcel());
@@ -190,23 +250,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
sheep.setSheepfold(foldList.get(0).getId().intValue());
}
if (StringUtils.isNotBlank(sheep.getTypeName())) {
BasSheepType typeQuery = new BasSheepType();
typeQuery.setName(sheep.getTypeName().trim());
List<BasSheepType> typeList = basSheepTypeService.selectBasSheepTypeList(typeQuery);
if (typeList == null || typeList.isEmpty()) {
failure++;
failureMsg.append("<br/>第")
.append(i + 1)
.append("行:羊只类型名称不存在【")
.append(sheep.getTypeName())
.append("");
continue;
}
sheep.setTypeId(typeList.get(0).getId().longValue());
}
// 校验耳号
if (StringUtils.isBlank(sheep.getEarNumber())) {
failure++;
failureMsg.append("<br/>第")
@@ -225,6 +269,8 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
.append("");
continue;
}
// 校验父号(如果填写了)
if (StringUtils.isNotBlank(sheep.getFather())) {
BasSheep father = basSheepService.selectBasSheepByManageTags(sheep.getFather().trim());
if (father == null) {
@@ -234,6 +280,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
}
}
// 校验母号(如果填写了)
if (StringUtils.isNotBlank(sheep.getMother())) {
BasSheep mother = basSheepService.selectBasSheepByManageTags(sheep.getMother().trim());
if (mother == null) {
@@ -242,6 +289,46 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
continue;
}
}
// 校验出生日期必填
if (sheep.getBirthday() == null) {
failure++;
failureMsg.append("<br/>第").append(i + 1).append("行:出生日期不能为空");
continue;
}
// 校验性别必填
if (sheep.getGender() == null) {
failure++;
failureMsg.append("<br/>第").append(i + 1).append("行:性别不能为空");
continue;
}
// 自动判断羊只类别
int monthAge = calculateMonthAge(sheep.getBirthday());
Long autoTypeId = determineSheepType(sheep.getWeaningWeight(), monthAge, sheep.getGender());
// 如果Excel中填写了typeName以Excel为准
if (StringUtils.isNotBlank(sheep.getTypeName())) {
BasSheepType typeQuery = new BasSheepType();
typeQuery.setName(sheep.getTypeName().trim());
List<BasSheepType> typeList = basSheepTypeService.selectBasSheepTypeList(typeQuery);
if (typeList == null || typeList.isEmpty()) {
failure++;
failureMsg.append("<br/>第")
.append(i + 1)
.append("行:羊只类型名称不存在【")
.append(sheep.getTypeName())
.append("");
continue;
}
sheep.setTypeId(typeList.get(0).getId().longValue());
} else {
// 使用自动判断的类别
sheep.setTypeId(autoTypeId);
}
// 数据分离:设置用户和部门
sheep.setUserId(userId);
sheep.setDeptId(deptId);

View File

@@ -68,19 +68,15 @@ public class ScChangeVarietyServiceImpl implements IScChangeVarietyService
@Transactional(rollbackFor = Exception.class)
public int insertScChangeVariety(ScChangeVariety scChangeVariety)
{
// ✅ 第1步先查羊只移到 insert 之前!)
String manageTags = scChangeVariety.getManageTags();
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags);
if (sheep == null) {
throw new RuntimeException("未找到耳号为【" + manageTags + "】的羊只,无法更新品种");
}
// ✅ 第2步设置所有字段关键
scChangeVariety.setSheepId(sheep.getId().intValue()); // 设置羊只ID
scChangeVariety.setSheepId(sheep.getId().intValue());
// 查询当前品种作为旧品种(如果前端没传)
if (StringUtils.isBlank(scChangeVariety.getVarietyOld())) {
// ✅ 修正:使用正确的方法名 selectBasSheepVarietyById
BasSheepVariety oldVariety = varietyService.selectBasSheepVarietyById(sheep.getVarietyId());
if (oldVariety != null) {
scChangeVariety.setVarietyOld(oldVariety.getVariety());
@@ -98,13 +94,11 @@ public class ScChangeVarietyServiceImpl implements IScChangeVarietyService
throw new RuntimeException("事件日期不能为空");
}
// ✅ 第3步再执行 insert此时所有字段都有值了
int rows = scChangeVarietyMapper.insertScChangeVariety(scChangeVariety);
if (rows <= 0) {
return rows;
}
// 第4步更新羊只品种保持你的原逻辑
String newVarietyName = scChangeVariety.getVarietyNew();
BasSheepVariety newVariety = varietyService.selectByVarietyName(newVarietyName);
if (newVariety == null) {

View File

@@ -25,7 +25,7 @@ public class ScCastrate extends BaseEntity {
* $column.columnComment
*/
private Long id;
private Long[] ids;
/**
* 羊只id
*/

View File

@@ -25,7 +25,7 @@ public class ScFixHoof extends BaseEntity {
* $column.columnComment
*/
private Integer id;
private Integer[] ids;
/**
* 羊只id
*/

View File

@@ -56,6 +56,12 @@
<select id="selectDdFeList" parameterType="DdFe" resultMap="DdFeResult">
<include refid="selectDdFeVo"/>
<where>
<if test="ids != null and ids.length > 0">
AND id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="code != null and code != ''">and code like concat('%', #{code}, '%')</if>
<if test="grade != null and grade != ''">and grade = #{grade}</if>
<if test="status != null and status != ''">and status = #{status}</if>

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.frozen.mapper.DdFsMapper">
<resultMap type="com.zhyc.module.frozen.domain.DdFs" id="DdFsResult">
<result property="id" column="id" />
<result property="code" column="code" />
@@ -31,7 +31,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDdFsList" parameterType="DdFs" resultMap="DdFsResult">
<include refid="selectDdFsVo"/>
<where>
<where>
<if test="ids != null and ids.length > 0">
AND id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
<if test="stat != null and stat != ''">and stat = #{stat}</if>
<if test="tech != null and tech != ''"> and tech like concat('%', #{tech}, '%')</if>
@@ -44,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="stat != null and stat != ''">and stat = #{stat}</if>
</where>
</select>
<select id="selectDdFsById" parameterType="Long" resultMap="DdFsResult">
<include refid="selectDdFsVo"/>
where id = #{id}
@@ -121,7 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteDdFsByIds" parameterType="String">
delete from dd_fs where id in
delete from dd_fs where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

View File

@@ -50,97 +50,105 @@
<sql id="selectScBodyMeasureVo">
select sm.id,
sm.sheep_id,
sm.user_id,
sm.dept_id,
bs.manage_tags,
ds.id as sheepfold_id,
ds.sheepfold_name,
bsv.id as variety_id,
bsv.variety as variety_name,
'体尺测量' as event_type,
bst.name as sheep_type_name,
sm.measure_date,
bs.gender,
bs.parity,
bs.birth_weight as birth_weight,
bs.weaning_weight as weaning_weight,
sm.current_weight as current_weight,
sm.height,
sm.bust,
sm.body_length,
sm.pipe_length,
sm.chest_depth,
sm.hip_height,
sm.rump_width,
sm.rump_heignt,
sm.hip_width,
sm.hip_cross_height,
sm.month_age,
sm.breast_depth,
sm.breast_position,
sm.breast_length,
sm.breast_adbere,
sm.breast_spacing,
sm.breast_score,
sm.body_score,
sm.lactation_day,
sm.gestation_day,
sm.post_mating_day,
bbs.breed as breed_status_name,
sm.comment,
sm.technician,
sm.create_by,
sm.create_time
sm.sheep_id,
sm.user_id,
sm.dept_id,
bs.manage_tags,
ds.id as sheepfold_id,
ds.sheepfold_name,
bsv.id as variety_id,
bsv.variety as variety_name,
'体尺测量' as event_type,
bst.name as sheep_type_name,
sm.measure_date,
bs.gender,
bs.parity,
bs.birth_weight as birth_weight,
bs.weaning_weight as weaning_weight,
sm.current_weight as current_weight,
sm.height,
sm.bust,
sm.body_length,
sm.pipe_length,
sm.chest_depth,
sm.hip_height,
sm.rump_width,
sm.rump_heignt,
sm.hip_width,
sm.hip_cross_height,
sm.month_age,
sm.breast_depth,
sm.breast_position,
sm.breast_length,
sm.breast_adbere,
sm.breast_spacing,
sm.breast_score,
sm.body_score,
sm.lactation_day,
sm.gestation_day,
sm.post_mating_day,
bbs.breed as breed_status_name,
sm.comment,
sm.technician,
sm.create_by,
sm.create_time
from sc_body_measure sm
LEFT JOIN bas_sheep bs ON sm.sheep_id = bs.id
LEFT JOIN bas_breed_status bbs ON bs.breed_status_id = bbs.id
LEFT JOIN da_sheepfold ds ON bs.sheepfold_id = ds.id
LEFT JOIN bas_sheep_type bst ON bs.type_id = bst.id
LEFT JOIN bas_sheep_variety bsv ON bs.variety_id = bsv.id
LEFT JOIN bas_sheep bs ON sm.sheep_id = bs.id
LEFT JOIN bas_breed_status bbs ON bs.breed_status_id = bbs.id
LEFT JOIN da_sheepfold ds ON bs.sheepfold_id = ds.id
LEFT JOIN bas_sheep_type bst ON bs.type_id = bst.id
LEFT JOIN bas_sheep_variety bsv ON bs.variety_id = bsv.id
</sql>
<select id="selectScBodyMeasureList" resultMap="ScBodyMeasureResult">
<include refid="selectScBodyMeasureVo"/>
<where>
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
<if test="sc.ids != null and sc.ids.length > 0">
AND sm.id IN
<foreach collection="sc.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="sc.sheepId != null">and sm.sheep_id = #{sc.sheepId}</if>
<if test="sc.sheepfoldId != null">and bs.sheepfold_id = #{sc.sheepfoldId}</if>
<if test="sc.varietyId != null">and bsv.id = #{sc.varietyId}</if>
<if test="sc.sheepTypeId != null">and bs.type_id = #{sc.sheepTypeId}</if>
<if test="sc.params != null and sc.params.beginMeasureDate != null and sc.params.beginMeasureDate != '' and sc.params.endMeasureDate != null and sc.params.endMeasureDate != ''">
and sm.measure_date between #{sc.params.beginMeasureDate} and #{sc.params.endMeasureDate}
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and sm.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.gender != null and sc.gender != ''">
and bs.gender = #{sc.gender}
</if>
<if test="sc.technician != null and sc.technician != ''">
and sm.technician like concat('%', #{sc.technician}, '%')
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
<if test="sc.monthAgeStart != null">
and <![CDATA[ sm.month_age >= #{sc.monthAgeStart} ]]>
</if>
<if test="sc.monthAgeEnd != null">
and <![CDATA[ sm.month_age <= #{sc.monthAgeEnd} ]]>
</if>
<if test="sc.breedStatusName != null and sc.breedStatusName != ''">
and bbs.breed = #{sc.breedStatusName}
</if>
<if test="sc.deptId != null">
and sm.dept_id = #{sc.deptId}
</if>
<if test="sc.userId != null">
and sm.user_id = #{sc.userId}
<if test="sc.ids == null or sc.ids.length == 0">
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
</foreach>
</if>
<if test="sc.sheepId != null">and sm.sheep_id = #{sc.sheepId}</if>
<if test="sc.sheepfoldId != null">and bs.sheepfold_id = #{sc.sheepfoldId}</if>
<if test="sc.varietyId != null">and bsv.id = #{sc.varietyId}</if>
<if test="sc.sheepTypeId != null">and bs.type_id = #{sc.sheepTypeId}</if>
<if test="sc.params != null and sc.params.beginMeasureDate != null and sc.params.beginMeasureDate != '' and sc.params.endMeasureDate != null and sc.params.endMeasureDate != ''">
and sm.measure_date between #{sc.params.beginMeasureDate} and #{sc.params.endMeasureDate}
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and sm.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.gender != null and sc.gender != ''">
and bs.gender = #{sc.gender}
</if>
<if test="sc.technician != null and sc.technician != ''">
and sm.technician like concat('%', #{sc.technician}, '%')
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
<if test="sc.monthAgeStart != null">
and <![CDATA[ sm.month_age >= #{sc.monthAgeStart} ]]>
</if>
<if test="sc.monthAgeEnd != null">
and <![CDATA[ sm.month_age <= #{sc.monthAgeEnd} ]]>
</if>
<if test="sc.breedStatusName != null and sc.breedStatusName != ''">
and bbs.breed = #{sc.breedStatusName}
</if>
<if test="sc.deptId != null">
and sm.dept_id = #{sc.deptId}
</if>
<if test="sc.userId != null">
and sm.user_id = #{sc.userId}
</if>
</if>
${sc.params.dataScope}
</where>
@@ -272,7 +280,7 @@
SELECT DISTINCT bs.manage_tags
FROM bas_sheep bs
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0
AND bs.is_delete = 0
ORDER BY bs.manage_tags
</select>

View File

@@ -46,26 +46,34 @@
<select id="selectScBodyScoreList" resultMap="ScBodyScoreResult">
<include refid="selectScBodyScoreVo"/>
<where>
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
<if test="sc.ids != null and sc.ids.length > 0">
AND sbs.id IN
<foreach collection="sc.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="sc.sheepId != null and sc.sheepId != ''">and sbs.sheep_id = #{sc.sheepId}</if>
<if test="sc.varietyId != null">and bsv.id = #{sc.varietyId}</if>
<if test="sc.sheepfold != null">and bs.sheepfold_id = #{sc.sheepfold}</if>
<if test="sc.score != null ">and sbs.score = #{sc.score}</if>
<if test="sc.params != null and sc.params.beginDatetime != null and sc.params.beginDatetime != '' and sc.params.endDatetime != null and sc.params.endDatetime != ''">
and sbs.datetime between #{sc.params.beginDatetime} and #{sc.params.endDatetime}
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and sbs.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
<if test="sc.technician != null and sc.technician != ''">
and sbs.technician like concat('%', #{sc.technician}, '%')
<if test="sc.ids == null or sc.ids.length == 0">
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
</foreach>
</if>
<if test="sc.sheepId != null and sc.sheepId != ''">and sbs.sheep_id = #{sc.sheepId}</if>
<if test="sc.varietyId != null">and bsv.id = #{sc.varietyId}</if>
<if test="sc.sheepfold != null">and bs.sheepfold_id = #{sc.sheepfold}</if>
<if test="sc.score != null ">and sbs.score = #{sc.score}</if>
<if test="sc.params != null and sc.params.beginDatetime != null and sc.params.beginDatetime != '' and sc.params.endDatetime != null and sc.params.endDatetime != ''">
and sbs.datetime between #{sc.params.beginDatetime} and #{sc.params.endDatetime}
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and sbs.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
<if test="sc.technician != null and sc.technician != ''">
and sbs.technician like concat('%', #{sc.technician}, '%')
</if>
</if>
${sc.params.dataScope}
</where>

View File

@@ -48,27 +48,35 @@
<select id="selectScBreastRatingList" resultMap="ScBreastRatingResult">
<include refid="selectScBreastRatingVo"/>
<where>
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
<if test="sc.ids != null and sc.ids.length > 0">
AND sbr.id IN
<foreach collection="sc.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="sc.varietyId != null">and bsv.id = #{sc.varietyId}</if>
<if test="sc.sheepfoldId != null">and sf.id = #{sc.sheepfoldId}</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.endEventDate != null">
and sbr.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.endCreateTime != null">
and sbr.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
<if test="sc.technician != null and sc.technician != ''">
and sbr.technician = #{sc.technician}
</if>
<if test="sc.score != null">
and sbr.score = #{sc.score}
<if test="sc.ids == null or sc.ids.length == 0">
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
</foreach>
</if>
<if test="sc.varietyId != null">and bsv.id = #{sc.varietyId}</if>
<if test="sc.sheepfoldId != null">and sf.id = #{sc.sheepfoldId}</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.endEventDate != null">
and sbr.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.endCreateTime != null">
and sbr.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
<if test="sc.technician != null and sc.technician != ''">
and sbr.technician = #{sc.technician}
</if>
<if test="sc.score != null">
and sbr.score = #{sc.score}
</if>
</if>
${sc.params.dataScope}
</where>

View File

@@ -40,33 +40,41 @@
<select id="selectScChangeCommentList" resultMap="ScChangeCommentResult">
<include refid="selectScChangeCommentVo"/>
<where>
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
<if test="sc.ids != null and sc.ids.length > 0">
AND scc.id IN
<foreach collection="sc.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!-- <if test="sc.sheepfoldId != null">-->
<!-- and bs.sheepfold_id = #{sc.sheepfoldId}-->
<!-- </if>-->
<if test="sc.technician != null and sc.technician != ''">
and scc.technician like concat('%', #{sc.technician}, '%')
</if>
<if test="sc.newComment != null and sc.newComment != ''">
and scc.new_comment like concat('%', #{sc.newComment}, '%')
</if>
<if test="sc.oldComment != null and sc.oldComment != ''">
and scc.old_comment like concat('%', #{sc.oldComment}, '%')
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != ''
<if test="sc.ids == null or sc.ids.length == 0">
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
</foreach>
</if>
<!-- <if test="sc.sheepfoldId != null">-->
<!-- and bs.sheepfold_id = #{sc.sheepfoldId}-->
<!-- </if>-->
<if test="sc.technician != null and sc.technician != ''">
and scc.technician like concat('%', #{sc.technician}, '%')
</if>
<if test="sc.newComment != null and sc.newComment != ''">
and scc.new_comment like concat('%', #{sc.newComment}, '%')
</if>
<if test="sc.oldComment != null and sc.oldComment != ''">
and scc.old_comment like concat('%', #{sc.oldComment}, '%')
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != ''
and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and scc.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != ''
and scc.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != ''
and sc.params.endEventDate != null and sc.params.endEventDate != ''">
and scc.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
and scc.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
</if>
${sc.params.dataScope}
</where>

View File

@@ -48,30 +48,40 @@
<select id="selectScChangeEarList" resultMap="ScChangeEarResult">
<include refid="selectScChangeEarVo"/>
<where>
<if test="sc.sheepId != null">and sce.sheep_id = #{sc.sheepId}</if>
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
(bs.manage_tags like concat('%', #{tag}, '%')
or bs.electronic_tags like concat('%', #{tag}, '%'))
<if test="sc.ids != null and sc.ids.length > 0">
AND sce.id IN
<foreach collection="sc.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="sc.technician != null and sc.technician != ''">and sce.technician like concat('%', #{sc.technician}, '%')</if>
<if test="sc.earType != null">and sce.ear_type = #{sc.earType}</if>
<if test="sc.newTag != null and sc.newTag != ''">and sce.newTag like concat('%', #{sc.newTag}, '%')</if>
<if test="sc.oldTag != null and sc.oldTag != ''">and sce.oldTag like concat('%', #{sc.oldTag}, '%')</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != ''
<if test="sc.ids == null or sc.ids.length == 0">
<if test="sc.sheepId != null">and sce.sheep_id = #{sc.sheepId}</if>
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
(bs.manage_tags like concat('%', #{tag}, '%')
or bs.electronic_tags like concat('%', #{tag}, '%'))
</foreach>
</if>
<if test="sc.technician != null and sc.technician != ''">and sce.technician like concat('%',
#{sc.technician}, '%')
</if>
<if test="sc.earType != null">and sce.ear_type = #{sc.earType}</if>
<if test="sc.newTag != null and sc.newTag != ''">and sce.newTag like concat('%', #{sc.newTag}, '%')</if>
<if test="sc.oldTag != null and sc.oldTag != ''">and sce.oldTag like concat('%', #{sc.oldTag}, '%')</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != ''
and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and sce.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != ''
and sce.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != ''
and sc.params.endEventDate != null and sc.params.endEventDate != ''">
and sce.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.inGroup != null">
<choose>
<when test="sc.inGroup == 1">and bs.is_delete = 0</when>
<when test="sc.inGroup == 2">and bs.is_delete = 1</when>
</choose>
and sce.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.inGroup != null">
<choose>
<when test="sc.inGroup == 1">and bs.is_delete = 0</when>
<when test="sc.inGroup == 2">and bs.is_delete = 1</when>
</choose>
</if>
</if>
${sc.params.dataScope}
</where>

View File

@@ -40,30 +40,38 @@
<select id="selectScChangeVarietyList" resultMap="ScChangeVarietyResult">
<include refid="selectScChangeVarietyVo"/>
<where>
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
<if test="sc.ids != null and sc.ids.length > 0">
and scv.id IN
<foreach collection="sc.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="sc.sheepId != null">and scv.sheep_id = #{sc.sheepId}</if>
<!-- <if test="sc.sheepfoldId != null">and bs.sheepfold_id = #{sc.sheepfoldId}</if>-->
<if test="sc.technician != null and sc.technician != ''">and scv.technician like concat('%',
#{sc.technician}, '%')
</if>
<if test="sc.varietyOld != null and sc.varietyOld != ''">and scv.variety_old like concat('%',
#{sc.varietyOld}, '%')
</if>
<if test="sc.varietyNew != null and sc.varietyNew != ''">and scv.variety_new like concat('%',
#{sc.varietyNew}, '%')
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and scv.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''">
and scv.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
<if test="sc.ids == null or sc.ids.length == 0">
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
</foreach>
</if>
<if test="sc.sheepId != null">and scv.sheep_id = #{sc.sheepId}</if>
<!-- <if test="sc.sheepfoldId != null">and bs.sheepfold_id = #{sc.sheepfoldId}</if>-->
<if test="sc.technician != null and sc.technician != ''">and scv.technician like concat('%',
#{sc.technician}, '%')
</if>
<if test="sc.varietyOld != null and sc.varietyOld != ''">and scv.variety_old like concat('%',
#{sc.varietyOld}, '%')
</if>
<if test="sc.varietyNew != null and sc.varietyNew != ''">and scv.variety_new like concat('%',
#{sc.varietyNew}, '%')
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and scv.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''">
and scv.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
</if>
${sc.params.dataScope}
</where>

View File

@@ -54,27 +54,35 @@
<select id="selectScTransGroupList" resultMap="ScTransGroupResult">
<include refid="selectScTransGroupVo"/>
<where>
<if test="sc.manageTagsList != null and sc.manageTagsList.size() > 0">
<foreach collection="sc.manageTagsList" item="tag" separator="or" open="and (" close=")">
s.manage_tags LIKE CONCAT('%', #{tag}, '%')
<if test="sc.ids != null and sc.ids.length > 0">
and tg.id IN
<foreach collection="sc.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="sc.sheepId != null">and tg.sheep_id = #{sc.sheepId}</if>
<if test="sc.foldTo != null and sc.foldTo != ''">and tg.fold_to = #{sc.foldTo}</if>
<if test="sc.foldFrom != null and sc.foldFrom != ''">and tg.fold_from = #{sc.foldFrom}</if>
<if test="sc.varietyId != null">and tg.variety_id = #{sc.varietyId}</if>
<if test="sc.sheepTypeId != null">and st.id = #{sc.sheepTypeId}</if>
<if test="sc.params != null and sc.params.beginTransDate != null and sc.params.beginTransDate != '' and sc.params.endTransDate != null and sc.params.endTransDate != ''">
and tg.trans_date between #{sc.params.beginTransDate} and #{sc.params.endTransDate}
</if>
<if test="sc.eventType != null and sc.eventType != ''">
and tg.event_type like concat('%', #{sc.eventType}, '%')
</if>
<if test="sc.technician != null and sc.technician != ''">
and tg.technician like concat('%', #{sc.technician}, '%')
</if>
<if test="sc.isDelete != null">
and s.is_delete = #{sc.isDelete}
<if test="sc.ids == null or sc.ids.length == 0">
<if test="sc.manageTagsList != null and sc.manageTagsList.size() > 0">
<foreach collection="sc.manageTagsList" item="tag" separator="or" open="and (" close=")">
s.manage_tags LIKE CONCAT('%', #{tag}, '%')
</foreach>
</if>
<if test="sc.sheepId != null">and tg.sheep_id = #{sc.sheepId}</if>
<if test="sc.foldTo != null and sc.foldTo != ''">and tg.fold_to = #{sc.foldTo}</if>
<if test="sc.foldFrom != null and sc.foldFrom != ''">and tg.fold_from = #{sc.foldFrom}</if>
<if test="sc.varietyId != null">and tg.variety_id = #{sc.varietyId}</if>
<if test="sc.sheepTypeId != null">and st.id = #{sc.sheepTypeId}</if>
<if test="sc.params != null and sc.params.beginTransDate != null and sc.params.beginTransDate != '' and sc.params.endTransDate != null and sc.params.endTransDate != ''">
and tg.trans_date between #{sc.params.beginTransDate} and #{sc.params.endTransDate}
</if>
<if test="sc.eventType != null and sc.eventType != ''">
and tg.event_type like concat('%', #{sc.eventType}, '%')
</if>
<if test="sc.technician != null and sc.technician != ''">
and tg.technician like concat('%', #{sc.technician}, '%')
</if>
<if test="sc.isDelete != null">
and s.is_delete = #{sc.isDelete}
</if>
</if>
${sc.params.dataScope}
</where>

View File

@@ -55,31 +55,39 @@
<select id="selectScTransitionInfoList" resultMap="ScTransitionInfoResult">
<include refid="selectScTransitionInfoVo"/>
<where>
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
<if test="sc.ids != null and sc.ids.length > 0">
and t.id IN
<foreach collection="sc.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="sc.sheepId != null">and t.sheep_id = #{sc.sheepId}</if>
<if test="sc.transType != null">and t.trans_type = #{sc.transType}</if>
<if test="sc.varietyId != null">and bs.variety_id = #{sc.varietyId}</if>
<if test="sc.transTo != null and sc.transTo != ''">and t.trans_to = #{sc.transTo}</if>
<if test="sc.transFrom != null and sc.transFrom != ''">and t.trans_from = #{sc.transFrom}</if>
<if test="sc.status != null">and t.status = #{sc.status}</if>
<if test="sc.params != null and sc.params.beginTransitionDate != null and sc.params.beginTransitionDate != '' and sc.params.endTransitionDate != null and sc.params.endTransitionDate != ''">
and t.transition_date between #{sc.params.beginTransitionDate} and #{sc.params.endTransitionDate}
</if>
<if test="sc.technician != null and sc.technician != ''">
and t.technician like concat('%', #{sc.technician}, '%')
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
<if test="sc.sheepTypeId != null">
and bs.type_id = #{sc.sheepTypeId}
</if>
<if test="sc.currentRanchId != null">
and bs.ranch_id = #{sc.currentRanchId}
<if test="sc.ids == null or sc.ids.length == 0">
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
</foreach>
</if>
<if test="sc.sheepId != null">and t.sheep_id = #{sc.sheepId}</if>
<if test="sc.transType != null">and t.trans_type = #{sc.transType}</if>
<if test="sc.varietyId != null">and bs.variety_id = #{sc.varietyId}</if>
<if test="sc.transTo != null and sc.transTo != ''">and t.trans_to = #{sc.transTo}</if>
<if test="sc.transFrom != null and sc.transFrom != ''">and t.trans_from = #{sc.transFrom}</if>
<if test="sc.status != null">and t.status = #{sc.status}</if>
<if test="sc.params != null and sc.params.beginTransitionDate != null and sc.params.beginTransitionDate != '' and sc.params.endTransitionDate != null and sc.params.endTransitionDate != ''">
and t.transition_date between #{sc.params.beginTransitionDate} and #{sc.params.endTransitionDate}
</if>
<if test="sc.technician != null and sc.technician != ''">
and t.technician like concat('%', #{sc.technician}, '%')
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
<if test="sc.sheepTypeId != null">
and bs.type_id = #{sc.sheepTypeId}
</if>
<if test="sc.currentRanchId != null">
and bs.ranch_id = #{sc.currentRanchId}
</if>
</if>
${sc.params.dataScope}
</where>
@@ -91,41 +99,41 @@
WHERE t.id = #{id}
</select>
<!-- <insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id">-->
<!-- insert into sc_transition_info-->
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
<!-- <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="transFrom != null and transFrom != ''">trans_from,</if>-->
<!-- <if test="eventType != null and eventType != ''">event_type,</if>-->
<!-- <if test="transType != null">trans_type,</if>-->
<!-- <if test="transitionDate != null">transition_date,</if>-->
<!-- <if test="technician != null and technician != ''">technician,</if>-->
<!-- <if test="status != null">status,</if>-->
<!-- <if test="comment != null">comment,</if>-->
<!-- <if test="createBy != null">create_by,</if>-->
<!-- <if test="createTime != null">create_time,</if>-->
<!-- <if test="userId != null">user_id,</if>-->
<!-- <if test="deptId != null">dept_id,</if>-->
<!-- </trim>-->
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
<!-- <if test="sheepId != null">#{sheepId},</if>-->
<!-- <if test="varietyId != null">#{varietyId},</if>-->
<!-- <if test="transTo != null and transTo != ''">#{transTo},</if>-->
<!-- <if test="transFrom != null and transFrom != ''">#{transFrom},</if>-->
<!-- <if test="eventType != null and eventType != ''">#{eventType},</if>-->
<!-- <if test="transType != null">#{transType},</if>-->
<!-- <if test="transitionDate != null">#{transitionDate},</if>-->
<!-- <if test="technician != null and technician != ''">#{technician},</if>-->
<!-- <if test="status != null">#{status},</if>-->
<!-- <if test="comment != null">#{comment},</if>-->
<!-- <if test="createBy != null">#{createBy},</if>-->
<!-- <if test="createTime != null">#{createTime},</if>-->
<!-- <if test="userId != null">#{userId},</if>-->
<!-- <if test="deptId != null">#{deptId},</if>-->
<!-- </trim>-->
<!-- </insert>-->
<!-- <insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id">-->
<!-- insert into sc_transition_info-->
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
<!-- <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="transFrom != null and transFrom != ''">trans_from,</if>-->
<!-- <if test="eventType != null and eventType != ''">event_type,</if>-->
<!-- <if test="transType != null">trans_type,</if>-->
<!-- <if test="transitionDate != null">transition_date,</if>-->
<!-- <if test="technician != null and technician != ''">technician,</if>-->
<!-- <if test="status != null">status,</if>-->
<!-- <if test="comment != null">comment,</if>-->
<!-- <if test="createBy != null">create_by,</if>-->
<!-- <if test="createTime != null">create_time,</if>-->
<!-- <if test="userId != null">user_id,</if>-->
<!-- <if test="deptId != null">dept_id,</if>-->
<!-- </trim>-->
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
<!-- <if test="sheepId != null">#{sheepId},</if>-->
<!-- <if test="varietyId != null">#{varietyId},</if>-->
<!-- <if test="transTo != null and transTo != ''">#{transTo},</if>-->
<!-- <if test="transFrom != null and transFrom != ''">#{transFrom},</if>-->
<!-- <if test="eventType != null and eventType != ''">#{eventType},</if>-->
<!-- <if test="transType != null">#{transType},</if>-->
<!-- <if test="transitionDate != null">#{transitionDate},</if>-->
<!-- <if test="technician != null and technician != ''">#{technician},</if>-->
<!-- <if test="status != null">#{status},</if>-->
<!-- <if test="comment != null">#{comment},</if>-->
<!-- <if test="createBy != null">#{createBy},</if>-->
<!-- <if test="createTime != null">#{createTime},</if>-->
<!-- <if test="userId != null">#{userId},</if>-->
<!-- <if test="deptId != null">#{deptId},</if>-->
<!-- </trim>-->
<!-- </insert>-->
<insert id="insertScTransitionInfoBatch">
INSERT INTO sc_transition_info (
@@ -135,7 +143,8 @@
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.sheepId},#{item.sheepfoldId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom}, #{item.eventType},
#{item.sheepId},#{item.sheepfoldId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom},
#{item.eventType},
#{item.transType},#{item.transitionDate}, #{item.technician}, #{item.status}, #{item.comment},
#{item.createBy}, now(), #{item.userId},
#{item.deptId}

View File

@@ -24,7 +24,7 @@
select sc.id,
sc.sheep_id,
bs.manage_tags as manageTags,
'去势' as event_type,
'去势' as event_type,
bs.sheepfold_id as sheepfold,
sf.sheepfold_name as sheepfoldName,
bs.variety_id as varietyId,
@@ -43,24 +43,32 @@
<select id="selectScCastrateList" resultMap="ScCastrateResult">
<include refid="selectScCastrateVo"/>
<where>
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
<if test="sc.ids != null and sc.ids.length > 0">
and sc.id IN
<foreach collection="sc.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="sc.sheepfold != null">and bs.sheepfold_id = #{sc.sheepfold}</if>
<if test="sc.varietyId != null">and bs.variety_id = #{sc.varietyId}</if>
<if test="sc.technician != null and sc.technician != ''">
and sc.technician like concat('%', #{sc.technician}, '%')
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and sc.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''">
and sc.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
<if test="sc.ids == null or sc.ids.length == 0">
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
</foreach>
</if>
<if test="sc.sheepfold != null">and bs.sheepfold_id = #{sc.sheepfold}</if>
<if test="sc.varietyId != null">and bs.variety_id = #{sc.varietyId}</if>
<if test="sc.technician != null and sc.technician != ''">
and sc.technician like concat('%', #{sc.technician}, '%')
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and sc.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''">
and sc.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
</if>
${sc.params.dataScope}
</where>

View File

@@ -40,24 +40,32 @@
<select id="selectScFixHoofList" resultMap="ScFixHoofResult">
<include refid="selectScFixHoofVo"/>
<where>
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
<if test="sc.ids != null and sc.ids.length > 0">
and fh.id IN
<foreach collection="sc.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="sc.sheepfold != null">and bs.sheepfold_id = #{sc.sheepfold}</if>
<if test="sc.varietyId != null">and bs.variety_id = #{sc.varietyId}</if>
<if test="sc.technician != null and sc.technician != ''">and fh.technician like concat('%',
#{sc.technician}, '%')
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and fh.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''">
and fh.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
<if test="sc.ids == null or sc.ids.length == 0">
<if test="manageTagsList != null and manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
bs.manage_tags like concat('%', #{tag}, '%')
</foreach>
</if>
<if test="sc.sheepfold != null">and bs.sheepfold_id = #{sc.sheepfold}</if>
<if test="sc.varietyId != null">and bs.variety_id = #{sc.varietyId}</if>
<if test="sc.technician != null and sc.technician != ''">and fh.technician like concat('%',
#{sc.technician}, '%')
</if>
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
and fh.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''">
and fh.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
</if>
${sc.params.dataScope}
</where>