refactor (farm): 投入品重构
- 涉及到的模块: - 基础数据管理 - 投入品 (模版类型) - 模型管理 - 农事记录 - 投入品(引用类型) - 生产中心 - 农事记录 - 投入品使用记录
This commit is contained in:
@@ -0,0 +1,57 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 投入品分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class InputsPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "投入品分类 (1: 模版分类; 2: 引用分类)")
|
||||||
|
private Integer inputCategory;
|
||||||
|
|
||||||
|
@Schema(description = "投入品类型", example = "2")
|
||||||
|
private String inputType;
|
||||||
|
|
||||||
|
@Schema(description = "投入品名称", example = "芋艿")
|
||||||
|
private String inputName;
|
||||||
|
|
||||||
|
@Schema(description = "投入品单价", example = "11570")
|
||||||
|
private BigDecimal inputPrice;
|
||||||
|
|
||||||
|
@Schema(description = "投入品单位")
|
||||||
|
private String inputUnit;
|
||||||
|
|
||||||
|
@Schema(description = "投入品规格")
|
||||||
|
private String inputSpec;
|
||||||
|
|
||||||
|
@Schema(description = "投入品规格单位")
|
||||||
|
private String specUnit;
|
||||||
|
|
||||||
|
@Schema(description = "投入品用量")
|
||||||
|
private BigDecimal inputUsage;
|
||||||
|
|
||||||
|
@Schema(description = "投入品使用状态 (1:启用; 0:停用;)", example = "1")
|
||||||
|
private Integer usageStatus;
|
||||||
|
|
||||||
|
@Schema(description = "投入品备注", example = "你说的对")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 投入品 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class InputsRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4097")
|
||||||
|
@ExcelProperty("ID")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "投入品分类 (1: 模版分类; 2: 引用分类)")
|
||||||
|
@ExcelProperty("投入品分类 (1: 模版分类; 2: 引用分类)")
|
||||||
|
private Integer inputCategory;
|
||||||
|
|
||||||
|
@Schema(description = "投入品类型", example = "2")
|
||||||
|
@ExcelProperty("投入品类型")
|
||||||
|
private String inputType;
|
||||||
|
|
||||||
|
@Schema(description = "投入品名称", example = "芋艿")
|
||||||
|
@ExcelProperty("投入品名称")
|
||||||
|
private String inputName;
|
||||||
|
|
||||||
|
@Schema(description = "投入品单价", example = "11570")
|
||||||
|
@ExcelProperty("投入品单价")
|
||||||
|
private BigDecimal inputPrice;
|
||||||
|
|
||||||
|
@Schema(description = "投入品单位")
|
||||||
|
@ExcelProperty("投入品单位")
|
||||||
|
private String inputUnit;
|
||||||
|
|
||||||
|
@Schema(description = "投入品规格")
|
||||||
|
@ExcelProperty("投入品规格")
|
||||||
|
private String inputSpec;
|
||||||
|
|
||||||
|
@Schema(description = "投入品规格单位")
|
||||||
|
@ExcelProperty("投入品规格单位")
|
||||||
|
private String specUnit;
|
||||||
|
|
||||||
|
@Schema(description = "投入品用量")
|
||||||
|
@ExcelProperty("投入品用量")
|
||||||
|
private BigDecimal inputUsage;
|
||||||
|
|
||||||
|
@Schema(description = "投入品使用状态 (1:启用; 0:停用;)", example = "1")
|
||||||
|
@ExcelProperty("投入品使用状态 (1:启用; 0:停用;)")
|
||||||
|
private Integer usageStatus;
|
||||||
|
|
||||||
|
@Schema(description = "投入品备注", example = "你说的对")
|
||||||
|
@ExcelProperty("投入品备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 投入品新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class InputsSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4097")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "投入品分类 (1: 模版分类; 2: 引用分类)")
|
||||||
|
private Integer inputCategory;
|
||||||
|
|
||||||
|
@Schema(description = "投入品类型", example = "2")
|
||||||
|
private String inputType;
|
||||||
|
|
||||||
|
@Schema(description = "投入品名称", example = "芋艿")
|
||||||
|
private String inputName;
|
||||||
|
|
||||||
|
@Schema(description = "投入品单价", example = "11570")
|
||||||
|
private BigDecimal inputPrice;
|
||||||
|
|
||||||
|
@Schema(description = "投入品单位")
|
||||||
|
private String inputUnit;
|
||||||
|
|
||||||
|
@Schema(description = "投入品规格")
|
||||||
|
private String inputSpec;
|
||||||
|
|
||||||
|
@Schema(description = "投入品规格单位")
|
||||||
|
private String specUnit;
|
||||||
|
|
||||||
|
@Schema(description = "投入品用量")
|
||||||
|
private BigDecimal inputUsage;
|
||||||
|
|
||||||
|
@Schema(description = "投入品使用状态 (1:启用; 0:停用;)", example = "1")
|
||||||
|
private Integer usageStatus;
|
||||||
|
|
||||||
|
@Schema(description = "投入品备注", example = "你说的对")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 投入品使用记录分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class InputUsageRecordsPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "投入品ID", example = "30559")
|
||||||
|
private String inputId;
|
||||||
|
|
||||||
|
@Schema(description = "农事记录ID", example = "26500")
|
||||||
|
private String farmRecordId;
|
||||||
|
|
||||||
|
@Schema(description = "用量")
|
||||||
|
private BigDecimal usageAmount;
|
||||||
|
|
||||||
|
@Schema(description = "单价", example = "280")
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
@Schema(description = "总价", example = "29353")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 投入品使用记录 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class InputUsageRecordsRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14729")
|
||||||
|
@ExcelProperty("ID")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "投入品ID", example = "30559")
|
||||||
|
@ExcelProperty("投入品ID")
|
||||||
|
private String inputId;
|
||||||
|
|
||||||
|
@Schema(description = "农事记录ID", example = "26500")
|
||||||
|
@ExcelProperty("农事记录ID")
|
||||||
|
private String farmRecordId;
|
||||||
|
|
||||||
|
@Schema(description = "用量")
|
||||||
|
@ExcelProperty("用量")
|
||||||
|
private BigDecimal usageAmount;
|
||||||
|
|
||||||
|
@Schema(description = "单价", example = "280")
|
||||||
|
@ExcelProperty("单价")
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
@Schema(description = "总价", example = "29353")
|
||||||
|
@ExcelProperty("总价")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 投入品使用记录新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class InputUsageRecordsSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14729")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "投入品ID", example = "30559")
|
||||||
|
private String inputId;
|
||||||
|
|
||||||
|
@Schema(description = "农事记录ID", example = "26500")
|
||||||
|
private String farmRecordId;
|
||||||
|
|
||||||
|
@Schema(description = "用量")
|
||||||
|
private BigDecimal usageAmount;
|
||||||
|
|
||||||
|
@Schema(description = "单价", example = "280")
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
@Schema(description = "总价", example = "29353")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@Deprecated
|
||||||
public class InputLibraryDO extends BaseDO {
|
public class InputLibraryDO extends BaseDO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投入品使用记录 DO
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
@TableName("farm_input_usage_records")
|
||||||
|
@KeySequence("farm_input_usage_records_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class InputUsageRecordsDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.INPUT)
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 投入品ID
|
||||||
|
*/
|
||||||
|
private String inputId;
|
||||||
|
/**
|
||||||
|
* 农事记录ID
|
||||||
|
*/
|
||||||
|
private String farmRecordId;
|
||||||
|
/**
|
||||||
|
* 用量
|
||||||
|
*/
|
||||||
|
private BigDecimal usageAmount;
|
||||||
|
/**
|
||||||
|
* 单价
|
||||||
|
*/
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
/**
|
||||||
|
* 总价
|
||||||
|
*/
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投入品 DO
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
@TableName("farm_inputs")
|
||||||
|
@KeySequence("farm_inputs_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class InputsDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.INPUT)
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 投入品分类 (1: 模版分类; 2: 引用分类)
|
||||||
|
*/
|
||||||
|
private Integer inputCategory;
|
||||||
|
/**
|
||||||
|
* 投入品类型
|
||||||
|
*/
|
||||||
|
private String inputType;
|
||||||
|
/**
|
||||||
|
* 投入品名称
|
||||||
|
*/
|
||||||
|
private String inputName;
|
||||||
|
/**
|
||||||
|
* 投入品单价
|
||||||
|
*/
|
||||||
|
private BigDecimal inputPrice;
|
||||||
|
/**
|
||||||
|
* 投入品单位
|
||||||
|
*/
|
||||||
|
private String inputUnit;
|
||||||
|
/**
|
||||||
|
* 投入品规格
|
||||||
|
*/
|
||||||
|
private String inputSpec;
|
||||||
|
/**
|
||||||
|
* 投入品规格单位
|
||||||
|
*/
|
||||||
|
private String specUnit;
|
||||||
|
/**
|
||||||
|
* 投入品用量
|
||||||
|
*/
|
||||||
|
private BigDecimal inputUsage;
|
||||||
|
/**
|
||||||
|
* 投入品使用状态 (1:启用; 0:停用;)
|
||||||
|
*/
|
||||||
|
private Integer usageStatus;
|
||||||
|
/**
|
||||||
|
* 投入品备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
|
@Deprecated
|
||||||
public interface InputLibraryMapper extends BaseMapperX<InputLibraryDO> {
|
public interface InputLibraryMapper extends BaseMapperX<InputLibraryDO> {
|
||||||
|
|
||||||
default PageResult<InputLibraryDO> selectPage(InputLibraryPageReqVO reqVO) {
|
default PageResult<InputLibraryDO> selectPage(InputLibraryPageReqVO reqVO) {
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputUsageRecordsDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投入品使用记录 Mapper
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface InputUsageRecordsMapper extends BaseMapperX<InputUsageRecordsDO> {
|
||||||
|
|
||||||
|
default PageResult<InputUsageRecordsDO> selectPage(InputUsageRecordsPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<InputUsageRecordsDO>()
|
||||||
|
.eqIfPresent(InputUsageRecordsDO::getInputId, reqVO.getInputId())
|
||||||
|
.eqIfPresent(InputUsageRecordsDO::getFarmRecordId, reqVO.getFarmRecordId())
|
||||||
|
.eqIfPresent(InputUsageRecordsDO::getUsageAmount, reqVO.getUsageAmount())
|
||||||
|
.eqIfPresent(InputUsageRecordsDO::getUnitPrice, reqVO.getUnitPrice())
|
||||||
|
.eqIfPresent(InputUsageRecordsDO::getTotalPrice, reqVO.getTotalPrice())
|
||||||
|
.eqIfPresent(InputUsageRecordsDO::getRemark, reqVO.getRemark())
|
||||||
|
.betweenIfPresent(InputUsageRecordsDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(InputUsageRecordsDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.InputsPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputsDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投入品 Mapper
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface InputsMapper extends BaseMapperX<InputsDO> {
|
||||||
|
|
||||||
|
default PageResult<InputsDO> selectPage(InputsPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<InputsDO>()
|
||||||
|
.eqIfPresent(InputsDO::getInputCategory, reqVO.getInputCategory())
|
||||||
|
.eqIfPresent(InputsDO::getInputType, reqVO.getInputType())
|
||||||
|
.likeIfPresent(InputsDO::getInputName, reqVO.getInputName())
|
||||||
|
.eqIfPresent(InputsDO::getInputPrice, reqVO.getInputPrice())
|
||||||
|
.eqIfPresent(InputsDO::getInputUnit, reqVO.getInputUnit())
|
||||||
|
.eqIfPresent(InputsDO::getInputSpec, reqVO.getInputSpec())
|
||||||
|
.eqIfPresent(InputsDO::getSpecUnit, reqVO.getSpecUnit())
|
||||||
|
.eqIfPresent(InputsDO::getInputUsage, reqVO.getInputUsage())
|
||||||
|
.eqIfPresent(InputsDO::getUsageStatus, reqVO.getUsageStatus())
|
||||||
|
.eqIfPresent(InputsDO::getRemark, reqVO.getRemark())
|
||||||
|
.betweenIfPresent(InputsDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(InputsDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -155,4 +155,10 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode ENVIRONMENT_INDICATORS_NOT_EXISTS = new ErrorCode(1_050_048_000, "环境指标不存在");
|
ErrorCode ENVIRONMENT_INDICATORS_NOT_EXISTS = new ErrorCode(1_050_048_000, "环境指标不存在");
|
||||||
|
|
||||||
ErrorCode FARM_INFORMATION_NOT_EXISTS = new ErrorCode(1_050_049_000, "农业资讯不存在");
|
ErrorCode FARM_INFORMATION_NOT_EXISTS = new ErrorCode(1_050_049_000, "农业资讯不存在");
|
||||||
|
|
||||||
|
// ========== 投入品 ==========
|
||||||
|
ErrorCode INPUTS_NOT_EXISTS = new ErrorCode(1_050_050_000, "投入品不存在");
|
||||||
|
|
||||||
|
// ========== 使用记录 ==========
|
||||||
|
ErrorCode INPUT_USAGE_RECORDS_NOT_EXISTS = new ErrorCode(1_050_051_000, "投入品使用记录不存在");
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.service.inputlibrary;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputUsageRecordsDO;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投入品使用记录 Service 接口
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
public interface InputUsageRecordsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建投入品使用记录
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
String createInputUsageRecords(@Valid InputUsageRecordsSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新投入品使用记录
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateInputUsageRecords(@Valid InputUsageRecordsSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除投入品使用记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteInputUsageRecords(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除投入品使用记录
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteInputUsageRecordsListByIds(List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得投入品使用记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 投入品使用记录
|
||||||
|
*/
|
||||||
|
InputUsageRecordsDO getInputUsageRecords(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得投入品使用记录分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 投入品使用记录分页
|
||||||
|
*/
|
||||||
|
PageResult<InputUsageRecordsDO> getInputUsageRecordsPage(InputUsageRecordsPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.service.inputlibrary;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.usagerecords.InputUsageRecordsSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputUsageRecordsDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputUsageRecordsMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投入品使用记录 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class InputUsageRecordsServiceImpl implements InputUsageRecordsService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private InputUsageRecordsMapper inputUsageRecordsMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createInputUsageRecords(InputUsageRecordsSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
InputUsageRecordsDO inputUsageRecords = BeanUtils.toBean(createReqVO, InputUsageRecordsDO.class);
|
||||||
|
inputUsageRecordsMapper.insert(inputUsageRecords);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return inputUsageRecords.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateInputUsageRecords(InputUsageRecordsSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateInputUsageRecordsExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
InputUsageRecordsDO updateObj = BeanUtils.toBean(updateReqVO, InputUsageRecordsDO.class);
|
||||||
|
inputUsageRecordsMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteInputUsageRecords(String id) {
|
||||||
|
// 校验存在
|
||||||
|
validateInputUsageRecordsExists(id);
|
||||||
|
// 删除
|
||||||
|
inputUsageRecordsMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteInputUsageRecordsListByIds(List<String> ids) {
|
||||||
|
// 删除
|
||||||
|
inputUsageRecordsMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateInputUsageRecordsExists(String id) {
|
||||||
|
if (inputUsageRecordsMapper.selectById(id) == null) {
|
||||||
|
throw exception(INPUT_USAGE_RECORDS_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InputUsageRecordsDO getInputUsageRecords(String id) {
|
||||||
|
return inputUsageRecordsMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<InputUsageRecordsDO> getInputUsageRecordsPage(InputUsageRecordsPageReqVO pageReqVO) {
|
||||||
|
return inputUsageRecordsMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.service.inputlibrary;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.InputsPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.InputsSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputsDO;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投入品 Service 接口
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
public interface InputsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建投入品
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
String createInputs(@Valid InputsSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新投入品
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateInputs(@Valid InputsSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除投入品
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteInputs(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除投入品
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteInputsListByIds(List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得投入品
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 投入品
|
||||||
|
*/
|
||||||
|
InputsDO getInputs(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得投入品分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 投入品分页
|
||||||
|
*/
|
||||||
|
PageResult<InputsDO> getInputsPage(InputsPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.service.inputlibrary;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.InputsPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.inputlibrary.vo.inputs.InputsSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputsDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputsMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投入品 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class InputsServiceImpl implements InputsService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private InputsMapper inputsMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createInputs(InputsSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
InputsDO inputs = BeanUtils.toBean(createReqVO, InputsDO.class);
|
||||||
|
inputsMapper.insert(inputs);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return inputs.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateInputs(InputsSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateInputsExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
InputsDO updateObj = BeanUtils.toBean(updateReqVO, InputsDO.class);
|
||||||
|
inputsMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteInputs(String id) {
|
||||||
|
// 校验存在
|
||||||
|
validateInputsExists(id);
|
||||||
|
// 删除
|
||||||
|
inputsMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteInputsListByIds(List<String> ids) {
|
||||||
|
// 删除
|
||||||
|
inputsMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateInputsExists(String id) {
|
||||||
|
if (inputsMapper.selectById(id) == null) {
|
||||||
|
throw exception(INPUTS_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InputsDO getInputs(String id) {
|
||||||
|
return inputsMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<InputsDO> getInputsPage(InputsPageReqVO pageReqVO) {
|
||||||
|
return inputsMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?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">
|
||||||
|
<mapper namespace="cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputUsageRecordsMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?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">
|
||||||
|
<mapper namespace="cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputsMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user