farm模块-农事操作示意图转换
This commit is contained in:
@@ -85,6 +85,13 @@ public class BaseInfoController {
|
|||||||
return success(BeanUtils.toBean(pageResult, BaseInfoRespVO.class));
|
return success(BeanUtils.toBean(pageResult, BaseInfoRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getList")
|
||||||
|
@Operation(summary = "获得基地分页")
|
||||||
|
public CommonResult<List<BaseInfoRespVO>> getList(@Valid BaseInfoPageReqVO pageReqVO) {
|
||||||
|
List<BaseInfoDO> pageResult = baseInfoService.getList(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, BaseInfoRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出基地 Excel")
|
@Operation(summary = "导出基地 Excel")
|
||||||
@ApiAccessLog(operateType = EXPORT)
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package cn.iocoder.yudao.module.farm.controller.admin.modelfarmingoperation.vo;
|
package cn.iocoder.yudao.module.farm.controller.admin.modelfarmingoperation.vo;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
@@ -18,7 +18,7 @@ public class ModelFarmingOperationPageReqVO extends PageParam {
|
|||||||
|
|
||||||
@Schema(description = "农事名称id", example = "赵六")
|
@Schema(description = "农事名称id", example = "赵六")
|
||||||
private String farmingName;
|
private String farmingName;
|
||||||
|
private String farmingId;
|
||||||
@Schema(description = "操作开始时期(天)")
|
@Schema(description = "操作开始时期(天)")
|
||||||
private Integer startingPeriod;
|
private Integer startingPeriod;
|
||||||
|
|
||||||
@@ -33,6 +33,8 @@ public class ModelFarmingOperationPageReqVO extends PageParam {
|
|||||||
|
|
||||||
@Schema(description = "操作示意图")
|
@Schema(description = "操作示意图")
|
||||||
private String sketch;
|
private String sketch;
|
||||||
|
@Schema(description = "操作示意图集合")
|
||||||
|
private java.util.List<String> sketchList;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ModelFarmingOperationRespVO {
|
|||||||
@Schema(description = "农事名称id", example = "赵六")
|
@Schema(description = "农事名称id", example = "赵六")
|
||||||
@ExcelProperty("农事名称id")
|
@ExcelProperty("农事名称id")
|
||||||
private String farmingName;
|
private String farmingName;
|
||||||
|
private String farmingId;
|
||||||
@Schema(description = "操作开始时期(天)")
|
@Schema(description = "操作开始时期(天)")
|
||||||
@ExcelProperty("操作开始时期(天)")
|
@ExcelProperty("操作开始时期(天)")
|
||||||
private Integer startingPeriod;
|
private Integer startingPeriod;
|
||||||
@@ -45,6 +45,9 @@ public class ModelFarmingOperationRespVO {
|
|||||||
@Schema(description = "操作示意图")
|
@Schema(description = "操作示意图")
|
||||||
@ExcelProperty("操作示意图")
|
@ExcelProperty("操作示意图")
|
||||||
private String sketch;
|
private String sketch;
|
||||||
|
@Schema(description = "操作示意图集合")
|
||||||
|
@ExcelProperty("操作示意图集合")
|
||||||
|
private List<String> sketchList;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
@ExcelProperty("创建时间")
|
@ExcelProperty("创建时间")
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public class ModelFarmingOperationSaveReqVO {
|
|||||||
|
|
||||||
@Schema(description = "操作示意图")
|
@Schema(description = "操作示意图")
|
||||||
private String sketch;
|
private String sketch;
|
||||||
|
@Schema(description = "操作示意图集合")
|
||||||
|
private List<String> sketchList;
|
||||||
|
|
||||||
@Schema(description = "基地id", example = "20985")
|
@Schema(description = "基地id", example = "20985")
|
||||||
private String baseId;
|
private String baseId;
|
||||||
@@ -48,6 +50,6 @@ public class ModelFarmingOperationSaveReqVO {
|
|||||||
|
|
||||||
@Schema(description = "租户id", example = "31485")
|
@Schema(description = "租户id", example = "31485")
|
||||||
private String tenantId;
|
private String tenantId;
|
||||||
|
private String farmingId;
|
||||||
private List<ModelFarmingOperationInputDO> investGoodsList;
|
private List<ModelFarmingOperationInputDO> investGoodsList;
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.farm.dal.dataobject.modelfarmingoperation;
|
package cn.iocoder.yudao.module.farm.dal.dataobject.modelfarmingoperation;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelfarmingoperationinput.ModelFarmingOperationInputDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.modelfarmingoperationinput.ModelFarmingOperationInputDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.framework.util.ImageCollectionUtil;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
@@ -34,6 +33,10 @@ public class ModelFarmingOperationDO extends BaseDO {
|
|||||||
* 周期id
|
* 周期id
|
||||||
*/
|
*/
|
||||||
private String cycleId;
|
private String cycleId;
|
||||||
|
/**
|
||||||
|
* 农事名称id
|
||||||
|
*/
|
||||||
|
private String farmingId;
|
||||||
/**
|
/**
|
||||||
* 农事名称id
|
* 农事名称id
|
||||||
*/
|
*/
|
||||||
@@ -58,6 +61,11 @@ public class ModelFarmingOperationDO extends BaseDO {
|
|||||||
* 操作示意图
|
* 操作示意图
|
||||||
*/
|
*/
|
||||||
private String sketch;
|
private String sketch;
|
||||||
|
/**
|
||||||
|
* 操作示意图集合(业务层使用)
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> sketchList;
|
||||||
/**
|
/**
|
||||||
* 基地id
|
* 基地id
|
||||||
*/
|
*/
|
||||||
@@ -78,4 +86,22 @@ public class ModelFarmingOperationDO extends BaseDO {
|
|||||||
private String tenantId;
|
private String tenantId;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<ModelFarmingOperationInputDO> investGoodsList;
|
private List<ModelFarmingOperationInputDO> investGoodsList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取操作示意图集合
|
||||||
|
*/
|
||||||
|
public List<String> getSketchList() {
|
||||||
|
if (sketchList == null) {
|
||||||
|
sketchList = ImageCollectionUtil.toImageList(this.sketch);
|
||||||
|
}
|
||||||
|
return sketchList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置操作示意图集合
|
||||||
|
*/
|
||||||
|
public void setSketchList(List<String> sketchList) {
|
||||||
|
this.sketchList = sketchList;
|
||||||
|
this.sketch = ImageCollectionUtil.toDatabaseString(sketchList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -35,4 +35,6 @@ public interface ModelFarmingOperationInputMapper extends BaseMapperX<ModelFarmi
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<ModelFarmingOperationInputDO> selectByFarmingId(String farmingId);
|
List<ModelFarmingOperationInputDO> selectByFarmingId(String farmingId);
|
||||||
|
|
||||||
|
void deleteByFarmingId(String farmingId);
|
||||||
}
|
}
|
||||||
@@ -68,4 +68,6 @@ public interface BaseInfoService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<BaseNameRespVO> getBaseNameList();
|
List<BaseNameRespVO> getBaseNameList();
|
||||||
|
|
||||||
|
List<BaseInfoDO> getList(@Valid BaseInfoPageReqVO pageReqVO);
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
|||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.baseinfo.BaseInfoMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.baseinfo.BaseInfoMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.plotinfo.PlotInfoMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.plotinfo.PlotInfoMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -124,4 +125,11 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BaseInfoDO> getList(BaseInfoPageReqVO pageReqVO) {
|
||||||
|
LambdaQueryWrapper<BaseInfoDO> qw = new LambdaQueryWrapper<>();
|
||||||
|
qw.eq(BaseInfoDO::getTenantId, getLoginUser().getTenantId());
|
||||||
|
return baseInfoMapper.selectList(qw);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,11 @@ public class ModelFarmingOperationServiceImpl implements ModelFarmingOperationSe
|
|||||||
modelFarmingOperation.setId(IdUtil.fastUUID());
|
modelFarmingOperation.setId(IdUtil.fastUUID());
|
||||||
modelFarmingOperation.setTenantId(String.valueOf(user.getTenantId()));
|
modelFarmingOperation.setTenantId(String.valueOf(user.getTenantId()));
|
||||||
modelFarmingOperationMapper.insert(modelFarmingOperation);
|
modelFarmingOperationMapper.insert(modelFarmingOperation);
|
||||||
|
createReqVO.getInvestGoodsList().forEach(e -> {
|
||||||
|
e.setId(IdUtil.fastUUID());
|
||||||
|
e.setFarmingId(modelFarmingOperation.getId());
|
||||||
|
modelFarmingOperationInputMapper.insert(e);
|
||||||
|
});
|
||||||
// 返回
|
// 返回
|
||||||
return modelFarmingOperation.getId();
|
return modelFarmingOperation.getId();
|
||||||
}
|
}
|
||||||
@@ -55,6 +59,12 @@ public class ModelFarmingOperationServiceImpl implements ModelFarmingOperationSe
|
|||||||
// 更新
|
// 更新
|
||||||
ModelFarmingOperationDO updateObj = BeanUtils.toBean(updateReqVO, ModelFarmingOperationDO.class);
|
ModelFarmingOperationDO updateObj = BeanUtils.toBean(updateReqVO, ModelFarmingOperationDO.class);
|
||||||
modelFarmingOperationMapper.updateById(updateObj);
|
modelFarmingOperationMapper.updateById(updateObj);
|
||||||
|
modelFarmingOperationInputMapper.deleteByFarmingId(updateObj.getId());
|
||||||
|
updateReqVO.getInvestGoodsList().forEach(e -> {
|
||||||
|
e.setId(IdUtil.fastUUID());
|
||||||
|
e.setFarmingId(updateObj.getId());
|
||||||
|
modelFarmingOperationInputMapper.insert(e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!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.modelfarmingoperationinput.ModelFarmingOperationInputMapper">
|
<mapper namespace="cn.iocoder.yudao.module.farm.dal.mysql.modelfarmingoperationinput.ModelFarmingOperationInputMapper">
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
@@ -16,4 +17,10 @@
|
|||||||
where farming_id = #{farmingId}
|
where farming_id = #{farmingId}
|
||||||
and deleted = 0
|
and deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteByFarmingId" parameterType="String">
|
||||||
|
delete
|
||||||
|
from farm_model_farming_operation_input
|
||||||
|
where farming_id = #{farmingId}
|
||||||
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user