|
@@ -0,0 +1,53 @@
|
|
|
+package com.chelvc.cloud.maintain.controller;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import javax.validation.Valid;
|
|
|
+import javax.validation.constraints.Min;
|
|
|
+
|
|
|
+import com.chelvc.cloud.maintain.copier.MerchantCopier;
|
|
|
+import com.chelvc.cloud.maintain.vo.MerchantDetailVO;
|
|
|
+import com.chelvc.cloud.maintain.vo.SimpleMerchantVO;
|
|
|
+import com.chelvc.cloud.vehicle.api.param.MerchantQueryParam;
|
|
|
+import com.chelvc.cloud.vehicle.api.service.MerchantService;
|
|
|
+import com.chelvc.framework.base.annotation.UnifiedResponseBody;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
+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.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 商家接口
|
|
|
+ *
|
|
|
+ * @author Woody
|
|
|
+ * @date 2023/7/20
|
|
|
+ */
|
|
|
+@Validated
|
|
|
+@RestController
|
|
|
+@UnifiedResponseBody
|
|
|
+public class MerchantController {
|
|
|
+ @DubboReference
|
|
|
+ private MerchantService merchantService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取商家列表
|
|
|
+ *
|
|
|
+ * @param param 查询参数
|
|
|
+ * @return 商家信息列表
|
|
|
+ */
|
|
|
+ @GetMapping("/merchants")
|
|
|
+ public List<SimpleMerchantVO> listSimpleMerchants(@Valid MerchantQueryParam param) {
|
|
|
+ return MerchantCopier.INSTANCE.copying(this.merchantService.listSimpleMerchants(param));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取商家详情
|
|
|
+ *
|
|
|
+ * @param id 商家ID
|
|
|
+ * @return 商家详情
|
|
|
+ */
|
|
|
+ @GetMapping("/merchant/{id}")
|
|
|
+ public MerchantDetailVO getMerchantDetail(@PathVariable("id") @Min(value = 1, message = "商家ID不能小于1") Long id) {
|
|
|
+ return MerchantCopier.INSTANCE.copying(this.merchantService.getMerchantDetail(id));
|
|
|
+ }
|
|
|
+}
|