Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -168,7 +168,7 @@ public class BasSheepController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 根据羊只类型ID查询羊只列表
|
* 根据羊只类型ID查询羊只列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('sheep:sheep:query')")
|
// @PreAuthorize("@ss.hasPermi('sheep:sheep:queryByType')")
|
||||||
@GetMapping("/listByTypeId")
|
@GetMapping("/listByTypeId")
|
||||||
public TableDataInfo listByTypeId(Integer typeId) {
|
public TableDataInfo listByTypeId(Integer typeId) {
|
||||||
if (typeId == null) {
|
if (typeId == null) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.zhyc.common.annotation.Log;
|
|||||||
import com.zhyc.common.core.controller.BaseController;
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
import com.zhyc.common.core.domain.AjaxResult;
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
import com.zhyc.common.enums.BusinessType;
|
import com.zhyc.common.enums.BusinessType;
|
||||||
|
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore; // 引入实体类
|
||||||
import com.zhyc.module.dairyProducts.service.INpMilkInOutStoreService;
|
import com.zhyc.module.dairyProducts.service.INpMilkInOutStoreService;
|
||||||
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;
|
||||||
@@ -32,7 +33,16 @@ public class NpMilkInOutStoreController extends BaseController {
|
|||||||
@RequestParam(required=false) Date datetimeEnd
|
@RequestParam(required=false) Date datetimeEnd
|
||||||
) {
|
) {
|
||||||
startPage();
|
startPage();
|
||||||
List<Map<String, Object>> rows = service.selectWithDynamicColumns(datetimeStart, datetimeEnd);
|
// 修改:封装查询参数到实体对象,以便利用 BaseEntity 的 params 属性传递数据权限
|
||||||
|
NpMilkInOutStore query = new NpMilkInOutStore();
|
||||||
|
if (datetimeStart != null) {
|
||||||
|
query.getParams().put("beginTime", datetimeStart);
|
||||||
|
}
|
||||||
|
if (datetimeEnd != null) {
|
||||||
|
query.getParams().put("endTime", datetimeEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Map<String, Object>> rows = service.selectWithDynamicColumns(query);
|
||||||
return getDataTable(rows);
|
return getDataTable(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,6 +55,7 @@ public class NpMilkInOutStoreController extends BaseController {
|
|||||||
service.batchInsertFromRows(list);
|
service.batchInsertFromRows(list);
|
||||||
return AjaxResult.success("导入成功");
|
return AjaxResult.success("导入成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出 Excel */
|
/** 导出 Excel */
|
||||||
@PreAuthorize("@ss.hasPermi('milkInOutStore:export')")
|
@PreAuthorize("@ss.hasPermi('milkInOutStore:export')")
|
||||||
@Log(title="导出羊奶出入库", businessType=BusinessType.EXPORT)
|
@Log(title="导出羊奶出入库", businessType=BusinessType.EXPORT)
|
||||||
@@ -53,10 +64,20 @@ public class NpMilkInOutStoreController extends BaseController {
|
|||||||
@RequestParam(required=false) Date datetimeStart,
|
@RequestParam(required=false) Date datetimeStart,
|
||||||
@RequestParam(required=false) Date datetimeEnd
|
@RequestParam(required=false) Date datetimeEnd
|
||||||
) {
|
) {
|
||||||
List<Map<String,Object>> rows = service.selectWithDynamicColumns(datetimeStart, datetimeEnd);
|
// 修改:封装查询参数到实体对象
|
||||||
|
NpMilkInOutStore query = new NpMilkInOutStore();
|
||||||
|
if (datetimeStart != null) {
|
||||||
|
query.getParams().put("beginTime", datetimeStart);
|
||||||
|
}
|
||||||
|
if (datetimeEnd != null) {
|
||||||
|
query.getParams().put("endTime", datetimeEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Map<String,Object>> rows = service.selectWithDynamicColumns(query);
|
||||||
// 解决方案:强制转换并压制警告
|
// 解决方案:强制转换并压制警告
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
ExcelUtil<Map<String,Object>> util = new ExcelUtil<>((Class<Map<String,Object>>) (Class<?>) Map.class);
|
ExcelUtil<Map<String,Object>> util = new ExcelUtil<>((Class<Map<String,Object>>) (Class<?>) Map.class);
|
||||||
|
util.exportExcel(response, rows, "羊奶出入库数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取可选列定义(饲喂来源 + 销售去向) */
|
/** 获取可选列定义(饲喂来源 + 销售去向) */
|
||||||
@@ -65,5 +86,4 @@ public class NpMilkInOutStoreController extends BaseController {
|
|||||||
public AjaxResult getColumns(){
|
public AjaxResult getColumns(){
|
||||||
return AjaxResult.success(service.getAllColumnOptions());
|
return AjaxResult.success(service.getAllColumnOptions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5,11 +5,20 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.zhyc.common.annotation.Excel;
|
import com.zhyc.common.annotation.Excel;
|
||||||
|
import com.zhyc.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
public class NpMilkProdClasses implements Serializable {
|
/**
|
||||||
|
* 班次奶量对象 np_milk_prod_classes
|
||||||
|
* * 修改说明:继承 BaseEntity 以支持数据权限(params.dataScope)
|
||||||
|
*/
|
||||||
|
public class NpMilkProdClasses extends BaseEntity implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
// 注意:BaseEntity 中通常已包含 createTime 和 updateTime。
|
||||||
|
// 如果父类已有,此处保留会发生字段遮蔽(Shadowing),但能保证代码兼容性。
|
||||||
|
// 为了修复 params 报错,保留原样即可,核心是 extends BaseEntity。
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ package com.zhyc.module.dairyProducts.mapper;
|
|||||||
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
|
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface NpMilkInOutStoreMapper {
|
public interface NpMilkInOutStoreMapper {
|
||||||
/**
|
/**
|
||||||
* 动态列查询
|
* 动态列查询
|
||||||
|
* 修改:使用 @Param("queryParams") 传递实体,包含 params.dataScope
|
||||||
*/
|
*/
|
||||||
List<Map<String,Object>> selectWithColumns(
|
List<Map<String,Object>> selectWithColumns(
|
||||||
@Param("start") Date start, @Param("end") Date end,
|
@Param("queryParams") NpMilkInOutStore queryParams,
|
||||||
@Param("feedSources") List<String> feedSources,
|
@Param("feedSources") List<String> feedSources,
|
||||||
@Param("saleDestinations") List<String> saleDestinations
|
@Param("saleDestinations") List<String> saleDestinations
|
||||||
);
|
);
|
||||||
@@ -23,7 +23,7 @@ public interface NpMilkInOutStoreMapper {
|
|||||||
int insertStore(NpMilkInOutStore store);
|
int insertStore(NpMilkInOutStore store);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入饲喂子表(已修正:增加 userId 和 deptId 参数)
|
* 插入饲喂子表
|
||||||
*/
|
*/
|
||||||
void insertFeedRecord(
|
void insertFeedRecord(
|
||||||
@Param("storeId") Integer storeId,
|
@Param("storeId") Integer storeId,
|
||||||
@@ -34,7 +34,7 @@ public interface NpMilkInOutStoreMapper {
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入销售子表(已修正:增加 userId 和 deptId 参数)
|
* 插入销售子表
|
||||||
*/
|
*/
|
||||||
void insertSaleRecord(
|
void insertSaleRecord(
|
||||||
@Param("storeId") Integer storeId,
|
@Param("storeId") Integer storeId,
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package com.zhyc.module.dairyProducts.service;
|
package com.zhyc.module.dairyProducts.service;
|
||||||
|
|
||||||
|
import com.zhyc.module.dairyProducts.domain.NpMilkInOutStore; // 引入实体
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface INpMilkInOutStoreService {
|
public interface INpMilkInOutStoreService {
|
||||||
List<Map<String,Object>> selectWithDynamicColumns(Date start, Date end);
|
// 修改参数为实体对象
|
||||||
|
List<Map<String,Object>> selectWithDynamicColumns(NpMilkInOutStore query);
|
||||||
|
|
||||||
List<Map<String,Object>> getAllColumnOptions();
|
List<Map<String,Object>> getAllColumnOptions();
|
||||||
List<Map<String,Object>> parseImportExcel(MultipartFile file) throws Exception;
|
List<Map<String,Object>> parseImportExcel(MultipartFile file) throws Exception;
|
||||||
void batchInsertFromRows(List<Map<String,Object>> rows) throws Exception;
|
void batchInsertFromRows(List<Map<String,Object>> rows) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,11 +21,12 @@ public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
|
|||||||
private NpMilkInOutStoreMapper mapper;
|
private NpMilkInOutStoreMapper mapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "s", userAlias = "s")
|
@DataScope(deptAlias = "s", userAlias = "s") // 启用数据权限注解
|
||||||
public List<Map<String, Object>> selectWithDynamicColumns(Date start, Date end) {
|
public List<Map<String, Object>> selectWithDynamicColumns(NpMilkInOutStore query) {
|
||||||
List<String> feed = mapper.selectFeedSources();
|
List<String> feed = mapper.selectFeedSources();
|
||||||
List<String> sale = mapper.selectSaleDestinations();
|
List<String> sale = mapper.selectSaleDestinations();
|
||||||
return mapper.selectWithColumns(start, end, feed, sale);
|
// 将实体对象传递给 Mapper
|
||||||
|
return mapper.selectWithColumns(query, feed, sale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -35,6 +36,7 @@ public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
|
|||||||
m.put("sale", mapper.selectSaleDestinations());
|
m.put("sale", mapper.selectSaleDestinations());
|
||||||
return Collections.singletonList(m);
|
return Collections.singletonList(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> parseImportExcel(MultipartFile file) throws Exception {
|
public List<Map<String, Object>> parseImportExcel(MultipartFile file) throws Exception {
|
||||||
// 用 Apache POI 解析 Excel 第一行标题,动态映射列名跟 unit cells
|
// 用 Apache POI 解析 Excel 第一行标题,动态映射列名跟 unit cells
|
||||||
@@ -61,10 +63,8 @@ public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchInsertFromRows(List<Map<String, Object>> rows) throws Exception {
|
public void batchInsertFromRows(List<Map<String, Object>> rows) throws Exception {
|
||||||
// === 修改开始:获取当前用户和部门ID ===
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
Long deptId = SecurityUtils.getDeptId();
|
Long deptId = SecurityUtils.getDeptId();
|
||||||
// === 修改结束 ===
|
|
||||||
|
|
||||||
for (Map<String,Object> row : rows) {
|
for (Map<String,Object> row : rows) {
|
||||||
// 提取主表字段
|
// 提取主表字段
|
||||||
@@ -76,10 +76,8 @@ public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
|
|||||||
// 手动填充其它主表字段,这里省略了具体的 get 调用,请根据您的 Excel 列名自行补充
|
// 手动填充其它主表字段,这里省略了具体的 get 调用,请根据您的 Excel 列名自行补充
|
||||||
// store.setColostSheep(...);
|
// store.setColostSheep(...);
|
||||||
|
|
||||||
// === 修改开始:给主表实体注入用户和部门ID ===
|
|
||||||
store.setUserId(userId);
|
store.setUserId(userId);
|
||||||
store.setDeptId(deptId);
|
store.setDeptId(deptId);
|
||||||
// === 修改结束 ===
|
|
||||||
|
|
||||||
mapper.insertStore(store);
|
mapper.insertStore(store);
|
||||||
Integer sid = store.getId();
|
Integer sid = store.getId();
|
||||||
@@ -94,10 +92,8 @@ public class NpMilkInOutStoreServiceImpl implements INpMilkInOutStoreService {
|
|||||||
BigDecimal amt = new BigDecimal(ent.getValue().toString());
|
BigDecimal amt = new BigDecimal(ent.getValue().toString());
|
||||||
|
|
||||||
if (mapper.selectFeedSources().contains(col)) {
|
if (mapper.selectFeedSources().contains(col)) {
|
||||||
// === 修改开始:插入饲喂子表时传入 userId 和 deptId ===
|
|
||||||
mapper.insertFeedRecord(sid, col, amt, userId, deptId);
|
mapper.insertFeedRecord(sid, col, amt, userId, deptId);
|
||||||
} else if (mapper.selectSaleDestinations().contains(col)) {
|
} else if (mapper.selectSaleDestinations().contains(col)) {
|
||||||
// === 修改开始:插入销售子表时传入 userId 和 deptId ===
|
|
||||||
mapper.insertSaleRecord(sid, col, amt, userId, deptId);
|
mapper.insertSaleRecord(sid, col, amt, userId, deptId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ public class ScBodyMeasureController extends BaseController {
|
|||||||
@Log(title = "体尺测量", businessType = BusinessType.INSERT)
|
@Log(title = "体尺测量", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ScBodyMeasure scBodyMeasure) {
|
public AjaxResult add(@RequestBody ScBodyMeasure scBodyMeasure) {
|
||||||
|
scBodyMeasure.setUserId(getUserId());
|
||||||
|
scBodyMeasure.setDeptId(getDeptId());
|
||||||
return toAjax(scBodyMeasureService.insertScBodyMeasure(scBodyMeasure));
|
return toAjax(scBodyMeasureService.insertScBodyMeasure(scBodyMeasure));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,6 +142,9 @@ public class ScBodyMeasureController extends BaseController {
|
|||||||
measure.setCreateTime(DateUtils.getNowDate());
|
measure.setCreateTime(DateUtils.getNowDate());
|
||||||
measure.setCreateBy(SecurityUtils.getUsername());
|
measure.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
|
||||||
|
// 数据分离:自动填充当前用户和部门
|
||||||
|
measure.setUserId(getUserId());
|
||||||
|
measure.setDeptId(getDeptId());
|
||||||
scBodyMeasureService.insertScBodyMeasure(measure);
|
scBodyMeasureService.insertScBodyMeasure(measure);
|
||||||
successCount++;
|
successCount++;
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ public class ScBodyScoreController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ScBodyScore scBodyScore)
|
public AjaxResult add(@RequestBody ScBodyScore scBodyScore)
|
||||||
{
|
{
|
||||||
|
scBodyScore.setUserId(getUserId());
|
||||||
|
scBodyScore.setDeptId(getDeptId());
|
||||||
return toAjax(scBodyScoreService.insertScBodyScore(scBodyScore));
|
return toAjax(scBodyScoreService.insertScBodyScore(scBodyScore));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ public class ScBreastRatingController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ScBreastRating scBreastRating)
|
public AjaxResult add(@RequestBody ScBreastRating scBreastRating)
|
||||||
{
|
{
|
||||||
|
scBreastRating.setUserId(getUserId());
|
||||||
|
scBreastRating.setDeptId(getDeptId());
|
||||||
return toAjax(scBreastRatingService.insertScBreastRating(scBreastRating));
|
return toAjax(scBreastRatingService.insertScBreastRating(scBreastRating));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -212,4 +212,38 @@ public class ScBodyMeasure extends BaseEntity {
|
|||||||
* 月龄查询条件(结束),非数据库字段
|
* 月龄查询条件(结束),非数据库字段
|
||||||
*/
|
*/
|
||||||
private Integer monthAgeEnd;
|
private Integer monthAgeEnd;
|
||||||
|
|
||||||
|
@Excel(name = "月龄")
|
||||||
|
private Integer monthAge; // 测量时月龄
|
||||||
|
|
||||||
|
@Excel(name = "乳房深度")
|
||||||
|
private Long breastDepth; // 测量时乳房深度
|
||||||
|
|
||||||
|
@Excel(name = "乳头位置")
|
||||||
|
private String breastPosition; // 测量时乳头位置
|
||||||
|
|
||||||
|
@Excel(name = "乳头长度")
|
||||||
|
private Long breastLength; // 测量时乳头长度
|
||||||
|
|
||||||
|
@Excel(name = "乳房附着")
|
||||||
|
private String breastAdbere; // 测量时乳房附着
|
||||||
|
|
||||||
|
@Excel(name = "乳房间隔度")
|
||||||
|
private String breastSpacing; // 测量时乳房间隔度
|
||||||
|
|
||||||
|
@Excel(name = "乳房评分")
|
||||||
|
private Long breastScore; // 测量时乳房评分(快照)
|
||||||
|
|
||||||
|
@Excel(name = "体况评分")
|
||||||
|
private Long bodyScore; // 测量时体况评分(快照)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,4 +87,14 @@ public class ScBodyScore extends BaseEntity {
|
|||||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||||
*/
|
*/
|
||||||
private Integer isDelete;
|
private Integer isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,33 +54,24 @@ public class ScBreastRating extends BaseEntity {
|
|||||||
@Excel(name = "事件日期")
|
@Excel(name = "事件日期")
|
||||||
private LocalDate eventDate;
|
private LocalDate eventDate;
|
||||||
|
|
||||||
/**
|
|
||||||
* 羊舍ID
|
|
||||||
*/
|
|
||||||
private Long sheepfoldId;
|
|
||||||
@Excel(name = "羊舍")
|
|
||||||
/** 羊舍名称(用于展示) */
|
|
||||||
private String sheepfoldName;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 乳房深度
|
* 乳房深度
|
||||||
*/
|
*/
|
||||||
@Excel(name = "乳房深度")
|
@Excel(name = "乳房深度")
|
||||||
private Long depth;
|
private Long depth;
|
||||||
|
|
||||||
/**
|
|
||||||
* 乳房长度
|
|
||||||
*/
|
|
||||||
@Excel(name = "乳房长度")
|
|
||||||
private Long length;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 乳房位置
|
* 乳房位置
|
||||||
*/
|
*/
|
||||||
@Excel(name = "乳房位置")
|
@Excel(name = "乳房位置")
|
||||||
private String position;
|
private String position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乳房长度
|
||||||
|
*/
|
||||||
|
@Excel(name = "乳房长度")
|
||||||
|
private Long length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 乳房附着
|
* 乳房附着
|
||||||
*/
|
*/
|
||||||
@@ -100,10 +91,12 @@ public class ScBreastRating extends BaseEntity {
|
|||||||
private Long score;
|
private Long score;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 羊舍ID
|
||||||
*/
|
*/
|
||||||
@Excel(name = "备注")
|
private Long sheepfoldId;
|
||||||
private String comment;
|
@Excel(name = "羊舍")
|
||||||
|
/** 羊舍名称(用于展示) */
|
||||||
|
private String sheepfoldName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 技术员
|
* 技术员
|
||||||
@@ -111,6 +104,12 @@ public class ScBreastRating extends BaseEntity {
|
|||||||
@Excel(name = "技术员")
|
@Excel(name = "技术员")
|
||||||
private String technician;
|
private String technician;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String comment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 前端多耳号查询条件,非表字段
|
* 前端多耳号查询条件,非表字段
|
||||||
*/
|
*/
|
||||||
@@ -120,4 +119,14 @@ public class ScBreastRating extends BaseEntity {
|
|||||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||||
*/
|
*/
|
||||||
private Integer isDelete;
|
private Integer isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.zhyc.module.produce.bodyManage.mapper;
|
package com.zhyc.module.produce.bodyManage.mapper;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
||||||
|
import com.zhyc.module.produce.bodyManage.domain.ScBreastRating;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,4 +78,6 @@ public interface ScBodyMeasureMapper
|
|||||||
* 查询繁殖状态列表
|
* 查询繁殖状态列表
|
||||||
*/
|
*/
|
||||||
List<Map<String, Object>> selectBreedStatusList();
|
List<Map<String, Object>> selectBreedStatusList();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zhyc.module.produce.bodyManage.mapper;
|
package com.zhyc.module.produce.bodyManage.mapper;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.zhyc.module.produce.bodyManage.domain.ScBreastRating;
|
import com.zhyc.module.produce.bodyManage.domain.ScBreastRating;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -69,4 +70,12 @@ public interface ScBreastRatingMapper
|
|||||||
List<ScBreastRating> selectScBreastRatingList(
|
List<ScBreastRating> selectScBreastRatingList(
|
||||||
@Param("sc") ScBreastRating sc,
|
@Param("sc") ScBreastRating sc,
|
||||||
@Param("manageTagsList") List<String> manageTagsList);
|
@Param("manageTagsList") List<String> manageTagsList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指定日期前该羊只最新的乳房评分记录
|
||||||
|
*/
|
||||||
|
ScBreastRating selectLatestBySheepIdBeforeDate(
|
||||||
|
@Param("sheepId") Long sheepId,
|
||||||
|
@Param("measureDate") Date measureDate
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,46 @@
|
|||||||
package com.zhyc.module.produce.bodyManage.service.impl;
|
package com.zhyc.module.produce.bodyManage.service.impl;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
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;
|
||||||
import com.zhyc.module.base.domain.BasSheep;
|
import com.zhyc.module.base.domain.BasSheep;
|
||||||
import com.zhyc.module.base.service.IBasSheepService;
|
import com.zhyc.module.base.service.IBasSheepService;
|
||||||
|
import com.zhyc.module.produce.bodyManage.domain.ScBreastRating;
|
||||||
|
import com.zhyc.module.produce.bodyManage.mapper.ScBreastRatingMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.zhyc.module.produce.bodyManage.mapper.ScBodyMeasureMapper;
|
import com.zhyc.module.produce.bodyManage.mapper.ScBodyMeasureMapper;
|
||||||
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
||||||
import com.zhyc.module.produce.bodyManage.service.IScBodyMeasureService;
|
import com.zhyc.module.produce.bodyManage.service.IScBodyMeasureService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 体尺测量Service业务层处理
|
* 体尺测量Service业务层处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
* @date 2025-07-27
|
* @date 2025-07-27
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ScBodyMeasureServiceImpl implements IScBodyMeasureService
|
public class ScBodyMeasureServiceImpl implements IScBodyMeasureService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScBodyMeasureMapper scBodyMeasureMapper;
|
private ScBodyMeasureMapper scBodyMeasureMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBasSheepService basSheepService;
|
private IBasSheepService basSheepService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScBreastRatingMapper scBreastRatingMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询体尺测量
|
* 查询体尺测量
|
||||||
*
|
*
|
||||||
* @param id 体尺测量主键
|
* @param id 体尺测量主键
|
||||||
* @return 体尺测量
|
* @return 体尺测量
|
||||||
*/
|
*/
|
||||||
@@ -41,11 +52,12 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询体尺测量列表
|
* 查询体尺测量列表
|
||||||
*
|
*
|
||||||
* @param scBodyMeasure 体尺测量
|
* @param scBodyMeasure 体尺测量
|
||||||
* @return 体尺测量
|
* @return 体尺测量
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "sm", userAlias = "sm")
|
||||||
public List<ScBodyMeasure> selectScBodyMeasureList(ScBodyMeasure scBodyMeasure) {
|
public List<ScBodyMeasure> selectScBodyMeasureList(ScBodyMeasure scBodyMeasure) {
|
||||||
return scBodyMeasureMapper.selectScBodyMeasureList(scBodyMeasure,
|
return scBodyMeasureMapper.selectScBodyMeasureList(scBodyMeasure,
|
||||||
scBodyMeasure.getManageTagsList());
|
scBodyMeasure.getManageTagsList());
|
||||||
@@ -58,57 +70,164 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增体尺测量
|
* 新增体尺测量
|
||||||
|
* 追根溯源原则:记录测量时刻的所有数据快照,后续羊只信息变化不影响历史记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertScBodyMeasure(ScBodyMeasure scBodyMeasure) {
|
public int insertScBodyMeasure(ScBodyMeasure scBodyMeasure) {
|
||||||
|
// 1. 耳号验证并获取羊只信息
|
||||||
String manageTags = scBodyMeasure.getManageTags();
|
String manageTags = scBodyMeasure.getManageTags();
|
||||||
if (StringUtils.isNotBlank(manageTags)) {
|
if (StringUtils.isNotBlank(manageTags)) {
|
||||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags);
|
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
|
||||||
if (sheep == null) {
|
if (sheep == null) {
|
||||||
throw new RuntimeException("耳号不存在,请检查输入");
|
throw new RuntimeException("耳号不存在,请检查输入");
|
||||||
}
|
}
|
||||||
scBodyMeasure.setSheepId(sheep.getId());
|
scBodyMeasure.setSheepId(sheep.getId());
|
||||||
|
|
||||||
|
// 2. 固化测量时刻的基础信息(追根溯源)
|
||||||
|
fillMeasureTimeSnapshot(scBodyMeasure, sheep);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scBodyMeasure.getCurrentWeight() != null) {
|
// 3. 设置创建信息
|
||||||
|
scBodyMeasure.setCreateTime(DateUtils.getNowDate());
|
||||||
|
scBodyMeasure.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
|
||||||
|
// 4. 保存体尺测量记录
|
||||||
|
int rows = scBodyMeasureMapper.insertScBodyMeasure(scBodyMeasure);
|
||||||
|
|
||||||
|
// 5. 同步更新羊只当前体重(实时状态,可以更新)
|
||||||
|
if (rows > 0 && scBodyMeasure.getCurrentWeight() != null) {
|
||||||
BasSheep updateSheep = new BasSheep();
|
BasSheep updateSheep = new BasSheep();
|
||||||
updateSheep.setId(scBodyMeasure.getSheepId());
|
updateSheep.setId(scBodyMeasure.getSheepId());
|
||||||
updateSheep.setCurrentWeight(scBodyMeasure.getCurrentWeight());
|
updateSheep.setCurrentWeight(scBodyMeasure.getCurrentWeight());
|
||||||
basSheepService.updateBasSheep(updateSheep);
|
basSheepService.updateBasSheep(updateSheep);
|
||||||
}
|
}
|
||||||
|
|
||||||
scBodyMeasure.setCreateTime(DateUtils.getNowDate());
|
return rows;
|
||||||
scBodyMeasure.setCreateBy(SecurityUtils.getUsername());
|
}
|
||||||
return scBodyMeasureMapper.insertScBodyMeasure(scBodyMeasure);
|
|
||||||
|
/**
|
||||||
|
* 填充测量时刻的数据快照(追根溯源)
|
||||||
|
* 所有字段基于测量日期计算,固化存储,不受后续数据变化影响
|
||||||
|
*/
|
||||||
|
private void fillMeasureTimeSnapshot(ScBodyMeasure measure, BasSheep sheep) {
|
||||||
|
Date measureDate = measure.getMeasureDate();
|
||||||
|
if (measureDate == null) {
|
||||||
|
measureDate = new Date(); // 如果未指定,默认当前日期
|
||||||
|
measure.setMeasureDate(measureDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 1. 月龄(测量日期 - 出生日期)==========
|
||||||
|
if (sheep.getBirthday() != null) {
|
||||||
|
int monthAge = calculateMonthAge(sheep.getBirthday(), measureDate);
|
||||||
|
measure.setMonthAge(monthAge);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 2. 体况评分 & 乳房评分(羊只档案当前值)==========
|
||||||
|
measure.setBodyScore(sheep.getBody()); // 测量时的体况评分
|
||||||
|
measure.setBreastScore(sheep.getBreast()); // 测量时的乳房评分
|
||||||
|
|
||||||
|
// ========== 3. 时间相关天数(基于测量日期计算,非当前日期)==========
|
||||||
|
|
||||||
|
// 配后天数 = 测量日期 - 配种日期
|
||||||
|
if (sheep.getMatingDate() != null) {
|
||||||
|
int postMatingDay = calculateDaysDiff(sheep.getMatingDate(), measureDate);
|
||||||
|
measure.setPostMatingDay(postMatingDay);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 怀孕天数 = 测量日期 - 配种日期(如果已配种)
|
||||||
|
if (sheep.getMatingDate() != null) {
|
||||||
|
int gestationDay = calculateDaysDiff(sheep.getMatingDate(), measureDate);
|
||||||
|
measure.setGestationDay(gestationDay);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 泌乳天数 = 测量日期 - 产羔日期(如果已产羔)
|
||||||
|
if (sheep.getLambingDate() != null) {
|
||||||
|
int lactationDay = calculateDaysDiff(sheep.getLambingDate(), measureDate);
|
||||||
|
measure.setLactationDay(lactationDay);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 4. 乳房详细指标(取测量日期前最新的乳房评分记录)==========
|
||||||
|
fillBreastRatingSnapshot(measure);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 填充乳房评分快照(测量时刻的最新记录)
|
||||||
|
*/
|
||||||
|
private void fillBreastRatingSnapshot(ScBodyMeasure measure) {
|
||||||
|
if (measure.getSheepId() == null || measure.getMeasureDate() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询该羊只在测量日期前最新的乳房评分记录
|
||||||
|
ScBreastRating latestRating = scBreastRatingMapper
|
||||||
|
.selectLatestBySheepIdBeforeDate(measure.getSheepId(), measure.getMeasureDate());
|
||||||
|
|
||||||
|
if (latestRating != null) {
|
||||||
|
measure.setBreastDepth(latestRating.getDepth()); // 乳房深度
|
||||||
|
measure.setBreastPosition(latestRating.getPosition()); // 乳头位置
|
||||||
|
measure.setBreastLength(latestRating.getLength()); // 乳头长度
|
||||||
|
measure.setBreastAdbere(latestRating.getAdbere()); // 乳房附着
|
||||||
|
measure.setBreastSpacing(latestRating.getSpacing()); // 乳房间隔度
|
||||||
|
// 注意:breastScore 取羊只档案的当前值,不取历史评分记录的score
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算月龄(精确到月)
|
||||||
|
*/
|
||||||
|
private int calculateMonthAge(Date birthday, Date measureDate) {
|
||||||
|
Calendar birthCal = Calendar.getInstance();
|
||||||
|
birthCal.setTime(birthday);
|
||||||
|
|
||||||
|
Calendar measureCal = Calendar.getInstance();
|
||||||
|
measureCal.setTime(measureDate);
|
||||||
|
|
||||||
|
int yearDiff = measureCal.get(Calendar.YEAR) - birthCal.get(Calendar.YEAR);
|
||||||
|
int monthDiff = measureCal.get(Calendar.MONTH) - birthCal.get(Calendar.MONTH);
|
||||||
|
|
||||||
|
int monthAge = yearDiff * 12 + monthDiff;
|
||||||
|
|
||||||
|
// 如果测量日期的"日"小于出生日期的"日",则不满整月,减1
|
||||||
|
if (measureCal.get(Calendar.DAY_OF_MONTH) < birthCal.get(Calendar.DAY_OF_MONTH)) {
|
||||||
|
monthAge--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.max(0, monthAge); // 确保不为负数
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算两个日期相差天数
|
||||||
|
*/
|
||||||
|
private int calculateDaysDiff(Date startDate, Date endDate) {
|
||||||
|
long diffMillis = endDate.getTime() - startDate.getTime();
|
||||||
|
return (int) (diffMillis / (1000 * 60 * 60 * 24));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改体尺测量
|
* 修改体尺测量
|
||||||
|
* 注意:修改时不改变已固化的快照数据(月龄、评分等),只修改体尺测量值本身
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateScBodyMeasure(ScBodyMeasure scBodyMeasure) {
|
public int updateScBodyMeasure(ScBodyMeasure scBodyMeasure) {
|
||||||
String manageTags = scBodyMeasure.getManageTags();
|
String manageTags = scBodyMeasure.getManageTags();
|
||||||
if (StringUtils.isNotBlank(manageTags)) {
|
if (StringUtils.isNotBlank(manageTags)) {
|
||||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags);
|
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
|
||||||
if (sheep == null) {
|
if (sheep == null) {
|
||||||
throw new RuntimeException("耳号不存在,请检查输入");
|
throw new RuntimeException("耳号不存在,请检查输入");
|
||||||
}
|
}
|
||||||
scBodyMeasure.setSheepId(sheep.getId());
|
scBodyMeasure.setSheepId(sheep.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scBodyMeasure.getCurrentWeight() != null) {
|
// 修改时不同步更新体重,避免历史记录被污染
|
||||||
BasSheep updateSheep = new BasSheep();
|
// 如需修改体重,应通过专门的功能或重新新增记录
|
||||||
updateSheep.setId(scBodyMeasure.getSheepId());
|
|
||||||
updateSheep.setCurrentWeight(scBodyMeasure.getCurrentWeight());
|
|
||||||
basSheepService.updateBasSheep(updateSheep);
|
|
||||||
}
|
|
||||||
|
|
||||||
return scBodyMeasureMapper.updateScBodyMeasure(scBodyMeasure);
|
return scBodyMeasureMapper.updateScBodyMeasure(scBodyMeasure);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除体尺测量
|
* 批量删除体尺测量
|
||||||
*
|
*
|
||||||
* @param ids 需要删除的体尺测量主键
|
* @param ids 需要删除的体尺测量主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@@ -120,7 +239,7 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除体尺测量信息
|
* 删除体尺测量信息
|
||||||
*
|
*
|
||||||
* @param id 体尺测量主键
|
* @param id 体尺测量主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@@ -134,4 +253,4 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService
|
|||||||
public List<Map<String, Object>> selectBreedStatusList() {
|
public List<Map<String, Object>> selectBreedStatusList() {
|
||||||
return scBodyMeasureMapper.selectBreedStatusList();
|
return scBodyMeasureMapper.selectBreedStatusList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.zhyc.module.produce.bodyManage.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
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;
|
||||||
@@ -48,6 +49,7 @@ public class ScBodyScoreServiceImpl implements IScBodyScoreService {
|
|||||||
* @return 体况评分
|
* @return 体况评分
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "sbs", userAlias = "sbs")
|
||||||
public List<ScBodyScore> selectScBodyScoreList(ScBodyScore scBodyScore) {
|
public List<ScBodyScore> selectScBodyScoreList(ScBodyScore scBodyScore) {
|
||||||
return scBodyScoreMapper.selectScBodyScoreList(scBodyScore,
|
return scBodyScoreMapper.selectScBodyScoreList(scBodyScore,
|
||||||
scBodyScore.getManageTagsList());
|
scBodyScore.getManageTagsList());
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.bodyManage.service.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
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;
|
||||||
@@ -51,6 +52,7 @@ public class ScBreastRatingServiceImpl implements IScBreastRatingService {
|
|||||||
* @return 乳房评分
|
* @return 乳房评分
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "sbr", userAlias = "sbr")
|
||||||
public List<ScBreastRating> selectScBreastRatingList(ScBreastRating scBreastRating) {
|
public List<ScBreastRating> selectScBreastRatingList(ScBreastRating scBreastRating) {
|
||||||
return scBreastRatingMapper.selectScBreastRatingList(scBreastRating,
|
return scBreastRatingMapper.selectScBreastRatingList(scBreastRating,
|
||||||
scBreastRating.getManageTagsList());
|
scBreastRating.getManageTagsList());
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zhyc.module.produce.manage_sheep.controller;
|
package com.zhyc.module.produce.manage_sheep.controller;
|
||||||
|
|
||||||
import com.zhyc.common.annotation.Log;
|
import com.zhyc.common.annotation.Log;
|
||||||
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
import com.zhyc.common.core.domain.AjaxResult;
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
import com.zhyc.common.enums.BusinessType;
|
import com.zhyc.common.enums.BusinessType;
|
||||||
import com.zhyc.common.exception.ServiceException;
|
import com.zhyc.common.exception.ServiceException;
|
||||||
@@ -33,7 +34,7 @@ import static com.zhyc.common.utils.SecurityUtils.getUsername;
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("produce/manage_sheep/add_sheep")
|
@RequestMapping("produce/manage_sheep/add_sheep")
|
||||||
public class ScAddSheepController {
|
public class ScAddSheepController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IScAddSheepService scAddSheepService;
|
private IScAddSheepService scAddSheepService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -73,6 +74,8 @@ public class ScAddSheepController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
scAddSheep.setUserId(getUserId());
|
||||||
|
scAddSheep.setDeptId(getDeptId());
|
||||||
boolean success = scAddSheepService.insertScAddSheep(scAddSheep);
|
boolean success = scAddSheepService.insertScAddSheep(scAddSheep);
|
||||||
if (success) {
|
if (success) {
|
||||||
return success("新增成功");
|
return success("新增成功");
|
||||||
@@ -134,7 +137,9 @@ public class ScAddSheepController {
|
|||||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
|
||||||
ExcelUtil<ScAddSheep> util = new ExcelUtil<>(ScAddSheep.class);
|
ExcelUtil<ScAddSheep> util = new ExcelUtil<>(ScAddSheep.class);
|
||||||
List<ScAddSheep> list = util.importExcel(file.getInputStream());
|
List<ScAddSheep> list = util.importExcel(file.getInputStream());
|
||||||
String message = scAddSheepService.importSheep(list, updateSupport, getUsername());
|
Long userId = getUserId();
|
||||||
|
Long deptId = getDeptId();
|
||||||
|
String message = scAddSheepService.importSheep(list, updateSupport, getUsername(), userId, deptId);
|
||||||
return success(message);
|
return success(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ public class ScChangeCommentController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ScChangeComment scChangeComment)
|
public AjaxResult add(@RequestBody ScChangeComment scChangeComment)
|
||||||
{
|
{
|
||||||
|
scChangeComment.setUserId(getUserId());
|
||||||
|
scChangeComment.setDeptId(getDeptId());
|
||||||
return toAjax(scChangeCommentService.insertScChangeComment(scChangeComment));
|
return toAjax(scChangeCommentService.insertScChangeComment(scChangeComment));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ public class ScChangeEarController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ScChangeEar scChangeEar)
|
public AjaxResult add(@RequestBody ScChangeEar scChangeEar)
|
||||||
{
|
{
|
||||||
|
scChangeEar.setUserId(getUserId());
|
||||||
|
scChangeEar.setDeptId(getDeptId());
|
||||||
return toAjax(scChangeEarService.insertScChangeEar(scChangeEar));
|
return toAjax(scChangeEarService.insertScChangeEar(scChangeEar));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ public class ScChangeVarietyController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ScChangeVariety scChangeVariety)
|
public AjaxResult add(@RequestBody ScChangeVariety scChangeVariety)
|
||||||
{
|
{
|
||||||
|
scChangeVariety.setUserId(getUserId());
|
||||||
|
scChangeVariety.setDeptId(getDeptId());
|
||||||
return toAjax(scChangeVarietyService.insertScChangeVariety(scChangeVariety));
|
return toAjax(scChangeVarietyService.insertScChangeVariety(scChangeVariety));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ public class ScTransGroupController extends BaseController {
|
|||||||
@Log(title = "转群记录", businessType = BusinessType.INSERT)
|
@Log(title = "转群记录", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ScTransGroup scTransGroup) {
|
public AjaxResult add(@RequestBody ScTransGroup scTransGroup) {
|
||||||
|
scTransGroup.setUserId(getUserId());
|
||||||
|
scTransGroup.setDeptId(getDeptId());
|
||||||
return toAjax(scTransGroupService.insertScTransGroup(scTransGroup));
|
return toAjax(scTransGroupService.insertScTransGroup(scTransGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,12 +72,16 @@ public class ScTransitionInfoController extends BaseController {
|
|||||||
@Log(title = "转场", businessType = BusinessType.INSERT)
|
@Log(title = "转场", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ScTransitionInfo scTransitionInfo) {
|
public AjaxResult add(@RequestBody ScTransitionInfo scTransitionInfo) {
|
||||||
|
scTransitionInfo.setUserId(getUserId());
|
||||||
|
scTransitionInfo.setDeptId(getDeptId());
|
||||||
return toAjax(scTransitionInfoService.insertScTransitionInfo(scTransitionInfo));
|
return toAjax(scTransitionInfoService.insertScTransitionInfo(scTransitionInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
//批量添加
|
//批量添加
|
||||||
@PostMapping("/batch")
|
@PostMapping("/batch")
|
||||||
public AjaxResult addBatch(@RequestBody List<ScTransitionInfo> transitionInfoList) {
|
public AjaxResult addBatch(@RequestBody List<ScTransitionInfo> transitionInfoList) {
|
||||||
|
Long userId = getUserId();
|
||||||
|
Long deptId = getDeptId();
|
||||||
return toAjax(scTransitionInfoService.insertScTransitionInfoBatch(transitionInfoList));
|
return toAjax(scTransitionInfoService.insertScTransitionInfoBatch(transitionInfoList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,6 +105,7 @@ public class ScTransitionInfoController extends BaseController {
|
|||||||
return toAjax(scTransitionInfoService.deleteScTransitionInfoByIds(ids));
|
return toAjax(scTransitionInfoService.deleteScTransitionInfoByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('produce:transition_info:approve')")
|
||||||
@PutMapping("/approve")
|
@PutMapping("/approve")
|
||||||
public AjaxResult approveScTransitionInfo(@RequestBody ScTransitionInfo scTransitionInfo) {
|
public AjaxResult approveScTransitionInfo(@RequestBody ScTransitionInfo scTransitionInfo) {
|
||||||
int rows = scTransitionInfoService.approveScTransitionInfo(scTransitionInfo);
|
int rows = scTransitionInfoService.approveScTransitionInfo(scTransitionInfo);
|
||||||
|
|||||||
@@ -21,18 +21,23 @@ public class ScAddSheep extends BaseEntity {
|
|||||||
* @date 2025-07-10
|
* @date 2025-07-10
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@Excel(name = "主键")
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
/** 羊只耳号 */
|
/**
|
||||||
|
* 羊只耳号
|
||||||
|
*/
|
||||||
@Excel(name = "耳号")
|
@Excel(name = "耳号")
|
||||||
private String earNumber;
|
private String earNumber;
|
||||||
|
|
||||||
/** 牧场 */
|
/**
|
||||||
|
* 牧场
|
||||||
|
*/
|
||||||
private Integer ranchId;
|
private Integer ranchId;
|
||||||
@Excel(name = "牧场名称")
|
@Excel(name = "牧场名称")
|
||||||
private String ranchName;
|
private String ranchName;
|
||||||
|
|
||||||
/** 羊舍编号 */
|
/**
|
||||||
|
* 羊舍编号
|
||||||
|
*/
|
||||||
private Integer sheepfold;
|
private Integer sheepfold;
|
||||||
|
|
||||||
private String sheepfoldName;
|
private String sheepfoldName;
|
||||||
@@ -40,62 +45,95 @@ public class ScAddSheep extends BaseEntity {
|
|||||||
@Excel(name = "羊舍名称")
|
@Excel(name = "羊舍名称")
|
||||||
private String sheepfoldNameExcel;
|
private String sheepfoldNameExcel;
|
||||||
|
|
||||||
/** 父号 */
|
/**
|
||||||
|
* 父号
|
||||||
|
*/
|
||||||
@Excel(name = "父号")
|
@Excel(name = "父号")
|
||||||
private String father;
|
private String father;
|
||||||
|
|
||||||
/** 母号 */
|
/**
|
||||||
|
* 母号
|
||||||
|
*/
|
||||||
@Excel(name = "母号")
|
@Excel(name = "母号")
|
||||||
private String mother;
|
private String mother;
|
||||||
|
/**
|
||||||
/** 出生体重 */
|
* 断奶体重(仅接收,不入库)
|
||||||
@Excel(name = "出生体重")
|
*/
|
||||||
private BigDecimal bornWeight;
|
|
||||||
|
|
||||||
/** 出生日期 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
|
||||||
@Excel(name = "出生日期", dateFormat = "yyyy-MM-dd")
|
|
||||||
private Date birthday;
|
|
||||||
|
|
||||||
/** 性别 1母 2公 3阉羊 */
|
|
||||||
@Excel(name = "性别", readConverterExp = "1=母,2=公,3=阉羊")
|
|
||||||
private Integer gender;
|
|
||||||
|
|
||||||
/** 胎次 */
|
|
||||||
@Excel(name = "胎次")
|
|
||||||
private Integer parity;
|
|
||||||
|
|
||||||
/** 品种id */
|
|
||||||
private Integer varietyId;
|
|
||||||
|
|
||||||
/** 品种名称(联表查询返回,非数据库字段) */
|
|
||||||
@Excel(name = "品种")
|
|
||||||
private String varietyName;
|
|
||||||
|
|
||||||
/** 羊只类别 */
|
|
||||||
private Long typeId;
|
|
||||||
@Excel(name = "羊只类型")
|
|
||||||
private String typeName;
|
|
||||||
|
|
||||||
/** 入群日期 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
|
||||||
@Excel(name = "入群日期", dateFormat = "yyyy-MM-dd")
|
|
||||||
private Date joinDate;
|
|
||||||
|
|
||||||
/** 备注 */
|
|
||||||
@Excel(name = "备注")
|
|
||||||
private String comment;
|
|
||||||
|
|
||||||
/** 技术员 */
|
|
||||||
@Excel(name = "技术员")
|
|
||||||
private String technician;
|
|
||||||
|
|
||||||
/** 断奶体重(仅接收,不入库) */
|
|
||||||
@Excel(name = "断奶体重")
|
@Excel(name = "断奶体重")
|
||||||
private BigDecimal weaningWeight;
|
private BigDecimal weaningWeight;
|
||||||
private String createBy;
|
private String createBy;
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 出生体重
|
||||||
|
*/
|
||||||
|
@Excel(name = "出生体重")
|
||||||
|
private BigDecimal bornWeight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出生日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
|
@Excel(name = "出生日期", dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date birthday;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 性别 1母 2公 3阉羊
|
||||||
|
*/
|
||||||
|
@Excel(name = "性别", readConverterExp = "1=母,2=公,3=阉羊")
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 胎次
|
||||||
|
*/
|
||||||
|
@Excel(name = "胎次")
|
||||||
|
private Integer parity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品种id
|
||||||
|
*/
|
||||||
|
private Integer varietyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品种名称(联表查询返回,非数据库字段)
|
||||||
|
*/
|
||||||
|
@Excel(name = "品种")
|
||||||
|
private String varietyName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 羊只类别
|
||||||
|
*/
|
||||||
|
private Long typeId;
|
||||||
|
@Excel(name = "羊只类型")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入群日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
|
@Excel(name = "入群日期", dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date joinDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 技术员
|
||||||
|
*/
|
||||||
|
@Excel(name = "技术员")
|
||||||
|
private String technician;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,4 +82,14 @@ public class ScChangeComment extends BaseEntity {
|
|||||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||||
*/
|
*/
|
||||||
private Integer isDelete;
|
private Integer isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,4 +101,14 @@ public class ScChangeEar extends BaseEntity {
|
|||||||
* 在群状态 0-全部 1-在群 2-不在群(列表查询用)
|
* 在群状态 0-全部 1-在群 2-不在群(列表查询用)
|
||||||
*/
|
*/
|
||||||
private Integer inGroup;
|
private Integer inGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,4 +88,14 @@ public class ScChangeVariety extends BaseEntity {
|
|||||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||||
*/
|
*/
|
||||||
private Integer isDelete;
|
private Integer isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,4 +112,14 @@ public class ScTransGroup extends BaseEntity {
|
|||||||
* 是否在群查询条件(0-在群,1-离群)
|
* 是否在群查询条件(0-在群,1-离群)
|
||||||
*/
|
*/
|
||||||
private Integer isDelete;
|
private Integer isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,4 +120,14 @@ public class ScTransitionInfo extends BaseEntity {
|
|||||||
* 当前场区名称(展示用),非数据库字段
|
* 当前场区名称(展示用),非数据库字段
|
||||||
*/
|
*/
|
||||||
private String currentRanchName;
|
private String currentRanchName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号(数据分离用)
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public interface ScChangeCommentMapper
|
|||||||
* @param scChangeComment 改备注
|
* @param scChangeComment 改备注
|
||||||
* @return 改备注集合
|
* @return 改备注集合
|
||||||
*/
|
*/
|
||||||
public List<ScChangeComment> selectScChangeCommentList(ScChangeComment scChangeComment);
|
// public List<ScChangeComment> selectScChangeCommentList(ScChangeComment scChangeComment);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增改备注
|
* 新增改备注
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public interface IScAddSheepService {
|
|||||||
boolean deleteScAddSheepByIds(Integer[] ids);
|
boolean deleteScAddSheepByIds(Integer[] ids);
|
||||||
|
|
||||||
//导入
|
//导入
|
||||||
String importSheep(List<ScAddSheep> list, boolean updateSupport, String operName);
|
String importSheep(List<ScAddSheep> list, boolean updateSupport, String operName, Long userId, Long deptId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zhyc.module.produce.manage_sheep.service.impl;
|
package com.zhyc.module.produce.manage_sheep.service.impl;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
import com.zhyc.common.exception.ServiceException;
|
import com.zhyc.common.exception.ServiceException;
|
||||||
import com.zhyc.common.utils.StringUtils;
|
import com.zhyc.common.utils.StringUtils;
|
||||||
import com.zhyc.module.base.domain.BasSheepType;
|
import com.zhyc.module.base.domain.BasSheepType;
|
||||||
@@ -41,21 +42,22 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDaRanchService daRanchService;
|
private IDaRanchService daRanchService;
|
||||||
|
|
||||||
//新增
|
//新增
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean insertScAddSheep(ScAddSheep scAddSheep) {
|
public boolean insertScAddSheep(ScAddSheep scAddSheep) {
|
||||||
BasSheep existSheep =basSheepService.selectBasSheepByManageTags(scAddSheep.getEarNumber().trim());
|
BasSheep existSheep = basSheepService.selectBasSheepByManageTags(scAddSheep.getEarNumber().trim());
|
||||||
if (existSheep != null) {
|
if (existSheep != null) {
|
||||||
throw new ServiceException("添加失败,耳号已存在");
|
throw new ServiceException("添加失败,耳号已存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// userId 和 deptId 已在 Controller 中设置,直接插入
|
||||||
boolean ok = scAddSheepMapper.insert(scAddSheep) > 0;
|
boolean ok = scAddSheepMapper.insert(scAddSheep) > 0;
|
||||||
if (!ok) return false;
|
if (!ok) return false;
|
||||||
|
|
||||||
BasSheep bs = new BasSheep();
|
BasSheep bs = new BasSheep();
|
||||||
bs.setManageTags(scAddSheep.getEarNumber());
|
bs.setManageTags(scAddSheep.getEarNumber());
|
||||||
// bs.setElectronicTags(scAddSheep.getEarNumber());
|
|
||||||
bs.setRanchId(scAddSheep.getRanchId().longValue());
|
bs.setRanchId(scAddSheep.getRanchId().longValue());
|
||||||
bs.setSheepfoldId(scAddSheep.getSheepfold().longValue());
|
bs.setSheepfoldId(scAddSheep.getSheepfold().longValue());
|
||||||
bs.setFatherId(null);
|
bs.setFatherId(null);
|
||||||
@@ -86,6 +88,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
|
|
||||||
//查询
|
//查询
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "sas", userAlias = "sas") // sas 是 sc_add_sheep 的别名
|
||||||
public List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep) {
|
public List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep) {
|
||||||
return scAddSheepMapper.selectScAddSheepList(scAddSheep);
|
return scAddSheepMapper.selectScAddSheepList(scAddSheep);
|
||||||
}
|
}
|
||||||
@@ -105,7 +108,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
//导入羊只
|
//导入羊只
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String importSheep(List<ScAddSheep> list, boolean updateSupport, String operName) {
|
public String importSheep(List<ScAddSheep> list, boolean updateSupport, String operName, Long userId, Long deptId) {
|
||||||
if (list == null || list.isEmpty()) {
|
if (list == null || list.isEmpty()) {
|
||||||
throw new ServiceException("导入数据不能为空!");
|
throw new ServiceException("导入数据不能为空!");
|
||||||
}
|
}
|
||||||
@@ -206,6 +209,10 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 数据分离:设置用户和部门
|
||||||
|
sheep.setUserId(userId);
|
||||||
|
sheep.setDeptId(deptId);
|
||||||
|
|
||||||
if (updateSupport && sheep.getId() != null) {
|
if (updateSupport && sheep.getId() != null) {
|
||||||
sheep.setUpdateBy(operName);
|
sheep.setUpdateBy(operName);
|
||||||
updateScAddSheep(sheep);
|
updateScAddSheep(sheep);
|
||||||
@@ -229,6 +236,4 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
}
|
}
|
||||||
return "导入成功!共 " + success + " 条";
|
return "导入成功!共 " + success + " 条";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.manage_sheep.service.impl;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
import com.zhyc.common.utils.SecurityUtils;
|
import com.zhyc.common.utils.SecurityUtils;
|
||||||
import com.zhyc.common.utils.StringUtils;
|
import com.zhyc.common.utils.StringUtils;
|
||||||
import com.zhyc.module.base.domain.BasSheep;
|
import com.zhyc.module.base.domain.BasSheep;
|
||||||
@@ -47,10 +48,12 @@ public class ScChangeCommentServiceImpl implements IScChangeCommentService
|
|||||||
* @return 改备注
|
* @return 改备注
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "scc", userAlias = "scc")
|
||||||
public List<ScChangeComment> selectScChangeCommentList(ScChangeComment scChangeComment)
|
public List<ScChangeComment> selectScChangeCommentList(ScChangeComment scChangeComment)
|
||||||
{
|
{
|
||||||
// 把实体和独立参数一起传过去
|
// 把实体和独立参数一起传过去
|
||||||
return scChangeCommentMapper.selectScChangeCommentList(scChangeComment,
|
return scChangeCommentMapper.selectScChangeCommentList(
|
||||||
|
scChangeComment,
|
||||||
scChangeComment.getManageTagsList());
|
scChangeComment.getManageTagsList());
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@@ -73,12 +76,6 @@ public class ScChangeCommentServiceImpl implements IScChangeCommentService
|
|||||||
if (scChangeComment.getEventDate() == null) {
|
if (scChangeComment.getEventDate() == null) {
|
||||||
throw new RuntimeException("事件日期不能为空");
|
throw new RuntimeException("事件日期不能为空");
|
||||||
}
|
}
|
||||||
scChangeComment.setCreateTime(new Date());
|
|
||||||
scChangeComment.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
int rows = scChangeCommentMapper.insertScChangeComment(scChangeComment);
|
|
||||||
if (rows <= 0) {
|
|
||||||
return rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
String manageTags = scChangeComment.getManageTags();
|
String manageTags = scChangeComment.getManageTags();
|
||||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags);
|
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags);
|
||||||
@@ -86,6 +83,16 @@ public class ScChangeCommentServiceImpl implements IScChangeCommentService
|
|||||||
throw new RuntimeException("未找到耳号为【" + manageTags + "】的羊只,无法更新备注");
|
throw new RuntimeException("未找到耳号为【" + manageTags + "】的羊只,无法更新备注");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scChangeComment.setSheepId(String.valueOf(sheep.getId()));
|
||||||
|
scChangeComment.setOldComment(sheep.getComment());
|
||||||
|
scChangeComment.setCreateTime(new Date());
|
||||||
|
scChangeComment.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
|
||||||
|
int rows = scChangeCommentMapper.insertScChangeComment(scChangeComment);
|
||||||
|
if (rows <= 0) {
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
sheep.setComment(scChangeComment.getNewComment());
|
sheep.setComment(scChangeComment.getNewComment());
|
||||||
basSheepService.updateBasSheep(sheep);
|
basSheepService.updateBasSheep(sheep);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.zhyc.module.produce.manage_sheep.service.impl;
|
package com.zhyc.module.produce.manage_sheep.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
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;
|
||||||
@@ -66,6 +68,7 @@ public class ScChangeEarServiceImpl implements IScChangeEarService
|
|||||||
* @return 修改电子耳号记录
|
* @return 修改电子耳号记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "sce", userAlias = "sce")
|
||||||
public List<ScChangeEar> selectScChangeEarList(ScChangeEar scChangeEar) {
|
public List<ScChangeEar> selectScChangeEarList(ScChangeEar scChangeEar) {
|
||||||
return scChangeEarMapper.selectScChangeEarList(scChangeEar,
|
return scChangeEarMapper.selectScChangeEarList(scChangeEar,
|
||||||
scChangeEar.getManageTagsList());
|
scChangeEar.getManageTagsList());
|
||||||
@@ -91,9 +94,6 @@ public class ScChangeEarServiceImpl implements IScChangeEarService
|
|||||||
if (scChangeEar.getSheepId() == null) {
|
if (scChangeEar.getSheepId() == null) {
|
||||||
throw new RuntimeException("未找到对应的羊只ID");
|
throw new RuntimeException("未找到对应的羊只ID");
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(scChangeEar.getComment())) {
|
|
||||||
throw new RuntimeException("备注不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
BasSheep sheep = basSheepService.selectBasSheepById(scChangeEar.getSheepId());
|
BasSheep sheep = basSheepService.selectBasSheepById(scChangeEar.getSheepId());
|
||||||
if (sheep == null) {
|
if (sheep == null) {
|
||||||
@@ -122,11 +122,6 @@ public class ScChangeEarServiceImpl implements IScChangeEarService
|
|||||||
sheep.setManageTags(scChangeEar.getNewTag());
|
sheep.setManageTags(scChangeEar.getNewTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步更新羊只主表备注
|
|
||||||
if (StringUtils.isNotBlank(scChangeEar.getComment())) {
|
|
||||||
sheep.setComment(scChangeEar.getComment());
|
|
||||||
}
|
|
||||||
|
|
||||||
basSheepService.updateBasSheep(sheep);
|
basSheepService.updateBasSheep(sheep);
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.zhyc.module.produce.manage_sheep.service.impl;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
import com.zhyc.common.utils.SecurityUtils;
|
import com.zhyc.common.utils.SecurityUtils;
|
||||||
import com.zhyc.common.utils.StringUtils;
|
import com.zhyc.common.utils.StringUtils;
|
||||||
import com.zhyc.module.base.domain.BasSheep;
|
import com.zhyc.module.base.domain.BasSheep;
|
||||||
@@ -50,6 +51,7 @@ public class ScChangeVarietyServiceImpl implements IScChangeVarietyService
|
|||||||
* @return 改品种记录
|
* @return 改品种记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "scv", userAlias = "scv")
|
||||||
public List<ScChangeVariety> selectScChangeVarietyList(ScChangeVariety scChangeVariety)
|
public List<ScChangeVariety> selectScChangeVarietyList(ScChangeVariety scChangeVariety)
|
||||||
{
|
{
|
||||||
return scChangeVarietyMapper.selectScChangeVarietyList(scChangeVariety,
|
return scChangeVarietyMapper.selectScChangeVarietyList(scChangeVariety,
|
||||||
@@ -66,9 +68,29 @@ public class ScChangeVarietyServiceImpl implements IScChangeVarietyService
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertScChangeVariety(ScChangeVariety scChangeVariety)
|
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
|
||||||
|
|
||||||
|
// 查询当前品种作为旧品种(如果前端没传)
|
||||||
|
if (StringUtils.isBlank(scChangeVariety.getVarietyOld())) {
|
||||||
|
// ✅ 修正:使用正确的方法名 selectBasSheepVarietyById
|
||||||
|
BasSheepVariety oldVariety = varietyService.selectBasSheepVarietyById(sheep.getVarietyId());
|
||||||
|
if (oldVariety != null) {
|
||||||
|
scChangeVariety.setVarietyOld(oldVariety.getVariety());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scChangeVariety.setCreateTime(new Date());
|
scChangeVariety.setCreateTime(new Date());
|
||||||
scChangeVariety.setCreateBy(SecurityUtils.getUsername());
|
scChangeVariety.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
|
||||||
|
// 校验
|
||||||
if (StringUtils.isBlank(scChangeVariety.getTechnician())) {
|
if (StringUtils.isBlank(scChangeVariety.getTechnician())) {
|
||||||
throw new RuntimeException("技术员不能为空");
|
throw new RuntimeException("技术员不能为空");
|
||||||
}
|
}
|
||||||
@@ -76,17 +98,13 @@ public class ScChangeVarietyServiceImpl implements IScChangeVarietyService
|
|||||||
throw new RuntimeException("事件日期不能为空");
|
throw new RuntimeException("事件日期不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ✅ 第3步:再执行 insert(此时所有字段都有值了)
|
||||||
int rows = scChangeVarietyMapper.insertScChangeVariety(scChangeVariety);
|
int rows = scChangeVarietyMapper.insertScChangeVariety(scChangeVariety);
|
||||||
if (rows <= 0) {
|
if (rows <= 0) {
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
String manageTags = scChangeVariety.getManageTags();
|
// 第4步:更新羊只品种(保持你的原逻辑)
|
||||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags);
|
|
||||||
if (sheep == null) {
|
|
||||||
throw new RuntimeException("未找到耳号为【" + manageTags + "】的羊只,无法更新品种");
|
|
||||||
}
|
|
||||||
|
|
||||||
String newVarietyName = scChangeVariety.getVarietyNew();
|
String newVarietyName = scChangeVariety.getVarietyNew();
|
||||||
BasSheepVariety newVariety = varietyService.selectByVarietyName(newVarietyName);
|
BasSheepVariety newVariety = varietyService.selectByVarietyName(newVarietyName);
|
||||||
if (newVariety == null) {
|
if (newVariety == null) {
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
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.module.base.domain.BasSheep;
|
import com.zhyc.module.base.domain.BasSheep;
|
||||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||||
import com.zhyc.module.base.service.IBasSheepService;
|
import com.zhyc.module.base.service.IBasSheepService;
|
||||||
@@ -54,6 +56,7 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
|
|||||||
* @return 转群记录
|
* @return 转群记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "tg", userAlias = "tg")
|
||||||
public List<ScTransGroup> selectScTransGroupList(ScTransGroup scTransGroup) {
|
public List<ScTransGroup> selectScTransGroupList(ScTransGroup scTransGroup) {
|
||||||
List<ScTransGroup> list = scTransGroupMapper.selectScTransGroupList(scTransGroup,
|
List<ScTransGroup> list = scTransGroupMapper.selectScTransGroupList(scTransGroup,
|
||||||
scTransGroup.getManageTagsList());
|
scTransGroup.getManageTagsList());
|
||||||
@@ -74,8 +77,28 @@ 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) {
|
||||||
|
// 1. 根据耳号查询羊只信息,填充 sheepId、varietyId 等字段
|
||||||
|
String manageTags = scTransGroup.getManageTags();
|
||||||
|
if (StringUtils.isNotBlank(manageTags)) {
|
||||||
|
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
|
||||||
|
if (sheep == null) {
|
||||||
|
throw new RuntimeException("耳号不存在,请检查输入");
|
||||||
|
}
|
||||||
|
scTransGroup.setSheepId(sheep.getId().intValue());
|
||||||
|
scTransGroup.setVarietyId(sheep.getVarietyId());
|
||||||
|
// 转出羊舍取羊只当前所在羊舍
|
||||||
|
scTransGroup.setFoldFrom(String.valueOf(sheep.getSheepfoldId()));
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("耳号不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 设置创建信息
|
||||||
scTransGroup.setCreateTime(DateUtils.getNowDate());
|
scTransGroup.setCreateTime(DateUtils.getNowDate());
|
||||||
scTransGroup.setCreateBy(SecurityUtils.getUsername());
|
scTransGroup.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
|
||||||
|
// 3. 数据分离字段已在 Controller 设置,这里不需要再设置
|
||||||
|
|
||||||
|
// 4. 插入数据库
|
||||||
int rows = scTransGroupMapper.insertScTransGroup(scTransGroup);
|
int rows = scTransGroupMapper.insertScTransGroup(scTransGroup);
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zhyc.module.produce.manage_sheep.service.impl;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
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;
|
||||||
@@ -53,6 +54,7 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
|
|||||||
* @return 转场
|
* @return 转场
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "t", userAlias = "t")
|
||||||
public List<ScTransitionInfo> selectScTransitionInfoList(ScTransitionInfo scTransitionInfo)
|
public List<ScTransitionInfo> selectScTransitionInfoList(ScTransitionInfo scTransitionInfo)
|
||||||
{
|
{
|
||||||
return scTransitionInfoMapper.selectScTransitionInfoList(scTransitionInfo,
|
return scTransitionInfoMapper.selectScTransitionInfoList(scTransitionInfo,
|
||||||
@@ -66,13 +68,27 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
{
|
public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo) {
|
||||||
|
// 根据耳号查询羊只信息
|
||||||
|
String manageTags = scTransitionInfo.getManageTags();
|
||||||
|
if (StringUtils.isNotBlank(manageTags)) {
|
||||||
|
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
|
||||||
|
if (sheep == null) {
|
||||||
|
throw new RuntimeException("耳号不存在,请检查输入");
|
||||||
|
}
|
||||||
|
scTransitionInfo.setSheepId(sheep.getId().intValue());
|
||||||
|
scTransitionInfo.setVarietyId(sheep.getVarietyId());
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("耳号不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
scTransitionInfo.setStatus(0);
|
scTransitionInfo.setStatus(0);
|
||||||
scTransitionInfo.setCreateTime(DateUtils.getNowDate());
|
scTransitionInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
return scTransitionInfoMapper.insertScTransitionInfo(scTransitionInfo);
|
return scTransitionInfoMapper.insertScTransitionInfo(scTransitionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改转场
|
* 修改转场
|
||||||
*
|
*
|
||||||
@@ -110,11 +126,25 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertScTransitionInfoBatch(List<ScTransitionInfo> transitionInfoList) {
|
public int insertScTransitionInfoBatch(List<ScTransitionInfo> transitionInfoList) {
|
||||||
String username = SecurityUtils.getUsername();
|
String username = SecurityUtils.getUsername();
|
||||||
Date now = DateUtils.getNowDate();
|
Date now = DateUtils.getNowDate();
|
||||||
|
|
||||||
for (ScTransitionInfo info : transitionInfoList) {
|
for (ScTransitionInfo info : transitionInfoList) {
|
||||||
|
// 每条记录根据耳号查询羊只信息
|
||||||
|
String manageTags = info.getManageTags();
|
||||||
|
if (StringUtils.isNotBlank(manageTags)) {
|
||||||
|
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
|
||||||
|
if (sheep == null) {
|
||||||
|
throw new RuntimeException("耳号 " + manageTags + " 不存在,请检查输入");
|
||||||
|
}
|
||||||
|
info.setSheepId(sheep.getId().intValue());
|
||||||
|
info.setVarietyId(sheep.getVarietyId());
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("耳号不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
info.setCreateBy(username);
|
info.setCreateBy(username);
|
||||||
info.setCreateTime(now);
|
info.setCreateTime(now);
|
||||||
info.setStatus(0);
|
info.setStatus(0);
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ public class ScCastrateController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ScCastrate scCastrate)
|
public AjaxResult add(@RequestBody ScCastrate scCastrate)
|
||||||
{
|
{
|
||||||
|
scCastrate.setUserId(getUserId());
|
||||||
|
scCastrate.setDeptId(getDeptId());
|
||||||
return toAjax(scCastrateService.insertScCastrate(scCastrate));
|
return toAjax(scCastrateService.insertScCastrate(scCastrate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,8 @@ public class ScFixHoofController extends BaseController
|
|||||||
Long sheepId = scFixHoofService.findIdByManageTags(dto.getManageTags());
|
Long sheepId = scFixHoofService.findIdByManageTags(dto.getManageTags());
|
||||||
dto.setSheepId(sheepId.intValue());
|
dto.setSheepId(sheepId.intValue());
|
||||||
}
|
}
|
||||||
|
dto.setUserId(getUserId());
|
||||||
|
dto.setDeptId(getDeptId());
|
||||||
// 保存修蹄记录
|
// 保存修蹄记录
|
||||||
scFixHoofService.insertScFixHoof(dto);
|
scFixHoofService.insertScFixHoof(dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,20 +34,6 @@ public class ScCastrate extends BaseEntity {
|
|||||||
@Excel(name = "耳号")
|
@Excel(name = "耳号")
|
||||||
private String manageTags;
|
private String manageTags;
|
||||||
|
|
||||||
/**
|
|
||||||
* 事件类型
|
|
||||||
*/
|
|
||||||
@Excel(name = "事件类型")
|
|
||||||
private String eventType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 羊舍id
|
|
||||||
*/
|
|
||||||
private Long sheepfold;
|
|
||||||
|
|
||||||
@Excel(name = "羊舍名称")
|
|
||||||
private String sheepfoldName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品种id
|
* 品种id
|
||||||
*/
|
*/
|
||||||
@@ -60,10 +46,25 @@ public class ScCastrate extends BaseEntity {
|
|||||||
private String varietyName;
|
private String varietyName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 事件类型
|
||||||
*/
|
*/
|
||||||
@Excel(name = "备注")
|
@Excel(name = "事件类型")
|
||||||
private String comment;
|
private String eventType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 去势日期
|
||||||
|
*/
|
||||||
|
@Excel(name = "去势日期", width = 15, dateFormat = "yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private String eventDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 羊舍id
|
||||||
|
*/
|
||||||
|
private Long sheepfold;
|
||||||
|
|
||||||
|
@Excel(name = "羊舍名称")
|
||||||
|
private String sheepfoldName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 技术员
|
* 技术员
|
||||||
@@ -72,11 +73,10 @@ public class ScCastrate extends BaseEntity {
|
|||||||
private String technician;
|
private String technician;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事件日期
|
* 备注
|
||||||
*/
|
*/
|
||||||
@Excel(name = "事件日期", width = 15, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "备注")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
private String comment;
|
||||||
private String eventDate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 前端多耳号查询条件,非表字段
|
* 前端多耳号查询条件,非表字段
|
||||||
@@ -87,4 +87,14 @@ public class ScCastrate extends BaseEntity {
|
|||||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||||
*/
|
*/
|
||||||
private Integer isDelete;
|
private Integer isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,4 +89,14 @@ public class ScFixHoof extends BaseEntity {
|
|||||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||||
*/
|
*/
|
||||||
private Integer isDelete;
|
private Integer isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zhyc.module.produce.other.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
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.module.base.domain.BasSheep;
|
import com.zhyc.module.base.domain.BasSheep;
|
||||||
@@ -11,6 +12,7 @@ import com.zhyc.module.produce.other.mapper.ScCastrateMapper;
|
|||||||
import com.zhyc.module.produce.other.service.IScCastrateService;
|
import com.zhyc.module.produce.other.service.IScCastrateService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 去势Service业务层处理
|
* 去势Service业务层处理
|
||||||
@@ -43,6 +45,7 @@ public class ScCastrateServiceImpl implements IScCastrateService {
|
|||||||
* @return 去势
|
* @return 去势
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "sc", userAlias = "sc")
|
||||||
public List<ScCastrate> selectScCastrateList(ScCastrate scCastrate) {
|
public List<ScCastrate> selectScCastrateList(ScCastrate scCastrate) {
|
||||||
return scCastrateMapper.selectScCastrateList(scCastrate,
|
return scCastrateMapper.selectScCastrateList(scCastrate,
|
||||||
scCastrate.getManageTagsList());
|
scCastrate.getManageTagsList());
|
||||||
@@ -55,22 +58,33 @@ public class ScCastrateServiceImpl implements IScCastrateService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertScCastrate(ScCastrate scCastrate) {
|
public int insertScCastrate(ScCastrate scCastrate) {
|
||||||
|
// ✅ 第1步:先根据耳号查羊只(确保存在且获取完整信息)
|
||||||
|
String manageTags = scCastrate.getManageTags();
|
||||||
|
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags);
|
||||||
|
if (sheep == null) {
|
||||||
|
throw new RuntimeException("未找到耳号为【" + manageTags + "】的羊只");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ 第2步:设置 sheepId 和其他字段(关键!)
|
||||||
|
scCastrate.setSheepId(String.valueOf(sheep.getId()));
|
||||||
|
scCastrate.setVarietyId(sheep.getVarietyId()); // 品种ID也设置
|
||||||
|
scCastrate.setSheepfold(sheep.getSheepfoldId()); // 羊舍ID也设置
|
||||||
|
|
||||||
scCastrate.setCreateTime(DateUtils.getNowDate());
|
scCastrate.setCreateTime(DateUtils.getNowDate());
|
||||||
scCastrate.setCreateBy(SecurityUtils.getUsername());
|
scCastrate.setCreateBy(SecurityUtils.getUsername());
|
||||||
int result = scCastrateMapper.insertScCastrate(scCastrate);
|
|
||||||
|
|
||||||
if (result > 0 && scCastrate.getSheepId() != null) {
|
// ✅ 第3步:再执行 insert(此时所有字段都有值了)
|
||||||
try {
|
int result = scCastrateMapper.insertScCastrate(scCastrate);
|
||||||
BasSheep sheep = new BasSheep();
|
if (result <= 0) {
|
||||||
sheep.setId(Long.parseLong(scCastrate.getSheepId()));
|
return result;
|
||||||
sheep.setGender(3L);
|
|
||||||
basSheepService.updateBasSheep(sheep);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("去势成功,但更新羊只性别失败,请重试");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 第4步:更新羊只性别为去势(3)
|
||||||
|
sheep.setGender(3L);
|
||||||
|
basSheepService.updateBasSheep(sheep);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zhyc.module.produce.other.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.zhyc.common.annotation.DataScope;
|
||||||
import com.zhyc.common.exception.ServiceException;
|
import com.zhyc.common.exception.ServiceException;
|
||||||
import com.zhyc.common.utils.DateUtils;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
import com.zhyc.common.utils.SecurityUtils;
|
import com.zhyc.common.utils.SecurityUtils;
|
||||||
@@ -14,6 +15,7 @@ import com.zhyc.module.produce.other.mapper.ScFixHoofMapper;
|
|||||||
import com.zhyc.module.produce.other.service.IScFixHoofService;
|
import com.zhyc.module.produce.other.service.IScFixHoofService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修蹄Service业务层处理
|
* 修蹄Service业务层处理
|
||||||
@@ -50,6 +52,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService {
|
|||||||
* @return 修蹄
|
* @return 修蹄
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@DataScope(deptAlias = "fh", userAlias = "fh")
|
||||||
public List<ScFixHoof> selectScFixHoofList(ScFixHoof scFixHoof) {
|
public List<ScFixHoof> selectScFixHoofList(ScFixHoof scFixHoof) {
|
||||||
return scFixHoofMapper.selectScFixHoofList(scFixHoof,
|
return scFixHoofMapper.selectScFixHoofList(scFixHoof,
|
||||||
scFixHoof.getManageTagsList());
|
scFixHoof.getManageTagsList());
|
||||||
@@ -63,13 +66,21 @@ public class ScFixHoofServiceImpl implements IScFixHoofService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class) // ✅ 添加事务
|
||||||
public int insertScFixHoof(ScFixHoof scFixHoof) {
|
public int insertScFixHoof(ScFixHoof scFixHoof) {
|
||||||
|
// ✅ 查羊只(已有)
|
||||||
BasSheep sheep = basSheepMapper.selectBasSheepById(scFixHoof.getSheepId().longValue());
|
BasSheep sheep = basSheepMapper.selectBasSheepById(scFixHoof.getSheepId().longValue());
|
||||||
if (sheep == null) {
|
if (sheep == null) {
|
||||||
throw new ServiceException("该羊只ID不存在,请检查后再添加");
|
throw new ServiceException("该羊只ID不存在,请检查后再添加");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ✅ 关键:设置 sheepfold 和 varietyId(你漏了!)
|
||||||
|
scFixHoof.setSheepfold(sheep.getSheepfoldId().intValue());
|
||||||
|
scFixHoof.setVarietyId(sheep.getVarietyId());
|
||||||
|
|
||||||
scFixHoof.setCreateTime(DateUtils.getNowDate());
|
scFixHoof.setCreateTime(DateUtils.getNowDate());
|
||||||
scFixHoof.setCreateBy(SecurityUtils.getUsername());
|
scFixHoof.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
|
||||||
return scFixHoofMapper.insertScFixHoof(scFixHoof);
|
return scFixHoofMapper.insertScFixHoof(scFixHoof);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,7 +167,6 @@
|
|||||||
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
|
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
|
||||||
<where>s.manage_tags = #{manageTags}
|
<where>s.manage_tags = #{manageTags}
|
||||||
AND s.is_delete = 0
|
AND s.is_delete = 0
|
||||||
${params.dataScope}
|
|
||||||
</where>
|
</where>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -18,10 +18,14 @@
|
|||||||
LEFT JOIN np_milk_feed_records fr ON fr.store_id = s.id
|
LEFT JOIN np_milk_feed_records fr ON fr.store_id = s.id
|
||||||
LEFT JOIN np_milk_sale_records sr ON sr.store_id = s.id
|
LEFT JOIN np_milk_sale_records sr ON sr.store_id = s.id
|
||||||
<where>
|
<where>
|
||||||
<if test="start != null"> s.datetime >= #{start}</if>
|
<if test="queryParams.params.beginTime != null and queryParams.params.beginTime != ''">
|
||||||
<if test="end != null"> AND s.datetime <= #{end}</if>
|
AND s.datetime >= #{queryParams.params.beginTime}
|
||||||
|
</if>
|
||||||
|
<if test="queryParams.params.endTime != null and queryParams.params.endTime != ''">
|
||||||
|
AND s.datetime <= #{queryParams.params.endTime}
|
||||||
|
</if>
|
||||||
|
|
||||||
${params.dataScope}
|
${queryParams.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
GROUP BY s.id
|
GROUP BY s.id
|
||||||
ORDER BY s.datetime
|
ORDER BY s.datetime
|
||||||
|
|||||||
@@ -30,10 +30,18 @@
|
|||||||
<result property="rumpHeignt" column="rump_heignt"/>
|
<result property="rumpHeignt" column="rump_heignt"/>
|
||||||
<result property="hipWidth" column="hip_width"/>
|
<result property="hipWidth" column="hip_width"/>
|
||||||
<result property="hipCrossHeight" column="hip_cross_height"/>
|
<result property="hipCrossHeight" column="hip_cross_height"/>
|
||||||
<result property="breedStatusName" column="breed_status_name"/>
|
<result property="monthAge" column="month_age"/>
|
||||||
|
<result property="breastDepth" column="breast_depth"/>
|
||||||
|
<result property="breastPosition" column="breast_position"/>
|
||||||
|
<result property="breastLength" column="breast_length"/>
|
||||||
|
<result property="breastAdbere" column="breast_adbere"/>
|
||||||
|
<result property="breastSpacing" column="breast_spacing"/>
|
||||||
|
<result property="breastScore" column="breast_score"/>
|
||||||
|
<result property="bodyScore" column="body_score"/>
|
||||||
<result property="lactationDay" column="lactation_day"/>
|
<result property="lactationDay" column="lactation_day"/>
|
||||||
<result property="gestationDay" column="gestation_day"/>
|
<result property="gestationDay" column="gestation_day"/>
|
||||||
<result property="postMatingDay" column="post_mating_day"/>
|
<result property="postMatingDay" column="post_mating_day"/>
|
||||||
|
<result property="breedStatusName" column="breed_status_name"/>
|
||||||
<result property="comment" column="comment"/>
|
<result property="comment" column="comment"/>
|
||||||
<result property="technician" column="technician"/>
|
<result property="technician" column="technician"/>
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="createBy" column="create_by"/>
|
||||||
@@ -42,47 +50,54 @@
|
|||||||
|
|
||||||
<sql id="selectScBodyMeasureVo">
|
<sql id="selectScBodyMeasureVo">
|
||||||
select sm.id,
|
select sm.id,
|
||||||
sm.sheep_id,
|
sm.sheep_id,
|
||||||
bs.manage_tags,
|
sm.user_id,
|
||||||
ds.id as sheepfold_id,
|
sm.dept_id,
|
||||||
ds.sheepfold_name,
|
bs.manage_tags,
|
||||||
bsv.id as variety_id,
|
ds.id as sheepfold_id,
|
||||||
bsv.variety as variety_name,
|
ds.sheepfold_name,
|
||||||
'体尺测量' as event_type,
|
bsv.id as variety_id,
|
||||||
bst.name as sheep_type_name,
|
bsv.variety as variety_name,
|
||||||
sm.measure_date,
|
'体尺测量' as event_type,
|
||||||
bs.gender,
|
bst.name as sheep_type_name,
|
||||||
bs.parity,
|
sm.measure_date,
|
||||||
bs.birth_weight as birth_weight,
|
bs.gender,
|
||||||
bs.weaning_weight as weaning_weight,
|
bs.parity,
|
||||||
sm.current_weight as current_weight,
|
bs.birth_weight as birth_weight,
|
||||||
sm.height,
|
bs.weaning_weight as weaning_weight,
|
||||||
sm.bust,
|
sm.current_weight as current_weight,
|
||||||
sm.body_length,
|
sm.height,
|
||||||
sm.pipe_length,
|
sm.bust,
|
||||||
sm.chest_depth,
|
sm.body_length,
|
||||||
sm.hip_height,
|
sm.pipe_length,
|
||||||
sm.rump_width,
|
sm.chest_depth,
|
||||||
sm.rump_heignt,
|
sm.hip_height,
|
||||||
sm.hip_width,
|
sm.rump_width,
|
||||||
sm.hip_cross_height,
|
sm.rump_heignt,
|
||||||
bbs.breed as breed_status_name,
|
sm.hip_width,
|
||||||
bs.lactation_day as lactation_day,
|
sm.hip_cross_height,
|
||||||
bs.gestation_day as gestation_day,
|
sm.month_age,
|
||||||
case when bs.mating_date is not null
|
sm.breast_depth,
|
||||||
then DATEDIFF(NOW(), bs.mating_date)
|
sm.breast_position,
|
||||||
else null
|
sm.breast_length,
|
||||||
end as post_mating_day,
|
sm.breast_adbere,
|
||||||
sm.comment,
|
sm.breast_spacing,
|
||||||
sm.technician,
|
sm.breast_score,
|
||||||
sm.create_by,
|
sm.body_score,
|
||||||
sm.create_time
|
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
|
from sc_body_measure sm
|
||||||
LEFT JOIN bas_sheep bs ON sm.sheep_id = bs.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 bas_breed_status bbs ON bs.breed_status_id = bbs.id
|
||||||
LEFT JOIN da_sheepfold ds ON bs.sheepfold_id = ds.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_type bst ON bs.type_id = bst.id
|
||||||
LEFT JOIN bas_sheep_variety bsv ON bs.variety_id = bsv.id
|
LEFT JOIN bas_sheep_variety bsv ON bs.variety_id = bsv.id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectScBodyMeasureList" resultMap="ScBodyMeasureResult">
|
<select id="selectScBodyMeasureList" resultMap="ScBodyMeasureResult">
|
||||||
@@ -113,14 +128,21 @@
|
|||||||
and bs.is_delete = #{sc.isDelete}
|
and bs.is_delete = #{sc.isDelete}
|
||||||
</if>
|
</if>
|
||||||
<if test="sc.monthAgeStart != null">
|
<if test="sc.monthAgeStart != null">
|
||||||
and <![CDATA[ TIMESTAMPDIFF(MONTH, bs.birthday, CURDATE()) >= #{sc.monthAgeStart} ]]>
|
and <![CDATA[ sm.month_age >= #{sc.monthAgeStart} ]]>
|
||||||
</if>
|
</if>
|
||||||
<if test="sc.monthAgeEnd != null">
|
<if test="sc.monthAgeEnd != null">
|
||||||
and <![CDATA[ TIMESTAMPDIFF(MONTH, bs.birthday, CURDATE()) <= #{sc.monthAgeEnd} ]]>
|
and <![CDATA[ sm.month_age <= #{sc.monthAgeEnd} ]]>
|
||||||
</if>
|
</if>
|
||||||
<if test="sc.breedStatusName != null and sc.breedStatusName != ''">
|
<if test="sc.breedStatusName != null and sc.breedStatusName != ''">
|
||||||
and bbs.breed = #{sc.breedStatusName}
|
and bbs.breed = #{sc.breedStatusName}
|
||||||
</if>
|
</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>
|
||||||
|
${sc.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
ORDER BY sm.create_time DESC
|
ORDER BY sm.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
@@ -146,10 +168,23 @@
|
|||||||
<if test="currentWeight != null">current_weight,</if>
|
<if test="currentWeight != null">current_weight,</if>
|
||||||
<if test="hipWidth != null">hip_width,</if>
|
<if test="hipWidth != null">hip_width,</if>
|
||||||
<if test="hipCrossHeight != null">hip_cross_height,</if>
|
<if test="hipCrossHeight != null">hip_cross_height,</if>
|
||||||
|
<if test="monthAge != null">month_age,</if>
|
||||||
|
<if test="breastDepth != null">breast_depth,</if>
|
||||||
|
<if test="breastPosition != null">breast_position,</if>
|
||||||
|
<if test="breastLength != null">breast_length,</if>
|
||||||
|
<if test="breastAdbere != null">breast_adbere,</if>
|
||||||
|
<if test="breastSpacing != null">breast_spacing,</if>
|
||||||
|
<if test="breastScore != null">breast_score,</if>
|
||||||
|
<if test="bodyScore != null">body_score,</if>
|
||||||
|
<if test="lactationDay != null">lactation_day,</if>
|
||||||
|
<if test="gestationDay != null">gestation_day,</if>
|
||||||
|
<if test="postMatingDay != null">post_mating_day,</if>
|
||||||
<if test="comment != null">comment,</if>
|
<if test="comment != null">comment,</if>
|
||||||
<if test="technician != null">technician,</if>
|
<if test="technician != null">technician,</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>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="sheepId != null">#{sheepId},</if>
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
@@ -165,10 +200,23 @@
|
|||||||
<if test="currentWeight != null">#{currentWeight},</if>
|
<if test="currentWeight != null">#{currentWeight},</if>
|
||||||
<if test="hipWidth != null">#{hipWidth},</if>
|
<if test="hipWidth != null">#{hipWidth},</if>
|
||||||
<if test="hipCrossHeight != null">#{hipCrossHeight},</if>
|
<if test="hipCrossHeight != null">#{hipCrossHeight},</if>
|
||||||
|
<if test="monthAge != null">#{monthAge},</if>
|
||||||
|
<if test="breastDepth != null">#{breastDepth},</if>
|
||||||
|
<if test="breastPosition != null">#{breastPosition},</if>
|
||||||
|
<if test="breastLength != null">#{breastLength},</if>
|
||||||
|
<if test="breastAdbere != null">#{breastAdbere},</if>
|
||||||
|
<if test="breastSpacing != null">#{breastSpacing},</if>
|
||||||
|
<if test="breastScore != null">#{breastScore},</if>
|
||||||
|
<if test="bodyScore != null">#{bodyScore},</if>
|
||||||
|
<if test="lactationDay != null">#{lactationDay},</if>
|
||||||
|
<if test="gestationDay != null">#{gestationDay},</if>
|
||||||
|
<if test="postMatingDay != null">#{postMatingDay},</if>
|
||||||
<if test="comment != null">#{comment},</if>
|
<if test="comment != null">#{comment},</if>
|
||||||
<if test="technician != null">#{technician},</if>
|
<if test="technician != null">#{technician},</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>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -188,6 +236,17 @@
|
|||||||
<if test="currentWeight != null">current_weight = #{currentWeight},</if>
|
<if test="currentWeight != null">current_weight = #{currentWeight},</if>
|
||||||
<if test="hipWidth != null">hip_width = #{hipWidth},</if>
|
<if test="hipWidth != null">hip_width = #{hipWidth},</if>
|
||||||
<if test="hipCrossHeight != null">hip_cross_height = #{hipCrossHeight},</if>
|
<if test="hipCrossHeight != null">hip_cross_height = #{hipCrossHeight},</if>
|
||||||
|
<if test="monthAge != null">month_age = #{monthAge},</if>
|
||||||
|
<if test="breastDepth != null">breast_depth = #{breastDepth},</if>
|
||||||
|
<if test="breastPosition != null">breast_position = #{breastPosition},</if>
|
||||||
|
<if test="breastLength != null">breast_length = #{breastLength},</if>
|
||||||
|
<if test="breastAdbere != null">breast_adbere = #{breastAdbere},</if>
|
||||||
|
<if test="breastSpacing != null">breast_spacing = #{breastSpacing},</if>
|
||||||
|
<if test="breastScore != null">breast_score = #{breastScore},</if>
|
||||||
|
<if test="bodyScore != null">body_score = #{bodyScore},</if>
|
||||||
|
<if test="lactationDay != null">lactation_day = #{lactationDay},</if>
|
||||||
|
<if test="gestationDay != null">gestation_day = #{gestationDay},</if>
|
||||||
|
<if test="postMatingDay != null">post_mating_day = #{postMatingDay},</if>
|
||||||
<if test="comment != null">comment = #{comment},</if>
|
<if test="comment != null">comment = #{comment},</if>
|
||||||
<if test="technician != null">technician = #{technician},</if>
|
<if test="technician != null">technician = #{technician},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
@@ -208,11 +267,12 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="searchEarNumbers" resultType="java.lang.String">
|
<select id="searchEarNumbers" resultType="java.lang.String">
|
||||||
SELECT DISTINCT bs.manage_tags
|
SELECT DISTINCT bs.manage_tags
|
||||||
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
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,12 @@
|
|||||||
<sql id="selectScBodyScoreVo">
|
<sql id="selectScBodyScoreVo">
|
||||||
select sbs.id,
|
select sbs.id,
|
||||||
sbs.sheep_id,
|
sbs.sheep_id,
|
||||||
|
sbs.user_id,
|
||||||
|
sbs.dept_id,
|
||||||
bs.manage_tags,
|
bs.manage_tags,
|
||||||
bsv.id as varietyId,
|
bsv.id as varietyId,
|
||||||
bsv.variety as varietyName,
|
bsv.variety as varietyName,
|
||||||
'体况评分' as event_type,
|
'体况评分' as event_type,
|
||||||
sbs.datetime,
|
sbs.datetime,
|
||||||
sbs.score,
|
sbs.score,
|
||||||
ds.sheepfold_name as sheepfoldName,
|
ds.sheepfold_name as sheepfoldName,
|
||||||
@@ -62,6 +64,10 @@
|
|||||||
<if test="sc.isDelete != null">
|
<if test="sc.isDelete != null">
|
||||||
and bs.is_delete = #{sc.isDelete}
|
and bs.is_delete = #{sc.isDelete}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="sc.technician != null and sc.technician != ''">
|
||||||
|
and sbs.technician like concat('%', #{sc.technician}, '%')
|
||||||
|
</if>
|
||||||
|
${sc.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
ORDER BY sbs.create_time DESC
|
ORDER BY sbs.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
@@ -82,6 +88,8 @@
|
|||||||
<if test="technician != null">technician,</if>
|
<if test="technician != null">technician,</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>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="sheepId != null">#{sheepId},</if>
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
@@ -92,6 +100,8 @@
|
|||||||
<if test="technician != null">#{technician},</if>
|
<if test="technician != null">#{technician},</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>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -129,6 +139,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>
|
||||||
@@ -24,11 +24,15 @@
|
|||||||
<result property="technician" column="technician"/>
|
<result property="technician" column="technician"/>
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="createBy" column="create_by"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="deptId" column="dept_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectScBreastRatingVo">
|
<sql id="selectScBreastRatingVo">
|
||||||
select sbr.*,
|
select sbr.*,
|
||||||
bs.manage_tags as manageTags,
|
bs.manage_tags as manageTags,
|
||||||
|
sbr.user_id,
|
||||||
|
sbr.dept_id,
|
||||||
bsv.id as varietyId,
|
bsv.id as varietyId,
|
||||||
bsv.variety as varietyName,
|
bsv.variety as varietyName,
|
||||||
'乳房评分' as event_type,
|
'乳房评分' as event_type,
|
||||||
@@ -60,6 +64,13 @@
|
|||||||
<if test="sc.isDelete != null">
|
<if test="sc.isDelete != null">
|
||||||
and bs.is_delete = #{sc.isDelete}
|
and bs.is_delete = #{sc.isDelete}
|
||||||
</if>
|
</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>
|
||||||
|
${sc.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
ORDER BY sbr.create_time DESC
|
ORDER BY sbr.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
@@ -84,6 +95,8 @@
|
|||||||
<if test="technician != null">technician,</if>
|
<if test="technician != null">technician,</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>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="sheepId != null">#{sheepId},</if>
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
@@ -98,6 +111,8 @@
|
|||||||
<if test="technician != null">#{technician},</if>
|
<if test="technician != null">#{technician},</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>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -137,6 +152,15 @@
|
|||||||
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 LIMIT 50
|
ORDER BY bs.manage_tags
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectLatestBySheepIdBeforeDate" resultMap="ScBreastRatingResult">
|
||||||
|
SELECT *
|
||||||
|
FROM sc_breast_rating
|
||||||
|
WHERE sheep_id = #{sheepId}
|
||||||
|
AND event_date <= #{measureDate}
|
||||||
|
ORDER BY event_date DESC, create_time DESC LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -25,18 +25,40 @@
|
|||||||
<result property="technician" column="technician"/>
|
<result property="technician" column="technician"/>
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="createBy" column="create_by"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="deptId" column="dept_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<sql id="selectScAddSheepVo">
|
||||||
<select id="selectScAddSheepList" parameterType="ScAddSheep" resultMap="ScAddSheepResult">
|
|
||||||
SELECT
|
SELECT
|
||||||
sas.*,
|
sas.id,
|
||||||
sf.sheepfold_name AS sheepfoldName,
|
sas.ear_number,
|
||||||
bv.variety AS varietyName,
|
sas.sheepfold,
|
||||||
st.type_name AS typeName
|
sas.ranch_id,
|
||||||
|
sas.father,
|
||||||
|
sas.mother,
|
||||||
|
sas.born_weight,
|
||||||
|
sas.birthday,
|
||||||
|
sas.gender,
|
||||||
|
sas.parity,
|
||||||
|
sas.variety_id,
|
||||||
|
sas.type_id,
|
||||||
|
sas.join_date,
|
||||||
|
sas.comment,
|
||||||
|
sas.technician,
|
||||||
|
sas.create_by,
|
||||||
|
sas.create_time,
|
||||||
|
sas.user_id,
|
||||||
|
sas.dept_id,
|
||||||
|
sf.sheepfold_name AS sheepfoldName,
|
||||||
|
bv.variety AS varietyName,
|
||||||
|
st.type_name AS typeName
|
||||||
FROM sc_add_sheep sas
|
FROM sc_add_sheep sas
|
||||||
LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id
|
LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id
|
||||||
LEFT JOIN bas_sheep_variety bv ON sas.variety_id = bv.id
|
LEFT JOIN bas_sheep_variety bv ON sas.variety_id = bv.id
|
||||||
LEFT JOIN bas_sheep_type st ON sas.type_id = st.id
|
LEFT JOIN bas_sheep_type st ON sas.type_id = st.id
|
||||||
|
</sql>
|
||||||
|
<select id="selectScAddSheepList" parameterType="ScAddSheep" resultMap="ScAddSheepResult">
|
||||||
|
<include refid="selectScAddSheepVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="earNumber != null and earNumber != ''">
|
<if test="earNumber != null and earNumber != ''">
|
||||||
AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%')
|
AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%')
|
||||||
@@ -50,6 +72,7 @@
|
|||||||
<if test="typeId != null">
|
<if test="typeId != null">
|
||||||
AND sas.type_id = #{typeId}
|
AND sas.type_id = #{typeId}
|
||||||
</if>
|
</if>
|
||||||
|
${params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -61,12 +84,46 @@
|
|||||||
|
|
||||||
<insert id="insert" parameterType="ScAddSheep" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insert" parameterType="ScAddSheep" useGeneratedKeys="true" keyProperty="id">
|
||||||
INSERT INTO sc_add_sheep
|
INSERT INTO sc_add_sheep
|
||||||
(ear_number, sheepfold, ranch_id, father, mother, born_weight, birthday,
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
gender, parity, variety_id, type_id, join_date, comment, technician,
|
<if test="earNumber != null">ear_number,</if>
|
||||||
create_by, create_time)
|
<if test="sheepfold != null">sheepfold,</if>
|
||||||
VALUES (#{earNumber}, #{sheepfold}, #{ranchId}, #{father}, #{mother}, #{bornWeight},
|
<if test="ranchId != null">ranch_id,</if>
|
||||||
#{birthday}, #{gender}, #{parity}, #{varietyId}, #{typeId}, #{joinDate},
|
<if test="father != null">father,</if>
|
||||||
#{comment}, #{technician}, #{createBy}, #{createTime})
|
<if test="mother != null">mother,</if>
|
||||||
|
<if test="bornWeight != null">born_weight,</if>
|
||||||
|
<if test="birthday != null">birthday,</if>
|
||||||
|
<if test="gender != null">gender,</if>
|
||||||
|
<if test="parity != null">parity,</if>
|
||||||
|
<if test="varietyId != null">variety_id,</if>
|
||||||
|
<if test="typeId != null">type_id,</if>
|
||||||
|
<if test="joinDate != null">join_date,</if>
|
||||||
|
<if test="comment != null">comment,</if>
|
||||||
|
<if test="technician != null">technician,</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="earNumber != null">#{earNumber},</if>
|
||||||
|
<if test="sheepfold != null">#{sheepfold},</if>
|
||||||
|
<if test="ranchId != null">#{ranchId},</if>
|
||||||
|
<if test="father != null">#{father},</if>
|
||||||
|
<if test="mother != null">#{mother},</if>
|
||||||
|
<if test="bornWeight != null">#{bornWeight},</if>
|
||||||
|
<if test="birthday != null">#{birthday},</if>
|
||||||
|
<if test="gender != null">#{gender},</if>
|
||||||
|
<if test="parity != null">#{parity},</if>
|
||||||
|
<if test="varietyId != null">#{varietyId},</if>
|
||||||
|
<if test="typeId != null">#{typeId},</if>
|
||||||
|
<if test="joinDate != null">#{joinDate},</if>
|
||||||
|
<if test="comment != null">#{comment},</if>
|
||||||
|
<if test="technician != null">#{technician},</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>
|
||||||
|
|
||||||
<update id="updateScAddSheep" parameterType="ScAddSheep">
|
<update id="updateScAddSheep" parameterType="ScAddSheep">
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
<sql id="selectScChangeCommentVo">
|
<sql id="selectScChangeCommentVo">
|
||||||
select scc.id,
|
select scc.id,
|
||||||
scc.sheep_id,
|
scc.sheep_id,
|
||||||
|
scc.user_id,
|
||||||
|
scc.dept_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,
|
||||||
'改备注' as event_type,
|
'改备注' as event_type,
|
||||||
@@ -43,9 +45,9 @@
|
|||||||
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>-->
|
||||||
<if test="sc.technician != null and sc.technician != ''">
|
<if test="sc.technician != null and sc.technician != ''">
|
||||||
and scc.technician like concat('%', #{sc.technician}, '%')
|
and scc.technician like concat('%', #{sc.technician}, '%')
|
||||||
</if>
|
</if>
|
||||||
@@ -66,6 +68,7 @@
|
|||||||
<if test="sc.isDelete != null">
|
<if test="sc.isDelete != null">
|
||||||
and bs.is_delete = #{sc.isDelete}
|
and bs.is_delete = #{sc.isDelete}
|
||||||
</if>
|
</if>
|
||||||
|
${sc.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
ORDER BY scc.create_time DESC
|
ORDER BY scc.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
@@ -85,6 +88,8 @@
|
|||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="eventDate != null">event_date,</if>
|
<if test="eventDate != null">event_date,</if>
|
||||||
<if test="technician != null and technician != ''">technician,</if>
|
<if test="technician != null and technician != ''">technician,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="sheepId != null and sheepId != ''">#{sheepId},</if>
|
<if test="sheepId != null and sheepId != ''">#{sheepId},</if>
|
||||||
@@ -94,6 +99,8 @@
|
|||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="eventDate != null">#{eventDate},</if>
|
<if test="eventDate != null">#{eventDate},</if>
|
||||||
<if test="technician != null and technician != ''">#{technician},</if>
|
<if test="technician != null and technician != ''">#{technician},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -128,6 +135,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>
|
||||||
@@ -73,6 +73,7 @@
|
|||||||
<when test="sc.inGroup == 2">and bs.is_delete = 1</when>
|
<when test="sc.inGroup == 2">and bs.is_delete = 1</when>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
|
${sc.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
ORDER BY sce.create_time DESC
|
ORDER BY sce.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
@@ -94,6 +95,8 @@
|
|||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="eventDate != null">event_date,</if>
|
<if test="eventDate != null">event_date,</if>
|
||||||
<if test="technician != null and technician != ''">technician,</if>
|
<if test="technician != null and technician != ''">technician,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="sheepId != null">#{sheepId},</if>
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
@@ -105,6 +108,8 @@
|
|||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="eventDate != null">#{eventDate},</if>
|
<if test="eventDate != null">#{eventDate},</if>
|
||||||
<if test="technician != null and technician != ''">#{technician},</if>
|
<if test="technician != null and technician != ''">#{technician},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -141,6 +146,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>
|
||||||
@@ -65,6 +65,7 @@
|
|||||||
<if test="sc.isDelete != null">
|
<if test="sc.isDelete != null">
|
||||||
and bs.is_delete = #{sc.isDelete}
|
and bs.is_delete = #{sc.isDelete}
|
||||||
</if>
|
</if>
|
||||||
|
${sc.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
ORDER BY scv.create_time DESC
|
ORDER BY scv.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
@@ -83,8 +84,10 @@
|
|||||||
<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>
|
||||||
<if test="technician != null and technician != ''">technician,</if> <!-- 新增 -->
|
<if test="technician != null and technician != ''">technician,</if>
|
||||||
<if test="eventDate != null">event_date,</if> <!-- 新增 -->
|
<if test="eventDate != null">event_date,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="sheepId != null">#{sheepId},</if>
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
@@ -93,8 +96,10 @@
|
|||||||
<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>
|
||||||
<if test="technician != null and technician != ''">#{technician},</if> <!-- 新增 -->
|
<if test="technician != null and technician != ''">#{technician},</if>
|
||||||
<if test="eventDate != null">#{eventDate},</if> <!-- 新增 -->
|
<if test="eventDate != null">#{eventDate},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -129,6 +134,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 LIMIT 50
|
ORDER BY bs.manage_tags
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -18,11 +18,15 @@
|
|||||||
<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"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="deptId" column="dept_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectScTransGroupVo">
|
<sql id="selectScTransGroupVo">
|
||||||
SELECT tg.id,
|
SELECT tg.id,
|
||||||
tg.sheep_id,
|
tg.sheep_id,
|
||||||
|
tg.user_id,
|
||||||
|
tg.dept_id,
|
||||||
s.manage_tags AS manageTags,
|
s.manage_tags AS manageTags,
|
||||||
tg.event_type AS eventType,
|
tg.event_type AS eventType,
|
||||||
tg.trans_date AS transDate,
|
tg.trans_date AS transDate,
|
||||||
@@ -38,9 +42,7 @@
|
|||||||
tg.create_time,
|
tg.create_time,
|
||||||
sf_from.sheepfold_name AS foldFromName,
|
sf_from.sheepfold_name AS foldFromName,
|
||||||
sf_to.sheepfold_name AS foldToName,
|
sf_to.sheepfold_name AS foldToName,
|
||||||
tg.technician,
|
tg.technician
|
||||||
st.id AS sheepTypeId,
|
|
||||||
st.name AS sheepTypeName
|
|
||||||
FROM sc_trans_group tg
|
FROM sc_trans_group tg
|
||||||
LEFT JOIN bas_sheep s ON tg.sheep_id = s.id
|
LEFT JOIN bas_sheep s ON tg.sheep_id = s.id
|
||||||
LEFT JOIN bas_sheep_type st ON s.type_id = st.id
|
LEFT JOIN bas_sheep_type st ON s.type_id = st.id
|
||||||
@@ -74,6 +76,7 @@
|
|||||||
<if test="sc.isDelete != null">
|
<if test="sc.isDelete != null">
|
||||||
and s.is_delete = #{sc.isDelete}
|
and s.is_delete = #{sc.isDelete}
|
||||||
</if>
|
</if>
|
||||||
|
${sc.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
ORDER BY tg.create_time DESC
|
ORDER BY tg.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
@@ -99,6 +102,8 @@
|
|||||||
<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>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="sheepId != null">#{sheepId},</if>
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
@@ -112,6 +117,8 @@
|
|||||||
<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>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,16 @@
|
|||||||
<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"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="deptId" column="dept_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectScTransitionInfoVo">
|
<sql id="selectScTransitionInfoVo">
|
||||||
SELECT t.*,
|
SELECT t.*,
|
||||||
bv.variety AS varietyName,
|
bv.variety AS varietyName,
|
||||||
bs.manage_tags AS manageTags,
|
bs.manage_tags AS manageTags,
|
||||||
|
t.user_id,
|
||||||
|
t.dept_id,
|
||||||
sf.sheepfold_name AS sheepfoldName,
|
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,
|
||||||
@@ -77,6 +81,7 @@
|
|||||||
<if test="sc.currentRanchId != null">
|
<if test="sc.currentRanchId != null">
|
||||||
and bs.ranch_id = #{sc.currentRanchId}
|
and bs.ranch_id = #{sc.currentRanchId}
|
||||||
</if>
|
</if>
|
||||||
|
${sc.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
ORDER BY t.create_time DESC
|
ORDER BY t.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
@@ -101,6 +106,8 @@
|
|||||||
<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>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="sheepId != null">#{sheepId},</if>
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
@@ -115,6 +122,8 @@
|
|||||||
<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>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -171,6 +180,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 LIMIT 50
|
ORDER BY bs.manage_tags
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -50,7 +50,9 @@
|
|||||||
</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 sc.technician like concat('%', #{sc.technician}, '%')</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 != ''">
|
<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}
|
and sc.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
|
||||||
</if>
|
</if>
|
||||||
@@ -60,6 +62,7 @@
|
|||||||
<if test="sc.isDelete != null">
|
<if test="sc.isDelete != null">
|
||||||
and bs.is_delete = #{sc.isDelete}
|
and bs.is_delete = #{sc.isDelete}
|
||||||
</if>
|
</if>
|
||||||
|
${sc.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
ORDER BY sc.create_time DESC
|
ORDER BY sc.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
@@ -80,6 +83,8 @@
|
|||||||
<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>
|
||||||
<if test="eventDate != null">event_date,</if>
|
<if test="eventDate != null">event_date,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="deptId != null">dept_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="sheepId != null">#{sheepId},</if>
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
@@ -90,6 +95,8 @@
|
|||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="eventDate != null">#{eventDate},</if>
|
<if test="eventDate != null">#{eventDate},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="deptId != null">#{deptId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -126,6 +133,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>
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
<if test="sc.isDelete != null">
|
<if test="sc.isDelete != null">
|
||||||
and bs.is_delete = #{sc.isDelete}
|
and bs.is_delete = #{sc.isDelete}
|
||||||
</if>
|
</if>
|
||||||
|
${sc.params.dataScope}
|
||||||
</where>
|
</where>
|
||||||
ORDER BY fh.create_time DESC
|
ORDER BY fh.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
@@ -68,26 +69,32 @@
|
|||||||
where fh.id = #{id}
|
where fh.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertScFixHoof" parameterType="ScFixHoof"
|
<insert id="insertScFixHoof" parameterType="ScFixHoof" useGeneratedKeys="true" keyProperty="id">
|
||||||
useGeneratedKeys="true" keyProperty="id">
|
insert into sc_fix_hoof
|
||||||
INSERT INTO sc_fix_hoof
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
(sheep_id,
|
<if test="sheepId != null">sheep_id,</if>
|
||||||
sheepfold,
|
<if test="sheepfold != null">sheepfold,</if>
|
||||||
variety_id,
|
<if test="varietyId != null">variety_id,</if>
|
||||||
<if test="comment != null">comment,</if>
|
<if test="comment != null">comment,</if>
|
||||||
<if test="technician != null and technician != ''">technician,</if>
|
<if test="technician != null and technician != ''">technician,</if>
|
||||||
<if test="eventDate != null and eventDate != ''">event_date,</if>
|
<if test="eventDate != null and eventDate != ''">event_date,</if>
|
||||||
create_by,
|
<if test="createBy != null">create_by,</if>
|
||||||
create_time)
|
<if test="createTime != null">create_time,</if>
|
||||||
VALUES
|
<if test="userId != null">user_id,</if>
|
||||||
(#{sheepId},
|
<if test="deptId != null">dept_id,</if>
|
||||||
#{sheepfold},
|
</trim>
|
||||||
<if test="varietyId != null">#{varietyId},</if>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="comment != null">#{comment},</if>
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
<if test="technician != null and technician != ''">#{technician},</if>
|
<if test="sheepfold != null">#{sheepfold},</if>
|
||||||
<if test="eventDate != null and eventDate != ''">#{eventDate},</if>
|
<if test="varietyId != null">#{varietyId},</if>
|
||||||
#{createBy},
|
<if test="comment != null">#{comment},</if>
|
||||||
#{createTime})
|
<if test="technician != null and technician != ''">#{technician},</if>
|
||||||
|
<if test="eventDate != null and eventDate != ''">#{eventDate},</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>
|
||||||
|
|
||||||
<update id="updateScFixHoof" parameterType="ScFixHoof">
|
<update id="updateScFixHoof" parameterType="ScFixHoof">
|
||||||
|
|||||||
Reference in New Issue
Block a user