|
@@ -0,0 +1,72 @@
|
|
|
+package com.chelvc.cloud.maintain.controller;
|
|
|
+import com.chelvc.cloud.vehicle.client.UserReceiveAddressClient;
|
|
|
+import com.chelvc.cloud.vehicle.client.dto.UserReceiveAddressDTO;
|
|
|
+import com.chelvc.cloud.vehicle.client.param.UserReceiveAddressModifyParam;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import javax.validation.Valid;
|
|
|
+import javax.validation.constraints.Min;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 用户常用地址接口
|
|
|
+ *
|
|
|
+ * @author liude
|
|
|
+ * @date 2024/4/30
|
|
|
+ */
|
|
|
+@Validated
|
|
|
+@RestController
|
|
|
+@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
|
|
+public class UserReceiveAddressController {
|
|
|
+ private final UserReceiveAddressClient userReceiveAddressClient;
|
|
|
+ /**
|
|
|
+ * 新增用户常用地址
|
|
|
+ *
|
|
|
+ * @param param 新增参数
|
|
|
+ * @return 用户常用地址主键
|
|
|
+ */
|
|
|
+ @PostMapping("/userReceiveAddress/save")
|
|
|
+ public void add(@RequestBody @Valid UserReceiveAddressModifyParam param) {
|
|
|
+ this.userReceiveAddressClient.add(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改用户常用地址
|
|
|
+ *
|
|
|
+ * @param id 用户常用地址主键
|
|
|
+ * @param param 修改参数
|
|
|
+ */
|
|
|
+ @PutMapping("/userReceiveAddress/update/{id}")
|
|
|
+ public Long update(@PathVariable("id") @Min(value = 1, message = "主键不能小于1") Long id,
|
|
|
+ @RequestBody @Valid UserReceiveAddressModifyParam param) {
|
|
|
+ return this.userReceiveAddressClient.update(id,param);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询用户常用地址列表
|
|
|
+ *
|
|
|
+ * @return 用户常用地址信息
|
|
|
+ */
|
|
|
+ @GetMapping("/userReceiveAddress/list")
|
|
|
+ public List<UserReceiveAddressDTO> list() {
|
|
|
+ return this.userReceiveAddressClient.getList();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除用户常用地址
|
|
|
+ *
|
|
|
+ * @param id 用户常用地址主键
|
|
|
+ */
|
|
|
+ @PutMapping("/userReceiveAddress/delete/{id}")
|
|
|
+ public void delete(@PathVariable("id") @Min(value = 1, message = "主键不能小于1") Long id) {
|
|
|
+ this.userReceiveAddressClient.delete(id);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|