Compare commits

...

3 Commits

Author SHA1 Message Date
4ab62cd1f2 fix(produce/breed): 接口未实现 | 合并错误
produce模块中未实现接口问题(仅使用默认实现代替)
2026-02-02 12:31:08 +08:00
5a2f59b02d fix(produce/breed): 接口未实现
produce模块中未实现接口问题(仅使用默认实现代替)
2026-02-01 21:52:14 +08:00
40fc60ddc9 refactor(feed/all): 数据库增加字段支持
为数据库中新增的`user_id` `dept_id` 提供结构支持
[重构依据](https://www.yuque.com/piaobo-igrka/xvqmhp/ofcoxh57lywwubgy?singleDoc#)

BREAKING CHANGE: 可能产生隐性数据一致性问题
可能导致某些业务逻辑出现问题
2026-02-01 21:49:42 +08:00
25 changed files with 421 additions and 314 deletions

View File

@@ -109,6 +109,8 @@ public class SgFeedListController extends BaseController {
@Log(title = "配料清单", businessType = BusinessType.INSERT) @Log(title = "配料清单", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SgFeedList sgFeedList) { public AjaxResult add(@RequestBody SgFeedList sgFeedList) {
sgFeedList.setDeptId(getDeptId());
sgFeedList.setUserId(getUserId());
return toAjax(sgFeedListService.insertSgFeedList(sgFeedList)); return toAjax(sgFeedListService.insertSgFeedList(sgFeedList));
} }

View File

@@ -79,6 +79,8 @@ public class SgFeedPlanController extends BaseController {
if (null == sgFeedPlan) { if (null == sgFeedPlan) {
throw new RuntimeException("数据为空"); throw new RuntimeException("数据为空");
} }
sgFeedPlan.setDeptId(getDeptId());
sgFeedPlan.setUserId(getUserId());
sgFeedPlan.setCreateDate(new Date()); sgFeedPlan.setCreateDate(new Date());
// 计算其他字段值 // 计算其他字段值
setPlan(sgFeedPlan); setPlan(sgFeedPlan);

View File

@@ -84,6 +84,8 @@ public class SgFeedStatisticController extends BaseController {
if (null == sgFeedStatistic.getFormulaId() && null == sgFeedStatistic.getFormulaBatchId()) { if (null == sgFeedStatistic.getFormulaId() && null == sgFeedStatistic.getFormulaBatchId()) {
throw new RuntimeException("ERROR: 数据为空"); throw new RuntimeException("ERROR: 数据为空");
} }
sgFeedStatistic.setUserId(getUserId());
sgFeedStatistic.setDeptId(getDeptId());
List<SgFeedStatistic> isExist = sgFeedStatisticService.selectSgFeedStatisticList(sgFeedStatistic); List<SgFeedStatistic> isExist = sgFeedStatisticService.selectSgFeedStatisticList(sgFeedStatistic);
if (null != isExist && !isExist.isEmpty()) { if (null != isExist && !isExist.isEmpty()) {
throw new RuntimeException("WARNING: 数据重复"); throw new RuntimeException("WARNING: 数据重复");

View File

@@ -79,6 +79,8 @@ public class SgFormulaListController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SgFormulaList sgFormulaList) public AjaxResult add(@RequestBody SgFormulaList sgFormulaList)
{ {
sgFormulaList.setUserId(getUserId());
sgFormulaList.setDeptId(getDeptId());
return toAjax(sgFormulaListService.insertSgFormulaList(sgFormulaList)); return toAjax(sgFormulaListService.insertSgFormulaList(sgFormulaList));
} }

View File

@@ -95,6 +95,8 @@ public class SgFormulaManagementController extends BaseController {
public AjaxResult add(@RequestBody SgFormulaManagement sgFormulaManagement) { public AjaxResult add(@RequestBody SgFormulaManagement sgFormulaManagement) {
if (null == sgFormulaManagement) if (null == sgFormulaManagement)
throw new RuntimeException("ERROR: 数据为空"); throw new RuntimeException("ERROR: 数据为空");
sgFormulaManagement.setUserId(getUserId());
sgFormulaManagement.setDeptId(getDeptId());
if (Objects.equals(sgFormulaManagement.getBatchId(), "0")) { if (Objects.equals(sgFormulaManagement.getBatchId(), "0")) {
SgFormulaManagement exist = sgFormulaManagementService.selectSgFormulaManagementByFormulaId(sgFormulaManagement.getFormulaId()); SgFormulaManagement exist = sgFormulaManagementService.selectSgFormulaManagementByFormulaId(sgFormulaManagement.getFormulaId());
if (exist != null) { if (exist != null) {

View File

@@ -2,6 +2,7 @@ package com.zhyc.module.feed.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@@ -23,14 +24,13 @@ import com.zhyc.common.core.page.TableDataInfo;
/** /**
* 原料Controller * 原料Controller
* *
* @author HashMap * @author HashMap
* @date 2026-01-16 * @date 2026-01-16
*/ */
@RestController @RestController
@RequestMapping("/feed/material") @RequestMapping("/feed/material")
public class SgMaterialController extends BaseController public class SgMaterialController extends BaseController {
{
@Autowired @Autowired
private ISgMaterialService sgMaterialService; private ISgMaterialService sgMaterialService;
@@ -39,8 +39,7 @@ public class SgMaterialController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('feed:material:list')") @PreAuthorize("@ss.hasPermi('feed:material:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SgMaterial sgMaterial) public TableDataInfo list(SgMaterial sgMaterial) {
{
startPage(); startPage();
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial); List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
return getDataTable(list); return getDataTable(list);
@@ -52,8 +51,7 @@ public class SgMaterialController extends BaseController
@PreAuthorize("@ss.hasPermi('feed:material:export')") @PreAuthorize("@ss.hasPermi('feed:material:export')")
@Log(title = "原料", businessType = BusinessType.EXPORT) @Log(title = "原料", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, SgMaterial sgMaterial) public void export(HttpServletResponse response, SgMaterial sgMaterial) {
{
List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial); List<SgMaterial> list = sgMaterialService.selectSgMaterialList(sgMaterial);
ExcelUtil<SgMaterial> util = new ExcelUtil<SgMaterial>(SgMaterial.class); ExcelUtil<SgMaterial> util = new ExcelUtil<SgMaterial>(SgMaterial.class);
util.exportExcel(response, list, "原料数据"); util.exportExcel(response, list, "原料数据");
@@ -64,8 +62,7 @@ public class SgMaterialController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('feed:material:query')") @PreAuthorize("@ss.hasPermi('feed:material:query')")
@GetMapping(value = "/{materialId}") @GetMapping(value = "/{materialId}")
public AjaxResult getInfo(@PathVariable("materialId") String materialId) public AjaxResult getInfo(@PathVariable("materialId") String materialId) {
{
return success(sgMaterialService.selectSgMaterialByMaterialId(materialId)); return success(sgMaterialService.selectSgMaterialByMaterialId(materialId));
} }
@@ -75,8 +72,9 @@ public class SgMaterialController extends BaseController
@PreAuthorize("@ss.hasPermi('feed:material:add')") @PreAuthorize("@ss.hasPermi('feed:material:add')")
@Log(title = "原料", businessType = BusinessType.INSERT) @Log(title = "原料", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SgMaterial sgMaterial) public AjaxResult add(@RequestBody SgMaterial sgMaterial) {
{ sgMaterial.setUserId(getUserId());
sgMaterial.setDeptId(getDeptId());
return toAjax(sgMaterialService.insertSgMaterial(sgMaterial)); return toAjax(sgMaterialService.insertSgMaterial(sgMaterial));
} }
@@ -86,8 +84,7 @@ public class SgMaterialController extends BaseController
@PreAuthorize("@ss.hasPermi('feed:material:edit')") @PreAuthorize("@ss.hasPermi('feed:material:edit')")
@Log(title = "原料", businessType = BusinessType.UPDATE) @Log(title = "原料", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody SgMaterial sgMaterial) public AjaxResult edit(@RequestBody SgMaterial sgMaterial) {
{
return toAjax(sgMaterialService.updateSgMaterial(sgMaterial)); return toAjax(sgMaterialService.updateSgMaterial(sgMaterial));
} }
@@ -96,9 +93,8 @@ public class SgMaterialController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('feed:material:remove')") @PreAuthorize("@ss.hasPermi('feed:material:remove')")
@Log(title = "原料", businessType = BusinessType.DELETE) @Log(title = "原料", businessType = BusinessType.DELETE)
@DeleteMapping("/{materialIds}") @DeleteMapping("/{materialIds}")
public AjaxResult remove(@PathVariable String[] materialIds) public AjaxResult remove(@PathVariable String[] materialIds) {
{
return toAjax(sgMaterialService.deleteSgMaterialByMaterialIds(materialIds)); return toAjax(sgMaterialService.deleteSgMaterialByMaterialIds(materialIds));
} }
} }

View File

@@ -19,26 +19,36 @@ import com.zhyc.common.core.domain.BaseEntity;
*/ */
@Setter @Setter
@Getter @Getter
public class SgFeedList extends BaseEntity public class SgFeedList extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long userId;
/** 序号 */ private Long deptId;
/**
* 序号
*/
private Long id; private Long id;
/** 配方编号 */ /**
* 配方编号
*/
@Excel(name = "配方编号") @Excel(name = "配方编号")
private String formulaId; private String formulaId;
/** 配方批号 */ /**
* 配方批号
*/
@Excel(name = "配方批号") @Excel(name = "配方批号")
private String formulaBatchId; private String formulaBatchId;
/** 饲草班人员 */ /**
* 饲草班人员
*/
@Excel(name = "饲草班人员") @Excel(name = "饲草班人员")
private String zookeeper; private String zookeeper;
/** 配料日期 */ /**
* 配料日期
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "配料日期", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "配料日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date deployDate; private Date deployDate;
@@ -51,14 +61,14 @@ public class SgFeedList extends BaseEntity
private Double noonTotal; private Double noonTotal;
private Double afternoonTotal; private Double afternoonTotal;
private List<SgFormulaList> formulaList; private List<SgFormulaList> formulaList;
private List<SgFeedPlan> planList; private List<SgFeedPlan> planList;
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("formulaId", getFormulaId()) .append("formulaId", getFormulaId())
.append("formulaBatchId", getFormulaBatchId()) .append("formulaBatchId", getFormulaBatchId())

View File

@@ -1,6 +1,7 @@
package com.zhyc.module.feed.domain; package com.zhyc.module.feed.domain;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@@ -11,125 +12,144 @@ import com.zhyc.common.core.domain.BaseEntity;
/** /**
* 饲喂计划对象 sg_feed_plan * 饲喂计划对象 sg_feed_plan
* *
* @author HashMap * @author HashMap
* @date 2025-08-14 * @date 2025-08-14
*/ */
@Getter @Getter
@Setter @Setter
public class SgFeedPlan extends BaseEntity public class SgFeedPlan extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long userId;
/** 创建日期 */ private Long deptId;
/**
* 创建日期
*/
private Date createDate; private Date createDate;
/** 配方编码 */ /**
* 配方编码
*/
@Excel(name = "配方编码") @Excel(name = "配方编码")
private String formulaId; private String formulaId;
/** 批号 */ /**
* 批号
*/
@Excel(name = "批号") @Excel(name = "批号")
private String batchId; private String batchId;
/** 羊舍 */ /**
* 羊舍
*/
@Excel(name = "羊舍") @Excel(name = "羊舍")
private Integer sheepHouseId; private Integer sheepHouseId;
/** 羊只数量 */ /**
* 羊只数量
*/
@Excel(name = "羊只数量") @Excel(name = "羊只数量")
private Integer sheepCount; private Integer sheepCount;
/** 日均计划量 */ /**
* 日均计划量
*/
@Excel(name = "日均计划量") @Excel(name = "日均计划量")
private Double planDailySize; private Double planDailySize;
/** 饲喂比例(早) */ /**
* 饲喂比例(早)
*/
@Excel(name = "饲喂比例(早)") @Excel(name = "饲喂比例(早)")
private Double ratioMorning; private Double ratioMorning;
/** 饲喂比例(中) */ /**
* 饲喂比例(中)
*/
@Excel(name = "饲喂比例(中)") @Excel(name = "饲喂比例(中)")
private Double ratioNoon; private Double ratioNoon;
/** 饲喂比例(下) */ /**
* 饲喂比例(下)
*/
@Excel(name = "饲喂比例(下)") @Excel(name = "饲喂比例(下)")
private Double ratioAfternoon; private Double ratioAfternoon;
/** 计划量(早) */ /**
* 计划量(早)
*/
@Excel(name = "计划量(早)") @Excel(name = "计划量(早)")
private Double planMorningSize; private Double planMorningSize;
/** 计划总量(早) */ /**
* 计划总量(早)
*/
@Excel(name = "计划总量(早)") @Excel(name = "计划总量(早)")
private Double planMorningTotal; private Double planMorningTotal;
/** 实际量(早) */ /**
* 实际量(早)
*/
@Excel(name = "实际量(早)") @Excel(name = "实际量(早)")
private Double actualMorningSize; private Double actualMorningSize;
/** 计划量(中) */ /**
* 计划量(中)
*/
@Excel(name = "计划量(中)") @Excel(name = "计划量(中)")
private Double planNoonSize; private Double planNoonSize;
/** 计划总量(中) */ /**
* 计划总量(中)
*/
@Excel(name = "计划总量(中)") @Excel(name = "计划总量(中)")
private Double planNoonTotal; private Double planNoonTotal;
/** 实际量(中) */ /**
* 实际量(中)
*/
@Excel(name = "实际量(中)") @Excel(name = "实际量(中)")
private Double actualNoonSize; private Double actualNoonSize;
/** 计划量(下) */ /**
* 计划量(下)
*/
@Excel(name = "计划量(下)") @Excel(name = "计划量(下)")
private Double planAfternoonSize; private Double planAfternoonSize;
/** 计划总量(下) */ /**
* 计划总量(下)
*/
@Excel(name = "计划总量(下)") @Excel(name = "计划总量(下)")
private Double planAfternoonTotal; private Double planAfternoonTotal;
/** 实际量(下) */ /**
* 实际量(下)
*/
@Excel(name = "实际量(下)") @Excel(name = "实际量(下)")
private Double actualAfternoonSize; private Double actualAfternoonSize;
/** 计划饲喂总量 */ /**
* 计划饲喂总量
*/
@Excel(name = "计划饲喂总量") @Excel(name = "计划饲喂总量")
private Double planFeedTotal; private Double planFeedTotal;
/** 饲草班人员 */ /**
* 饲草班人员
*/
@Excel(name = "饲草班人员") @Excel(name = "饲草班人员")
private String zookeeper; private String zookeeper;
/** 饲喂计划日期 */ /**
* 饲喂计划日期
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "饲喂计划日期", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "饲喂计划日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date planDate; private Date planDate;
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 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();
.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();
} }
} }

View File

@@ -23,7 +23,8 @@ import java.util.List;
@Getter @Getter
public class SgFeedStatistic extends BaseEntity { public class SgFeedStatistic extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long userId;
private Long deptId;
/** /**
* UUID * UUID
*/ */

View File

@@ -9,33 +9,45 @@ import com.zhyc.common.core.domain.BaseEntity;
/** /**
* 配方列表对象 sg_formula_list * 配方列表对象 sg_formula_list
* *
* @author HashMap * @author HashMap
* @date 2025-08-09 * @date 2025-08-09
*/ */
@Setter @Setter
@Getter @Getter
public class SgFormulaList extends BaseEntity public class SgFormulaList extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long userId;
/** 序号 */ private Long deptId;
/**
* 序号
*/
private Long code; private Long code;
/** 配方编号 */ /**
* 配方编号
*/
private String formulaId; private String formulaId;
/** 配方编号 */ /**
* 配方编号
*/
private String batchId; private String batchId;
/** 原料编号 */ /**
* 原料编号
*/
@Excel(name = "原料编号") @Excel(name = "原料编号")
private String materialId; private String materialId;
/** 原料名称 */ /**
* 原料名称
*/
@Excel(name = "原料名称") @Excel(name = "原料名称")
private String materialName; private String materialName;
/** 比例 */ /**
* 比例
*/
@Excel(name = "比例") @Excel(name = "比例")
private Long ratio; private Long ratio;
@@ -60,14 +72,14 @@ public class SgFormulaList extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("code", getCode()) .append("code", getCode())
.append("formulaId", getFormulaId()) .append("formulaId", getFormulaId())
.append("materialId", getMaterialId()) .append("materialId", getMaterialId())
.append("materialName", getMaterialName()) .append("materialName", getMaterialName())
.append("ratio", getRatio()) .append("ratio", getRatio())
.append("isGranular", getIsGranular()) .append("isGranular", getIsGranular())
.append("isSupplement", getIsSupplement()) .append("isSupplement", getIsSupplement())
.toString(); .toString();
} }
} }

View File

@@ -13,67 +13,87 @@ import com.zhyc.common.core.domain.BaseEntity;
/** /**
* 配方管理对象 sg_formula_management * 配方管理对象 sg_formula_management
* *
* @author HashMap * @author HashMap
* @date 2025-08-09 * @date 2025-08-09
*/ */
@Setter @Setter
@Getter @Getter
public class SgFormulaManagement extends BaseEntity public class SgFormulaManagement extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long userId;
/** 配方编号 */ private Long deptId;
/**
* 配方编号
*/
private String formulaId; private String formulaId;
/** 饲养阶段 */ /**
* 饲养阶段
*/
@Excel(name = "饲养阶段") @Excel(name = "饲养阶段")
private String feedStage; private String feedStage;
/** 批号 */ /**
* 批号
*/
@Excel(name = "批号") @Excel(name = "批号")
private String batchId; private String batchId;
/** 开始使用时间 */ /**
* 开始使用时间
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始使用时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "开始使用时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date useStartDate; private Date useStartDate;
/** 结束使用时间 */ /**
* 结束使用时间
*/
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束使用时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "结束使用时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date useEndDate; private Date useEndDate;
/** 使用状态 */ /**
* 使用状态
*/
@Excel(name = "使用状态") @Excel(name = "使用状态")
private String useState; private String useState;
/** 备注 */ /**
* 备注
*/
@Excel(name = "备注") @Excel(name = "备注")
private String remark; private String remark;
/** 配方列表 */ /**
private List<SgFormulaList> sgFormulaList; * 配方列表
*/
private List<SgFormulaList> sgFormulaList;
/** 子配方 */ /**
* 子配方
*/
private List<SgFormulaManagement> subFormulaList; private List<SgFormulaManagement> subFormulaList;
/** 查询类型 * /**
* 查询类型 *
* Sub : 子配方查询 * Sub : 子配方查询
* query : 类型查询 * query : 类型查询
* */ *
*/
private String queryType; private String queryType;
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("formulaId", getFormulaId()) .append("formulaId", getFormulaId())
.append("feedStage", getFeedStage()) .append("feedStage", getFeedStage())
.append("batchId", getBatchId()) .append("batchId", getBatchId())
.append("useStartDate", getUseStartDate()) .append("useStartDate", getUseStartDate())
.append("useEndDate", getUseEndDate()) .append("useEndDate", getUseEndDate())
.append("useState", getUseState()) .append("useState", getUseState())
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }

View File

@@ -1,5 +1,6 @@
package com.zhyc.module.feed.domain; package com.zhyc.module.feed.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
@@ -7,62 +8,59 @@ import com.zhyc.common.core.domain.BaseEntity;
/** /**
* 原料对象 sg_material * 原料对象 sg_material
* *
* @author HashMap * @author HashMap
* @date 2026-01-16 * @date 2026-01-16
*/ */
public class SgMaterial extends BaseEntity @Data
{ public class SgMaterial extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long userId;
/** 原料编码 */ private Long deptId;
/**
* 原料编码
*/
@Excel(name = "原料编码") @Excel(name = "原料编码")
private String materialId; private String materialId;
/** 原料名称 */ /**
* 原料名称
*/
@Excel(name = "原料名称") @Excel(name = "原料名称")
private String materialName; private String materialName;
/** 颗粒料 */ /**
* 颗粒料
*/
@Excel(name = "颗粒料") @Excel(name = "颗粒料")
private Integer isGranular; private Integer isGranular;
public void setMaterialId(String materialId) public void setMaterialId(String materialId) {
{
this.materialId = materialId; this.materialId = materialId;
} }
public String getMaterialId() public String getMaterialId() {
{
return materialId; return materialId;
} }
public void setMaterialName(String materialName) public void setMaterialName(String materialName) {
{
this.materialName = materialName; this.materialName = materialName;
} }
public String getMaterialName() public String getMaterialName() {
{
return materialName; return materialName;
} }
public void setIsGranular(Integer isGranular) public void setIsGranular(Integer isGranular) {
{
this.isGranular = isGranular; this.isGranular = isGranular;
} }
public Integer getIsGranular() public Integer getIsGranular() {
{
return isGranular; return isGranular;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("materialId", getMaterialId()).append("materialName", getMaterialName()).append("isGranular", getIsGranular()).toString();
.append("materialId", getMaterialId())
.append("materialName", getMaterialName())
.append("isGranular", getIsGranular())
.toString();
} }
} }

View File

@@ -2,6 +2,7 @@ package com.zhyc.module.feed.service.impl;
import java.util.*; import java.util.*;
import com.zhyc.common.annotation.DataScope;
import com.zhyc.module.feed.domain.SgFeedPlan; import com.zhyc.module.feed.domain.SgFeedPlan;
import com.zhyc.module.feed.domain.SgFormulaManagement; import com.zhyc.module.feed.domain.SgFormulaManagement;
import com.zhyc.module.feed.service.ISgFeedPlanService; import com.zhyc.module.feed.service.ISgFeedPlanService;
@@ -56,6 +57,7 @@ public class SgFeedListServiceImpl implements ISgFeedListService {
* @return 配料清单 * @return 配料清单
*/ */
@Override @Override
@DataScope(deptAlias = "sg_feed_list_alias", userAlias = "sg_feed_list_alias")
public List<SgFeedList> selectSgFeedListList(SgFeedList sgFeedList) { public List<SgFeedList> selectSgFeedListList(SgFeedList sgFeedList) {
return sgFeedListMapper.selectSgFeedListList(sgFeedList); return sgFeedListMapper.selectSgFeedListList(sgFeedList);
} }

View File

@@ -3,6 +3,7 @@ package com.zhyc.module.feed.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 org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgFeedPlanMapper; import com.zhyc.module.feed.mapper.SgFeedPlanMapper;
import com.zhyc.module.feed.domain.SgFeedPlan; import com.zhyc.module.feed.domain.SgFeedPlan;
@@ -11,14 +12,13 @@ import org.springframework.transaction.annotation.Transactional;
/** /**
* 饲喂计划Service业务层处理 * 饲喂计划Service业务层处理
* *
* @author HashMap * @author HashMap
* @date 2025-08-14 * @date 2025-08-14
*/ */
@Service @Service
@Transactional(rollbackFor=Exception.class) @Transactional(rollbackFor = Exception.class)
public class SgFeedPlanServiceImpl implements ISgFeedPlanService public class SgFeedPlanServiceImpl implements ISgFeedPlanService {
{
private final SgFeedPlanMapper sgFeedPlanMapper; private final SgFeedPlanMapper sgFeedPlanMapper;
public SgFeedPlanServiceImpl(SgFeedPlanMapper sgFeedPlanMapper) { public SgFeedPlanServiceImpl(SgFeedPlanMapper sgFeedPlanMapper) {
@@ -27,73 +27,68 @@ public class SgFeedPlanServiceImpl implements ISgFeedPlanService
/** /**
* 查询饲喂计划 * 查询饲喂计划
* *
* @param createDate 饲喂计划主键 * @param createDate 饲喂计划主键
* @return 饲喂计划 * @return 饲喂计划
*/ */
@Override @Override
public SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate) public SgFeedPlan selectSgFeedPlanByCreateDate(Date createDate) {
{
return sgFeedPlanMapper.selectSgFeedPlanByCreateDate(createDate); return sgFeedPlanMapper.selectSgFeedPlanByCreateDate(createDate);
} }
/** /**
* 查询饲喂计划列表 * 查询饲喂计划列表
* *
* @param sgFeedPlan 饲喂计划 * @param sgFeedPlan 饲喂计划
* @return 饲喂计划 * @return 饲喂计划
*/ */
@Override @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); return sgFeedPlanMapper.selectSgFeedPlanList(sgFeedPlan);
} }
/** /**
* 新增饲喂计划 * 新增饲喂计划
* *
* @param sgFeedPlan 饲喂计划 * @param sgFeedPlan 饲喂计划
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertSgFeedPlan(SgFeedPlan sgFeedPlan) public int insertSgFeedPlan(SgFeedPlan sgFeedPlan) {
{
return sgFeedPlanMapper.insertSgFeedPlan(sgFeedPlan); return sgFeedPlanMapper.insertSgFeedPlan(sgFeedPlan);
} }
/** /**
* 修改饲喂计划 * 修改饲喂计划
* *
* @param sgFeedPlan 饲喂计划 * @param sgFeedPlan 饲喂计划
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateSgFeedPlan(SgFeedPlan sgFeedPlan) public int updateSgFeedPlan(SgFeedPlan sgFeedPlan) {
{
return sgFeedPlanMapper.updateSgFeedPlan(sgFeedPlan); return sgFeedPlanMapper.updateSgFeedPlan(sgFeedPlan);
} }
/** /**
* 批量删除饲喂计划 * 批量删除饲喂计划
* *
* @param createDates 需要删除的饲喂计划主键 * @param createDates 需要删除的饲喂计划主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSgFeedPlanByCreateDates(Date[] createDates) public int deleteSgFeedPlanByCreateDates(Date[] createDates) {
{
return sgFeedPlanMapper.deleteSgFeedPlanByCreateDates(createDates); return sgFeedPlanMapper.deleteSgFeedPlanByCreateDates(createDates);
} }
/** /**
* 删除饲喂计划信息 * 删除饲喂计划信息
* *
* @param createDate 饲喂计划主键 * @param createDate 饲喂计划主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSgFeedPlanByCreateDate(Date createDate) public int deleteSgFeedPlanByCreateDate(Date createDate) {
{
return sgFeedPlanMapper.deleteSgFeedPlanByCreateDate(createDate); return sgFeedPlanMapper.deleteSgFeedPlanByCreateDate(createDate);
} }

View File

@@ -3,6 +3,7 @@ package com.zhyc.module.feed.service.impl;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.zhyc.common.annotation.DataScope;
import com.zhyc.module.base.domain.DaSheepfold; import com.zhyc.module.base.domain.DaSheepfold;
import com.zhyc.module.feed.domain.SgFeedList; import com.zhyc.module.feed.domain.SgFeedList;
import com.zhyc.module.feed.domain.SgFeedPlan; import com.zhyc.module.feed.domain.SgFeedPlan;
@@ -51,6 +52,7 @@ public class SgFeedStatisticServiceImpl implements ISgFeedStatisticService {
* @return 饲喂量统计 * @return 饲喂量统计
*/ */
@Override @Override
@DataScope(deptAlias = "sg_feed_statistic_alias", userAlias = "sg_feed_statistic_alias")
public List<SgFeedStatistic> selectSgFeedStatisticList(SgFeedStatistic sgFeedStatistic) { public List<SgFeedStatistic> selectSgFeedStatisticList(SgFeedStatistic sgFeedStatistic) {
return sgFeedStatisticMapper.selectSgFeedStatisticList(sgFeedStatistic); return sgFeedStatisticMapper.selectSgFeedStatisticList(sgFeedStatistic);
} }

View File

@@ -2,6 +2,7 @@ package com.zhyc.module.feed.service.impl;
import java.util.List; import java.util.List;
import com.zhyc.common.annotation.DataScope;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgFormulaListMapper; import com.zhyc.module.feed.mapper.SgFormulaListMapper;
import com.zhyc.module.feed.domain.SgFormulaList; import com.zhyc.module.feed.domain.SgFormulaList;
@@ -41,6 +42,7 @@ public class SgFormulaListServiceImpl implements ISgFormulaListService {
* @return 配方列表 * @return 配方列表
*/ */
@Override @Override
@DataScope(deptAlias = "sg_formula_list_alias", userAlias = "sg_formula_list_alias")
public List<SgFormulaList> selectSgFormulaListList(SgFormulaList sgFormulaList) { public List<SgFormulaList> selectSgFormulaListList(SgFormulaList sgFormulaList) {
return sgFormulaListMapper.selectSgFormulaListList(sgFormulaList); return sgFormulaListMapper.selectSgFormulaListList(sgFormulaList);
} }

View File

@@ -4,6 +4,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import com.zhyc.common.annotation.DataScope;
import com.zhyc.module.feed.domain.SgFormulaList; import com.zhyc.module.feed.domain.SgFormulaList;
import com.zhyc.module.feed.mapper.SgFormulaListMapper; import com.zhyc.module.feed.mapper.SgFormulaListMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -46,6 +47,7 @@ public class SgFormulaManagementServiceImpl implements ISgFormulaManagementServi
* @return 配方管理 * @return 配方管理
*/ */
@Override @Override
@DataScope(deptAlias = "sg_formula_management_alias", userAlias = "sg_formula_management_alias")
public List<SgFormulaManagement> selectSgFormulaManagementList(SgFormulaManagement sgFormulaManagement) { public List<SgFormulaManagement> selectSgFormulaManagementList(SgFormulaManagement sgFormulaManagement) {
List<SgFormulaManagement> sgFormulaManagements = List<SgFormulaManagement> sgFormulaManagements =
sgFormulaManagementMapper.selectSgFormulaManagementList(sgFormulaManagement); sgFormulaManagementMapper.selectSgFormulaManagementList(sgFormulaManagement);

View File

@@ -2,6 +2,7 @@ package com.zhyc.module.feed.service.impl;
import java.util.List; import java.util.List;
import com.zhyc.common.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zhyc.module.feed.mapper.SgMaterialMapper; import com.zhyc.module.feed.mapper.SgMaterialMapper;
@@ -37,6 +38,7 @@ public class SgMaterialServiceImpl implements ISgMaterialService {
* @return 原料 * @return 原料
*/ */
@Override @Override
@DataScope(deptAlias = "sg_material_alias", userAlias = "sg_material_alias")
public List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial) { public List<SgMaterial> selectSgMaterialList(SgMaterial sgMaterial) {
return sgMaterialMapper.selectSgMaterialList(sgMaterial); return sgMaterialMapper.selectSgMaterialList(sgMaterial);
} }

View File

@@ -318,49 +318,6 @@ public class ScBreedRecordServiceImpl implements IScBreedRecordService
return scBreedRecordMapper.selectBreedRecordByMatingTime(sheepId, startDate, endDate); 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;
// }
/** /**
* 新增配种记录 * 新增配种记录
*/ */

View File

@@ -5,24 +5,28 @@
<mapper namespace="com.zhyc.module.feed.mapper.SgFeedListMapper"> <mapper namespace="com.zhyc.module.feed.mapper.SgFeedListMapper">
<resultMap type="SgFeedList" id="SgFeedListResult"> <resultMap type="SgFeedList" id="SgFeedListResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="formulaId" column="formula_id" /> <result property="formulaId" column="formula_id"/>
<result property="formulaBatchId" column="formula_batch_id" /> <result property="formulaBatchId" column="formula_batch_id"/>
<result property="zookeeper" column="zookeeper" /> <result property="zookeeper" column="zookeeper"/>
<result property="deployDate" column="deploy_date" /> <result property="deployDate" column="deploy_date"/>
</resultMap> </resultMap>
<sql id="selectSgFeedListVo"> <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> </sql>
<select id="selectSgFeedListList" parameterType="SgFeedList" resultMap="SgFeedListResult"> <select id="selectSgFeedListList" parameterType="SgFeedList" resultMap="SgFeedListResult">
<include refid="selectSgFeedListVo"/> <include refid="selectSgFeedListVo"/>
<where> <where>
<if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</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="formulaBatchId != null and formulaBatchId != ''">and formula_batch_id LIKE
<if test="zookeeper != null and zookeeper != ''"> and zookeeper LIKE CONCAT('%',#{zookeeper},'%')</if> CONCAT('%',#{formulaBatchId},'%')
<if test="deployDate != null "> and deploy_date = #{deployDate}</if> </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> </where>
ORDER BY deploy_date ASC, formula_id ASC, formula_batch_id ASC ORDER BY deploy_date ASC, formula_id ASC, formula_batch_id ASC
</select> </select>
@@ -39,12 +43,16 @@
<if test="formulaBatchId != null">formula_batch_id,</if> <if test="formulaBatchId != null">formula_batch_id,</if>
<if test="zookeeper != null">zookeeper,</if> <if test="zookeeper != null">zookeeper,</if>
<if test="deployDate != null">deploy_date,</if> <if test="deployDate != null">deploy_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="formulaId != null">#{formulaId},</if> <if test="formulaId != null">#{formulaId},</if>
<if test="formulaBatchId != null">#{formulaBatchId},</if> <if test="formulaBatchId != null">#{formulaBatchId},</if>
<if test="zookeeper != null">#{zookeeper},</if> <if test="zookeeper != null">#{zookeeper},</if>
<if test="deployDate != null">#{deployDate},</if> <if test="deployDate != null">#{deployDate},</if>
<if test="userId != null">#{userId},</if>
<if test="deptId != null">#{deptId},</if>
</trim> </trim>
</insert> </insert>
@@ -60,7 +68,9 @@
</update> </update>
<delete id="deleteSgFeedListById" parameterType="Long"> <delete id="deleteSgFeedListById" parameterType="Long">
delete from sg_feed_list where id = #{id} delete
from sg_feed_list
where id = #{id}
</delete> </delete>
<delete id="deleteSgFeedListByIds" parameterType="String"> <delete id="deleteSgFeedListByIds" parameterType="String">
@@ -71,6 +81,7 @@
</delete> </delete>
<delete id="deleteAll"> <delete id="deleteAll">
DELETE FROM sg_feed_list; DELETE
FROM sg_feed_list;
</delete> </delete>
</mapper> </mapper>

View File

@@ -30,16 +30,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectSgFeedPlanVo"> <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> </sql>
<select id="selectSgFeedPlanList" parameterType="SgFeedPlan" resultMap="SgFeedPlanResult"> <select id="selectSgFeedPlanList" parameterType="SgFeedPlan" resultMap="SgFeedPlanResult">
<include refid="selectSgFeedPlanVo"/> <include refid="selectSgFeedPlanVo"/>
<where> <where>
<if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</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>
<if test="sheepHouseId != null "> and sheep_house_id LIKE CONCAT('%',#{sheepHouseId},'%')</if> <if test="sheepHouseId != null ">and sheep_house_id LIKE CONCAT('%',#{sheepHouseId},'%')</if>
<if test="planDate != null "> and plan_date = #{planDate}</if> <if test="planDate != null ">and plan_date = #{planDate}</if>
${params.dataScope}
</where> </where>
ORDER BY plan_date ASC, formula_id ASC , batch_id ASC ORDER BY plan_date ASC, formula_id ASC , batch_id ASC
</select> </select>
@@ -74,7 +75,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="zookeeper != null">zookeeper,</if> <if test="zookeeper != null">zookeeper,</if>
<if test="planDate != null">plan_date,</if> <if test="planDate != null">plan_date,</if>
<if test="remark != null">remark,</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=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createDate != null">#{createDate},</if> <if test="createDate != null">#{createDate},</if>
<if test="formulaId != null and formulaId != ''">#{formulaId},</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="zookeeper != null">#{zookeeper},</if>
<if test="planDate != null">#{planDate},</if> <if test="planDate != null">#{planDate},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
</trim> <if test="userId != null">#{userId},</if>
<if test="deptId != null">#{deptId},</if>
</trim>
</insert> </insert>
<update id="updateSgFeedPlan" parameterType="SgFeedPlan"> <update id="updateSgFeedPlan" parameterType="SgFeedPlan">

View File

@@ -1,42 +1,57 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgFeedStatisticMapper"> <mapper namespace="com.zhyc.module.feed.mapper.SgFeedStatisticMapper">
<resultMap type="SgFeedStatistic" id="SgFeedStatisticResult"> <resultMap type="SgFeedStatistic" id="SgFeedStatisticResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="formulaId" column="formula_id" /> <result property="formulaId" column="formula_id"/>
<result property="formulaBatchId" column="formula_batch_id" /> <result property="formulaBatchId" column="formula_batch_id"/>
<result property="sheepFoldCount" column="sheep_fold_count" /> <result property="sheepFoldCount" column="sheep_fold_count"/>
<result property="silageLossRate" column="silage_loss_rate" /> <result property="silageLossRate" column="silage_loss_rate"/>
<result property="feedTotalSize" column="feed_total_size" /> <result property="feedTotalSize" column="feed_total_size"/>
<result property="feedDailySize" column="feed_daily_size" /> <result property="feedDailySize" column="feed_daily_size"/>
<!-- <!--
适配泛型TypeHandler 适配泛型TypeHandler
弃用: XML中无法使用"<>" 弃用: XML中无法使用"<>"
--> -->
<!-- <result property="materialList" column="material_list"--> <!-- <result property="materialList" column="material_list"-->
<!-- typeHandler="com.zhyc.module.feed.mapper.TypeHandler.JsonTypeHandler<java.util.List<com.zhyc.module.feed.domain.SgFormulaList>>" />--> <!-- typeHandler="com.zhyc.module.feed.mapper.TypeHandler.JsonTypeHandler<java.util.List<com.zhyc.module.feed.domain.SgFormulaList>>" />-->
<!-- 分别使用两个TypeHandler完成实体类List<T> 到 数据库 JSON串的映射转换 --> <!-- 分别使用两个TypeHandler完成实体类List<T> 到 数据库 JSON串的映射转换 -->
<result property="materialList" column="material_list" typeHandler="com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler"/> <result property="materialList" column="material_list"
<result property="sheepFoldList" column="sheep_fold_list" typeHandler="com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler"/> typeHandler="com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler"/>
<result property="feedDate" column="feed_date" /> <result property="sheepFoldList" column="sheep_fold_list"
typeHandler="com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler"/>
<result property="feedDate" column="feed_date"/>
</resultMap> </resultMap>
<sql id="selectSgFeedStatisticVo"> <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> </sql>
<select id="selectSgFeedStatisticList" parameterType="SgFeedStatistic" resultMap="SgFeedStatisticResult"> <select id="selectSgFeedStatisticList" parameterType="SgFeedStatistic" resultMap="SgFeedStatisticResult">
<include refid="selectSgFeedStatisticVo"/> <include refid="selectSgFeedStatisticVo"/>
<where> <where>
<if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</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="formulaBatchId != null and formulaBatchId != ''">and formula_batch_id = LIKE
<if test="silageLossRate != null and silageLossRate != ''"> and silage_loss_rate = #{silageLossRate}</if> CONCAT('%',#{formulaBatchId},'%')
</if>
<if test="silageLossRate != null and silageLossRate != ''">and silage_loss_rate = #{silageLossRate}</if>
${params.dataScope}
</where> </where>
</select> </select>
<select id="selectSgFeedStatisticById" parameterType="String" resultMap="SgFeedStatisticResult"> <select id="selectSgFeedStatisticById" parameterType="String" resultMap="SgFeedStatisticResult">
<include refid="selectSgFeedStatisticVo"/> <include refid="selectSgFeedStatisticVo"/>
where id = #{id} where id = #{id}
@@ -55,7 +70,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialList != null">material_list,</if> <if test="materialList != null">material_list,</if>
<if test="sheepFoldList != null">sheep_fold_list,</if> <if test="sheepFoldList != null">sheep_fold_list,</if>
<if test="feedDate != null">feed_date,</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=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
<if test="formulaId != null and formulaId != ''">#{formulaId},</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="silageLossRate != null">#{silageLossRate},</if>
<if test="feedTotalSize != null">#{feedTotalSize},</if> <if test="feedTotalSize != null">#{feedTotalSize},</if>
<if test="feedDailySize != null">#{feedDailySize},</if> <if test="feedDailySize != null">#{feedDailySize},</if>
# 写入操作需要手动指定 TypeHandler 参数 # 写入操作需要手动指定 TypeHandler 参数
<if test="materialList != null">#{materialList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler},</if> <if test="materialList != null">
<if test="sheepFoldList != null">#{sheepFoldList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler},</if> #{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> <if test="feedDate != null">#{feedDate},</if>
</trim> <if test="userId != null">#{userId},</if>
<if test="deptId != null">#{deptId},</if>
</trim>
</insert> </insert>
<update id="updateSgFeedStatistic" parameterType="SgFeedStatistic"> <update id="updateSgFeedStatistic" parameterType="SgFeedStatistic">
@@ -80,19 +103,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="silageLossRate != null">silage_loss_rate = #{silageLossRate},</if> <if test="silageLossRate != null">silage_loss_rate = #{silageLossRate},</if>
<if test="feedTotalSize != null">feed_total_size = #{feedTotalSize},</if> <if test="feedTotalSize != null">feed_total_size = #{feedTotalSize},</if>
<if test="feedDailySize != null">feed_daily_size = #{feedDailySize},</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="materialList != null">material_list =
<if test="sheepFoldList != null">sheep_fold_list = #{sheepFoldList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler},</if> #{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> <if test="feedDate != null">feed_date = #{feedDate},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteSgFeedStatisticById" parameterType="String"> <delete id="deleteSgFeedStatisticById" parameterType="String">
delete from sg_feed_statistic where id = #{id} delete
from sg_feed_statistic
where id = #{id}
</delete> </delete>
<delete id="deleteSgFeedStatisticByIds" parameterType="String"> <delete id="deleteSgFeedStatisticByIds" parameterType="String">
delete from sg_feed_statistic where id in delete from sg_feed_statistic where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

View File

@@ -1,22 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgFormulaListMapper"> <mapper namespace="com.zhyc.module.feed.mapper.SgFormulaListMapper">
<resultMap type="SgFormulaList" id="SgFormulaListResult"> <resultMap type="SgFormulaList" id="SgFormulaListResult">
<result property="code" column="code" /> <result property="code" column="code"/>
<result property="formulaId" column="formula_id" /> <result property="formulaId" column="formula_id"/>
<result property="batchId" column="batch_id" /> <result property="batchId" column="batch_id"/>
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id"/>
<result property="materialName" column="material_name" /> <result property="materialName" column="material_name"/>
<result property="ratio" column="ratio" /> <result property="ratio" column="ratio"/>
<result property="isGranular" column="is_granular" /> <result property="isGranular" column="is_granular"/>
<result property="isSupplement" column="is_supplement" /> <result property="isSupplement" column="is_supplement"/>
</resultMap> </resultMap>
<sql id="selectSgFormulaListVo"> <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> </sql>
<select id="selectSgFormulaListList" parameterType="SgFormulaList" resultMap="SgFormulaListResult"> <select id="selectSgFormulaListList" parameterType="SgFormulaList" resultMap="SgFormulaListResult">
@@ -24,10 +25,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="materialId != null and materialId != ''">material_id LIKE CONCAT('%',#{materialId},'%')</if> <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="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> </where>
</select> </select>
<select id="selectSgFormulaListByCode" parameterType="Long" resultMap="SgFormulaListResult"> <select id="selectSgFormulaListByCode" parameterType="Long" resultMap="SgFormulaListResult">
<include refid="selectSgFormulaListVo"/> <include refid="selectSgFormulaListVo"/>
where code = #{code} where code = #{code}
@@ -44,7 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ratio != null">ratio,</if> <if test="ratio != null">ratio,</if>
<if test="isGranular != null">is_granular,</if> <if test="isGranular != null">is_granular,</if>
<if test="isSupplement != null">is_supplement,</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=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if> <if test="code != null">#{code},</if>
<if test="formulaId != null">#{formulaId},</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="ratio != null">#{ratio},</if>
<if test="isGranular != null">#{isGranular},</if> <if test="isGranular != null">#{isGranular},</if>
<if test="isSupplement != null">#{isSupplement},</if> <if test="isSupplement != null">#{isSupplement},</if>
</trim> <if test="userId != null">#{userId},</if>
<if test="deptId != null">#{deptId},</if>
</trim>
</insert> </insert>
<update id="updateSgFormulaList" parameterType="SgFormulaList"> <update id="updateSgFormulaList" parameterType="SgFormulaList">
@@ -71,17 +77,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteSgFormulaListByCode" parameterType="Long"> <delete id="deleteSgFormulaListByCode" parameterType="Long">
delete from sg_formula_list where code = #{code} delete
from sg_formula_list
where code = #{code}
</delete> </delete>
<delete id="deleteSgFormulaListByCodes" parameterType="String"> <delete id="deleteSgFormulaListByCodes" parameterType="String">
delete from sg_formula_list where code in delete from sg_formula_list where code in
<foreach item="code" collection="array" open="(" separator="," close=")"> <foreach item="code" collection="array" open="(" separator="," close=")">
#{code} #{code}
</foreach> </foreach>
</delete> </delete>
<delete id="deleteSgFormulaListByFormulaIdAndBatchId" parameterType="SgFormulaList"> <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> </delete>
</mapper> </mapper>

View File

@@ -1,32 +1,35 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgFormulaManagementMapper"> <mapper namespace="com.zhyc.module.feed.mapper.SgFormulaManagementMapper">
<resultMap type="SgFormulaManagement" id="SgFormulaManagementResult"> <resultMap type="SgFormulaManagement" id="SgFormulaManagementResult">
<result property="formulaId" column="formula_id" /> <result property="formulaId" column="formula_id"/>
<result property="feedStage" column="feed_stage" /> <result property="feedStage" column="feed_stage"/>
<result property="batchId" column="batch_id" /> <result property="batchId" column="batch_id"/>
<result property="useStartDate" column="use_start_date" /> <result property="useStartDate" column="use_start_date"/>
<result property="useEndDate" column="use_end_date" /> <result property="useEndDate" column="use_end_date"/>
<result property="useState" column="use_state" /> <result property="useState" column="use_state"/>
<result property="remark" column="remark" /> <result property="remark" column="remark"/>
</resultMap> </resultMap>
<sql id="selectSgFormulaManagementVo"> <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> </sql>
<select id="selectSgFormulaManagementList" parameterType="SgFormulaManagement" resultMap="SgFormulaManagementResult"> <select id="selectSgFormulaManagementList" parameterType="SgFormulaManagement"
resultMap="SgFormulaManagementResult">
<include refid="selectSgFormulaManagementVo"/> <include refid="selectSgFormulaManagementVo"/>
<where> <where>
<if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</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="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="batchId != null and batchId != ''">and batch_id LIKE CONCAT('%',#{batchId},'%')</if>
${params.dataScope}
</where> </where>
</select> </select>
<select id="selectSgFormulaManagementByFormulaId" parameterType="String" resultMap="SgFormulaManagementResult"> <select id="selectSgFormulaManagementByFormulaId" parameterType="String" resultMap="SgFormulaManagementResult">
<include refid="selectSgFormulaManagementVo"/> <include refid="selectSgFormulaManagementVo"/>
where formula_id = #{formulaId} where formula_id = #{formulaId}
@@ -42,7 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="useEndDate != null">use_end_date,</if> <if test="useEndDate != null">use_end_date,</if>
<if test="useState != null">use_state,</if> <if test="useState != null">use_state,</if>
<if test="remark != null">remark,</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=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="formulaId != null and formulaId != ''">#{formulaId},</if> <if test="formulaId != null and formulaId != ''">#{formulaId},</if>
<if test="feedStage != null and feedStage != ''">#{feedStage},</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="useEndDate != null">#{useEndDate},</if>
<if test="useState != null">#{useState},</if> <if test="useState != null">#{useState},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
</trim> <if test="userId != null">#{userId},</if>
<if test="deptId != null">#{deptId},</if>
</trim>
</insert> </insert>
<update id="updateSgFormulaManagement" parameterType="SgFormulaManagement"> <update id="updateSgFormulaManagement" parameterType="SgFormulaManagement">
@@ -67,16 +74,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteSgFormulaManagementByFormulaId" parameterType="String"> <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>
<delete id="deleteSgFormulaManagementByFormulaIds" parameterType="String"> <delete id="deleteSgFormulaManagementByFormulaIds" parameterType="String">
delete from sg_formula_management where formula_id in delete from sg_formula_management where formula_id in
<foreach item="formulaId" collection="array" open="(" separator="," close=")"> <foreach item="formulaId" collection="array" open="(" separator="," close=")">
#{formulaId} #{formulaId}
</foreach> </foreach>
</delete> </delete>
<delete id="deleteSgFormulaManagement" parameterType="SgFormulaManagement"> <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> </delete>
</mapper> </mapper>

View File

@@ -1,28 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.feed.mapper.SgMaterialMapper"> <mapper namespace="com.zhyc.module.feed.mapper.SgMaterialMapper">
<resultMap type="SgMaterial" id="SgMaterialResult"> <resultMap type="SgMaterial" id="SgMaterialResult">
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id"/>
<result property="materialName" column="material_name" /> <result property="materialName" column="material_name"/>
<result property="isGranular" column="is_granular" /> <result property="isGranular" column="is_granular"/>
</resultMap> </resultMap>
<sql id="selectSgMaterialVo"> <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> </sql>
<select id="selectSgMaterialList" parameterType="SgMaterial" resultMap="SgMaterialResult"> <select id="selectSgMaterialList" parameterType="SgMaterial" resultMap="SgMaterialResult">
<include refid="selectSgMaterialVo"/> <include refid="selectSgMaterialVo"/>
<where> <where>
<if test="materialId != null and materialId != ''"> and material_id LIKE CONCAT('%',#{materialId},'%')</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="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},
<if test="isGranular != null "> and is_granular = #{isGranular}</if> '%')
</if>
<if test="isGranular != null ">and is_granular = #{isGranular}</if>
${params.dataScope}
</where> </where>
</select> </select>
<select id="selectSgMaterialByMaterialId" parameterType="String" resultMap="SgMaterialResult"> <select id="selectSgMaterialByMaterialId" parameterType="String" resultMap="SgMaterialResult">
<include refid="selectSgMaterialVo"/> <include refid="selectSgMaterialVo"/>
where material_id = #{materialId} where material_id = #{materialId}
@@ -34,12 +38,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialId != null and materialId != ''">material_id,</if> <if test="materialId != null and materialId != ''">material_id,</if>
<if test="materialName != null and materialName != ''">material_name,</if> <if test="materialName != null and materialName != ''">material_name,</if>
<if test="isGranular != null">is_granular,</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=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="materialId != null and materialId != ''">#{materialId},</if> <if test="materialId != null and materialId != ''">#{materialId},</if>
<if test="materialName != null and materialName != ''">#{materialName},</if> <if test="materialName != null and materialName != ''">#{materialName},</if>
<if test="isGranular != null">#{isGranular},</if> <if test="isGranular != null">#{isGranular},</if>
</trim> <if test="userId != null">#{userId},</if>
<if test="deptId != null">#{deptId},</if>
</trim>
</insert> </insert>
<update id="updateSgMaterial" parameterType="SgMaterial"> <update id="updateSgMaterial" parameterType="SgMaterial">
@@ -52,11 +60,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteSgMaterialByMaterialId" parameterType="String"> <delete id="deleteSgMaterialByMaterialId" parameterType="String">
delete from sg_material where material_id = #{materialId} delete
from sg_material
where material_id = #{materialId}
</delete> </delete>
<delete id="deleteSgMaterialByMaterialIds" parameterType="String"> <delete id="deleteSgMaterialByMaterialIds" parameterType="String">
delete from sg_material where material_id in delete from sg_material where material_id in
<foreach item="materialId" collection="array" open="(" separator="," close=")"> <foreach item="materialId" collection="array" open="(" separator="," close=")">
#{materialId} #{materialId}
</foreach> </foreach>