Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -201,6 +201,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -44,6 +44,17 @@ public class DaSheepfoldController extends BaseController
|
||||
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldList(daSheepfold);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主表格:羊舍级别汇总列表
|
||||
*/
|
||||
@GetMapping("/summaryList")
|
||||
public TableDataInfo summaryList(DaSheepfold daSheepfold) {
|
||||
startPage();
|
||||
List<DaSheepfold> list = daSheepfoldService.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/*
|
||||
* 根据羊舍ids查询羊只id
|
||||
* */
|
||||
|
||||
@@ -115,5 +115,10 @@ public class DaSheepfold extends BaseEntity
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
// 非数据库字段:单栏位羊数(子表格用)
|
||||
private Integer sheepCount;
|
||||
// 非数据库字段:羊舍总羊数(主表格用)
|
||||
private Integer totalSheepCount;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// 创建文件:ExportConfig.java
|
||||
package com.zhyc.module.base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 导出配置类
|
||||
*/
|
||||
@Data
|
||||
public class ExportConfig {
|
||||
/**
|
||||
* 要导出的列名列表(前端传递的驼峰命名)
|
||||
*/
|
||||
private List<String> columnNames;
|
||||
|
||||
/**
|
||||
* 查询条件
|
||||
*/
|
||||
private Map<String, Object> queryParams;
|
||||
|
||||
/**
|
||||
* 自定义筛选条件
|
||||
*/
|
||||
private Map<String, Object> customFilterParams;
|
||||
}
|
||||
@@ -30,6 +30,12 @@ public interface DaSheepfoldMapper
|
||||
*/
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold);
|
||||
|
||||
|
||||
/**
|
||||
* 羊舍级别汇总查询(主表格)
|
||||
*/
|
||||
List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold);
|
||||
|
||||
/**
|
||||
* 新增羊舍管理
|
||||
*
|
||||
|
||||
@@ -29,6 +29,8 @@ public interface IDaSheepfoldService
|
||||
*/
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold);
|
||||
|
||||
public List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold);
|
||||
|
||||
/**
|
||||
* 新增羊舍管理
|
||||
*
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.zhyc.module.base.domain.DaSheepfold;
|
||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||
import com.zhyc.module.base.mapper.DaSheepfoldMapper;
|
||||
import com.zhyc.module.base.service.IDaSheepfoldService;
|
||||
import org.slf4j.Logger; // 核心修正:导入SLF4J的Logger
|
||||
import org.slf4j.LoggerFactory; // 核心修正:导入SLF4J的LoggerFactory
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -24,6 +26,11 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
@Autowired
|
||||
private BasSheepMapper basSheepMapper;
|
||||
|
||||
|
||||
// 新增:创建日志对象
|
||||
private static final Logger log = LoggerFactory.getLogger(DaSheepfoldServiceImpl.class);
|
||||
|
||||
|
||||
/**
|
||||
* 查询羊舍管理
|
||||
*
|
||||
@@ -45,9 +52,44 @@ public class DaSheepfoldServiceImpl implements IDaSheepfoldService
|
||||
@Override
|
||||
public List<DaSheepfold> selectDaSheepfoldList(DaSheepfold daSheepfold)
|
||||
{
|
||||
|
||||
List<DaSheepfold> sheepfoldList = daSheepfoldMapper.selectDaSheepfoldList(daSheepfold);
|
||||
|
||||
// 新增调试打印:输出每个栏位的羊数
|
||||
log.info("===== 栏位羊数调试 =====");
|
||||
log.info("查询条件:牧场ID={}, 羊舍类型ID={}, 羊舍编号={}",
|
||||
daSheepfold.getRanchId(), daSheepfold.getSheepfoldTypeId(), daSheepfold.getSheepfoldNo());
|
||||
log.info("共查询到{}个栏位", sheepfoldList.size());
|
||||
|
||||
for (DaSheepfold fold : sheepfoldList) {
|
||||
log.info("栏位ID={}, 羊舍编号={}, 排号={}, 栏数={}, 羊数={}",
|
||||
fold.getId(), fold.getSheepfoldNo(), fold.getRowNo(), fold.getColumns(), fold.getSheepCount());
|
||||
}
|
||||
log.info("===== 调试结束 =====\n");
|
||||
return daSheepfoldMapper.selectDaSheepfoldList(daSheepfold);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 羊舍级别汇总查询(主表格)
|
||||
*/
|
||||
public List<DaSheepfold> selectDaSheepfoldSummaryList(DaSheepfold daSheepfold) {
|
||||
// List<DaSheepfold> summaryList = daSheepfoldMapper.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
//
|
||||
// // 新增调试打印:输出羊舍汇总羊数
|
||||
// log.info("===== 羊舍汇总羊数调试 =====");
|
||||
// log.info("查询条件:牧场ID={}, 羊舍类型ID={}",
|
||||
// daSheepfold.getRanchId(), daSheepfold.getSheepfoldTypeId());
|
||||
// log.info("共查询到{}个羊舍", summaryList.size());
|
||||
//
|
||||
// for (DaSheepfold fold : summaryList) {
|
||||
// log.info("羊舍编号={}, 羊舍名称={}, 总羊数={}",
|
||||
// fold.getSheepfoldNo(), fold.getSheepfoldName(), fold.getTotalSheepCount());
|
||||
// }
|
||||
// log.info("===== 汇总调试结束 =====\n");
|
||||
return daSheepfoldMapper.selectDaSheepfoldSummaryList(daSheepfold);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增羊舍管理
|
||||
*
|
||||
|
||||
@@ -109,6 +109,8 @@ public class SgFeedListController extends BaseController {
|
||||
@Log(title = "配料清单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SgFeedList sgFeedList) {
|
||||
sgFeedList.setDeptId(getDeptId());
|
||||
sgFeedList.setUserId(getUserId());
|
||||
return toAjax(sgFeedListService.insertSgFeedList(sgFeedList));
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ public class SgFeedPlanController extends BaseController {
|
||||
if (null == sgFeedPlan) {
|
||||
throw new RuntimeException("数据为空");
|
||||
}
|
||||
sgFeedPlan.setDeptId(getDeptId());
|
||||
sgFeedPlan.setUserId(getUserId());
|
||||
sgFeedPlan.setCreateDate(new Date());
|
||||
// 计算其他字段值
|
||||
setPlan(sgFeedPlan);
|
||||
|
||||
@@ -84,6 +84,8 @@ public class SgFeedStatisticController extends BaseController {
|
||||
if (null == sgFeedStatistic.getFormulaId() && null == sgFeedStatistic.getFormulaBatchId()) {
|
||||
throw new RuntimeException("ERROR: 数据为空");
|
||||
}
|
||||
sgFeedStatistic.setUserId(getUserId());
|
||||
sgFeedStatistic.setDeptId(getDeptId());
|
||||
List<SgFeedStatistic> isExist = sgFeedStatisticService.selectSgFeedStatisticList(sgFeedStatistic);
|
||||
if (null != isExist && !isExist.isEmpty()) {
|
||||
throw new RuntimeException("WARNING: 数据重复");
|
||||
|
||||
@@ -79,6 +79,8 @@ public class SgFormulaListController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SgFormulaList sgFormulaList)
|
||||
{
|
||||
sgFormulaList.setUserId(getUserId());
|
||||
sgFormulaList.setDeptId(getDeptId());
|
||||
return toAjax(sgFormulaListService.insertSgFormulaList(sgFormulaList));
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,8 @@ public class SgFormulaManagementController extends BaseController {
|
||||
public AjaxResult add(@RequestBody SgFormulaManagement sgFormulaManagement) {
|
||||
if (null == sgFormulaManagement)
|
||||
throw new RuntimeException("ERROR: 数据为空");
|
||||
sgFormulaManagement.setUserId(getUserId());
|
||||
sgFormulaManagement.setDeptId(getDeptId());
|
||||
if (Objects.equals(sgFormulaManagement.getBatchId(), "0")) {
|
||||
SgFormulaManagement exist = sgFormulaManagementService.selectSgFormulaManagementByFormulaId(sgFormulaManagement.getFormulaId());
|
||||
if (exist != null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.feed.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -29,8 +30,7 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/feed/material")
|
||||
public class SgMaterialController extends BaseController
|
||||
{
|
||||
public class SgMaterialController extends BaseController {
|
||||
@Autowired
|
||||
private ISgMaterialService sgMaterialService;
|
||||
|
||||
@@ -39,8 +39,7 @@ public class SgMaterialController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SgMaterial sgMaterial)
|
||||
{
|
||||
public TableDataInfo list(SgMaterial sgMaterial) {
|
||||
startPage();
|
||||
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
|
||||
return getDataTable(list);
|
||||
@@ -52,8 +51,7 @@ public class SgMaterialController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:export')")
|
||||
@Log(title = "原料", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SgMaterial sgMaterial)
|
||||
{
|
||||
public void export(HttpServletResponse response, SgMaterial sgMaterial) {
|
||||
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
|
||||
ExcelUtil<SgMaterial> util = new ExcelUtil<SgMaterial>(SgMaterial.class);
|
||||
util.exportExcel(response, list, "原料数据");
|
||||
@@ -64,8 +62,7 @@ public class SgMaterialController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:query')")
|
||||
@GetMapping(value = "/{materialId}")
|
||||
public AjaxResult getInfo(@PathVariable("materialId") String materialId)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("materialId") String materialId) {
|
||||
return success(sgMaterialService.selectSgMaterialByMaterialId(materialId));
|
||||
}
|
||||
|
||||
@@ -75,8 +72,9 @@ public class SgMaterialController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:add')")
|
||||
@Log(title = "原料", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SgMaterial sgMaterial)
|
||||
{
|
||||
public AjaxResult add(@RequestBody SgMaterial sgMaterial) {
|
||||
sgMaterial.setUserId(getUserId());
|
||||
sgMaterial.setDeptId(getDeptId());
|
||||
return toAjax(sgMaterialService.insertSgMaterial(sgMaterial));
|
||||
}
|
||||
|
||||
@@ -86,8 +84,7 @@ public class SgMaterialController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:edit')")
|
||||
@Log(title = "原料", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SgMaterial sgMaterial)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody SgMaterial sgMaterial) {
|
||||
return toAjax(sgMaterialService.updateSgMaterial(sgMaterial));
|
||||
}
|
||||
|
||||
@@ -96,9 +93,8 @@ public class SgMaterialController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('feed:material:remove')")
|
||||
@Log(title = "原料", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{materialIds}")
|
||||
public AjaxResult remove(@PathVariable String[] materialIds)
|
||||
{
|
||||
@DeleteMapping("/{materialIds}")
|
||||
public AjaxResult remove(@PathVariable String[] materialIds) {
|
||||
return toAjax(sgMaterialService.deleteSgMaterialByMaterialIds(materialIds));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,26 +19,36 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class SgFeedList extends BaseEntity
|
||||
{
|
||||
public class SgFeedList extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 序号 */
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/** 配方编号 */
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
@Excel(name = "配方编号")
|
||||
private String formulaId;
|
||||
|
||||
/** 配方批号 */
|
||||
/**
|
||||
* 配方批号
|
||||
*/
|
||||
@Excel(name = "配方批号")
|
||||
private String formulaBatchId;
|
||||
|
||||
/** 饲草班人员 */
|
||||
/**
|
||||
* 饲草班人员
|
||||
*/
|
||||
@Excel(name = "饲草班人员")
|
||||
private String zookeeper;
|
||||
|
||||
/** 配料日期 */
|
||||
/**
|
||||
* 配料日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "配料日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date deployDate;
|
||||
@@ -51,14 +61,14 @@ public class SgFeedList extends BaseEntity
|
||||
private Double noonTotal;
|
||||
private Double afternoonTotal;
|
||||
|
||||
private List<SgFormulaList> formulaList;
|
||||
private List<SgFormulaList> formulaList;
|
||||
|
||||
private List<SgFeedPlan> planList;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("formulaBatchId", getFormulaBatchId())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zhyc.module.feed.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -17,119 +18,138 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SgFeedPlan extends BaseEntity
|
||||
{
|
||||
public class SgFeedPlan extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 创建日期 */
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
private Date createDate;
|
||||
|
||||
/** 配方编码 */
|
||||
/**
|
||||
* 配方编码
|
||||
*/
|
||||
@Excel(name = "配方编码")
|
||||
private String formulaId;
|
||||
|
||||
/** 批号 */
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
@Excel(name = "批号")
|
||||
private String batchId;
|
||||
|
||||
/** 羊舍 */
|
||||
/**
|
||||
* 羊舍
|
||||
*/
|
||||
@Excel(name = "羊舍")
|
||||
private Integer sheepHouseId;
|
||||
|
||||
/** 羊只数量 */
|
||||
/**
|
||||
* 羊只数量
|
||||
*/
|
||||
@Excel(name = "羊只数量")
|
||||
private Integer sheepCount;
|
||||
|
||||
/** 日均计划量 */
|
||||
/**
|
||||
* 日均计划量
|
||||
*/
|
||||
@Excel(name = "日均计划量")
|
||||
private Double planDailySize;
|
||||
|
||||
/** 饲喂比例(早) */
|
||||
/**
|
||||
* 饲喂比例(早)
|
||||
*/
|
||||
@Excel(name = "饲喂比例(早)")
|
||||
private Double ratioMorning;
|
||||
|
||||
/** 饲喂比例(中) */
|
||||
/**
|
||||
* 饲喂比例(中)
|
||||
*/
|
||||
@Excel(name = "饲喂比例(中)")
|
||||
private Double ratioNoon;
|
||||
|
||||
/** 饲喂比例(下) */
|
||||
/**
|
||||
* 饲喂比例(下)
|
||||
*/
|
||||
@Excel(name = "饲喂比例(下)")
|
||||
private Double ratioAfternoon;
|
||||
|
||||
/** 计划量(早) */
|
||||
/**
|
||||
* 计划量(早)
|
||||
*/
|
||||
@Excel(name = "计划量(早)")
|
||||
private Double planMorningSize;
|
||||
|
||||
/** 计划总量(早) */
|
||||
/**
|
||||
* 计划总量(早)
|
||||
*/
|
||||
@Excel(name = "计划总量(早)")
|
||||
private Double planMorningTotal;
|
||||
|
||||
/** 实际量(早) */
|
||||
/**
|
||||
* 实际量(早)
|
||||
*/
|
||||
@Excel(name = "实际量(早)")
|
||||
private Double actualMorningSize;
|
||||
|
||||
/** 计划量(中) */
|
||||
/**
|
||||
* 计划量(中)
|
||||
*/
|
||||
@Excel(name = "计划量(中)")
|
||||
private Double planNoonSize;
|
||||
|
||||
/** 计划总量(中) */
|
||||
/**
|
||||
* 计划总量(中)
|
||||
*/
|
||||
@Excel(name = "计划总量(中)")
|
||||
private Double planNoonTotal;
|
||||
|
||||
/** 实际量(中) */
|
||||
/**
|
||||
* 实际量(中)
|
||||
*/
|
||||
@Excel(name = "实际量(中)")
|
||||
private Double actualNoonSize;
|
||||
|
||||
/** 计划量(下) */
|
||||
/**
|
||||
* 计划量(下)
|
||||
*/
|
||||
@Excel(name = "计划量(下)")
|
||||
private Double planAfternoonSize;
|
||||
|
||||
/** 计划总量(下) */
|
||||
/**
|
||||
* 计划总量(下)
|
||||
*/
|
||||
@Excel(name = "计划总量(下)")
|
||||
private Double planAfternoonTotal;
|
||||
|
||||
/** 实际量(下) */
|
||||
/**
|
||||
* 实际量(下)
|
||||
*/
|
||||
@Excel(name = "实际量(下)")
|
||||
private Double actualAfternoonSize;
|
||||
|
||||
/** 计划饲喂总量 */
|
||||
/**
|
||||
* 计划饲喂总量
|
||||
*/
|
||||
@Excel(name = "计划饲喂总量")
|
||||
private Double planFeedTotal;
|
||||
|
||||
/** 饲草班人员 */
|
||||
/**
|
||||
* 饲草班人员
|
||||
*/
|
||||
@Excel(name = "饲草班人员")
|
||||
private String zookeeper;
|
||||
|
||||
/** 饲喂计划日期 */
|
||||
/**
|
||||
* 饲喂计划日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "饲喂计划日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date planDate;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("createDate", getCreateDate())
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("batchId", getBatchId())
|
||||
.append("sheepHouseId", getSheepHouseId())
|
||||
.append("sheepCount", getSheepCount())
|
||||
.append("planDailySize", getPlanDailySize())
|
||||
.append("ratioMorning", getRatioMorning())
|
||||
.append("ratioNoon", getRatioNoon())
|
||||
.append("ratioAfternoon", getRatioAfternoon())
|
||||
.append("planMorningSize", getPlanMorningSize())
|
||||
.append("planMorningTotal", getPlanMorningTotal())
|
||||
.append("actualMorningSize", getActualMorningSize())
|
||||
.append("planNoonSize", getPlanNoonSize())
|
||||
.append("planNoonTotal", getPlanNoonTotal())
|
||||
.append("actualNoonSize", getActualNoonSize())
|
||||
.append("planAfternoonSize", getPlanAfternoonSize())
|
||||
.append("planAfternoonTotal", getPlanAfternoonTotal())
|
||||
.append("actualAfternoonSize", getActualAfternoonSize())
|
||||
.append("planFeedTotal", getPlanFeedTotal())
|
||||
.append("zookeeper", getZookeeper())
|
||||
.append("planDate", getPlanDate())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("createDate", getCreateDate()).append("formulaId", getFormulaId()).append("batchId", getBatchId()).append("sheepHouseId", getSheepHouseId()).append("sheepCount", getSheepCount()).append("planDailySize", getPlanDailySize()).append("ratioMorning", getRatioMorning()).append("ratioNoon", getRatioNoon()).append("ratioAfternoon", getRatioAfternoon()).append("planMorningSize", getPlanMorningSize()).append("planMorningTotal", getPlanMorningTotal()).append("actualMorningSize", getActualMorningSize()).append("planNoonSize", getPlanNoonSize()).append("planNoonTotal", getPlanNoonTotal()).append("actualNoonSize", getActualNoonSize()).append("planAfternoonSize", getPlanAfternoonSize()).append("planAfternoonTotal", getPlanAfternoonTotal()).append("actualAfternoonSize", getActualAfternoonSize()).append("planFeedTotal", getPlanFeedTotal()).append("zookeeper", getZookeeper()).append("planDate", getPlanDate()).append("remark", getRemark()).toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ import java.util.List;
|
||||
@Getter
|
||||
public class SgFeedStatistic extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* UUID
|
||||
*/
|
||||
|
||||
@@ -15,27 +15,39 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class SgFormulaList extends BaseEntity
|
||||
{
|
||||
public class SgFormulaList extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 序号 */
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Long code;
|
||||
|
||||
/** 配方编号 */
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
private String formulaId;
|
||||
|
||||
/** 配方编号 */
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
private String batchId;
|
||||
/** 原料编号 */
|
||||
/**
|
||||
* 原料编号
|
||||
*/
|
||||
@Excel(name = "原料编号")
|
||||
private String materialId;
|
||||
|
||||
/** 原料名称 */
|
||||
/**
|
||||
* 原料名称
|
||||
*/
|
||||
@Excel(name = "原料名称")
|
||||
private String materialName;
|
||||
|
||||
/** 比例 */
|
||||
/**
|
||||
* 比例
|
||||
*/
|
||||
@Excel(name = "比例")
|
||||
private Long ratio;
|
||||
|
||||
@@ -60,14 +72,14 @@ public class SgFormulaList extends BaseEntity
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("code", getCode())
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("materialId", getMaterialId())
|
||||
.append("materialName", getMaterialName())
|
||||
.append("ratio", getRatio())
|
||||
.append("isGranular", getIsGranular())
|
||||
.append("isSupplement", getIsSupplement())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("code", getCode())
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("materialId", getMaterialId())
|
||||
.append("materialName", getMaterialName())
|
||||
.append("ratio", getRatio())
|
||||
.append("isGranular", getIsGranular())
|
||||
.append("isSupplement", getIsSupplement())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,61 +19,81 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class SgFormulaManagement extends BaseEntity
|
||||
{
|
||||
public class SgFormulaManagement extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 配方编号 */
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 配方编号
|
||||
*/
|
||||
private String formulaId;
|
||||
|
||||
/** 饲养阶段 */
|
||||
/**
|
||||
* 饲养阶段
|
||||
*/
|
||||
@Excel(name = "饲养阶段")
|
||||
private String feedStage;
|
||||
|
||||
/** 批号 */
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
@Excel(name = "批号")
|
||||
private String batchId;
|
||||
|
||||
/** 开始使用时间 */
|
||||
/**
|
||||
* 开始使用时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开始使用时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date useStartDate;
|
||||
|
||||
/** 结束使用时间 */
|
||||
/**
|
||||
* 结束使用时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "结束使用时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date useEndDate;
|
||||
|
||||
/** 使用状态 */
|
||||
/**
|
||||
* 使用状态
|
||||
*/
|
||||
@Excel(name = "使用状态")
|
||||
private String useState;
|
||||
|
||||
/** 备注 */
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
/** 配方列表 */
|
||||
private List<SgFormulaList> sgFormulaList;
|
||||
/**
|
||||
* 配方列表
|
||||
*/
|
||||
private List<SgFormulaList> sgFormulaList;
|
||||
|
||||
/** 子配方 */
|
||||
/**
|
||||
* 子配方
|
||||
*/
|
||||
private List<SgFormulaManagement> subFormulaList;
|
||||
|
||||
/** 查询类型 *
|
||||
/**
|
||||
* 查询类型 *
|
||||
* Sub : 子配方查询
|
||||
* query : 类型查询
|
||||
* */
|
||||
*
|
||||
*/
|
||||
private String queryType;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("feedStage", getFeedStage())
|
||||
.append("batchId", getBatchId())
|
||||
.append("useStartDate", getUseStartDate())
|
||||
.append("useEndDate", getUseEndDate())
|
||||
.append("useState", getUseState())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("formulaId", getFormulaId())
|
||||
.append("feedStage", getFeedStage())
|
||||
.append("batchId", getBatchId())
|
||||
.append("useStartDate", getUseStartDate())
|
||||
.append("useEndDate", getUseEndDate())
|
||||
.append("useState", getUseState())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.feed.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
@@ -11,58 +12,55 @@ import com.zhyc.common.core.domain.BaseEntity;
|
||||
* @author HashMap
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public class SgMaterial extends BaseEntity
|
||||
{
|
||||
@Data
|
||||
public class SgMaterial extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 原料编码 */
|
||||
private Long userId;
|
||||
private Long deptId;
|
||||
/**
|
||||
* 原料编码
|
||||
*/
|
||||
@Excel(name = "原料编码")
|
||||
private String materialId;
|
||||
|
||||
/** 原料名称 */
|
||||
/**
|
||||
* 原料名称
|
||||
*/
|
||||
@Excel(name = "原料名称")
|
||||
private String materialName;
|
||||
|
||||
/** 颗粒料 */
|
||||
/**
|
||||
* 颗粒料
|
||||
*/
|
||||
@Excel(name = "颗粒料")
|
||||
private Integer isGranular;
|
||||
|
||||
public void setMaterialId(String materialId)
|
||||
{
|
||||
public void setMaterialId(String materialId) {
|
||||
this.materialId = materialId;
|
||||
}
|
||||
|
||||
public String getMaterialId()
|
||||
{
|
||||
public String getMaterialId() {
|
||||
return materialId;
|
||||
}
|
||||
|
||||
public void setMaterialName(String materialName)
|
||||
{
|
||||
public void setMaterialName(String materialName) {
|
||||
this.materialName = materialName;
|
||||
}
|
||||
|
||||
public String getMaterialName()
|
||||
{
|
||||
public String getMaterialName() {
|
||||
return materialName;
|
||||
}
|
||||
|
||||
public void setIsGranular(Integer isGranular)
|
||||
{
|
||||
public void setIsGranular(Integer isGranular) {
|
||||
this.isGranular = isGranular;
|
||||
}
|
||||
|
||||
public Integer getIsGranular()
|
||||
{
|
||||
public Integer getIsGranular() {
|
||||
return isGranular;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("materialId", getMaterialId())
|
||||
.append("materialName", getMaterialName())
|
||||
.append("isGranular", getIsGranular())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("materialId", getMaterialId()).append("materialName", getMaterialName()).append("isGranular", getIsGranular()).toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.feed.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.feed.domain.SgFeedPlan;
|
||||
import com.zhyc.module.feed.domain.SgFormulaManagement;
|
||||
import com.zhyc.module.feed.service.ISgFeedPlanService;
|
||||
@@ -56,6 +57,7 @@ public class SgFeedListServiceImpl implements ISgFeedListService {
|
||||
* @return 配料清单
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_feed_list_alias", userAlias = "sg_feed_list_alias")
|
||||
public List<SgFeedList> selectSgFeedListList(SgFeedList sgFeedList) {
|
||||
return sgFeedListMapper.selectSgFeedListList(sgFeedList);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.feed.service.impl;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.feed.mapper.SgFeedPlanMapper;
|
||||
import com.zhyc.module.feed.domain.SgFeedPlan;
|
||||
@@ -16,9 +17,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
{
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SgFeedPlanServiceImpl implements ISgFeedPlanService {
|
||||
private final SgFeedPlanMapper sgFeedPlanMapper;
|
||||
|
||||
public SgFeedPlanServiceImpl(SgFeedPlanMapper sgFeedPlanMapper) {
|
||||
@@ -32,8 +32,7 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 饲喂计划
|
||||
*/
|
||||
@Override
|
||||
public SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate)
|
||||
{
|
||||
public SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate) {
|
||||
return sgFeedPlanMapper.selectSgFeedPlanByCreateDate(createDate);
|
||||
}
|
||||
|
||||
@@ -44,8 +43,8 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 饲喂计划
|
||||
*/
|
||||
@Override
|
||||
public List<SgFeedPlan> selectSgFeedPlanList(SgFeedPlan sgFeedPlan)
|
||||
{
|
||||
@DataScope(deptAlias = "sg_feed_plan_alias", userAlias = "sg_feed_plan_alias")
|
||||
public List<SgFeedPlan> selectSgFeedPlanList(SgFeedPlan sgFeedPlan) {
|
||||
return sgFeedPlanMapper.selectSgFeedPlanList(sgFeedPlan);
|
||||
}
|
||||
|
||||
@@ -56,8 +55,7 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSgFeedPlan(SgFeedPlan sgFeedPlan)
|
||||
{
|
||||
public int insertSgFeedPlan(SgFeedPlan sgFeedPlan) {
|
||||
return sgFeedPlanMapper.insertSgFeedPlan(sgFeedPlan);
|
||||
}
|
||||
|
||||
@@ -68,8 +66,7 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSgFeedPlan(SgFeedPlan sgFeedPlan)
|
||||
{
|
||||
public int updateSgFeedPlan(SgFeedPlan sgFeedPlan) {
|
||||
return sgFeedPlanMapper.updateSgFeedPlan(sgFeedPlan);
|
||||
}
|
||||
|
||||
@@ -80,8 +77,7 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSgFeedPlanByCreateDates(Date[] createDates)
|
||||
{
|
||||
public int deleteSgFeedPlanByCreateDates(Date[] createDates) {
|
||||
return sgFeedPlanMapper.deleteSgFeedPlanByCreateDates(createDates);
|
||||
}
|
||||
|
||||
@@ -92,8 +88,7 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSgFeedPlanByCreateDate(Date createDate)
|
||||
{
|
||||
public int deleteSgFeedPlanByCreateDate(Date createDate) {
|
||||
return sgFeedPlanMapper.deleteSgFeedPlanByCreateDate(createDate);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zhyc.module.feed.service.impl;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.base.domain.DaSheepfold;
|
||||
import com.zhyc.module.feed.domain.SgFeedList;
|
||||
import com.zhyc.module.feed.domain.SgFeedPlan;
|
||||
@@ -51,6 +52,7 @@ public class SgFeedStatisticServiceImpl implements ISgFeedStatisticService {
|
||||
* @return 饲喂量统计
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_feed_statistic_alias", userAlias = "sg_feed_statistic_alias")
|
||||
public List<SgFeedStatistic> selectSgFeedStatisticList(SgFeedStatistic sgFeedStatistic) {
|
||||
return sgFeedStatisticMapper.selectSgFeedStatisticList(sgFeedStatistic);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.feed.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.feed.mapper.SgFormulaListMapper;
|
||||
import com.zhyc.module.feed.domain.SgFormulaList;
|
||||
@@ -41,6 +42,7 @@ public class SgFormulaListServiceImpl implements ISgFormulaListService {
|
||||
* @return 配方列表
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_formula_list_alias", userAlias = "sg_formula_list_alias")
|
||||
public List<SgFormulaList> selectSgFormulaListList(SgFormulaList sgFormulaList) {
|
||||
return sgFormulaListMapper.selectSgFormulaListList(sgFormulaList);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import com.zhyc.module.feed.domain.SgFormulaList;
|
||||
import com.zhyc.module.feed.mapper.SgFormulaListMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -46,6 +47,7 @@ public class SgFormulaManagementServiceImpl implements ISgFormulaManagementServi
|
||||
* @return 配方管理
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_formula_management_alias", userAlias = "sg_formula_management_alias")
|
||||
public List<SgFormulaManagement> selectSgFormulaManagementList(SgFormulaManagement sgFormulaManagement) {
|
||||
List<SgFormulaManagement> sgFormulaManagements =
|
||||
sgFormulaManagementMapper.selectSgFormulaManagementList(sgFormulaManagement);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhyc.module.feed.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.common.annotation.DataScope;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.feed.mapper.SgMaterialMapper;
|
||||
@@ -37,6 +38,7 @@ public class SgMaterialServiceImpl implements ISgMaterialService {
|
||||
* @return 原料
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "sg_material_alias", userAlias = "sg_material_alias")
|
||||
public List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial) {
|
||||
return sgMaterialMapper.selectSgMaterialList(sgMaterial);
|
||||
}
|
||||
|
||||
@@ -288,49 +288,6 @@ public class ScBreedRecordServiceImpl implements IScBreedRecordService
|
||||
return scBreedRecordMapper.selectBreedRecordByMatingTime(sheepId, startDate, endDate);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 新增配种记录
|
||||
// *
|
||||
// * @param scBreedRecord 配种记录
|
||||
// * @return 结果
|
||||
// */
|
||||
// @Override
|
||||
// public int insertScBreedRecord(ScBreedRecord scBreedRecord)
|
||||
// {
|
||||
// // 设置创建时间
|
||||
// scBreedRecord.setCreateTime(DateUtils.getNowDate());
|
||||
//
|
||||
// // 插入配种记录
|
||||
// int result = scBreedRecordMapper.insertScBreedRecord(scBreedRecord);
|
||||
//
|
||||
// // 如果插入成功,同步更新羊只的配种日期
|
||||
// if (result > 0 && scBreedRecord.getEweId() != null) {
|
||||
// try {
|
||||
// Long eweId = Long.parseLong(scBreedRecord.getEweId());
|
||||
//
|
||||
//// // 方案1:只更新配种日期(推荐)
|
||||
//// scBreedRecordMapper.updateSheepMatingDate(
|
||||
//// eweId,
|
||||
//// scBreedRecord.getCreateTime(),
|
||||
//// scBreedRecord.getCreateBy()
|
||||
//// );
|
||||
//
|
||||
//// 方案2:同时更新配种日期和配种次数(如果需要的话,取消下面注释)
|
||||
// scBreedRecordMapper.incrementSheepMatingCount(
|
||||
// eweId,
|
||||
// scBreedRecord.getCreateTime(),
|
||||
// scBreedRecord.getCreateBy()
|
||||
// );
|
||||
//
|
||||
// log.info("同步更新羊只 {} 的配种日期成功", eweId);
|
||||
// } catch (Exception e) {
|
||||
// log.error("同步更新羊只配种日期失败", e);
|
||||
// // 不影响主流程,只记录日志
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
/**
|
||||
* 新增配种记录
|
||||
*/
|
||||
|
||||
@@ -13,33 +13,93 @@
|
||||
<result property="rowNo" column="row_no"/>
|
||||
<result property="columns" column="columns"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<!-- 新增羊只数量映射 -->
|
||||
<result property="sheepCount" column="sheep_count"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础栏位表查询字段 -->
|
||||
<sql id="selectDaSheepfoldVo">
|
||||
select id,
|
||||
ranch_id,
|
||||
sheepfold_name,
|
||||
sheepfold_type_id,
|
||||
sheepfold_no,
|
||||
row_no,
|
||||
columns,
|
||||
comment
|
||||
from da_sheepfold
|
||||
|
||||
SELECT
|
||||
ds.id,
|
||||
ds.ranch_id,
|
||||
ds.sheepfold_name,
|
||||
ds.sheepfold_type_id,
|
||||
ds.sheepfold_no,
|
||||
ds.row_no,
|
||||
ds.columns,
|
||||
ds.comment
|
||||
FROM da_sheepfold ds
|
||||
</sql>
|
||||
|
||||
<select id="selectDaSheepfoldList" parameterType="DaSheepfold" resultMap="DaSheepfoldResult">
|
||||
<include refid="selectDaSheepfoldVo"/>
|
||||
<where>
|
||||
<if test="ranchId != null ">and ranch_id = #{ranchId}</if>
|
||||
<if test="sheepfoldTypeId != null ">and sheepfold_type_id = #{sheepfoldTypeId}</if>
|
||||
</where>
|
||||
|
||||
order by
|
||||
SUBSTRING_INDEX(row_no, '-', 1),
|
||||
CAST(columns AS UNSIGNED)
|
||||
<!-- 1. 主表格:羊舍级别汇总查询(统计每个羊舍的总羊数) -->
|
||||
<select id="selectDaSheepfoldSummaryList" parameterType="DaSheepfold" resultMap="DaSheepfoldSummaryResult">
|
||||
SELECT
|
||||
ds.ranch_id,
|
||||
ds.sheepfold_type_id,
|
||||
ds.sheepfold_no,
|
||||
-- 提取羊舍名称(截取栏位名称的羊舍部分,保证唯一)
|
||||
CONCAT(ds.sheepfold_no, '号', (SELECT dict_label FROM sys_dict_data WHERE dict_value = ds.sheepfold_type_id AND dict_type = 'bas_sheepfold_type')) as sheepfoldName,
|
||||
MAX(ds.comment) as comment,
|
||||
-- 汇总该羊舍下所有栏位的羊数总和
|
||||
SUM(IFNULL(sheep_group.sheep_count, 0)) as totalSheepCount
|
||||
FROM da_sheepfold ds
|
||||
-- 左关联羊只表,统计每个栏位的羊数
|
||||
LEFT JOIN (
|
||||
SELECT sheepfold_id, COUNT(id) as sheep_count
|
||||
FROM bas_sheep -- 羊只表
|
||||
GROUP BY sheepfold_id -- 按栏位ID分组统计羊数
|
||||
) sheep_group ON ds.id = sheep_group.sheepfold_id -- 关联字段修正为sheepfold_id
|
||||
<where>
|
||||
<if test="ranchId != null ">and ds.ranch_id = #{ranchId}</if>
|
||||
<if test="sheepfoldTypeId != null ">and ds.sheepfold_type_id = #{sheepfoldTypeId}</if>
|
||||
</where>
|
||||
-- 按羊舍维度分组(牧场+羊舍类型+羊舍编号 唯一标识一个羊舍)
|
||||
GROUP BY ds.ranch_id, ds.sheepfold_type_id, ds.sheepfold_no
|
||||
ORDER BY ds.sheepfold_no
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 2. 子表格:栏位级别明细查询(统计单个栏位的羊数) -->
|
||||
<select id="selectDaSheepfoldList" parameterType="DaSheepfold" resultMap="DaSheepfoldResult">
|
||||
SELECT
|
||||
ds.id,
|
||||
ds.ranch_id,
|
||||
ds.sheepfold_name,
|
||||
ds.sheepfold_type_id,
|
||||
ds.sheepfold_no,
|
||||
ds.row_no,
|
||||
ds.columns,
|
||||
ds.comment,
|
||||
-- 统计当前栏位的羊数(关联羊只表)
|
||||
IFNULL(sheep_group.sheep_count, 0) as sheep_count
|
||||
FROM da_sheepfold ds
|
||||
-- 左关联羊只表,避免无羊的栏位被过滤
|
||||
LEFT JOIN (
|
||||
SELECT sheepfold_id, COUNT(id) as sheep_count
|
||||
FROM bas_sheep -- 羊只表
|
||||
GROUP BY sheepfold_id
|
||||
) sheep_group ON ds.id = sheep_group.sheepfold_id -- 关联字段修正为sheepfold_id
|
||||
<where>
|
||||
<if test="ranchId != null ">and ds.ranch_id = #{ranchId}</if>
|
||||
<if test="sheepfoldTypeId != null ">and ds.sheepfold_type_id = #{sheepfoldTypeId}</if>
|
||||
<if test="sheepfoldNo != null and sheepfoldNo != '' ">and ds.sheepfold_no = #{sheepfoldNo}</if>
|
||||
</where>
|
||||
GROUP BY ds.id,ds.ranch_id,ds.sheepfold_name,ds.sheepfold_type_id,ds.sheepfold_no,ds.row_no,ds.columns,ds.comment
|
||||
ORDER BY SUBSTRING_INDEX(ds.row_no, '-', 1), CAST(ds.columns AS UNSIGNED)
|
||||
</select>
|
||||
|
||||
<!-- 汇总结果映射(主表格用) -->
|
||||
<resultMap id="DaSheepfoldSummaryResult" type="DaSheepfold">
|
||||
<result property="ranchId" column="ranch_id"/>
|
||||
<result property="sheepfoldTypeId" column="sheepfold_type_id"/>
|
||||
<result property="sheepfoldNo" column="sheepfold_no"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="totalSheepCount" column="totalSheepCount"/> <!-- 羊舍总羊数 -->
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectDaSheepfoldById" parameterType="Long" resultMap="DaSheepfoldResult">
|
||||
<include refid="selectDaSheepfoldVo"/>
|
||||
where id = #{id}
|
||||
|
||||
@@ -5,24 +5,28 @@
|
||||
<mapper namespace="com.zhyc.module.feed.mapper.SgFeedListMapper">
|
||||
|
||||
<resultMap type="SgFeedList" id="SgFeedListResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="formulaBatchId" column="formula_batch_id" />
|
||||
<result property="zookeeper" column="zookeeper" />
|
||||
<result property="deployDate" column="deploy_date" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="formulaId" column="formula_id"/>
|
||||
<result property="formulaBatchId" column="formula_batch_id"/>
|
||||
<result property="zookeeper" column="zookeeper"/>
|
||||
<result property="deployDate" column="deploy_date"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFeedListVo">
|
||||
select id, formula_id, formula_batch_id, zookeeper, deploy_date from sg_feed_list
|
||||
select id, formula_id, formula_batch_id, zookeeper, deploy_date
|
||||
from sg_feed_list sg_feed_list_alias
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFeedListList" parameterType="SgFeedList" resultMap="SgFeedListResult">
|
||||
<include refid="selectSgFeedListVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''"> and formula_batch_id LIKE CONCAT('%',#{formulaBatchId},'%')</if>
|
||||
<if test="zookeeper != null and zookeeper != ''"> and zookeeper LIKE CONCAT('%',#{zookeeper},'%')</if>
|
||||
<if test="deployDate != null "> and deploy_date = #{deployDate}</if>
|
||||
<if test="formulaId != null and formulaId != ''">and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''">and formula_batch_id LIKE
|
||||
CONCAT('%',#{formulaBatchId},'%')
|
||||
</if>
|
||||
<if test="zookeeper != null and zookeeper != ''">and zookeeper LIKE CONCAT('%',#{zookeeper},'%')</if>
|
||||
<if test="deployDate != null ">and deploy_date = #{deployDate}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY deploy_date ASC, formula_id ASC, formula_batch_id ASC
|
||||
</select>
|
||||
@@ -39,12 +43,16 @@
|
||||
<if test="formulaBatchId != null">formula_batch_id,</if>
|
||||
<if test="zookeeper != null">zookeeper,</if>
|
||||
<if test="deployDate != null">deploy_date,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="formulaId != null">#{formulaId},</if>
|
||||
<if test="formulaBatchId != null">#{formulaBatchId},</if>
|
||||
<if test="zookeeper != null">#{zookeeper},</if>
|
||||
<if test="deployDate != null">#{deployDate},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -60,7 +68,9 @@
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFeedListById" parameterType="Long">
|
||||
delete from sg_feed_list where id = #{id}
|
||||
delete
|
||||
from sg_feed_list
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFeedListByIds" parameterType="String">
|
||||
@@ -71,6 +81,7 @@
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAll">
|
||||
DELETE FROM sg_feed_list;
|
||||
DELETE
|
||||
FROM sg_feed_list;
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -30,16 +30,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFeedPlanVo">
|
||||
select create_date, formula_id, batch_id, sheep_house_id, sheep_count, plan_daily_size, ratio_morning, ratio_noon, ratio_afternoon, plan_morning_size, plan_morning_total, actual_morning_size, plan_noon_size, plan_noon_total, actual_noon_size, plan_afternoon_size, plan_afternoon_total, actual_afternoon_size, plan_feed_total, zookeeper, plan_date, remark from sg_feed_plan
|
||||
select create_date, formula_id, batch_id, sheep_house_id, sheep_count, plan_daily_size, ratio_morning, ratio_noon, ratio_afternoon, plan_morning_size, plan_morning_total, actual_morning_size, plan_noon_size, plan_noon_total, actual_noon_size, plan_afternoon_size, plan_afternoon_total, actual_afternoon_size, plan_feed_total, zookeeper, plan_date, remark from sg_feed_plan sg_feed_plan_alias
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFeedPlanList" parameterType="SgFeedPlan" resultMap="SgFeedPlanResult">
|
||||
<include refid="selectSgFeedPlanVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
|
||||
<if test="batchId != null and batchId != ''"> and batch_id LIKE CONCAT('%',#{batchId},'%')</if>
|
||||
<if test="sheepHouseId != null "> and sheep_house_id LIKE CONCAT('%',#{sheepHouseId},'%')</if>
|
||||
<if test="planDate != null "> and plan_date = #{planDate}</if>
|
||||
<if test="formulaId != null and formulaId != ''">and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
|
||||
<if test="batchId != null and batchId != ''">and batch_id LIKE CONCAT('%',#{batchId},'%')</if>
|
||||
<if test="sheepHouseId != null ">and sheep_house_id LIKE CONCAT('%',#{sheepHouseId},'%')</if>
|
||||
<if test="planDate != null ">and plan_date = #{planDate}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY plan_date ASC, formula_id ASC , batch_id ASC
|
||||
</select>
|
||||
@@ -74,7 +75,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="zookeeper != null">zookeeper,</if>
|
||||
<if test="planDate != null">plan_date,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="createDate != null">#{createDate},</if>
|
||||
<if test="formulaId != null and formulaId != ''">#{formulaId},</if>
|
||||
@@ -98,7 +101,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="zookeeper != null">#{zookeeper},</if>
|
||||
<if test="planDate != null">#{planDate},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFeedPlan" parameterType="SgFeedPlan">
|
||||
|
||||
@@ -1,39 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.feed.mapper.SgFeedStatisticMapper">
|
||||
|
||||
<resultMap type="SgFeedStatistic" id="SgFeedStatisticResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="formulaBatchId" column="formula_batch_id" />
|
||||
<result property="sheepFoldCount" column="sheep_fold_count" />
|
||||
<result property="silageLossRate" column="silage_loss_rate" />
|
||||
<result property="feedTotalSize" column="feed_total_size" />
|
||||
<result property="feedDailySize" column="feed_daily_size" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="formulaId" column="formula_id"/>
|
||||
<result property="formulaBatchId" column="formula_batch_id"/>
|
||||
<result property="sheepFoldCount" column="sheep_fold_count"/>
|
||||
<result property="silageLossRate" column="silage_loss_rate"/>
|
||||
<result property="feedTotalSize" column="feed_total_size"/>
|
||||
<result property="feedDailySize" column="feed_daily_size"/>
|
||||
<!--
|
||||
适配泛型TypeHandler
|
||||
弃用: XML中无法使用"<>"
|
||||
-->
|
||||
<!-- <result property="materialList" column="material_list"-->
|
||||
<!-- typeHandler="com.zhyc.module.feed.mapper.TypeHandler.JsonTypeHandler<java.util.List<com.zhyc.module.feed.domain.SgFormulaList>>" />-->
|
||||
<!-- <result property="materialList" column="material_list"-->
|
||||
<!-- typeHandler="com.zhyc.module.feed.mapper.TypeHandler.JsonTypeHandler<java.util.List<com.zhyc.module.feed.domain.SgFormulaList>>" />-->
|
||||
<!-- 分别使用两个TypeHandler完成实体类List<T> 到 数据库 JSON串的映射转换 -->
|
||||
<result property="materialList" column="material_list" typeHandler="com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler"/>
|
||||
<result property="sheepFoldList" column="sheep_fold_list" typeHandler="com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler"/>
|
||||
<result property="feedDate" column="feed_date" />
|
||||
<result property="materialList" column="material_list"
|
||||
typeHandler="com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler"/>
|
||||
<result property="sheepFoldList" column="sheep_fold_list"
|
||||
typeHandler="com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler"/>
|
||||
<result property="feedDate" column="feed_date"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFeedStatisticVo">
|
||||
select id, formula_id, formula_batch_id, sheep_fold_count, silage_loss_rate, feed_total_size, feed_daily_size, material_list, sheep_fold_list,feed_date from sg_feed_statistic
|
||||
select id,
|
||||
formula_id,
|
||||
formula_batch_id,
|
||||
sheep_fold_count,
|
||||
silage_loss_rate,
|
||||
feed_total_size,
|
||||
feed_daily_size,
|
||||
material_list,
|
||||
sheep_fold_list,
|
||||
feed_date
|
||||
from sg_feed_statistic sg_feed_statistic_alias
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFeedStatisticList" parameterType="SgFeedStatistic" resultMap="SgFeedStatisticResult">
|
||||
<include refid="selectSgFeedStatisticVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''"> and formula_batch_id = LIKE CONCAT('%',#{formulaBatchId},'%')</if>
|
||||
<if test="silageLossRate != null and silageLossRate != ''"> and silage_loss_rate = #{silageLossRate}</if>
|
||||
<if test="formulaId != null and formulaId != ''">and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''">and formula_batch_id = LIKE
|
||||
CONCAT('%',#{formulaBatchId},'%')
|
||||
</if>
|
||||
<if test="silageLossRate != null and silageLossRate != ''">and silage_loss_rate = #{silageLossRate}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -55,7 +70,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="materialList != null">material_list,</if>
|
||||
<if test="sheepFoldList != null">sheep_fold_list,</if>
|
||||
<if test="feedDate != null">feed_date,</if>
|
||||
</trim>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="formulaId != null and formulaId != ''">#{formulaId},</if>
|
||||
@@ -64,11 +81,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="silageLossRate != null">#{silageLossRate},</if>
|
||||
<if test="feedTotalSize != null">#{feedTotalSize},</if>
|
||||
<if test="feedDailySize != null">#{feedDailySize},</if>
|
||||
# 写入操作需要手动指定 TypeHandler 参数
|
||||
<if test="materialList != null">#{materialList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler},</if>
|
||||
<if test="sheepFoldList != null">#{sheepFoldList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler},</if>
|
||||
# 写入操作需要手动指定 TypeHandler 参数
|
||||
<if test="materialList != null">
|
||||
#{materialList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler},
|
||||
</if>
|
||||
<if test="sheepFoldList != null">
|
||||
#{sheepFoldList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler},
|
||||
</if>
|
||||
<if test="feedDate != null">#{feedDate},</if>
|
||||
</trim>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFeedStatistic" parameterType="SgFeedStatistic">
|
||||
@@ -80,15 +103,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="silageLossRate != null">silage_loss_rate = #{silageLossRate},</if>
|
||||
<if test="feedTotalSize != null">feed_total_size = #{feedTotalSize},</if>
|
||||
<if test="feedDailySize != null">feed_daily_size = #{feedDailySize},</if>
|
||||
<if test="materialList != null">material_list = #{materialList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler},</if>
|
||||
<if test="sheepFoldList != null">sheep_fold_list = #{sheepFoldList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler},</if>
|
||||
<if test="materialList != null">material_list =
|
||||
#{materialList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler},
|
||||
</if>
|
||||
<if test="sheepFoldList != null">sheep_fold_list =
|
||||
#{sheepFoldList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler},
|
||||
</if>
|
||||
<if test="feedDate != null">feed_date = #{feedDate},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFeedStatisticById" parameterType="String">
|
||||
delete from sg_feed_statistic where id = #{id}
|
||||
delete
|
||||
from sg_feed_statistic
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFeedStatisticByIds" parameterType="String">
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.feed.mapper.SgFormulaListMapper">
|
||||
|
||||
<resultMap type="SgFormulaList" id="SgFormulaListResult">
|
||||
<result property="code" column="code" />
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="batchId" column="batch_id" />
|
||||
<result property="materialId" column="material_id" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="ratio" column="ratio" />
|
||||
<result property="isGranular" column="is_granular" />
|
||||
<result property="isSupplement" column="is_supplement" />
|
||||
<result property="code" column="code"/>
|
||||
<result property="formulaId" column="formula_id"/>
|
||||
<result property="batchId" column="batch_id"/>
|
||||
<result property="materialId" column="material_id"/>
|
||||
<result property="materialName" column="material_name"/>
|
||||
<result property="ratio" column="ratio"/>
|
||||
<result property="isGranular" column="is_granular"/>
|
||||
<result property="isSupplement" column="is_supplement"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFormulaListVo">
|
||||
select code, formula_id, material_id, material_name, ratio, is_granular, is_supplement from sg_formula_list
|
||||
select code, formula_id, material_id, material_name, ratio, is_granular, is_supplement
|
||||
from sg_formula_list sg_formula_list_alias
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFormulaListList" parameterType="SgFormulaList" resultMap="SgFormulaListResult">
|
||||
@@ -24,7 +25,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
<if test="materialId != null and materialId != ''">material_id LIKE CONCAT('%',#{materialId},'%')</if>
|
||||
<if test="formulaId != null and formulaId != ''">and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
|
||||
<if test="batchId != null and batchId != ''"> and batch_id LIKE CONCAT('%',#{batchId},'%')</if>
|
||||
<if test="batchId != null and batchId != ''">and batch_id LIKE CONCAT('%',#{batchId},'%')</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -44,7 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="ratio != null">ratio,</if>
|
||||
<if test="isGranular != null">is_granular,</if>
|
||||
<if test="isSupplement != null">is_supplement,</if>
|
||||
</trim>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="formulaId != null">#{formulaId},</if>
|
||||
@@ -54,7 +58,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="ratio != null">#{ratio},</if>
|
||||
<if test="isGranular != null">#{isGranular},</if>
|
||||
<if test="isSupplement != null">#{isSupplement},</if>
|
||||
</trim>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFormulaList" parameterType="SgFormulaList">
|
||||
@@ -71,7 +77,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFormulaListByCode" parameterType="Long">
|
||||
delete from sg_formula_list where code = #{code}
|
||||
delete
|
||||
from sg_formula_list
|
||||
where code = #{code}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFormulaListByCodes" parameterType="String">
|
||||
@@ -82,6 +90,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFormulaListByFormulaIdAndBatchId" parameterType="SgFormulaList">
|
||||
DELETE FROM sg_formula_list WHERE formula_id = #{formulaId} AND batch_id = #{batchId}
|
||||
DELETE
|
||||
FROM sg_formula_list
|
||||
WHERE formula_id = #{formulaId}
|
||||
AND batch_id = #{batchId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -1,29 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.feed.mapper.SgFormulaManagementMapper">
|
||||
|
||||
<resultMap type="SgFormulaManagement" id="SgFormulaManagementResult">
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="feedStage" column="feed_stage" />
|
||||
<result property="batchId" column="batch_id" />
|
||||
<result property="useStartDate" column="use_start_date" />
|
||||
<result property="useEndDate" column="use_end_date" />
|
||||
<result property="useState" column="use_state" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="formulaId" column="formula_id"/>
|
||||
<result property="feedStage" column="feed_stage"/>
|
||||
<result property="batchId" column="batch_id"/>
|
||||
<result property="useStartDate" column="use_start_date"/>
|
||||
<result property="useEndDate" column="use_end_date"/>
|
||||
<result property="useState" column="use_state"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFormulaManagementVo">
|
||||
select formula_id, feed_stage, batch_id, use_start_date, use_end_date, use_state, remark from sg_formula_management
|
||||
select formula_id, feed_stage, batch_id, use_start_date, use_end_date, use_state, remark
|
||||
from sg_formula_management sg_formula_management_alias
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFormulaManagementList" parameterType="SgFormulaManagement" resultMap="SgFormulaManagementResult">
|
||||
<select id="selectSgFormulaManagementList" parameterType="SgFormulaManagement"
|
||||
resultMap="SgFormulaManagementResult">
|
||||
<include refid="selectSgFormulaManagementVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
|
||||
<if test="feedStage != null and feedStage != ''"> and feed_stage LIKE CONCAT('%',#{feedStage},'%')</if>
|
||||
<if test="batchId != null and batchId != ''"> and batch_id LIKE CONCAT('%',#{batchId},'%')</if>
|
||||
<if test="formulaId != null and formulaId != ''">and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
|
||||
<if test="feedStage != null and feedStage != ''">and feed_stage LIKE CONCAT('%',#{feedStage},'%')</if>
|
||||
<if test="batchId != null and batchId != ''">and batch_id LIKE CONCAT('%',#{batchId},'%')</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -42,7 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="useEndDate != null">use_end_date,</if>
|
||||
<if test="useState != null">use_state,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="formulaId != null and formulaId != ''">#{formulaId},</if>
|
||||
<if test="feedStage != null and feedStage != ''">#{feedStage},</if>
|
||||
@@ -51,7 +56,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="useEndDate != null">#{useEndDate},</if>
|
||||
<if test="useState != null">#{useState},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFormulaManagement" parameterType="SgFormulaManagement">
|
||||
@@ -67,7 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFormulaManagementByFormulaId" parameterType="String">
|
||||
delete from sg_formula_management where formula_id = #{formulaId}
|
||||
delete
|
||||
from sg_formula_management
|
||||
where formula_id = #{formulaId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFormulaManagementByFormulaIds" parameterType="String">
|
||||
@@ -77,6 +86,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteSgFormulaManagement" parameterType="SgFormulaManagement">
|
||||
delete from sg_formula_management where formula_id = #{formulaId} and batch_id = #{batchId}
|
||||
delete
|
||||
from sg_formula_management
|
||||
where formula_id = #{formulaId}
|
||||
and batch_id = #{batchId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -1,25 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.feed.mapper.SgMaterialMapper">
|
||||
|
||||
<resultMap type="SgMaterial" id="SgMaterialResult">
|
||||
<result property="materialId" column="material_id" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="isGranular" column="is_granular" />
|
||||
<result property="materialId" column="material_id"/>
|
||||
<result property="materialName" column="material_name"/>
|
||||
<result property="isGranular" column="is_granular"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgMaterialVo">
|
||||
select material_id, material_name, is_granular from sg_material
|
||||
select material_id, material_name, is_granular
|
||||
from sg_material sg_material_alias
|
||||
</sql>
|
||||
|
||||
<select id="selectSgMaterialList" parameterType="SgMaterial" resultMap="SgMaterialResult">
|
||||
<include refid="selectSgMaterialVo"/>
|
||||
<where>
|
||||
<if test="materialId != null and materialId != ''"> and material_id LIKE CONCAT('%',#{materialId},'%')</if>
|
||||
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
|
||||
<if test="isGranular != null "> and is_granular = #{isGranular}</if>
|
||||
<if test="materialId != null and materialId != ''">and material_id LIKE CONCAT('%',#{materialId},'%')</if>
|
||||
<if test="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},
|
||||
'%')
|
||||
</if>
|
||||
<if test="isGranular != null ">and is_granular = #{isGranular}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -34,12 +38,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="materialId != null and materialId != ''">material_id,</if>
|
||||
<if test="materialName != null and materialName != ''">material_name,</if>
|
||||
<if test="isGranular != null">is_granular,</if>
|
||||
</trim>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="materialId != null and materialId != ''">#{materialId},</if>
|
||||
<if test="materialName != null and materialName != ''">#{materialName},</if>
|
||||
<if test="isGranular != null">#{isGranular},</if>
|
||||
</trim>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgMaterial" parameterType="SgMaterial">
|
||||
@@ -52,7 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgMaterialByMaterialId" parameterType="String">
|
||||
delete from sg_material where material_id = #{materialId}
|
||||
delete
|
||||
from sg_material
|
||||
where material_id = #{materialId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgMaterialByMaterialIds" parameterType="String">
|
||||
|
||||
Reference in New Issue
Block a user