fix (farm): 删除废弃代码
- 设备与地块 - 物种分类(最早一版) - 气象灾害 (与一般灾害合并为一张表) - 种植区域 (始终未使用)
This commit is contained in:
@@ -8,14 +8,8 @@ import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictRespVO;
|
|||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictTypeCodeRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictTypeCodeRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.sysDict.SysDictDO;
|
import cn.iocoder.yudao.module.farm.dal.mysql.sysDict.SysDictDO;
|
||||||
import cn.iocoder.yudao.module.farm.service.baseinfo.BaseInfoService;
|
import cn.iocoder.yudao.module.farm.service.baseinfo.BaseInfoService;
|
||||||
import cn.iocoder.yudao.module.farm.service.disasterdata.DisasterDataService;
|
|
||||||
import cn.iocoder.yudao.module.farm.service.farmingtypemaintenance.FarmingTypeMaintenanceService;
|
|
||||||
import cn.iocoder.yudao.module.farm.service.inputlibrary.InputLibraryService;
|
|
||||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||||
import cn.iocoder.yudao.module.farm.service.speciesclassifylibrary.SpeciesClassifyLibraryService;
|
|
||||||
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
|
||||||
import cn.iocoder.yudao.module.farm.service.sysDict.SysDictService;
|
import cn.iocoder.yudao.module.farm.service.sysDict.SysDictService;
|
||||||
import cn.iocoder.yudao.module.farm.service.twodict.TwoDictService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -44,26 +38,14 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class DictController {
|
public class DictController {
|
||||||
|
|
||||||
private final SpeciesLibraryService speciesLibraryService;
|
|
||||||
private final SpeciesClassifyLibraryService speciesClassifyLibraryService;
|
|
||||||
private final InputLibraryService inputLibraryService;
|
|
||||||
private final DisasterDataService disasterDataService;
|
|
||||||
private final SysDictService sysDictService;
|
private final SysDictService sysDictService;
|
||||||
private final ProductionPlanService productionPlanService;
|
private final ProductionPlanService productionPlanService;
|
||||||
private final BaseInfoService baseInfoService;
|
private final BaseInfoService baseInfoService;
|
||||||
private final FarmingTypeMaintenanceService farmingTypeMaintenanceService;
|
|
||||||
private final TwoDictService twoDictService;
|
|
||||||
|
|
||||||
public DictController(SpeciesLibraryService speciesLibraryService, SpeciesClassifyLibraryService speciesClassifyLibraryService, InputLibraryService inputLibraryService, DisasterDataService disasterDataService, SysDictService sysDictService, ProductionPlanService productionPlanService, BaseInfoService baseInfoService, FarmingTypeMaintenanceService farmingTypeMaintenanceService, TwoDictService twoDictService) {
|
public DictController(SysDictService sysDictService, ProductionPlanService productionPlanService, BaseInfoService baseInfoService) {
|
||||||
this.speciesLibraryService = speciesLibraryService;
|
|
||||||
this.speciesClassifyLibraryService = speciesClassifyLibraryService;
|
|
||||||
this.inputLibraryService = inputLibraryService;
|
|
||||||
this.disasterDataService = disasterDataService;
|
|
||||||
this.sysDictService = sysDictService;
|
this.sysDictService = sysDictService;
|
||||||
this.productionPlanService = productionPlanService;
|
this.productionPlanService = productionPlanService;
|
||||||
this.baseInfoService = baseInfoService;
|
this.baseInfoService = baseInfoService;
|
||||||
this.farmingTypeMaintenanceService = farmingTypeMaintenanceService;
|
|
||||||
this.twoDictService = twoDictService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 农事类型
|
// 农事类型
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.controller.admin.dict.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description:
|
|
||||||
* @author: binda
|
|
||||||
* @date: 2025/8/17 16:51
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class SpeciesClassifyLibraryReqVO {
|
|
||||||
@Schema(description = "ID")
|
|
||||||
private String id;
|
|
||||||
@Schema(description = "一级分类-编码")
|
|
||||||
private String primaryClassCode;
|
|
||||||
@Schema(description = "一级分类-名称")
|
|
||||||
private String primaryClassName;
|
|
||||||
@Schema(description = "二级分类-编码")
|
|
||||||
private String secondaryClassCode;
|
|
||||||
@Schema(description = "二级分类-名称")
|
|
||||||
private String secondaryClassName;
|
|
||||||
@Schema(description = "使用状态")
|
|
||||||
private Integer useStatus;
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.controller.admin.dict.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 物种分类
|
|
||||||
* @author: binda
|
|
||||||
* @date: 2025/8/17 16:43
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class SpeciesClassifyLibraryRespVO {
|
|
||||||
|
|
||||||
@Schema(description = "一级分类-编码")
|
|
||||||
private String speciesClassCode;
|
|
||||||
@Schema(description = "一级分类-名称")
|
|
||||||
private String speciesClassName;
|
|
||||||
@Schema(description = "生命周期")
|
|
||||||
private String lifeCycle;
|
|
||||||
|
|
||||||
private List<SpeciesClassifyLibraryRespVO> children;
|
|
||||||
|
|
||||||
public SpeciesClassifyLibraryRespVO(String speciesClassCode, String speciesClassName) {
|
|
||||||
this.speciesClassCode = speciesClassCode;
|
|
||||||
this.speciesClassName = speciesClassName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SpeciesClassifyLibraryRespVO(String speciesClassCode, String speciesClassName, String lifeCycle) {
|
|
||||||
this.speciesClassCode = speciesClassCode;
|
|
||||||
this.speciesClassName = speciesClassName;
|
|
||||||
this.lifeCycle = lifeCycle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.dal.dataobject.cultivationarea;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
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_cultivation_area")
|
|
||||||
@KeySequence("farm_cultivation_area_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class CultivationAreaDO extends BaseDO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 基础id
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.INPUT)
|
|
||||||
private String id;
|
|
||||||
/**
|
|
||||||
* 基地id
|
|
||||||
*/
|
|
||||||
private String baseId;
|
|
||||||
/**
|
|
||||||
* 基地
|
|
||||||
*/
|
|
||||||
private String baseName;
|
|
||||||
/**
|
|
||||||
* 地块ID
|
|
||||||
*/
|
|
||||||
private String plotId;
|
|
||||||
/**
|
|
||||||
* 地块
|
|
||||||
*/
|
|
||||||
private String plotName;
|
|
||||||
/**
|
|
||||||
* 计划面积
|
|
||||||
*/
|
|
||||||
private BigDecimal planArea;
|
|
||||||
/**
|
|
||||||
* 总面积
|
|
||||||
*/
|
|
||||||
private BigDecimal totalArea;
|
|
||||||
/**
|
|
||||||
* 剩余面积
|
|
||||||
*/
|
|
||||||
private BigDecimal surplusArea;
|
|
||||||
/**
|
|
||||||
* 逻辑删除标识符
|
|
||||||
*/
|
|
||||||
private Boolean delStatus;
|
|
||||||
private String tenantId;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.dal.dataobject.deviceplotrelation;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
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_device_plot_relation")
|
|
||||||
@KeySequence("farm_device_plot_relation_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class DevicePlotRelationDO extends BaseDO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.INPUT)
|
|
||||||
private String id;
|
|
||||||
/**
|
|
||||||
* 设备ID
|
|
||||||
*/
|
|
||||||
private String deviceUniqueId;
|
|
||||||
/**
|
|
||||||
* 设备厂商
|
|
||||||
*/
|
|
||||||
private String vendor;
|
|
||||||
/**
|
|
||||||
* 设备名称
|
|
||||||
*/
|
|
||||||
private String deviceName;
|
|
||||||
/**
|
|
||||||
* LP产品标识
|
|
||||||
*/
|
|
||||||
private String lpProductKey;
|
|
||||||
/**
|
|
||||||
* 用户id
|
|
||||||
*/
|
|
||||||
private String userId;
|
|
||||||
/**
|
|
||||||
* 是否存在物联网卡
|
|
||||||
*/
|
|
||||||
private Boolean isIotCardExisted;
|
|
||||||
/**
|
|
||||||
* 基地id
|
|
||||||
*/
|
|
||||||
private String baseId;
|
|
||||||
/**
|
|
||||||
* 基地
|
|
||||||
*/
|
|
||||||
private String baseName;
|
|
||||||
/**
|
|
||||||
* 地块ID
|
|
||||||
*/
|
|
||||||
private String plotId;
|
|
||||||
/**
|
|
||||||
* 地块
|
|
||||||
*/
|
|
||||||
private String plotName;
|
|
||||||
|
|
||||||
private String tenantId;
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.dal.dataobject.speciesclassifylibrary;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 物种分类 DO
|
|
||||||
* @author: binda
|
|
||||||
* @date: 2025/8/17 16:31
|
|
||||||
*/
|
|
||||||
@TableName("farm_species_classify_library")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class SpeciesClassifyLibraryDO extends BaseDO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.INPUT)
|
|
||||||
private String id;
|
|
||||||
/**
|
|
||||||
* 一级分类-编码
|
|
||||||
*/
|
|
||||||
private String primaryClassCode;
|
|
||||||
/**
|
|
||||||
* 一级分类-名称
|
|
||||||
*/
|
|
||||||
private String primaryClassName;
|
|
||||||
/**
|
|
||||||
* 二级分类-编码
|
|
||||||
*/
|
|
||||||
private String secondaryClassCode;
|
|
||||||
/**
|
|
||||||
* 二级分类-名称
|
|
||||||
*/
|
|
||||||
private String secondaryClassName;
|
|
||||||
/**
|
|
||||||
* 0=启用,1=停用
|
|
||||||
*/
|
|
||||||
private Integer useStatus;
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.dal.dataobject.weatherdisasterlibrary;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|
||||||
import cn.iocoder.yudao.module.farm.framework.util.ImageCollectionUtil;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 气象灾害库维护 DO
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@TableName("farm_weather_disaster_library")
|
|
||||||
@KeySequence("farm_weather_disaster_library_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class WeatherDisasterLibraryDO extends BaseDO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.INPUT)
|
|
||||||
private String id;
|
|
||||||
/**
|
|
||||||
* 灾害名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* 灾害描述
|
|
||||||
*/
|
|
||||||
private String description;
|
|
||||||
/**
|
|
||||||
* 防治建议
|
|
||||||
*/
|
|
||||||
private String propose;
|
|
||||||
/**
|
|
||||||
* 图片(数据库存储为逗号分隔的字符串)
|
|
||||||
*/
|
|
||||||
@TableField(value = "images")
|
|
||||||
private String images;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 图片集合(业务层使用)
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private List<String> imageList;
|
|
||||||
/**
|
|
||||||
* 0=启用,1=停用
|
|
||||||
*/
|
|
||||||
private Integer useStatus;
|
|
||||||
/**
|
|
||||||
* 基地id
|
|
||||||
*/
|
|
||||||
private String baseId;
|
|
||||||
/**
|
|
||||||
* 基地
|
|
||||||
*/
|
|
||||||
private String baseName;
|
|
||||||
/**
|
|
||||||
* 地块ID
|
|
||||||
*/
|
|
||||||
private String plotId;
|
|
||||||
/**
|
|
||||||
* 地块
|
|
||||||
*/
|
|
||||||
private String plotName;
|
|
||||||
|
|
||||||
private String tenantId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取图片集合
|
|
||||||
*/
|
|
||||||
public List<String> getImageList() {
|
|
||||||
if (imageList == null) {
|
|
||||||
imageList = ImageCollectionUtil.toImageList(this.images);
|
|
||||||
}
|
|
||||||
return imageList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置图片集合
|
|
||||||
*/
|
|
||||||
public void setImageList(List<String> imageList) {
|
|
||||||
this.imageList = imageList;
|
|
||||||
this.images = ImageCollectionUtil.toDatabaseString(imageList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.dal.mysql.cultivationarea;
|
|
||||||
|
|
||||||
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.cultivationarea.vo.CultivationAreaPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.cultivationarea.CultivationAreaDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 种植区域 Mapper
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface CultivationAreaMapper extends BaseMapperX<CultivationAreaDO> {
|
|
||||||
|
|
||||||
default PageResult<CultivationAreaDO> selectPage(CultivationAreaPageReqVO reqVO) {
|
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<CultivationAreaDO>()
|
|
||||||
.eqIfPresent(CultivationAreaDO::getBaseId, reqVO.getBaseId())
|
|
||||||
.likeIfPresent(CultivationAreaDO::getBaseName, reqVO.getBaseName())
|
|
||||||
.eqIfPresent(CultivationAreaDO::getPlotId, reqVO.getPlotId())
|
|
||||||
.likeIfPresent(CultivationAreaDO::getPlotName, reqVO.getPlotName())
|
|
||||||
.eqIfPresent(CultivationAreaDO::getPlanArea, reqVO.getPlanArea())
|
|
||||||
.eqIfPresent(CultivationAreaDO::getTotalArea, reqVO.getTotalArea())
|
|
||||||
.eqIfPresent(CultivationAreaDO::getSurplusArea, reqVO.getSurplusArea())
|
|
||||||
.eqIfPresent(CultivationAreaDO::getDelStatus, reqVO.getDelStatus())
|
|
||||||
.eqIfPresent(CultivationAreaDO::getTenantId, reqVO.getTenantId())
|
|
||||||
.betweenIfPresent(CultivationAreaDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.orderByDesc(CultivationAreaDO::getCreateTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.dal.mysql.deviceplotrelation;
|
|
||||||
|
|
||||||
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.deviceplotrelation.vo.DevicePlotRelationPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.deviceplotrelation.DevicePlotRelationDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备与地块关联 Mapper
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface DevicePlotRelationMapper extends BaseMapperX<DevicePlotRelationDO> {
|
|
||||||
|
|
||||||
default PageResult<DevicePlotRelationDO> selectPage(DevicePlotRelationPageReqVO reqVO) {
|
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<DevicePlotRelationDO>()
|
|
||||||
.eqIfPresent(DevicePlotRelationDO::getDeviceUniqueId, reqVO.getDeviceUniqueId())
|
|
||||||
.eqIfPresent(DevicePlotRelationDO::getVendor, reqVO.getVendor())
|
|
||||||
.likeIfPresent(DevicePlotRelationDO::getDeviceName, reqVO.getDeviceName())
|
|
||||||
.eqIfPresent(DevicePlotRelationDO::getLpProductKey, reqVO.getLpProductKey())
|
|
||||||
.eqIfPresent(DevicePlotRelationDO::getUserId, reqVO.getUserId())
|
|
||||||
.eqIfPresent(DevicePlotRelationDO::getIsIotCardExisted, reqVO.getIsIotCardExisted())
|
|
||||||
.eqIfPresent(DevicePlotRelationDO::getBaseId, reqVO.getBaseId())
|
|
||||||
.likeIfPresent(DevicePlotRelationDO::getBaseName, reqVO.getBaseName())
|
|
||||||
.eqIfPresent(DevicePlotRelationDO::getPlotId, reqVO.getPlotId())
|
|
||||||
.likeIfPresent(DevicePlotRelationDO::getPlotName, reqVO.getPlotName())
|
|
||||||
.eqIfPresent(DevicePlotRelationDO::getTenantId, reqVO.getTenantId())
|
|
||||||
.betweenIfPresent(DevicePlotRelationDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.orderByDesc(DevicePlotRelationDO::getCreateTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.dal.mysql.speciesclassifylibrary;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.SpeciesClassifyLibraryReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.speciesclassifylibrary.SpeciesClassifyLibraryDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description:
|
|
||||||
* @author: binda
|
|
||||||
* @date: 2025/8/17 16:30
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface SpeciesClassifyLibraryMapper extends BaseMapperX<SpeciesClassifyLibraryDO> {
|
|
||||||
|
|
||||||
List<SpeciesClassifyLibraryDO> getSpeciesClassifyLibraryList(@Param("req") SpeciesClassifyLibraryReqVO reqVO);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.dal.mysql.weatherdisasterlibrary;
|
|
||||||
|
|
||||||
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.weatherdisasterlibrary.vo.WeatherDisasterLibraryPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.weatherdisasterlibrary.WeatherDisasterLibraryDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 气象灾害库维护 Mapper
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface WeatherDisasterLibraryMapper extends BaseMapperX<WeatherDisasterLibraryDO> {
|
|
||||||
|
|
||||||
default PageResult<WeatherDisasterLibraryDO> selectPage(WeatherDisasterLibraryPageReqVO reqVO) {
|
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<WeatherDisasterLibraryDO>()
|
|
||||||
.likeIfPresent(WeatherDisasterLibraryDO::getName, reqVO.getName())
|
|
||||||
.eqIfPresent(WeatherDisasterLibraryDO::getDescription, reqVO.getDescription())
|
|
||||||
.eqIfPresent(WeatherDisasterLibraryDO::getPropose, reqVO.getPropose())
|
|
||||||
.eqIfPresent(WeatherDisasterLibraryDO::getImages, reqVO.getImages())
|
|
||||||
.eqIfPresent(WeatherDisasterLibraryDO::getUseStatus, reqVO.getUseStatus())
|
|
||||||
.betweenIfPresent(WeatherDisasterLibraryDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.eqIfPresent(WeatherDisasterLibraryDO::getBaseId, reqVO.getBaseId())
|
|
||||||
.likeIfPresent(WeatherDisasterLibraryDO::getBaseName, reqVO.getBaseName())
|
|
||||||
.eqIfPresent(WeatherDisasterLibraryDO::getPlotId, reqVO.getPlotId())
|
|
||||||
.likeIfPresent(WeatherDisasterLibraryDO::getPlotName, reqVO.getPlotName())
|
|
||||||
.eqIfPresent(WeatherDisasterLibraryDO::getTenantId, reqVO.getTenantId())
|
|
||||||
.orderByDesc(WeatherDisasterLibraryDO::getCreateTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.cultivationarea;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cultivationarea.vo.CultivationAreaPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cultivationarea.vo.CultivationAreaSaveReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.cultivationarea.CultivationAreaDO;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 种植区域 Service 接口
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
public interface CultivationAreaService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建种植区域
|
|
||||||
*
|
|
||||||
* @param createReqVO 创建信息
|
|
||||||
* @return 编号
|
|
||||||
*/
|
|
||||||
String createCultivationArea(@Valid CultivationAreaSaveReqVO createReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新种植区域
|
|
||||||
*
|
|
||||||
* @param updateReqVO 更新信息
|
|
||||||
*/
|
|
||||||
void updateCultivationArea(@Valid CultivationAreaSaveReqVO updateReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除种植区域
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
*/
|
|
||||||
void deleteCultivationArea(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除种植区域
|
|
||||||
*
|
|
||||||
* @param ids 编号
|
|
||||||
*/
|
|
||||||
void deleteCultivationAreaListByIds(List<String> ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得种植区域
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
* @return 种植区域
|
|
||||||
*/
|
|
||||||
CultivationAreaDO getCultivationArea(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得种植区域分页
|
|
||||||
*
|
|
||||||
* @param pageReqVO 分页查询
|
|
||||||
* @return 种植区域分页
|
|
||||||
*/
|
|
||||||
PageResult<CultivationAreaDO> getCultivationAreaPage(CultivationAreaPageReqVO pageReqVO);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.cultivationarea;
|
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cultivationarea.vo.CultivationAreaPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cultivationarea.vo.CultivationAreaSaveReqVO;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.cultivationarea.CultivationAreaDO;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.cultivationarea.CultivationAreaMapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
|
||||||
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.CULTIVATION_AREA_NOT_EXISTS;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 种植区域 Service 实现类
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Validated
|
|
||||||
public class CultivationAreaServiceImpl implements CultivationAreaService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CultivationAreaMapper cultivationAreaMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String createCultivationArea(CultivationAreaSaveReqVO createReqVO) {
|
|
||||||
LoginUser user = getLoginUser();
|
|
||||||
// 插入
|
|
||||||
CultivationAreaDO cultivationArea = BeanUtils.toBean(createReqVO, CultivationAreaDO.class);
|
|
||||||
cultivationArea.setId(IdUtil.fastUUID());
|
|
||||||
cultivationArea.setTenantId(String.valueOf(user.getTenantId()));
|
|
||||||
cultivationAreaMapper.insert(cultivationArea);
|
|
||||||
|
|
||||||
// 返回
|
|
||||||
return cultivationArea.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateCultivationArea(CultivationAreaSaveReqVO updateReqVO) {
|
|
||||||
// 校验存在
|
|
||||||
validateCultivationAreaExists(updateReqVO.getId());
|
|
||||||
// 更新
|
|
||||||
CultivationAreaDO updateObj = BeanUtils.toBean(updateReqVO, CultivationAreaDO.class);
|
|
||||||
cultivationAreaMapper.updateById(updateObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteCultivationArea(String id) {
|
|
||||||
// 校验存在
|
|
||||||
validateCultivationAreaExists(id);
|
|
||||||
// 删除
|
|
||||||
cultivationAreaMapper.deleteById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteCultivationAreaListByIds(List<String> ids) {
|
|
||||||
// 删除
|
|
||||||
cultivationAreaMapper.deleteByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateCultivationAreaExists(String id) {
|
|
||||||
if (cultivationAreaMapper.selectById(id) == null) {
|
|
||||||
throw exception(CULTIVATION_AREA_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CultivationAreaDO getCultivationArea(String id) {
|
|
||||||
return cultivationAreaMapper.selectById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageResult<CultivationAreaDO> getCultivationAreaPage(CultivationAreaPageReqVO pageReqVO) {
|
|
||||||
return cultivationAreaMapper.selectPage(pageReqVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.deviceplotrelation;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.deviceplotrelation.vo.DevicePlotRelationPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.deviceplotrelation.vo.DevicePlotRelationSaveReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.deviceplotrelation.DevicePlotRelationDO;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备与地块关联 Service 接口
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
public interface DevicePlotRelationService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建设备与地块关联
|
|
||||||
*
|
|
||||||
* @param createReqVO 创建信息
|
|
||||||
* @return 编号
|
|
||||||
*/
|
|
||||||
String createDevicePlotRelation(@Valid DevicePlotRelationSaveReqVO createReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新设备与地块关联
|
|
||||||
*
|
|
||||||
* @param updateReqVO 更新信息
|
|
||||||
*/
|
|
||||||
void updateDevicePlotRelation(@Valid DevicePlotRelationSaveReqVO updateReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除设备与地块关联
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
*/
|
|
||||||
void deleteDevicePlotRelation(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除设备与地块关联
|
|
||||||
*
|
|
||||||
* @param ids 编号
|
|
||||||
*/
|
|
||||||
void deleteDevicePlotRelationListByIds(List<String> ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得设备与地块关联
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
* @return 设备与地块关联
|
|
||||||
*/
|
|
||||||
DevicePlotRelationDO getDevicePlotRelation(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得设备与地块关联分页
|
|
||||||
*
|
|
||||||
* @param pageReqVO 分页查询
|
|
||||||
* @return 设备与地块关联分页
|
|
||||||
*/
|
|
||||||
PageResult<DevicePlotRelationDO> getDevicePlotRelationPage(DevicePlotRelationPageReqVO pageReqVO);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.deviceplotrelation;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.deviceplotrelation.vo.DevicePlotRelationPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.deviceplotrelation.vo.DevicePlotRelationSaveReqVO;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.deviceplotrelation.DevicePlotRelationDO;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.deviceplotrelation.DevicePlotRelationMapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
|
|
||||||
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.DEVICE_PLOT_RELATION_NOT_EXISTS;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备与地块关联 Service 实现类
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Validated
|
|
||||||
public class DevicePlotRelationServiceImpl implements DevicePlotRelationService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private DevicePlotRelationMapper devicePlotRelationMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String createDevicePlotRelation(DevicePlotRelationSaveReqVO createReqVO) {
|
|
||||||
LoginUser user = SecurityFrameworkUtils.getLoginUser();
|
|
||||||
// 插入
|
|
||||||
DevicePlotRelationDO devicePlotRelation = BeanUtils.toBean(createReqVO, DevicePlotRelationDO.class);
|
|
||||||
devicePlotRelation.setId(IdUtil.fastUUID());
|
|
||||||
devicePlotRelation.setTenantId(String.valueOf(user.getTenantId()));
|
|
||||||
devicePlotRelationMapper.insert(devicePlotRelation);
|
|
||||||
|
|
||||||
// 返回
|
|
||||||
return devicePlotRelation.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateDevicePlotRelation(DevicePlotRelationSaveReqVO updateReqVO) {
|
|
||||||
// 校验存在
|
|
||||||
validateDevicePlotRelationExists(updateReqVO.getId());
|
|
||||||
// 更新
|
|
||||||
DevicePlotRelationDO updateObj = BeanUtils.toBean(updateReqVO, DevicePlotRelationDO.class);
|
|
||||||
devicePlotRelationMapper.updateById(updateObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteDevicePlotRelation(String id) {
|
|
||||||
// 校验存在
|
|
||||||
validateDevicePlotRelationExists(id);
|
|
||||||
// 删除
|
|
||||||
devicePlotRelationMapper.deleteById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteDevicePlotRelationListByIds(List<String> ids) {
|
|
||||||
// 删除
|
|
||||||
devicePlotRelationMapper.deleteByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateDevicePlotRelationExists(String id) {
|
|
||||||
if (devicePlotRelationMapper.selectById(id) == null) {
|
|
||||||
throw exception(DEVICE_PLOT_RELATION_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DevicePlotRelationDO getDevicePlotRelation(String id) {
|
|
||||||
return devicePlotRelationMapper.selectById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageResult<DevicePlotRelationDO> getDevicePlotRelationPage(DevicePlotRelationPageReqVO pageReqVO) {
|
|
||||||
return devicePlotRelationMapper.selectPage(pageReqVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -10,7 +10,6 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlan
|
|||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.specieslibrary.SpeciesLibraryDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.specieslibrary.SpeciesLibraryDO;
|
||||||
import cn.iocoder.yudao.module.farm.service.baseinfo.BaseInfoService;
|
import cn.iocoder.yudao.module.farm.service.baseinfo.BaseInfoService;
|
||||||
import cn.iocoder.yudao.module.farm.service.cropFarmingCenter.CropFarmingCenterService;
|
import cn.iocoder.yudao.module.farm.service.cropFarmingCenter.CropFarmingCenterService;
|
||||||
import cn.iocoder.yudao.module.farm.service.deviceplotrelation.DevicePlotRelationService;
|
|
||||||
import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService;
|
import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService;
|
||||||
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
||||||
import cn.iocoder.yudao.module.farm.service.personnelmanagement.PersonnelManagementService;
|
import cn.iocoder.yudao.module.farm.service.personnelmanagement.PersonnelManagementService;
|
||||||
@@ -42,18 +41,16 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
private final BaseInfoService baseInfoService;
|
private final BaseInfoService baseInfoService;
|
||||||
private final PlotInfoService plotInfoService;
|
private final PlotInfoService plotInfoService;
|
||||||
private final ProductionPlanService productionPlanService;
|
private final ProductionPlanService productionPlanService;
|
||||||
private final DevicePlotRelationService driverPropertyInfoService;
|
|
||||||
private final CropFarmingCenterService cropFarmingCenterService;
|
private final CropFarmingCenterService cropFarmingCenterService;
|
||||||
private final PersonnelManagementService personnelManagementService;
|
private final PersonnelManagementService personnelManagementService;
|
||||||
private final ModelManagementService modelManagementService;
|
private final ModelManagementService modelManagementService;
|
||||||
private final SpeciesLibraryService speciesLibraryService;
|
private final SpeciesLibraryService speciesLibraryService;
|
||||||
private final FarmingRecordService farmingRecordService;
|
private final FarmingRecordService farmingRecordService;
|
||||||
|
|
||||||
public HomeServiceImpl(BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService, DevicePlotRelationService driverPropertyInfoService, CropFarmingCenterService cropFarmingCenterService, PersonnelManagementService personnelManagementService, ModelManagementService modelManagementService, SpeciesLibraryService speciesLibraryService, FarmingRecordService farmingRecordService) {
|
public HomeServiceImpl(BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService, CropFarmingCenterService cropFarmingCenterService, PersonnelManagementService personnelManagementService, ModelManagementService modelManagementService, SpeciesLibraryService speciesLibraryService, FarmingRecordService farmingRecordService) {
|
||||||
this.baseInfoService = baseInfoService;
|
this.baseInfoService = baseInfoService;
|
||||||
this.plotInfoService = plotInfoService;
|
this.plotInfoService = plotInfoService;
|
||||||
this.productionPlanService = productionPlanService;
|
this.productionPlanService = productionPlanService;
|
||||||
this.driverPropertyInfoService = driverPropertyInfoService;
|
|
||||||
this.cropFarmingCenterService = cropFarmingCenterService;
|
this.cropFarmingCenterService = cropFarmingCenterService;
|
||||||
this.personnelManagementService = personnelManagementService;
|
this.personnelManagementService = personnelManagementService;
|
||||||
this.modelManagementService = modelManagementService;
|
this.modelManagementService = modelManagementService;
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.speciesclassifylibrary;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.speciesclassifylibrary.SpeciesClassifyLibraryDO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 物种分类
|
|
||||||
* @author: binda
|
|
||||||
* @data: 2025/8/17 16:27
|
|
||||||
*/
|
|
||||||
public interface SpeciesClassifyLibraryService {
|
|
||||||
List<SpeciesClassifyLibraryDO> getSpeciesClassifyLibraryList();
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.speciesclassifylibrary;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.SpeciesClassifyLibraryReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.SpeciesClassifyLibraryRespVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.speciesclassifylibrary.SpeciesClassifyLibraryDO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.speciesclassifylibrary.SpeciesClassifyLibraryMapper;
|
|
||||||
import cn.iocoder.yudao.module.farm.utils.TreeStructureUtil;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 物种分类
|
|
||||||
* @author: binda
|
|
||||||
* @date: 2025/8/17 16:28
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Validated
|
|
||||||
@Slf4j
|
|
||||||
public class SpeciesClassifyLibraryServiceImpl implements SpeciesClassifyLibraryService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SpeciesClassifyLibraryMapper speciesClassifyLibraryMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SpeciesClassifyLibraryDO> getSpeciesClassifyLibraryList() {
|
|
||||||
return speciesClassifyLibraryMapper.getSpeciesClassifyLibraryList(new SpeciesClassifyLibraryReqVO());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取物种类别树结构(带缓存)
|
|
||||||
*
|
|
||||||
* @return 树形结构的物种类别列表
|
|
||||||
*/
|
|
||||||
@Cacheable(value = "speciesClassifyTree", key = "'all'", unless = "#result == null or #result.isEmpty()")
|
|
||||||
public List<SpeciesClassifyLibraryRespVO> getSpeciesClassifyLibraryTree() {
|
|
||||||
try {
|
|
||||||
List<SpeciesClassifyLibraryDO> speciesList = getSpeciesClassifyLibraryList();
|
|
||||||
if (speciesList == null || speciesList.isEmpty()) {
|
|
||||||
log.warn("物种类别数据为空");
|
|
||||||
return new java.util.ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 这里可以添加从 SpeciesClassifyLibraryDO 到树结构的转换逻辑
|
|
||||||
// 或者直接使用现有的字典服务
|
|
||||||
log.info("成功获取物种类别树结构,共 {} 条记录", speciesList.size());
|
|
||||||
return new java.util.ArrayList<>();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("获取物种类别树结构失败", e);
|
|
||||||
return new java.util.ArrayList<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.sysDict;
|
package cn.iocoder.yudao.module.farm.service.sysDict;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.SpeciesClassifyLibraryRespVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictPageReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictThreeLvRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictThreeLvRespVO;
|
||||||
@@ -30,10 +29,6 @@ public interface SysDictService {
|
|||||||
|
|
||||||
PageResult<SysDictDO> selectDictByPage(SysDictPageReqVO reqVO);
|
PageResult<SysDictDO> selectDictByPage(SysDictPageReqVO reqVO);
|
||||||
|
|
||||||
List<SpeciesClassifyLibraryRespVO> getSpeciesClassifyLibraryList();
|
|
||||||
|
|
||||||
List<SpeciesClassifyLibraryRespVO> getSpeciesClassifyAndModelList();
|
|
||||||
|
|
||||||
SysDictThreeLvRespVO getDictByField3Code(String field3Code);
|
SysDictThreeLvRespVO getDictByField3Code(String field3Code);
|
||||||
|
|
||||||
SysDictThreeLvRespVO getDictByField2Code(String field2Code);
|
SysDictThreeLvRespVO getDictByField2Code(String field2Code);
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package cn.iocoder.yudao.module.farm.service.sysDict;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.SpeciesClassifyLibraryRespVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictPageReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictThreeLvRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.sys.SysDictThreeLvRespVO;
|
||||||
@@ -15,26 +13,20 @@ import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatam
|
|||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingnamemaintenance.FarmingNameMaintenanceDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingnamemaintenance.FarmingNameMaintenanceDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingtypemaintenance.FarmingTypeMaintenanceDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingtypemaintenance.FarmingTypeMaintenanceDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputLibraryDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputLibraryDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelmanagement.ModelManagementDO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputLibraryMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputLibraryMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.modelmanagement.ModelManagementMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.modelmanagement.ModelManagementMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.sysDict.SysDictDO;
|
import cn.iocoder.yudao.module.farm.dal.mysql.sysDict.SysDictDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.sysDict.SysDictMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.sysDict.SysDictMapper;
|
||||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||||
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
|
||||||
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.FARMING_TYPE_MAINTENANCE_NOT_EXISTS;
|
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.FARMING_TYPE_MAINTENANCE_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,117 +86,6 @@ public class SysDictServiceImpl implements SysDictService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SpeciesClassifyLibraryRespVO> getSpeciesClassifyLibraryList() {
|
|
||||||
return getSpeciesClassifyLibraryList(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<SpeciesClassifyLibraryRespVO> getSpeciesClassifyLibraryList2() {
|
|
||||||
return getSpeciesClassifyLibraryList(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<SpeciesClassifyLibraryRespVO> getSpeciesClassifyLibraryList(int level) {
|
|
||||||
List<SysDictDO> list = this.getByTypeCode(CommonConstants.DICT_TYPE_CODE_3);
|
|
||||||
|
|
||||||
if (level == 1) {
|
|
||||||
// 一,二级联动
|
|
||||||
return this.build(list, SysDictDO::getField1Code, SysDictDO::getField1Name, SysDictDO::getField2Code, SysDictDO::getField2Name, SysDictDO::getField1Code
|
|
||||||
);
|
|
||||||
} else if (level == 2) {
|
|
||||||
// 二,三级联动
|
|
||||||
return this.build(list, SysDictDO::getField2Code, SysDictDO::getField2Name, SysDictDO::getField3Code, SysDictDO::getField3Name, SysDictDO::getField2Code
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("Unsupported level: " + level);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<SpeciesClassifyLibraryRespVO> build(
|
|
||||||
List<SysDictDO> list,
|
|
||||||
Function<SysDictDO, String> parentKeyExtractor,
|
|
||||||
Function<SysDictDO, String> parentValueExtractor,
|
|
||||||
Function<SysDictDO, String> childKeyExtractor,
|
|
||||||
Function<SysDictDO, String> childValueExtractor,
|
|
||||||
Function<SysDictDO, String> parentFilterExtractor) {
|
|
||||||
|
|
||||||
// 获取父级映射(去重)
|
|
||||||
Map<String, String> parentMap = list.stream()
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
parentKeyExtractor,
|
|
||||||
parentValueExtractor,
|
|
||||||
(existing, replacement) -> existing
|
|
||||||
));
|
|
||||||
|
|
||||||
List<SpeciesClassifyLibraryRespVO> result = new ArrayList<>();
|
|
||||||
|
|
||||||
// 按父级代码分组,提前组织子级数据
|
|
||||||
Map<String, List<SysDictDO>> groupedByParent = list.stream().collect(Collectors.groupingBy(parentFilterExtractor));
|
|
||||||
|
|
||||||
for (Map.Entry<String, String> entry : parentMap.entrySet()) {
|
|
||||||
String parentKey = entry.getKey();
|
|
||||||
SpeciesClassifyLibraryRespVO parentVO = new SpeciesClassifyLibraryRespVO(parentKey, entry.getValue());
|
|
||||||
|
|
||||||
// 获取该父级下的所有子项
|
|
||||||
List<SysDictDO> childrenItems = groupedByParent.getOrDefault(parentKey, Collections.emptyList());
|
|
||||||
|
|
||||||
// 去重处理子项
|
|
||||||
Map<String, String> childMap = childrenItems.stream()
|
|
||||||
.filter(e -> childKeyExtractor.apply(e) != null && !childKeyExtractor.apply(e).isEmpty())
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
childKeyExtractor,
|
|
||||||
childValueExtractor,
|
|
||||||
(existing, replacement) -> existing
|
|
||||||
));
|
|
||||||
|
|
||||||
// 构建子级VO列表
|
|
||||||
List<SpeciesClassifyLibraryRespVO> childList = childMap.entrySet().stream()
|
|
||||||
.map(childEntry -> new SpeciesClassifyLibraryRespVO(childEntry.getKey(), childEntry.getValue()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
parentVO.setChildren(childList);
|
|
||||||
result.add(parentVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SpeciesClassifyLibraryRespVO> getSpeciesClassifyAndModelList() {
|
|
||||||
LoginUser user = getLoginUser();
|
|
||||||
if (user == null) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
QueryWrapper<ModelManagementDO> qw = new QueryWrapper<>();
|
|
||||||
qw.eq("tenant_id", user.getTenantId());
|
|
||||||
qw.eq("type", CommonConstants.MODEL_TYPE_1);
|
|
||||||
List<ModelManagementDO> modelList = modelManagementMapper.selectList(qw);
|
|
||||||
|
|
||||||
Map<String, Map<String, String>> modelMap = modelList.stream()
|
|
||||||
.collect(Collectors.groupingBy(
|
|
||||||
ModelManagementDO::getSpeciesId,
|
|
||||||
Collectors.toMap(ModelManagementDO::getId, ModelManagementDO::getModelName)
|
|
||||||
));
|
|
||||||
|
|
||||||
List<SpeciesClassifyLibraryRespVO> rootList = this.getSpeciesClassifyLibraryList2();
|
|
||||||
for (SpeciesClassifyLibraryRespVO vo : rootList) {
|
|
||||||
for (SpeciesClassifyLibraryRespVO child : vo.getChildren()) {
|
|
||||||
|
|
||||||
if (!modelMap.containsKey(child.getSpeciesClassCode())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, String> stringStringMap = modelMap.get(child.getSpeciesClassCode());
|
|
||||||
List<SpeciesClassifyLibraryRespVO> collect = stringStringMap.entrySet().stream().map(e -> new SpeciesClassifyLibraryRespVO(e.getKey(), e.getValue())).collect(Collectors.toList());
|
|
||||||
child.setChildren(collect);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rootList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysDictThreeLvRespVO getDictByField3Code(String field3Code) {
|
public SysDictThreeLvRespVO getDictByField3Code(String field3Code) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.weatherdisasterlibrary;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.weatherdisasterlibrary.vo.WeatherDisasterLibraryPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.weatherdisasterlibrary.vo.WeatherDisasterLibrarySaveReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.weatherdisasterlibrary.WeatherDisasterLibraryDO;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 气象灾害库维护 Service 接口
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
public interface WeatherDisasterLibraryService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建气象灾害库维护
|
|
||||||
*
|
|
||||||
* @param createReqVO 创建信息
|
|
||||||
* @return 编号
|
|
||||||
*/
|
|
||||||
String createWeatherDisasterLibrary(@Valid WeatherDisasterLibrarySaveReqVO createReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新气象灾害库维护
|
|
||||||
*
|
|
||||||
* @param updateReqVO 更新信息
|
|
||||||
*/
|
|
||||||
void updateWeatherDisasterLibrary(@Valid WeatherDisasterLibrarySaveReqVO updateReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除气象灾害库维护
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
*/
|
|
||||||
void deleteWeatherDisasterLibrary(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除气象灾害库维护
|
|
||||||
*
|
|
||||||
* @param ids 编号
|
|
||||||
*/
|
|
||||||
void deleteWeatherDisasterLibraryListByIds(List<String> ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得气象灾害库维护
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
* @return 气象灾害库维护
|
|
||||||
*/
|
|
||||||
WeatherDisasterLibraryDO getWeatherDisasterLibrary(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得气象灾害库维护分页
|
|
||||||
*
|
|
||||||
* @param pageReqVO 分页查询
|
|
||||||
* @return 气象灾害库维护分页
|
|
||||||
*/
|
|
||||||
PageResult<WeatherDisasterLibraryDO> getWeatherDisasterLibraryPage(WeatherDisasterLibraryPageReqVO pageReqVO);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.weatherdisasterlibrary;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.weatherdisasterlibrary.vo.WeatherDisasterLibraryPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.weatherdisasterlibrary.vo.WeatherDisasterLibrarySaveReqVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.weatherdisasterlibrary.WeatherDisasterLibraryDO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.weatherdisasterlibrary.WeatherDisasterLibraryMapper;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
|
||||||
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 气象灾害库维护 Service 实现类
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Validated
|
|
||||||
public class WeatherDisasterLibraryServiceImpl implements WeatherDisasterLibraryService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private WeatherDisasterLibraryMapper weatherDisasterLibraryMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String createWeatherDisasterLibrary(WeatherDisasterLibrarySaveReqVO createReqVO) {
|
|
||||||
LoginUser user = getLoginUser();
|
|
||||||
// 名称查重
|
|
||||||
WeatherDisasterLibraryDO obj = weatherDisasterLibraryMapper.selectOne(WeatherDisasterLibraryDO::getName,createReqVO.getName());
|
|
||||||
if (ObjectUtils.isNotEmpty(obj)) {
|
|
||||||
throw exception(WEATHER_DISASTER_NAME_NON_UNIQUE_ERROR);
|
|
||||||
}
|
|
||||||
// 插入
|
|
||||||
WeatherDisasterLibraryDO weatherDisasterLibrary = BeanUtils.toBean(createReqVO, WeatherDisasterLibraryDO.class);
|
|
||||||
weatherDisasterLibrary.setId(IdUtil.fastUUID());
|
|
||||||
weatherDisasterLibrary.setTenantId(String.valueOf(user.getTenantId()));
|
|
||||||
weatherDisasterLibraryMapper.insert(weatherDisasterLibrary);
|
|
||||||
|
|
||||||
// 返回
|
|
||||||
return weatherDisasterLibrary.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateWeatherDisasterLibrary(WeatherDisasterLibrarySaveReqVO updateReqVO) {
|
|
||||||
// 校验存在
|
|
||||||
validateWeatherDisasterLibraryExists(updateReqVO.getId());
|
|
||||||
// 更新
|
|
||||||
WeatherDisasterLibraryDO updateObj = BeanUtils.toBean(updateReqVO, WeatherDisasterLibraryDO.class);
|
|
||||||
weatherDisasterLibraryMapper.updateById(updateObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteWeatherDisasterLibrary(String id) {
|
|
||||||
// 校验存在
|
|
||||||
validateWeatherDisasterLibraryExists(id);
|
|
||||||
// 删除
|
|
||||||
weatherDisasterLibraryMapper.deleteById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteWeatherDisasterLibraryListByIds(List<String> ids) {
|
|
||||||
// 删除
|
|
||||||
weatherDisasterLibraryMapper.deleteByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateWeatherDisasterLibraryExists(String id) {
|
|
||||||
if (weatherDisasterLibraryMapper.selectById(id) == null) {
|
|
||||||
throw exception(WEATHER_DISASTER_LIBRARY_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public WeatherDisasterLibraryDO getWeatherDisasterLibrary(String id) {
|
|
||||||
WeatherDisasterLibraryDO weatherDisasterLibrary = weatherDisasterLibraryMapper.selectById(id);
|
|
||||||
if (weatherDisasterLibrary != null) {
|
|
||||||
// 触发图片集合转换,确保返回的DO对象包含转换后的图片集合
|
|
||||||
weatherDisasterLibrary.getImageList();
|
|
||||||
}
|
|
||||||
return weatherDisasterLibrary;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageResult<WeatherDisasterLibraryDO> getWeatherDisasterLibraryPage(WeatherDisasterLibraryPageReqVO pageReqVO) {
|
|
||||||
PageResult<WeatherDisasterLibraryDO> pageResult = weatherDisasterLibraryMapper.selectPage(pageReqVO);
|
|
||||||
if (pageResult.getList() != null) {
|
|
||||||
// 触发图片集合转换,确保分页结果中的每个DO对象都包含转换后的图片集合
|
|
||||||
pageResult.getList().forEach(weatherDisasterLibrary -> {
|
|
||||||
if (weatherDisasterLibrary != null) {
|
|
||||||
weatherDisasterLibrary.getImageList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return pageResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,339 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.farm.utils;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.dict.vo.SpeciesClassifyLibraryRespVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.specieslibrary.vo.TwoDictTreeRespVO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.sysDict.SysDictDO;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 树结构构建工具类
|
|
||||||
*
|
|
||||||
* @author binda
|
|
||||||
* @date 2025/1/27
|
|
||||||
*/
|
|
||||||
public class TreeStructureUtil {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建物种类别树结构(支持三级分类)
|
|
||||||
* 说明:该方法基于 TwoDictTreeRespVO 的树(id/name/children)来生成
|
|
||||||
* SpeciesClassifyLibraryRespVO 的三级树。其中:
|
|
||||||
* - 一级:root 节点(parentId == null)
|
|
||||||
* - 二级:root.children
|
|
||||||
* - 三级:child.children,并在第三级填充生命周期(lifeCycle)
|
|
||||||
*/
|
|
||||||
public static List<SpeciesClassifyLibraryRespVO> buildSpeciesClassifyTree(List<TwoDictTreeRespVO> dictList,
|
|
||||||
Map<String, String> lifeCycMap) {
|
|
||||||
if (dictList == null || dictList.isEmpty()) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 兜底,避免 NPE
|
|
||||||
Map<String, String> safeLifeMap = lifeCycMap != null ? lifeCycMap : Collections.emptyMap();
|
|
||||||
|
|
||||||
// 找到所有根节点(parentId == null)
|
|
||||||
List<TwoDictTreeRespVO> level1Nodes = dictList.stream()
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.filter(n -> n.getParentId() == null)
|
|
||||||
.sorted(Comparator.comparing(TwoDictTreeRespVO::getName, Comparator.nullsLast(String::compareTo)))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<SpeciesClassifyLibraryRespVO> result = new ArrayList<>();
|
|
||||||
for (TwoDictTreeRespVO lvl1 : level1Nodes) {
|
|
||||||
if (lvl1.getId() == null || lvl1.getName() == null || lvl1.getName().trim().isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
SpeciesClassifyLibraryRespVO lvl1Vo = new SpeciesClassifyLibraryRespVO(String.valueOf(lvl1.getId()), lvl1.getName());
|
|
||||||
|
|
||||||
// 二级
|
|
||||||
List<SpeciesClassifyLibraryRespVO> lvl2Vos = new ArrayList<>();
|
|
||||||
List<TwoDictTreeRespVO> lvl2Children = lvl1.getChildren();
|
|
||||||
if (lvl2Children != null && !lvl2Children.isEmpty()) {
|
|
||||||
// 按名称排序,提升观感
|
|
||||||
lvl2Children.sort(Comparator.comparing(TwoDictTreeRespVO::getName, Comparator.nullsLast(String::compareTo)));
|
|
||||||
for (TwoDictTreeRespVO lvl2 : lvl2Children) {
|
|
||||||
if (lvl2 == null || lvl2.getId() == null || lvl2.getName() == null || lvl2.getName().trim().isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
SpeciesClassifyLibraryRespVO lvl2Vo = new SpeciesClassifyLibraryRespVO(String.valueOf(lvl2.getId()), lvl2.getName());
|
|
||||||
|
|
||||||
// 三级
|
|
||||||
List<SpeciesClassifyLibraryRespVO> lvl3Vos = new ArrayList<>();
|
|
||||||
List<TwoDictTreeRespVO> lvl3Children = lvl2.getChildren();
|
|
||||||
if (lvl3Children != null && !lvl3Children.isEmpty()) {
|
|
||||||
lvl3Children.sort(Comparator.comparing(TwoDictTreeRespVO::getName, Comparator.nullsLast(String::compareTo)));
|
|
||||||
for (TwoDictTreeRespVO lvl3 : lvl3Children) {
|
|
||||||
if (lvl3 == null || lvl3.getId() == null || lvl3.getName() == null || lvl3.getName().trim().isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// lifeCycMap 的 key 为第三级数据的 ID
|
|
||||||
String lifeCycle = safeLifeMap.get(String.valueOf(lvl3.getId()));
|
|
||||||
lvl3Vos.add(new SpeciesClassifyLibraryRespVO(String.valueOf(lvl3.getId()), lvl3.getName(), lifeCycle));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lvl2Vo.setChildren(lvl3Vos);
|
|
||||||
lvl2Vos.add(lvl2Vo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lvl1Vo.setChildren(lvl2Vos);
|
|
||||||
result.add(lvl1Vo);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 一级按名称排序
|
|
||||||
result.sort(Comparator.comparing(SpeciesClassifyLibraryRespVO::getSpeciesClassName, Comparator.nullsLast(String::compareTo)));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建物种类别二级树结构
|
|
||||||
*
|
|
||||||
* @param dictList 字典数据列表
|
|
||||||
* @return 二级树形结构列表
|
|
||||||
*/
|
|
||||||
public static List<SpeciesClassifyLibraryRespVO> buildTwoLevelTree(List<SysDictDO> dictList) {
|
|
||||||
if (dictList == null || dictList.isEmpty()) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 按一级分类分组
|
|
||||||
Map<String, List<SysDictDO>> groupedByLevel1 = dictList.stream()
|
|
||||||
.filter(dict -> isValidLevel1Node(dict))
|
|
||||||
.collect(Collectors.groupingBy(
|
|
||||||
SysDictDO::getField1Code,
|
|
||||||
Collectors.toList()
|
|
||||||
));
|
|
||||||
|
|
||||||
// 构建二级树形结构
|
|
||||||
return groupedByLevel1.entrySet().stream()
|
|
||||||
.map(entry -> buildTwoLevelNode(entry.getKey(), entry.getValue()))
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.sorted(Comparator.comparing(SpeciesClassifyLibraryRespVO::getSpeciesClassName))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 记录错误日志,返回空列表
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建通用树结构
|
|
||||||
*
|
|
||||||
* @param dataList 数据列表
|
|
||||||
* @param idGetter ID获取函数
|
|
||||||
* @param parentIdGetter 父ID获取函数
|
|
||||||
* @param childrenSetter 子节点设置函数
|
|
||||||
* @param <T> 数据类型
|
|
||||||
* @return 树形结构列表
|
|
||||||
*/
|
|
||||||
public static <T> List<T> buildGenericTree(List<T> dataList,
|
|
||||||
Function<T, String> idGetter,
|
|
||||||
Function<T, String> parentIdGetter,
|
|
||||||
Function<T, List<T>> childrenSetter) {
|
|
||||||
if (dataList == null || dataList.isEmpty()) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 构建ID到对象的映射
|
|
||||||
Map<String, T> idToObjectMap = dataList.stream()
|
|
||||||
.collect(Collectors.toMap(idGetter, Function.identity(), (existing, replacement) -> existing));
|
|
||||||
|
|
||||||
List<T> rootNodes = new ArrayList<>();
|
|
||||||
|
|
||||||
for (T item : dataList) {
|
|
||||||
String parentId = parentIdGetter.apply(item);
|
|
||||||
|
|
||||||
if (parentId == null || parentId.isEmpty() || !idToObjectMap.containsKey(parentId)) {
|
|
||||||
// 根节点
|
|
||||||
rootNodes.add(item);
|
|
||||||
} else {
|
|
||||||
// 子节点,添加到父节点的children中
|
|
||||||
T parent = idToObjectMap.get(parentId);
|
|
||||||
List<T> children = childrenSetter.apply(parent);
|
|
||||||
if (children == null) {
|
|
||||||
children = new ArrayList<>();
|
|
||||||
// 这里需要根据实际情况设置children,可能需要反射或其他方式
|
|
||||||
}
|
|
||||||
children.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rootNodes;
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证一级节点数据有效性
|
|
||||||
*/
|
|
||||||
private static boolean isValidLevel1Node(SysDictDO dict) {
|
|
||||||
return dict != null
|
|
||||||
&& dict.getField1Code() != null
|
|
||||||
&& !dict.getField1Code().trim().isEmpty()
|
|
||||||
&& dict.getField1Name() != null
|
|
||||||
&& !dict.getField1Name().trim().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证二级节点数据有效性
|
|
||||||
*/
|
|
||||||
private static boolean isValidLevel2Node(SysDictDO dict) {
|
|
||||||
return dict != null
|
|
||||||
&& dict.getField2Code() != null
|
|
||||||
&& !dict.getField2Code().trim().isEmpty()
|
|
||||||
&& dict.getField2Name() != null
|
|
||||||
&& !dict.getField2Name().trim().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证三级节点数据有效性
|
|
||||||
*/
|
|
||||||
private static boolean isValidLevel3Node(SysDictDO dict) {
|
|
||||||
return dict != null
|
|
||||||
&& dict.getField3Code() != null
|
|
||||||
&& !dict.getField3Code().trim().isEmpty()
|
|
||||||
&& dict.getField3Name() != null
|
|
||||||
&& !dict.getField3Name().trim().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建一级节点(包含二级和三级)
|
|
||||||
*/
|
|
||||||
private static SpeciesClassifyLibraryRespVO buildLevel1Node(String level1Code, List<SysDictDO> level1Children,
|
|
||||||
List<SysDictDO> allDictList,Map<String, String> lifeCycMap) {
|
|
||||||
if (level1Children == null || level1Children.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取一级分类名称
|
|
||||||
String level1Name = level1Children.stream()
|
|
||||||
.filter(TreeStructureUtil::isValidLevel1Node)
|
|
||||||
.map(SysDictDO::getField1Name)
|
|
||||||
.findFirst()
|
|
||||||
.orElse("");
|
|
||||||
|
|
||||||
if (level1Name.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建一级节点
|
|
||||||
SpeciesClassifyLibraryRespVO level1Node = new SpeciesClassifyLibraryRespVO(level1Code, level1Name);
|
|
||||||
|
|
||||||
// 按二级分类分组
|
|
||||||
Map<String, List<SysDictDO>> groupedByLevel2 = level1Children.stream()
|
|
||||||
.filter(dict -> isValidLevel2Node(dict))
|
|
||||||
.collect(Collectors.groupingBy(
|
|
||||||
SysDictDO::getField2Code,
|
|
||||||
Collectors.toList()
|
|
||||||
));
|
|
||||||
|
|
||||||
// 构建二级节点列表
|
|
||||||
List<SpeciesClassifyLibraryRespVO> level2Nodes = groupedByLevel2.entrySet().stream()
|
|
||||||
.map(entry -> buildLevel2Node(entry.getKey(), entry.getValue(), allDictList,lifeCycMap))
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.sorted(Comparator.comparing(SpeciesClassifyLibraryRespVO::getSpeciesClassName))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
level1Node.setChildren(level2Nodes);
|
|
||||||
return level1Node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建二级节点(包含三级)
|
|
||||||
*/
|
|
||||||
private static SpeciesClassifyLibraryRespVO buildLevel2Node(String level2Code, List<SysDictDO> level2Children,
|
|
||||||
List<SysDictDO> allDictList,Map<String, String> lifeCycMap) {
|
|
||||||
if (level2Children == null || level2Children.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取二级分类名称
|
|
||||||
String level2Name = level2Children.stream()
|
|
||||||
.filter(TreeStructureUtil::isValidLevel2Node)
|
|
||||||
.map(SysDictDO::getField2Name)
|
|
||||||
.findFirst()
|
|
||||||
.orElse("");
|
|
||||||
|
|
||||||
if (level2Name.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建二级节点
|
|
||||||
SpeciesClassifyLibraryRespVO level2Node = new SpeciesClassifyLibraryRespVO(level2Code, level2Name);
|
|
||||||
|
|
||||||
// 查找该二级分类下的所有三级分类
|
|
||||||
List<SpeciesClassifyLibraryRespVO> level3Nodes = allDictList.stream()
|
|
||||||
.filter(dict -> isValidLevel3Node(dict)
|
|
||||||
&& level2Code.equals(dict.getField2Code()))
|
|
||||||
.map(dict -> new SpeciesClassifyLibraryRespVO(dict.getField3Code(), dict.getField3Name(),lifeCycMap.get(dict.getField3Name())))
|
|
||||||
.sorted(Comparator.comparing(SpeciesClassifyLibraryRespVO::getSpeciesClassName))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
level2Node.setChildren(level3Nodes);
|
|
||||||
return level2Node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建二级树节点(只包含一级和二级,不包含三级)
|
|
||||||
*/
|
|
||||||
private static SpeciesClassifyLibraryRespVO buildTwoLevelNode(String level1Code, List<SysDictDO> level1Children) {
|
|
||||||
if (level1Children == null || level1Children.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取一级分类名称
|
|
||||||
String level1Name = level1Children.stream()
|
|
||||||
.filter(TreeStructureUtil::isValidLevel1Node)
|
|
||||||
.map(SysDictDO::getField1Name)
|
|
||||||
.findFirst()
|
|
||||||
.orElse("");
|
|
||||||
|
|
||||||
if (level1Name.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建一级节点
|
|
||||||
SpeciesClassifyLibraryRespVO level1Node = new SpeciesClassifyLibraryRespVO(level1Code, level1Name);
|
|
||||||
|
|
||||||
// 按二级分类分组
|
|
||||||
Map<String, List<SysDictDO>> groupedByLevel2 = level1Children.stream()
|
|
||||||
.filter(dict -> isValidLevel2Node(dict))
|
|
||||||
.collect(Collectors.groupingBy(
|
|
||||||
SysDictDO::getField2Code,
|
|
||||||
Collectors.toList()
|
|
||||||
));
|
|
||||||
|
|
||||||
// 构建二级节点列表(不包含三级)
|
|
||||||
List<SpeciesClassifyLibraryRespVO> level2Nodes = groupedByLevel2.entrySet().stream()
|
|
||||||
.map(entry -> {
|
|
||||||
String level2Code = entry.getKey();
|
|
||||||
List<SysDictDO> level2Children = entry.getValue();
|
|
||||||
|
|
||||||
// 获取二级分类名称
|
|
||||||
String level2Name = level2Children.stream()
|
|
||||||
.filter(TreeStructureUtil::isValidLevel2Node)
|
|
||||||
.map(SysDictDO::getField2Name)
|
|
||||||
.findFirst()
|
|
||||||
.orElse("");
|
|
||||||
|
|
||||||
if (level2Name.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建二级节点(不设置children,即不包含三级分类)
|
|
||||||
return new SpeciesClassifyLibraryRespVO(level2Code, level2Name);
|
|
||||||
})
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.sorted(Comparator.comparing(SpeciesClassifyLibraryRespVO::getSpeciesClassName))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
level1Node.setChildren(level2Nodes);
|
|
||||||
return level1Node;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?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.cultivationarea.CultivationAreaMapper">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
||||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
||||||
-->
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?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.deviceplotrelation.DevicePlotRelationMapper">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
||||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
||||||
-->
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<?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.speciesclassifylibrary.SpeciesClassifyLibraryMapper">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
||||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
||||||
-->
|
|
||||||
|
|
||||||
<sql id="all_fields">
|
|
||||||
t.id,
|
|
||||||
t.primary_class_code,
|
|
||||||
t.primary_class_name,
|
|
||||||
t.secondary_class_code,
|
|
||||||
t.secondary_class_name,
|
|
||||||
t.use_status,
|
|
||||||
t.creator,
|
|
||||||
t.create_time,
|
|
||||||
t.updater,
|
|
||||||
t.update_time
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="getSpeciesClassifyLibraryList"
|
|
||||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.dict.vo.SpeciesClassifyLibraryReqVO"
|
|
||||||
resultType="cn.iocoder.yudao.module.farm.dal.dataobject.speciesclassifylibrary.SpeciesClassifyLibraryDO">
|
|
||||||
|
|
||||||
SELECT <include refid="all_fields"/> FROM farm_species_classify_library t
|
|
||||||
<where>
|
|
||||||
<if test="req.id != null">
|
|
||||||
AND t.id = #{req.id}
|
|
||||||
</if>
|
|
||||||
<if test="req.primaryClassCode != null and req.primaryClassCode != ''">
|
|
||||||
AND t.tprimary_class_code = #{req.primaryClassCode}
|
|
||||||
</if>
|
|
||||||
<if test="req.primaryClassName != null and req.primaryClassName != ''">
|
|
||||||
AND t.primary_class_name LIKE CONCAT('%', #{req.primaryClassName}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="req.secondaryClassCode != null and req.secondaryClassCode != ''">
|
|
||||||
AND t.secondary_class_code = #{req.secondaryClassCode}
|
|
||||||
</if>
|
|
||||||
<if test="req.secondaryClassName != null and req.secondaryClassName != ''">
|
|
||||||
AND t.secondary_class_name LIKE CONCAT('%', #{req.secondaryClassName}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="req.useStatus != null">
|
|
||||||
AND t.use_status = #{req.useStatus}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?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.weatherdisasterlibrary.WeatherDisasterLibraryMapper">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
||||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
||||||
-->
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
Reference in New Issue
Block a user