farm模块-地块网格完善
This commit is contained in:
@@ -0,0 +1,104 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.gridinfo;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import jakarta.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.gridinfo.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.gridinfo.GridInfoDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.gridinfo.GridInfoService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 网格")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/farm/grid-info")
|
||||||
|
@Validated
|
||||||
|
public class GridInfoController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GridInfoService gridInfoService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建网格")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:grid-info:create')")
|
||||||
|
public CommonResult<String> createGridInfo(@Valid @RequestBody GridInfoSaveReqVO createReqVO) {
|
||||||
|
return success(gridInfoService.createGridInfo(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新网格")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:grid-info:update')")
|
||||||
|
public CommonResult<Boolean> updateGridInfo(@Valid @RequestBody GridInfoSaveReqVO updateReqVO) {
|
||||||
|
gridInfoService.updateGridInfo(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除网格")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:grid-info:delete')")
|
||||||
|
public CommonResult<Boolean> deleteGridInfo(@RequestParam("id") String id) {
|
||||||
|
gridInfoService.deleteGridInfo(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除网格")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:grid-info:delete')")
|
||||||
|
public CommonResult<Boolean> deleteGridInfoList(@RequestParam("ids") List<String> ids) {
|
||||||
|
gridInfoService.deleteGridInfoListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得网格")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:grid-info:query')")
|
||||||
|
public CommonResult<GridInfoRespVO> getGridInfo(@RequestParam("id") String id) {
|
||||||
|
GridInfoDO gridInfo = gridInfoService.getGridInfo(id);
|
||||||
|
return success(BeanUtils.toBean(gridInfo, GridInfoRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得网格分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:grid-info:query')")
|
||||||
|
public CommonResult<PageResult<GridInfoRespVO>> getGridInfoPage(@Valid GridInfoPageReqVO pageReqVO) {
|
||||||
|
PageResult<GridInfoDO> pageResult = gridInfoService.getGridInfoPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, GridInfoRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出网格 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:grid-info:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportGridInfoExcel(@Valid GridInfoPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<GridInfoDO> list = gridInfoService.getGridInfoPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "网格.xls", "数据", GridInfoRespVO.class,
|
||||||
|
BeanUtils.toBean(list, GridInfoRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.gridinfo.vo;
|
||||||
|
|
||||||
|
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 GridInfoPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "类型", example = "2")
|
||||||
|
private byte[] type;
|
||||||
|
|
||||||
|
@Schema(description = "行")
|
||||||
|
private String manager;
|
||||||
|
|
||||||
|
@Schema(description = "列")
|
||||||
|
private BigDecimal area;
|
||||||
|
|
||||||
|
@Schema(description = "颜色")
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "租户编号")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
@Schema(description = "地块id")
|
||||||
|
private String plotId;
|
||||||
|
|
||||||
|
@Schema(description = "描述")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.gridinfo.vo;
|
||||||
|
|
||||||
|
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 GridInfoRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12052")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "类型", example = "2")
|
||||||
|
@ExcelProperty("类型")
|
||||||
|
private byte[] type;
|
||||||
|
|
||||||
|
@Schema(description = "行")
|
||||||
|
@ExcelProperty("行")
|
||||||
|
private String manager;
|
||||||
|
|
||||||
|
@Schema(description = "列")
|
||||||
|
@ExcelProperty("列")
|
||||||
|
private BigDecimal area;
|
||||||
|
|
||||||
|
@Schema(description = "颜色")
|
||||||
|
@ExcelProperty("颜色")
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "租户编号")
|
||||||
|
@ExcelProperty("租户编号")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
@Schema(description = "地块id")
|
||||||
|
@ExcelProperty("地块id")
|
||||||
|
private String plotId;
|
||||||
|
|
||||||
|
@Schema(description = "描述")
|
||||||
|
@ExcelProperty("描述")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.gridinfo.vo;
|
||||||
|
|
||||||
|
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 GridInfoSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12052")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "类型", example = "2")
|
||||||
|
private byte[] type;
|
||||||
|
|
||||||
|
@Schema(description = "行")
|
||||||
|
private String manager;
|
||||||
|
|
||||||
|
@Schema(description = "列")
|
||||||
|
private BigDecimal area;
|
||||||
|
|
||||||
|
@Schema(description = "颜色")
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
@Schema(description = "租户编号")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
@Schema(description = "地块id")
|
||||||
|
private String plotId;
|
||||||
|
|
||||||
|
@Schema(description = "描述")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.dal.dataobject.gridinfo;
|
||||||
|
|
||||||
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网格 DO
|
||||||
|
*
|
||||||
|
* @author 万懋超级管理
|
||||||
|
*/
|
||||||
|
@TableName("farm_grid_info")
|
||||||
|
@KeySequence("farm_grid_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GridInfoDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.INPUT)
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private byte[] type;
|
||||||
|
/**
|
||||||
|
* 行
|
||||||
|
*/
|
||||||
|
private String manager;
|
||||||
|
/**
|
||||||
|
* 列
|
||||||
|
*/
|
||||||
|
private BigDecimal area;
|
||||||
|
/**
|
||||||
|
* 颜色
|
||||||
|
*/
|
||||||
|
private String color;
|
||||||
|
/**
|
||||||
|
* 地块id
|
||||||
|
*/
|
||||||
|
private String plotId;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
@Schema(description = "租户编号")
|
||||||
|
private String tenantId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.dal.mysql.gridinfo;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
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.dal.dataobject.gridinfo.GridInfoDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.gridinfo.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网格 Mapper
|
||||||
|
*
|
||||||
|
* @author 万懋超级管理
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface GridInfoMapper extends BaseMapperX<GridInfoDO> {
|
||||||
|
|
||||||
|
default PageResult<GridInfoDO> selectPage(GridInfoPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<GridInfoDO>()
|
||||||
|
.eqIfPresent(GridInfoDO::getType, reqVO.getType())
|
||||||
|
.eqIfPresent(GridInfoDO::getManager, reqVO.getManager())
|
||||||
|
.eqIfPresent(GridInfoDO::getArea, reqVO.getArea())
|
||||||
|
.eqIfPresent(GridInfoDO::getColor, reqVO.getColor())
|
||||||
|
.betweenIfPresent(GridInfoDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(GridInfoDO::getTenantId, reqVO.getTenantId())
|
||||||
|
.eqIfPresent(GridInfoDO::getPlotId, reqVO.getPlotId())
|
||||||
|
.eqIfPresent(GridInfoDO::getDescribe, reqVO.getDescribe())
|
||||||
|
.orderByDesc(GridInfoDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -107,6 +107,6 @@ public interface ErrorCodeConstants {
|
|||||||
|
|
||||||
// ========== 模型管理 1_050_032_000 ==========
|
// ========== 模型管理 1_050_032_000 ==========
|
||||||
ErrorCode SCREEN_DISASTER_DATA_NOT_EXISTS = new ErrorCode(1_050_032_000, "灾害数据不存在");
|
ErrorCode SCREEN_DISASTER_DATA_NOT_EXISTS = new ErrorCode(1_050_032_000, "灾害数据不存在");
|
||||||
|
// ========== 网格 1_050_033_000 ==========
|
||||||
|
ErrorCode GRID_INFO_NOT_EXISTS = new ErrorCode(1_050_033_000, "网格不存在");
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.service.gridinfo;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.gridinfo.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.gridinfo.GridInfoDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网格 Service 接口
|
||||||
|
*
|
||||||
|
* @author 万懋超级管理
|
||||||
|
*/
|
||||||
|
public interface GridInfoService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建网格
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
String createGridInfo(@Valid GridInfoSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新网格
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateGridInfo(@Valid GridInfoSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除网格
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteGridInfo(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除网格
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteGridInfoListByIds(List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得网格
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 网格
|
||||||
|
*/
|
||||||
|
GridInfoDO getGridInfo(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得网格分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 网格分页
|
||||||
|
*/
|
||||||
|
PageResult<GridInfoDO> getGridInfoPage(GridInfoPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.service.gridinfo;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.gridinfo.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.gridinfo.GridInfoDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.mysql.gridinfo.GridInfoMapper;
|
||||||
|
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网格 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 万懋超级管理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class GridInfoServiceImpl implements GridInfoService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GridInfoMapper gridInfoMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createGridInfo(GridInfoSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
GridInfoDO gridInfo = BeanUtils.toBean(createReqVO, GridInfoDO.class);
|
||||||
|
gridInfoMapper.insert(gridInfo);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return gridInfo.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGridInfo(GridInfoSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateGridInfoExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
GridInfoDO updateObj = BeanUtils.toBean(updateReqVO, GridInfoDO.class);
|
||||||
|
gridInfoMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteGridInfo(String id) {
|
||||||
|
// 校验存在
|
||||||
|
validateGridInfoExists(id);
|
||||||
|
// 删除
|
||||||
|
gridInfoMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteGridInfoListByIds(List<String> ids) {
|
||||||
|
// 删除
|
||||||
|
gridInfoMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateGridInfoExists(String id) {
|
||||||
|
if (gridInfoMapper.selectById(id) == null) {
|
||||||
|
throw exception(GRID_INFO_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GridInfoDO getGridInfo(String id) {
|
||||||
|
return gridInfoMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<GridInfoDO> getGridInfoPage(GridInfoPageReqVO pageReqVO) {
|
||||||
|
return gridInfoMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ import cn.iocoder.yudao.module.farm.dal.mysql.modelmanagement.ModelManagementMap
|
|||||||
import cn.iocoder.yudao.module.farm.dal.mysql.modelpestdiseaseweed.ModelPestDiseaseWeedMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.modelpestdiseaseweed.ModelPestDiseaseWeedMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.modelweatherdisaster.ModelWeatherDisasterMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.modelweatherdisaster.ModelWeatherDisasterMapper;
|
||||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.sysDict.SysDictService;
|
||||||
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;
|
||||||
@@ -59,7 +60,8 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
|||||||
private ModelFarmingOperationMapper modelFarmingOperationMapper;
|
private ModelFarmingOperationMapper modelFarmingOperationMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ModelFarmingOperationInputMapper modelFarmingOperationInputMapper;
|
private ModelFarmingOperationInputMapper modelFarmingOperationInputMapper;
|
||||||
|
@Resource
|
||||||
|
private SysDictService dictService;
|
||||||
@Override
|
@Override
|
||||||
public String createModelManagement(ModelManagementSaveReqVO createReqVO) {
|
public String createModelManagement(ModelManagementSaveReqVO createReqVO) {
|
||||||
LoginUser user = getLoginUser();
|
LoginUser user = getLoginUser();
|
||||||
@@ -69,6 +71,7 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
|||||||
modelManagement.setTenantId(String.valueOf(user.getTenantId()));
|
modelManagement.setTenantId(String.valueOf(user.getTenantId()));
|
||||||
modelManagement.setIsRelease(0);
|
modelManagement.setIsRelease(0);
|
||||||
modelManagement.setType(CommonConstants.MODEL_TYPE_1);
|
modelManagement.setType(CommonConstants.MODEL_TYPE_1);
|
||||||
|
dictService.getDictByField3Code(createReqVO.getSpeciesId());
|
||||||
// 处理suitablePlantingAreas字段,优先使用集合
|
// 处理suitablePlantingAreas字段,优先使用集合
|
||||||
if (createReqVO.getSuitablePlantingAreas() != null && !createReqVO.getSuitablePlantingAreas().isEmpty()) {
|
if (createReqVO.getSuitablePlantingAreas() != null && !createReqVO.getSuitablePlantingAreas().isEmpty()) {
|
||||||
modelManagement.setSuitablePlantingAreasList(createReqVO.getSuitablePlantingAreas());
|
modelManagement.setSuitablePlantingAreasList(createReqVO.getSuitablePlantingAreas());
|
||||||
|
|||||||
@@ -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.gridinfo.GridInfoMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user