diff --git a/src/main/java/jty/expressdistributionsystem/DTO/ExpressListDTO.java b/src/main/java/jty/expressdistributionsystem/DTO/ExpressListDTO.java index d9205f6..9d5e721 100644 --- a/src/main/java/jty/expressdistributionsystem/DTO/ExpressListDTO.java +++ b/src/main/java/jty/expressdistributionsystem/DTO/ExpressListDTO.java @@ -14,15 +14,17 @@ public class ExpressListDTO { private User recipient; // 收件人 private User addressee; // 签收者 private User courier; // 派送的快递员 - private Address address; // 送到哪里 + private Address addressFrom; // 从哪里送的 + private Address addressTo; // 送到哪里 - public ExpressListDTO(Records records, Goods goods, User sender, User recipient, User addressee, User courier, Address address) { + public ExpressListDTO(Records records, Goods goods, User sender, User recipient, User addressee, User courier, Address addressFrom, Address addressTo) { this.records = records; this.goods = goods; this.sender = sender; this.recipient = recipient; this.addressee = addressee; this.courier = courier; - this.address = address; + this.addressFrom = addressFrom; + this.addressTo = addressTo; } } diff --git a/src/main/java/jty/expressdistributionsystem/DTO/GoodsDTO.java b/src/main/java/jty/expressdistributionsystem/DTO/GoodsDTO.java index 08b4773..f33fb46 100644 --- a/src/main/java/jty/expressdistributionsystem/DTO/GoodsDTO.java +++ b/src/main/java/jty/expressdistributionsystem/DTO/GoodsDTO.java @@ -20,8 +20,11 @@ public class GoodsDTO { @NotBlank(message = "快递重量不能为空") private String quality; + @NotBlank(message = "发货地不能为空") + private String addressFrom; + @NotBlank(message = "运送地址不能为空") - private String address; + private String addressTo; @JsonSerialize(using = ToStringSerializer.class) @NotNull diff --git a/src/main/java/jty/expressdistributionsystem/controller/AdminController.java b/src/main/java/jty/expressdistributionsystem/controller/AdminController.java index ea969cd..a69c40e 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/AdminController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/AdminController.java @@ -118,9 +118,10 @@ public class AdminController { User recipient = userService.getById(records.getGetUserId()); User addressee = userService.getById(records.getAddresseeId()); User courier = userService.getById(records.getExpressId()); - // 查询地址信息 - Address address = addressService.getById(records.getAddressId()); - ExpressListDTO expressListDTO = new ExpressListDTO(records, goods, sender, recipient, addressee, courier, address); + // 查询地址信息: 从哪里送的 送到哪里 + Address addressTo = addressService.getById(records.getAddressId()); + Address addressFrom = addressService.getById(records.getAddressFrom()); + ExpressListDTO expressListDTO = new ExpressListDTO(records, goods, sender, recipient, addressee, courier, addressFrom, addressTo); expressListDTOList.add(expressListDTO); } Page expressDTOPage = new Page<>(recordsPage.getCurrent(), recordsPage.getSize(), recordsPage.getTotal()); diff --git a/src/main/java/jty/expressdistributionsystem/controller/UserController.java b/src/main/java/jty/expressdistributionsystem/controller/UserController.java index 5955264..f85a720 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/UserController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/UserController.java @@ -156,7 +156,7 @@ public class UserController { } // 判断地址是否存在 LambdaQueryWrapper
addressLambdaQueryWrapper = new LambdaQueryWrapper<>(); - addressLambdaQueryWrapper.eq(Address::getAddress, goodsDTO.getAddress()); + addressLambdaQueryWrapper.eq(Address::getAddress, goodsDTO.getAddressTo()); Address address = addressService.getOne(addressLambdaQueryWrapper); if (address == null) { return new Result<>(404, "地址不存在", null); diff --git a/src/main/java/jty/expressdistributionsystem/entity/Records.java b/src/main/java/jty/expressdistributionsystem/entity/Records.java index d9d20f4..3a12b19 100644 --- a/src/main/java/jty/expressdistributionsystem/entity/Records.java +++ b/src/main/java/jty/expressdistributionsystem/entity/Records.java @@ -33,6 +33,7 @@ public class Records implements Serializable { @NotNull private Long getUserId; + @TableField("express_id") @JsonSerialize(using = ToStringSerializer.class) @NotNull private Long expressId; @@ -45,7 +46,13 @@ public class Records implements Serializable { @TableField("mark") private Integer mark; - @TableField + // 从哪里送的 + @TableField("address_from") + @JsonSerialize(using = ToStringSerializer.class) + private Long addressFrom; + + // 送到哪里 + @TableField("address_id") @JsonSerialize(using = ToStringSerializer.class) private Long addressId;