转场,转群,改耳号,改备注,改品种部分bug修复,字段顺序调整

This commit is contained in:
zyh
2026-02-03 14:41:28 +08:00
parent 4ab62cd1f2
commit 2f6a1a9600
30 changed files with 516 additions and 271 deletions

View File

@@ -137,7 +137,6 @@ public class BasSheepController extends BaseController {
} }
BasSheep query = new BasSheep(); BasSheep query = new BasSheep();
query.setTypeId(typeId.longValue()); query.setTypeId(typeId.longValue());
startPage();
List<BasSheep> list = basSheepService.selectBasSheepList(query); List<BasSheep> list = basSheepService.selectBasSheepList(query);
return getDataTable(list); return getDataTable(list);
} }
@@ -154,7 +153,6 @@ public class BasSheepController extends BaseController {
BasSheep query = new BasSheep(); BasSheep query = new BasSheep();
query.setSheepfoldId(sheepfoldId.longValue()); query.setSheepfoldId(sheepfoldId.longValue());
query.setTypeId(typeId.longValue()); query.setTypeId(typeId.longValue());
startPage();
List<BasSheep> list = basSheepService.selectBasSheepList(query); List<BasSheep> list = basSheepService.selectBasSheepList(query);
return getDataTable(list); return getDataTable(list);
} }
@@ -191,7 +189,6 @@ public class BasSheepController extends BaseController {
return success(result); return success(result);
} }
/** /**
* 判断耳号是否存在(用于新增羊只时校验) * 判断耳号是否存在(用于新增羊只时校验)
*/ */

View File

@@ -77,7 +77,7 @@ public class DaRanchController extends BaseController
/** /**
* 获取指定牧场下的所有羊只耳号 * 获取指定牧场下的所有羊只耳号
*/ */
// @GetMapping("/getSheepByRanchId/{ranchId}") @GetMapping("/getSheepByRanchId/{ranchId}")
public AjaxResult getSheepByRanchId(@PathVariable Long ranchId) { public AjaxResult getSheepByRanchId(@PathVariable Long ranchId) {
List<BasSheep> sheepList = basSheepService.getSheepByRanchId(ranchId); List<BasSheep> sheepList = basSheepService.getSheepByRanchId(ranchId);
return AjaxResult.success(sheepList); return AjaxResult.success(sheepList);

View File

@@ -3,6 +3,11 @@ package com.zhyc.module.produce.bodyManage.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.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.*; import org.springframework.web.bind.annotation.*;
@@ -14,6 +19,7 @@ import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
import com.zhyc.module.produce.bodyManage.service.IScBodyMeasureService; import com.zhyc.module.produce.bodyManage.service.IScBodyMeasureService;
import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo; import com.zhyc.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* 体尺测量Controller * 体尺测量Controller
@@ -23,19 +29,18 @@ import com.zhyc.common.core.page.TableDataInfo;
*/ */
@RestController @RestController
@RequestMapping("/body_measure/body_measure") @RequestMapping("/body_measure/body_measure")
public class ScBodyMeasureController extends BaseController public class ScBodyMeasureController extends BaseController {
{
@Autowired @Autowired
private IScBodyMeasureService scBodyMeasureService; private IScBodyMeasureService scBodyMeasureService;
@Autowired
private IBasSheepService basSheepService;
/** /**
* 查询体尺测量列表 * 查询体尺测量列表
*/ */
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:list')") @PreAuthorize("@ss.hasPermi('body_measure:body_measure:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(ScBodyMeasure scBodyMeasure) public TableDataInfo list(ScBodyMeasure scBodyMeasure) {
{
startPage(); startPage();
List<ScBodyMeasure> list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure); List<ScBodyMeasure> list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure);
return getDataTable(list); return getDataTable(list);
@@ -47,8 +52,7 @@ public class ScBodyMeasureController extends BaseController
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:export')") @PreAuthorize("@ss.hasPermi('body_measure:body_measure:export')")
@Log(title = "体尺测量", businessType = BusinessType.EXPORT) @Log(title = "体尺测量", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, ScBodyMeasure scBodyMeasure) public void export(HttpServletResponse response, ScBodyMeasure scBodyMeasure) {
{
List<ScBodyMeasure> list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure); List<ScBodyMeasure> list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure);
ExcelUtil<ScBodyMeasure> util = new ExcelUtil<ScBodyMeasure>(ScBodyMeasure.class); ExcelUtil<ScBodyMeasure> util = new ExcelUtil<ScBodyMeasure>(ScBodyMeasure.class);
util.exportExcel(response, list, "体尺测量数据"); util.exportExcel(response, list, "体尺测量数据");
@@ -59,8 +63,7 @@ public class ScBodyMeasureController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:query')") @PreAuthorize("@ss.hasPermi('body_measure:body_measure:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id) {
{
return success(scBodyMeasureService.selectScBodyMeasureById(id)); return success(scBodyMeasureService.selectScBodyMeasureById(id));
} }
@@ -70,8 +73,7 @@ public class ScBodyMeasureController extends BaseController
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:add')") @PreAuthorize("@ss.hasPermi('body_measure:body_measure:add')")
@Log(title = "体尺测量", businessType = BusinessType.INSERT) @Log(title = "体尺测量", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ScBodyMeasure scBodyMeasure) public AjaxResult add(@RequestBody ScBodyMeasure scBodyMeasure) {
{
return toAjax(scBodyMeasureService.insertScBodyMeasure(scBodyMeasure)); return toAjax(scBodyMeasureService.insertScBodyMeasure(scBodyMeasure));
} }
@@ -81,8 +83,7 @@ public class ScBodyMeasureController extends BaseController
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:edit')") @PreAuthorize("@ss.hasPermi('body_measure:body_measure:edit')")
@Log(title = "体尺测量", businessType = BusinessType.UPDATE) @Log(title = "体尺测量", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ScBodyMeasure scBodyMeasure) public AjaxResult edit(@RequestBody ScBodyMeasure scBodyMeasure) {
{
return toAjax(scBodyMeasureService.updateScBodyMeasure(scBodyMeasure)); return toAjax(scBodyMeasureService.updateScBodyMeasure(scBodyMeasure));
} }
@@ -92,8 +93,7 @@ public class ScBodyMeasureController extends BaseController
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:remove')") @PreAuthorize("@ss.hasPermi('body_measure:body_measure:remove')")
@Log(title = "体尺测量", businessType = BusinessType.DELETE) @Log(title = "体尺测量", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids) {
{
return toAjax(scBodyMeasureService.deleteScBodyMeasureByIds(ids)); return toAjax(scBodyMeasureService.deleteScBodyMeasureByIds(ids));
} }
@@ -101,4 +101,73 @@ public class ScBodyMeasureController extends BaseController
public AjaxResult searchEarNumbers(@RequestParam("query") String query) { public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
return success(scBodyMeasureService.searchEarNumbers(query.trim())); return success(scBodyMeasureService.searchEarNumbers(query.trim()));
} }
/**
* 导入体尺测量数据
*/
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:import')")
@Log(title = "体尺测量", businessType = BusinessType.IMPORT)
@PostMapping("/import")
public AjaxResult importData(@RequestParam("file") MultipartFile file) throws Exception {
ExcelUtil<ScBodyMeasure> util = new ExcelUtil<>(ScBodyMeasure.class);
List<ScBodyMeasure> list = util.importExcel(file.getInputStream());
// 数据校验和处理
StringBuilder errorMsg = new StringBuilder();
int successCount = 0;
int failCount = 0;
for (int i = 0; i < list.size(); i++) {
ScBodyMeasure measure = list.get(i);
try {
// 根据耳号查询羊只ID
if (StringUtils.isNotBlank(measure.getManageTags())) {
BasSheep sheep = basSheepService.selectBasSheepByManageTags(measure.getManageTags().trim());
if (sheep == null) {
failCount++;
errorMsg.append("").append(i + 2).append("行:耳号【")
.append(measure.getManageTags()).append("】不存在;");
continue;
}
measure.setSheepId(sheep.getId());
} else {
failCount++;
errorMsg.append("").append(i + 2).append("行:耳号不能为空;");
continue;
}
// 设置默认值
measure.setCreateTime(DateUtils.getNowDate());
measure.setCreateBy(SecurityUtils.getUsername());
scBodyMeasureService.insertScBodyMeasure(measure);
successCount++;
// 更新羊只当前体重
if (measure.getCurrentWeight() != null) {
BasSheep updateSheep = new BasSheep();
updateSheep.setId(measure.getSheepId());
updateSheep.setCurrentWeight(measure.getCurrentWeight());
basSheepService.updateBasSheep(updateSheep);
}
} catch (Exception e) {
failCount++;
errorMsg.append("").append(i + 2).append("行:").append(e.getMessage()).append("");
}
}
String msg = String.format("导入完成:成功%d条失败%d条", successCount, failCount);
if (failCount > 0) {
msg += ";失败原因:" + errorMsg.toString();
}
return success(msg);
}
/**
* 获取繁殖状态列表(用于下拉选择)
*/
@GetMapping("/breedStatus")
public AjaxResult listBreedStatus() {
return success(scBodyMeasureService.selectBreedStatusList());
}
} }

View File

@@ -1,13 +1,16 @@
package com.zhyc.module.produce.bodyManage.domain; package com.zhyc.module.produce.bodyManage.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@@ -62,8 +65,10 @@ public class ScBodyMeasure extends BaseEntity {
/** /**
* 测量日期 * 测量日期
*/ */
@Excel(name = "测量日期") @Excel(name = "测量日期", dateFormat = "yyyy-MM-dd")
private LocalDate measureDate; @JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date measureDate;
/** /**
* 羊只类别 * 羊只类别
*/ */
@@ -82,10 +87,12 @@ public class ScBodyMeasure extends BaseEntity {
/** /**
* 出生体重 * 出生体重
*/ */
@Excel(name = "出生体重")
private BigDecimal birthWeight; private BigDecimal birthWeight;
/** /**
* 断奶体重 * 断奶体重
*/ */
@Excel(name = "断奶体重")
private BigDecimal weaningWeight; private BigDecimal weaningWeight;
/** /**
* 当前体重 * 当前体重
@@ -173,6 +180,13 @@ public class ScBodyMeasure extends BaseEntity {
*/ */
@Excel(name = "配后天数") @Excel(name = "配后天数")
private Integer postMatingDay; private Integer postMatingDay;
/**
* 技术员
*/
@Excel(name = "技术员")
private String technician;
/** /**
* 备注 * 备注
*/ */
@@ -180,12 +194,22 @@ public class ScBodyMeasure extends BaseEntity {
private String comment; private String comment;
/** /**
* 技术员 * 前端多耳号查询条件,非表字段
*/ */
@Excel(name = "技术员")
private String technician;
/** 前端多耳号查询条件,非表字段 */
private List<String> manageTagsList; private List<String> manageTagsList;
/**
* 是否在群查询条件0-在群1-离群),非数据库字段
*/
private Integer isDelete;
/**
* 月龄查询条件(开始),非数据库字段
*/
private Integer monthAgeStart;
/**
* 月龄查询条件(结束),非数据库字段
*/
private Integer monthAgeEnd;
} }

View File

@@ -78,6 +78,13 @@ public class ScBodyScore extends BaseEntity {
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/** 前端多耳号查询条件,非表字段 */ /**
* 前端多耳号查询条件,非表字段
*/
private List<String> manageTagsList; private List<String> manageTagsList;
/**
* 是否在群查询条件0-在群1-离群),非数据库字段
*/
private Integer isDelete;
} }

View File

@@ -111,7 +111,13 @@ public class ScBreastRating extends BaseEntity {
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/**
/** 前端多耳号查询条件,非表字段 */ * 前端多耳号查询条件,非表字段
*/
private List<String> manageTagsList; private List<String> manageTagsList;
/**
* 是否在群查询条件0-在群1-离群),非数据库字段
*/
private Integer isDelete;
} }

View File

@@ -1,6 +1,8 @@
package com.zhyc.module.produce.bodyManage.mapper; package com.zhyc.module.produce.bodyManage.mapper;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure; import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -69,4 +71,9 @@ public interface ScBodyMeasureMapper
List<ScBodyMeasure> selectScBodyMeasureList( List<ScBodyMeasure> selectScBodyMeasureList(
@Param("sc") ScBodyMeasure sc, @Param("sc") ScBodyMeasure sc,
@Param("manageTagsList") List<String> manageTagsList); @Param("manageTagsList") List<String> manageTagsList);
/**
* 查询繁殖状态列表
*/
List<Map<String, Object>> selectBreedStatusList();
} }

View File

@@ -1,6 +1,8 @@
package com.zhyc.module.produce.bodyManage.service; package com.zhyc.module.produce.bodyManage.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure; import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
/** /**
@@ -60,4 +62,9 @@ public interface IScBodyMeasureService
public int deleteScBodyMeasureById(Long id); public int deleteScBodyMeasureById(Long id);
List<String> searchEarNumbers(String query); List<String> searchEarNumbers(String query);
/**
* 查询繁殖状态列表
*/
List<Map<String, Object>> selectBreedStatusList();
} }

View File

@@ -1,6 +1,8 @@
package com.zhyc.module.produce.bodyManage.service.impl; package com.zhyc.module.produce.bodyManage.service.impl;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.SecurityUtils; import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.StringUtils; import com.zhyc.common.utils.StringUtils;
@@ -127,4 +129,9 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService
{ {
return scBodyMeasureMapper.deleteScBodyMeasureById(id); return scBodyMeasureMapper.deleteScBodyMeasureById(id);
} }
@Override
public List<Map<String, Object>> selectBreedStatusList() {
return scBodyMeasureMapper.selectBreedStatusList();
}
} }

View File

@@ -103,9 +103,6 @@ public class ScTransitionInfoController extends BaseController {
@PutMapping("/approve") @PutMapping("/approve")
public AjaxResult approveScTransitionInfo(@RequestBody ScTransitionInfo scTransitionInfo) { public AjaxResult approveScTransitionInfo(@RequestBody ScTransitionInfo scTransitionInfo) {
if ("转场转入".equals(scTransitionInfo.getEventType()) && scTransitionInfo.getSheepfoldId() == null) {
return AjaxResult.error("转场转入时接收羊舍ID不能为空");
}
int rows = scTransitionInfoService.approveScTransitionInfo(scTransitionInfo); int rows = scTransitionInfoService.approveScTransitionInfo(scTransitionInfo);
return toAjax(rows); return toAjax(rows);
} }
@@ -114,4 +111,6 @@ public class ScTransitionInfoController extends BaseController {
public AjaxResult searchEarNumbers(@RequestParam("query") String query){ public AjaxResult searchEarNumbers(@RequestParam("query") String query){
return success(scTransitionInfoService.searchEarNumbers(query.trim())); return success(scTransitionInfoService.searchEarNumbers(query.trim()));
} }
} }

View File

@@ -31,20 +31,23 @@ public class ScChangeComment extends BaseEntity {
* 羊只id * 羊只id
*/ */
private String sheepId; private String sheepId;
@Excel(name = "管理耳号") @Excel(name = "管理耳号")
private String manageTags; private String manageTags;
/** 羊舍 */
private Long sheepfoldId;
@Excel(name = "羊舍")
private String sheepfoldName;
/** /**
* 事件类型 * 事件类型
*/ */
@Excel(name = "事件类型") @Excel(name = "事件类型")
private String eventType; private String eventType;
/**
* 事件日期
*/
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date eventDate;
/** /**
* 新备注 * 新备注
*/ */
@@ -58,17 +61,25 @@ public class ScChangeComment extends BaseEntity {
private String oldComment; private String oldComment;
/** /**
* 事件日期 * 羊舍
*/ */
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd") private Long sheepfoldId;
@JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "羊舍")
private Date eventDate; private String sheepfoldName;
/** /**
* 技术员 * 技术员
*/ */
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/** 前端多耳号条件,非数据库字段 */ /**
* 前端多耳号条件,非数据库字段
*/
private List<String> manageTagsList; private List<String> manageTagsList;
/**
* 是否在群查询条件0-在群1-离群),非数据库字段
*/
private Integer isDelete;
} }

View File

@@ -36,11 +36,10 @@ public class ScChangeEar extends BaseEntity {
private String manageTags; private String manageTags;
/** /**
* 羊舍 * 品种
*/ */
private Long sheepfoldId; @Excel(name = "品种")
@Excel(name = "羊舍") private String varietyName;
private String sheepfoldName;
/** /**
* 事件类型(改管理耳号/改电子耳号) * 事件类型(改管理耳号/改电子耳号)
@@ -48,6 +47,13 @@ public class ScChangeEar extends BaseEntity {
@Excel(name = "事件类型") @Excel(name = "事件类型")
private String eventType; private String eventType;
/**
* 事件日期
*/
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date eventDate;
/** /**
* 选择更改耳号类型0电子耳号1管理耳号 * 选择更改耳号类型0电子耳号1管理耳号
*/ */
@@ -67,17 +73,11 @@ public class ScChangeEar extends BaseEntity {
private String oldTag; private String oldTag;
/** /**
* 备注 * 羊舍
*/ */
@Excel(name = "备注") private Long sheepfoldId;
private String comment; @Excel(name = "羊舍")
private String sheepfoldName;
/**
* 事件日期
*/
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date eventDate;
/** /**
* 技术员 * 技术员
@@ -85,7 +85,20 @@ public class ScChangeEar extends BaseEntity {
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/**
* 备注
*/
@Excel(name = "备注")
private String comment;
/** 前端多耳号查询条件,非表字段 */ /**
* 前端多耳号查询条件,非表字段
*/
private List<String> manageTagsList; private List<String> manageTagsList;
/**
* 在群状态 0-全部 1-在群 2-不在群(列表查询用)
*/
private Integer inGroup;
} }

View File

@@ -31,9 +31,35 @@ public class ScChangeVariety extends BaseEntity {
* 羊只id * 羊只id
*/ */
private Integer sheepId; private Integer sheepId;
@Excel(name = "耳号") @Excel(name = "耳号")
private String manageTags; private String manageTags;
/**
* 事件类型
*/
@Excel(name = "事件类型")
private String eventType;
/**
* 事件日期
*/
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date eventDate;
/**
* 新品种
*/
@Excel(name = "新品种")
private String varietyNew;
/**
* 旧品种
*/
@Excel(name = "旧品种")
private String varietyOld;
/** /**
* 羊舍 * 羊舍
*/ */
@@ -42,22 +68,10 @@ public class ScChangeVariety extends BaseEntity {
private String sheepfoldName; private String sheepfoldName;
/** /**
* 事件类型 * 技术员
*/ */
@Excel(name = "事件类型") @Excel(name = "技术员")
private String eventType; private String technician;
/**
* 原品种
*/
@Excel(name = "原品种")
private String varietyOld;
/**
* 新品种
*/
@Excel(name = "新品种")
private String varietyNew;
/** /**
* 备注 * 备注
@@ -66,18 +80,12 @@ public class ScChangeVariety extends BaseEntity {
private String comment; private String comment;
/** /**
* 技术员 * 前端多耳号查询条件,非表字段
*/ */
@Excel(name = "技术员") private List<String> manageTagsList;
private String technician;
/** /**
* 事件日期 * 是否在群查询条件0-在群1-离群),非数据库字段
*/ */
@Excel(name = "事件日期",width = 30, dateFormat = "yyyy-MM-dd") private Integer isDelete;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date eventDate;
/** 前端多耳号查询条件,非表字段 */
private List<String> manageTagsList;
} }

View File

@@ -33,42 +33,6 @@ public class ScTransGroup extends BaseEntity {
@Excel(name = "耳号") @Excel(name = "耳号")
private String manageTags; private String manageTags;
/**
* 事件类型1-围产转群2-普通转群3-育肥转群4-预售转群)
*/
private Integer eventType;
@Excel(name = "事件类型")
private String eventTypeText;
/**
* 转入羊舍
*/
private String foldTo;
/**
* 转出羊舍
*/
private String foldFrom;
/**
* 羊只类型
*/
private Integer sheepTypeId;
@Excel(name = "羊只类型")
private String sheepTypeName;
/**
* 转出羊舍名称
*/
@Excel(name = "转出羊舍")
private String foldFromName;
/**
* 转入羊舍名称
*/
@Excel(name = "转入羊舍")
private String foldToName;
/** /**
* 品种id * 品种id
*/ */
@@ -80,40 +44,72 @@ public class ScTransGroup extends BaseEntity {
@Excel(name = "品种") @Excel(name = "品种")
private String varietyName; private String varietyName;
/**
* 事件类型1-围产转群2-普通转群3-育肥转群4-预售转群)
*/
private String eventType;
@Excel(name = "事件类型")
private String eventTypeText;
private Integer reason; /**
* 转群日期
*/
@Excel(name = "转群日期")
private String transDate;
/**
* 转入羊舍
*/
private String foldTo;
/**
* 转入羊舍名称
*/
@Excel(name = "转入羊舍")
private String foldToName;
/**
* 转出羊舍
*/
private String foldFrom;
/**
* 转出羊舍名称
*/
@Excel(name = "转出羊舍")
private String foldFromName;
private String reason;
/** /**
* 转群原因描述 用于导出 * 转群原因描述 用于导出
*/ */
@Excel(name = "转群原因") @Excel(name = "转群原因")
private String reasonText; private String reasonText;
/** 转群日期 */
@Excel(name = "转群日期")
private String transDate;
/** /**
* 技术员 * 技术员
*/ */
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/**
* 状态
*/
private Integer status;
/**
* 状态描述 用于导出
*/
@Excel(name = "状态")
private String statusText;
/** /**
* 备注 * 备注
*/ */
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
/** 前端多耳号查询条件,非表字段 */ /**
* 羊只类型
*/
private Integer sheepTypeId;
private String sheepTypeName;
/**
* 前端多耳号查询条件,非表字段
*/
private List<String> manageTagsList; private List<String> manageTagsList;
/**
* 是否在群查询条件0-在群1-离群)
*/
private Integer isDelete;
} }

View File

@@ -33,24 +33,6 @@ public class ScTransitionInfo extends BaseEntity {
@Excel(name = "耳号") @Excel(name = "耳号")
private String manageTags; private String manageTags;
/**
* 事件类型
*/
@Excel(name = "事件类型")
private String eventType;
/**
* 转场类型
*/
private Integer transType;
@Excel(name = "转场类型")
private String transTypeText;
/** 转场日期 */
@Excel(name = "转场日期")
private LocalDate transitionDate;
/** /**
* 品种id * 品种id
*/ */
@@ -62,6 +44,23 @@ public class ScTransitionInfo extends BaseEntity {
@Excel(name = "品种") @Excel(name = "品种")
private String varietyName; private String varietyName;
/**
* 事件类型
*/
@Excel(name = "事件类型")
private String eventType;
/** 转场日期 */
@Excel(name = "转场日期")
private LocalDate transitionDate;
/**
* 转场类型
*/
private Integer transType;
@Excel(name = "转场类型")
private String transTypeText;
/** /**
* 转入牧场 * 转入牧场
*/ */
@@ -69,21 +68,34 @@ public class ScTransitionInfo extends BaseEntity {
private String transTo; private String transTo;
/** /**
* 当前牧场 * 转出牧场
*/ */
@Excel(name = "当前牧场") @Excel(name = "转出牧场")
private String transFrom; private String transFrom;
/**
* 羊舍
*/
@Excel(name = "羊舍")
private String sheepfoldName;
/** /**
* 接收羊舍 * 接收羊舍
*/ */
private Long sheepfoldId; private Long sheepfoldId;
/** /**
* 技术员 * 技术员
*/ */
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/**
* 备注
*/
@Excel(name = "备注")
private String comment;
/** /**
* 状态 * 状态
*/ */
@@ -91,12 +103,21 @@ public class ScTransitionInfo extends BaseEntity {
@Excel(name = "状态") @Excel(name = "状态")
private String statusText; private String statusText;
/**
* 备注
*/
@Excel(name = "备注")
private String comment;
/** 前端多耳号查询条件,非表字段 */ /** 前端多耳号查询条件,非表字段 */
private List<String> manageTagsList; private List<String> manageTagsList;
private Integer isDelete;
/** 羊只类型ID查询条件非数据库字段 */
private Long sheepTypeId;
/**
* 当前场区ID查询条件关联bas_sheep.ranch_id非数据库字段
*/
private Long currentRanchId;
/**
* 当前场区名称(展示用),非数据库字段
*/
private String currentRanchName;
} }

View File

@@ -59,11 +59,5 @@ public interface IScTransGroupService {
*/ */
public int deleteScTransGroupById(Integer id); public int deleteScTransGroupById(Integer id);
/**
* 审批转群记录
*/
int approveScTransGroup(ScTransGroup scTransGroup);
List<String> searchEarNumbers(String query); List<String> searchEarNumbers(String query);
} }

View File

@@ -42,7 +42,6 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
public ScTransGroup selectScTransGroupById(Integer id) { public ScTransGroup selectScTransGroupById(Integer id) {
ScTransGroup group = scTransGroupMapper.selectScTransGroupById(id); ScTransGroup group = scTransGroupMapper.selectScTransGroupById(id);
group.setReasonText(convertReason(group.getReason())); group.setReasonText(convertReason(group.getReason()));
group.setStatusText(convertStatus(group.getStatus()));
group.setEventTypeText(convertEventType(group.getEventType())); group.setEventTypeText(convertEventType(group.getEventType()));
return group; return group;
} }
@@ -60,7 +59,6 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
scTransGroup.getManageTagsList()); scTransGroup.getManageTagsList());
list.forEach(group -> { list.forEach(group -> {
group.setReasonText(convertReason(group.getReason())); group.setReasonText(convertReason(group.getReason()));
group.setStatusText(convertStatus(group.getStatus()));
group.setEventTypeText(convertEventType(group.getEventType())); group.setEventTypeText(convertEventType(group.getEventType()));
}); });
return list; return list;
@@ -76,7 +74,6 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int insertScTransGroup(ScTransGroup scTransGroup) { public int insertScTransGroup(ScTransGroup scTransGroup) {
scTransGroup.setStatus(0);
scTransGroup.setCreateTime(DateUtils.getNowDate()); scTransGroup.setCreateTime(DateUtils.getNowDate());
scTransGroup.setCreateBy(SecurityUtils.getUsername()); scTransGroup.setCreateBy(SecurityUtils.getUsername());
int rows = scTransGroupMapper.insertScTransGroup(scTransGroup); int rows = scTransGroupMapper.insertScTransGroup(scTransGroup);
@@ -123,22 +120,6 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
return scTransGroupMapper.deleteScTransGroupById(id); return scTransGroupMapper.deleteScTransGroupById(id);
} }
/**
* 审批转群记录
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int approveScTransGroup(ScTransGroup scTransGroup) {
int rows = scTransGroupMapper.updateScTransGroup(scTransGroup);
if (rows > 0 && scTransGroup.getStatus() == 1) {
updateSheepFold(scTransGroup);
}
return rows;
}
/** /**
* 更新羊只所在羊舍 * 更新羊只所在羊舍
*/ */
@@ -177,38 +158,28 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
/** /**
* 转换转群原因 * 转换转群原因
*/ */
private String convertReason(Integer reasonCode) { private String convertReason(String reasonCode) {
Map<Integer, String> reasonMap = new HashMap<>(); if (reasonCode == null) return "未知原因";
reasonMap.put(0, "新产羊过抗转群"); Map<String,String> map = new HashMap<>();
reasonMap.put(1, "治愈转群"); map.put("0","新产羊过抗转群");
reasonMap.put(2, "病羊过抗转群"); map.put("1","治愈转群");
return reasonMap.getOrDefault(reasonCode, "未知原因"); map.put("2","病羊过抗转群");
} return map.getOrDefault(reasonCode, reasonCode);
/**
* 转换状态
*/
private String convertStatus(Integer statusCode) {
Map<Integer, String> statusMap = new HashMap<>();
statusMap.put(0, "待批准");
statusMap.put(1, "通过");
statusMap.put(2, "驳回");
return statusMap.getOrDefault(statusCode, "未知状态");
} }
/** /**
* 转换事件类型1-围产转群2-普通转群3-育肥转群4-预售转群) * 转换事件类型1-围产转群2-普通转群3-育肥转群4-预售转群)
*/ */
private String convertEventType(Integer eventType) { private String convertEventType(String eventType) {
if (eventType == null) { if (eventType == null) {
return "未知"; return "未知";
} }
Map<Integer, String> eventTypeMap = new HashMap<>(); Map<String, String> eventTypeMap = new HashMap<>();
eventTypeMap.put(1, "围产转群"); eventTypeMap.put("1", "围产转群");
eventTypeMap.put(2, "普通转群"); eventTypeMap.put("2", "普通转群");
eventTypeMap.put(3, "育肥转群"); eventTypeMap.put("3", "育肥转群");
eventTypeMap.put(4, "预售转群"); eventTypeMap.put("4", "预售转群");
return eventTypeMap.getOrDefault(eventType, "未知"); return eventTypeMap.getOrDefault(eventType, eventType);
} }
@Override @Override

View File

@@ -135,6 +135,11 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
if (existing.getStatus() != 0) { if (existing.getStatus() != 0) {
throw new RuntimeException("该记录已完成审批,无法重复操作"); throw new RuntimeException("该记录已完成审批,无法重复操作");
} }
if (scTransitionInfo.getStatus() == 1) { // 同意
if ("转场转入".equals(scTransitionInfo.getEventType()) && scTransitionInfo.getSheepfoldId() == null) {
throw new RuntimeException("转场转入时接收羊舍ID不能为空");
}
}
int rows = scTransitionInfoMapper.updateScTransitionInfo(scTransitionInfo); int rows = scTransitionInfoMapper.updateScTransitionInfo(scTransitionInfo);
if (rows > 0 && scTransitionInfo.getStatus() == 1) { if (rows > 0 && scTransitionInfo.getStatus() == 1) {
updateSheepRanch(scTransitionInfo); updateSheepRanch(scTransitionInfo);
@@ -143,52 +148,47 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
} }
/** /**
* 更新羊只的所在牧场(基于现有牧场列表接口) * 更新羊只的所在牧场及羊舍
*/ */
private void updateSheepRanch(ScTransitionInfo transitionInfo) { private void updateSheepRanch(ScTransitionInfo transitionInfo) {
/* 1. 目标牧场 */
String transTo = transitionInfo.getTransTo(); String transTo = transitionInfo.getTransTo();
if (StringUtils.isBlank(transTo)) { if (StringUtils.isBlank(transTo)) {
throw new RuntimeException("转入牧场不能为空"); throw new RuntimeException("转入牧场不能为空");
} }
DaRanch query = new DaRanch(); DaRanch query = new DaRanch();
query.setRanch(transTo); query.setRanch(transTo);
List<DaRanch> ranchList = daRanchService.selectDaRanchList(query); List<DaRanch> ranchList = daRanchService.selectDaRanchList(query);
Optional<DaRanch> matchedRanch = ranchList.stream() Optional<DaRanch> matchedRanch = ranchList.stream()
.filter(ranch -> transTo.equals(ranch.getRanch())) .filter(ranch -> transTo.equals(ranch.getRanch()))
.findFirst(); .findFirst();
if (!matchedRanch.isPresent()) { if (!matchedRanch.isPresent()) {
throw new RuntimeException("转入牧场 [" + transTo + "] 不存在"); throw new RuntimeException("转入牧场 [" + transTo + "] 不存在");
} }
Long targetRanchId = matchedRanch.get().getId(); Long targetRanchId = matchedRanch.get().getId();
//获取接收羊舍 /* 2. 接收羊舍(审批通过时必传) */
Long targetSheepfoldId = transitionInfo.getSheepfoldId(); Long targetSheepfoldId = transitionInfo.getSheepfoldId();
if ("转场转入".equals(transitionInfo.getEventType()) && targetSheepfoldId == null) { if (targetSheepfoldId == null) {
throw new RuntimeException("转场转入时,接收羊舍不能为空"); throw new RuntimeException("接收羊舍不能为空");
} }
/* 3. 逐只迁移 */
String manageTags = transitionInfo.getManageTags(); String manageTags = transitionInfo.getManageTags();
if (StringUtils.isBlank(manageTags)) { if (StringUtils.isBlank(manageTags)) {
throw new RuntimeException("耳号不能为空"); throw new RuntimeException("耳号不能为空");
} }
List<String> tagList = Arrays.asList(manageTags.split(",")); List<String> tagList = Arrays.asList(manageTags.split(","));
for (String tag : tagList) { for (String tag : tagList) {
BasSheep sheep = basSheepService.selectBasSheepByManageTags(tag.trim()); BasSheep sheep = basSheepService.selectBasSheepByManageTags(tag.trim());
if (sheep == null) { if (sheep == null) {
throw new RuntimeException("耳号 [" + tag + "] 不存在"); throw new RuntimeException("耳号 [" + tag + "] 不存在");
} }
BasSheep upd = new BasSheep();
BasSheep updateSheep = new BasSheep(); upd.setId(sheep.getId());
updateSheep.setId(sheep.getId()); upd.setRanchId(targetRanchId);
updateSheep.setRanchId(targetRanchId); upd.setSheepfoldId(targetSheepfoldId); // 真正换舍
if ("转场转入".equals(transitionInfo.getEventType())) { basSheepMapper.updateBasSheep(upd);
updateSheep.setSheepfoldId(targetSheepfoldId);
}
basSheepMapper.updateBasSheep(updateSheep);
} }
} }

View File

@@ -48,10 +48,14 @@ public class ScCastrate extends BaseEntity {
@Excel(name = "羊舍名称") @Excel(name = "羊舍名称")
private String sheepfoldName; private String sheepfoldName;
/** 品种id */ /**
* 品种id
*/
private Long varietyId; private Long varietyId;
/** 品种名称(联表查询返回,非数据库字段) */ /**
* 品种名称(联表查询返回,非数据库字段)
*/
@Excel(name = "品种") @Excel(name = "品种")
private String varietyName; private String varietyName;
@@ -74,6 +78,13 @@ public class ScCastrate extends BaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private String eventDate; private String eventDate;
/** 前端多耳号查询条件,非表字段 */ /**
* 前端多耳号查询条件,非表字段
*/
private List<String> manageTagsList; private List<String> manageTagsList;
/**
* 是否在群查询条件0-在群1-离群),非数据库字段
*/
private Integer isDelete;
} }

View File

@@ -18,14 +18,17 @@ import java.util.List;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class ScFixHoof extends BaseEntity public class ScFixHoof 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
*/
private Integer sheepId; private Integer sheepId;
@Excel(name = "管理耳号") @Excel(name = "管理耳号")
private String manageTags; private String manageTags;
@@ -36,25 +39,37 @@ public class ScFixHoof extends BaseEntity
@Excel(name = "事件类型") @Excel(name = "事件类型")
private String eventType; private String eventType;
/** 羊舍id */ /**
* 羊舍id
*/
private Integer sheepfold; private Integer sheepfold;
/** 羊舍名称 */ /**
* 羊舍名称
*/
@Excel(name = "羊舍名称") @Excel(name = "羊舍名称")
private String sheepfoldName; private String sheepfoldName;
/** 品种id */ /**
* 品种id
*/
private Long varietyId; private Long varietyId;
/** 品种名称(联表查询返回,非数据库字段) */ /**
* 品种名称(联表查询返回,非数据库字段)
*/
@Excel(name = "品种") @Excel(name = "品种")
private String varietyName; private String varietyName;
/** 备注 */ /**
* 备注
*/
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
/** 技术员 */ /**
* 技术员
*/
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
@@ -65,6 +80,13 @@ public class ScFixHoof extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private String eventDate; private String eventDate;
/** 前端多耳号查询条件,非表字段 */ /**
* 前端多耳号查询条件,非表字段
*/
private List<String> manageTagsList; private List<String> manageTagsList;
/**
* 是否在群查询条件0-在群1-离群),非数据库字段
*/
private Integer isDelete;
} }

View File

@@ -103,6 +103,24 @@
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''"> <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} and sm.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if> </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[ TIMESTAMPDIFF(MONTH, bs.birthday, CURDATE()) >= #{sc.monthAgeStart} ]]>
</if>
<if test="sc.monthAgeEnd != null">
and <![CDATA[ TIMESTAMPDIFF(MONTH, bs.birthday, CURDATE()) <= #{sc.monthAgeEnd} ]]>
</if>
<if test="sc.breedStatusName != null and sc.breedStatusName != ''">
and bbs.breed = #{sc.breedStatusName}
</if>
</where> </where>
ORDER BY sm.create_time DESC ORDER BY sm.create_time DESC
</select> </select>
@@ -196,6 +214,11 @@
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0 AND bs.is_delete = 0
ORDER BY bs.manage_tags ORDER BY bs.manage_tags
LIMIT 50 </select>
<select id="selectBreedStatusList" resultType="java.util.HashMap">
SELECT id, breed as label, breed as value
FROM bas_breed_status
ORDER BY id
</select> </select>
</mapper> </mapper>

View File

@@ -59,6 +59,9 @@
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''"> <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} and sbs.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if> </if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
</where> </where>
ORDER BY sbs.create_time DESC ORDER BY sbs.create_time DESC
</select> </select>

View File

@@ -57,6 +57,9 @@
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.endCreateTime != null"> <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} and sbr.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if> </if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
</where> </where>
ORDER BY sbr.create_time DESC ORDER BY sbr.create_time DESC
</select> </select>
@@ -134,7 +137,6 @@
FROM bas_sheep bs FROM bas_sheep bs
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0 AND bs.is_delete = 0
ORDER BY bs.manage_tags ORDER BY bs.manage_tags LIMIT 50
LIMIT 50
</select> </select>
</mapper> </mapper>

View File

@@ -43,8 +43,11 @@
bs.manage_tags like concat('%', #{tag}, '%') bs.manage_tags like concat('%', #{tag}, '%')
</foreach> </foreach>
</if> </if>
<if test="sc.sheepfoldId != null"> <!-- <if test="sc.sheepfoldId != null">-->
and bs.sheepfold_id = #{sc.sheepfoldId} <!-- and bs.sheepfold_id = #{sc.sheepfoldId}-->
<!-- </if>-->
<if test="sc.technician != null and sc.technician != ''">
and scc.technician like concat('%', #{sc.technician}, '%')
</if> </if>
<if test="sc.newComment != null and sc.newComment != ''"> <if test="sc.newComment != null and sc.newComment != ''">
and scc.new_comment like concat('%', #{sc.newComment}, '%') and scc.new_comment like concat('%', #{sc.newComment}, '%')
@@ -60,6 +63,9 @@
and sc.params.endEventDate != null and sc.params.endEventDate != ''"> and sc.params.endEventDate != null and sc.params.endEventDate != ''">
and scc.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate} and scc.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if> </if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
</where> </where>
ORDER BY scc.create_time DESC ORDER BY scc.create_time DESC
</select> </select>

View File

@@ -25,6 +25,7 @@
sce.sheep_id, sce.sheep_id,
bs.manage_tags as manage_tags, bs.manage_tags as manage_tags,
sf.sheepfold_name as sheepfold_name, sf.sheepfold_name as sheepfold_name,
bv.variety as varietyName,
case case
when sce.ear_type = 0 then '改电子耳号' when sce.ear_type = 0 then '改电子耳号'
when sce.ear_type = 1 then '改管理耳号' when sce.ear_type = 1 then '改管理耳号'
@@ -41,6 +42,7 @@
from sc_change_ear sce from sc_change_ear sce
LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id
LEFT JOIN da_sheepfold sf ON bs.sheepfold_id = sf.id LEFT JOIN da_sheepfold sf ON bs.sheepfold_id = sf.id
LEFT JOIN bas_sheep_variety bv on bs.variety_id = bv.id
</sql> </sql>
<select id="selectScChangeEarList" resultMap="ScChangeEarResult"> <select id="selectScChangeEarList" resultMap="ScChangeEarResult">
@@ -53,7 +55,7 @@
or bs.electronic_tags like concat('%', #{tag}, '%')) or bs.electronic_tags like concat('%', #{tag}, '%'))
</foreach> </foreach>
</if> </if>
<if test="sc.sheepfoldId != null">and bs.sheepfold_id = #{sc.sheepfoldId}</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.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.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.oldTag != null and sc.oldTag != ''">and sce.oldTag like concat('%', #{sc.oldTag}, '%')</if>
@@ -65,6 +67,12 @@
and sc.params.endEventDate != null and sc.params.endEventDate != ''"> and sc.params.endEventDate != null and sc.params.endEventDate != ''">
and sce.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate} and sce.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if> </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>
</where> </where>
ORDER BY sce.create_time DESC ORDER BY sce.create_time DESC
</select> </select>

View File

@@ -46,15 +46,25 @@
</foreach> </foreach>
</if> </if>
<if test="sc.sheepId != null">and scv.sheep_id = #{sc.sheepId}</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.sheepfoldId != null">and bs.sheepfold_id = #{sc.sheepfoldId}</if>-->
<if test="sc.varietyOld != null and sc.varietyOld != ''">and scv.variety_old like concat('%', #{sc.varietyOld}, '%')</if> <if test="sc.technician != null and sc.technician != ''">and scv.technician like concat('%',
<if test="sc.varietyNew != null and sc.varietyNew != ''">and scv.variety_new like concat('%', #{sc.varietyNew}, '%')</if> #{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 != ''"> <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} and scv.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if> </if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''"> <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} and scv.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if> </if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
</where> </where>
ORDER BY scv.create_time DESC ORDER BY scv.create_time DESC
</select> </select>
@@ -119,7 +129,6 @@
FROM bas_sheep bs FROM bas_sheep bs
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0 AND bs.is_delete = 0
ORDER BY bs.manage_tags ORDER BY bs.manage_tags LIMIT 50
LIMIT 50
</select> </select>
</mapper> </mapper>

View File

@@ -15,7 +15,6 @@
<result property="varietyId" column="variety_id"/> <result property="varietyId" column="variety_id"/>
<result property="varietyName" column="varietyName"/> <result property="varietyName" column="varietyName"/>
<result property="technician" column="technician"/> <result property="technician" column="technician"/>
<result property="status" column="status"/>
<result property="comment" column="comment"/> <result property="comment" column="comment"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
@@ -34,7 +33,6 @@
bv.variety AS varietyName, bv.variety AS varietyName,
st.id AS sheepTypeId, st.id AS sheepTypeId,
st.name AS sheepTypeName, st.name AS sheepTypeName,
tg.status,
tg.comment, tg.comment,
tg.create_by, tg.create_by,
tg.create_time, tg.create_time,
@@ -54,20 +52,28 @@
<select id="selectScTransGroupList" resultMap="ScTransGroupResult"> <select id="selectScTransGroupList" resultMap="ScTransGroupResult">
<include refid="selectScTransGroupVo"/> <include refid="selectScTransGroupVo"/>
<where> <where>
<if test="manageTagsList != null and manageTagsList.size() > 0"> <if test="sc.manageTagsList != null and sc.manageTagsList.size() > 0">
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")"> <foreach collection="sc.manageTagsList" item="tag" separator="or" open="and (" close=")">
s.manage_tags like concat('%', #{tag}, '%') s.manage_tags LIKE CONCAT('%', #{tag}, '%')
</foreach> </foreach>
</if> </if>
<if test="sc.sheepId != null">and tg.sheep_id = #{sc.sheepId}</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.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.foldFrom != null and sc.foldFrom != ''">and tg.fold_from = #{sc.foldFrom}</if>
<if test="sc.status != null">and tg.status = #{sc.status}</if>
<if test="sc.varietyId != null">and tg.variety_id = #{sc.varietyId}</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.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 != ''"> <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} and tg.trans_date between #{sc.params.beginTransDate} and #{sc.params.endTransDate}
</if> </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>
</where> </where>
ORDER BY tg.create_time DESC ORDER BY tg.create_time DESC
</select> </select>
@@ -90,7 +96,6 @@
<if test="varietyId != null">variety_id,</if> <if test="varietyId != null">variety_id,</if>
<if test="reason != null">reason,</if> <if test="reason != null">reason,</if>
<if test="technician != null and technician != ''">technician,</if> <if test="technician != null and technician != ''">technician,</if>
<if test="status != null">status,</if>
<if test="comment != null">comment,</if> <if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
@@ -104,7 +109,6 @@
<if test="varietyId != null">#{varietyId},</if> <if test="varietyId != null">#{varietyId},</if>
<if test="reason != null">#{reason},</if> <if test="reason != null">#{reason},</if>
<if test="technician != null and technician != ''">#{technician},</if> <if test="technician != null and technician != ''">#{technician},</if>
<if test="status != null">#{status},</if>
<if test="comment != null">#{comment},</if> <if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
@@ -122,7 +126,6 @@
<if test="varietyId != null">variety_id = #{varietyId},</if> <if test="varietyId != null">variety_id = #{varietyId},</if>
<if test="reason != null">reason = #{reason},</if> <if test="reason != null">reason = #{reason},</if>
<if test="technician != null and technician != ''">technician = #{technician},</if> <if test="technician != null and technician != ''">technician = #{technician},</if>
<if test="status != null">status = #{status},</if>
<if test="comment != null">comment = #{comment},</if> <if test="comment != null">comment = #{comment},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
@@ -149,6 +152,5 @@
WHERE s.manage_tags LIKE CONCAT('%', #{query}, '%') WHERE s.manage_tags LIKE CONCAT('%', #{query}, '%')
AND s.is_delete = 0 AND s.is_delete = 0
ORDER BY s.manage_tags ORDER BY s.manage_tags
LIMIT 50
</select> </select>
</mapper> </mapper>

View File

@@ -25,8 +25,10 @@
SELECT t.*, SELECT t.*,
bv.variety AS varietyName, bv.variety AS varietyName,
bs.manage_tags AS manageTags, bs.manage_tags AS manageTags,
sf.sheepfold_name AS sheepfoldName,
t.event_type AS eventType, t.event_type AS eventType,
t.transition_date AS transitionDate, t.transition_date AS transitionDate,
dr.ranch AS currentRanchName,
CASE t.trans_type CASE t.trans_type
WHEN 0 THEN '内部调拨' WHEN 0 THEN '内部调拨'
WHEN 1 THEN '内部销售' WHEN 1 THEN '内部销售'
@@ -42,6 +44,8 @@
FROM sc_transition_info t FROM sc_transition_info t
LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id
LEFT JOIN bas_sheep_variety bv ON bs.variety_id = bv.id LEFT JOIN bas_sheep_variety bv ON bs.variety_id = bv.id
LEFT JOIN da_sheepfold sf ON t.sheepfold_id = sf.id
LEFT JOIN da_ranch dr ON bs.ranch_id = dr.id
</sql> </sql>
<select id="selectScTransitionInfoList" resultMap="ScTransitionInfoResult"> <select id="selectScTransitionInfoList" resultMap="ScTransitionInfoResult">
@@ -61,6 +65,18 @@
<if test="sc.params != null and sc.params.beginTransitionDate != null and sc.params.beginTransitionDate != '' and sc.params.endTransitionDate != null and sc.params.endTransitionDate != ''"> <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} and t.transition_date between #{sc.params.beginTransitionDate} and #{sc.params.endTransitionDate}
</if> </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>
</where> </where>
ORDER BY t.create_time DESC ORDER BY t.create_time DESC
</select> </select>
@@ -155,7 +171,6 @@
FROM bas_sheep bs FROM bas_sheep bs
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0 AND bs.is_delete = 0
ORDER BY bs.manage_tags ORDER BY bs.manage_tags LIMIT 50
LIMIT 50
</select> </select>
</mapper> </mapper>

View File

@@ -57,6 +57,9 @@
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''"> <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} and sc.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if> </if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
</where> </where>
ORDER BY sc.create_time DESC ORDER BY sc.create_time DESC
</select> </select>

View File

@@ -47,13 +47,18 @@
</if> </if>
<if test="sc.sheepfold != null">and bs.sheepfold_id = #{sc.sheepfold}</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.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.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 != ''"> <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} and fh.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
</if> </if>
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''"> <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} and fh.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
</if> </if>
<if test="sc.isDelete != null">
and bs.is_delete = #{sc.isDelete}
</if>
</where> </where>
ORDER BY fh.create_time DESC ORDER BY fh.create_time DESC
</select> </select>
@@ -118,6 +123,5 @@
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%') WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0 AND bs.is_delete = 0
ORDER BY bs.manage_tags ORDER BY bs.manage_tags
LIMIT 50
</select> </select>
</mapper> </mapper>