From 56ce311c38c3e734a2573bf8e191e4907521d124 Mon Sep 17 00:00:00 2001 From: xjm Date: Wed, 14 Aug 2024 16:02:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B0=B4=E5=BA=93=E5=B7=A5=E7=A8=8B=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=96=B0=E5=A2=9E=E4=BF=AE=E6=94=B9,=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=96=87=E4=BB=B6=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gunshi/project/xyt/controller/ResProjectImgController.java | 2 ++ src/main/java/com/gunshi/project/xyt/model/ResProjectImg.java | 3 +++ .../gunshi/project/xyt/service/FileAssociationsService.java | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gunshi/project/xyt/controller/ResProjectImgController.java b/src/main/java/com/gunshi/project/xyt/controller/ResProjectImgController.java index d11a688..2537b83 100644 --- a/src/main/java/com/gunshi/project/xyt/controller/ResProjectImgController.java +++ b/src/main/java/com/gunshi/project/xyt/controller/ResProjectImgController.java @@ -1,5 +1,6 @@ package com.gunshi.project.xyt.controller; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.gunshi.core.result.R; import com.gunshi.project.xyt.entity.so.ResCodeSo; import com.gunshi.project.xyt.model.ResProjectImg; @@ -46,6 +47,7 @@ public class ResProjectImgController extends AbstractCommonFileController{ if (Objects.isNull(resService.getById(dto.getResCode()))){ throw new RuntimeException("当前水库不存在"); } + dto.setId(IdWorker.getId()); dto.setModitime(new Date()); boolean result = service.save(dto); if (result){ diff --git a/src/main/java/com/gunshi/project/xyt/model/ResProjectImg.java b/src/main/java/com/gunshi/project/xyt/model/ResProjectImg.java index 49c9229..caaab07 100644 --- a/src/main/java/com/gunshi/project/xyt/model/ResProjectImg.java +++ b/src/main/java/com/gunshi/project/xyt/model/ResProjectImg.java @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.gunshi.core.dateformat.DateFormatString; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; @@ -37,6 +39,7 @@ public class ResProjectImg implements Serializable { @Schema(description="主键") // @Size(max = 0,message = "主键最大长度要小于 0") @NotNull(message = "主键不能为空") + @JsonSerialize(using = ToStringSerializer.class) private Long id; /** diff --git a/src/main/java/com/gunshi/project/xyt/service/FileAssociationsService.java b/src/main/java/com/gunshi/project/xyt/service/FileAssociationsService.java index ea534d0..da303ed 100644 --- a/src/main/java/com/gunshi/project/xyt/service/FileAssociationsService.java +++ b/src/main/java/com/gunshi/project/xyt/service/FileAssociationsService.java @@ -55,7 +55,7 @@ public class FileAssociationsService extends ServiceImpl