|
@@ -0,0 +1,63 @@
|
|
|
+package com.chelvc.cloud.admin.controller;
|
|
|
+
|
|
|
+import com.chelvc.cloud.vehicle.api.dto.MerchantDTO;
|
|
|
+import com.chelvc.cloud.vehicle.api.param.MerchantModifyParam;
|
|
|
+import com.chelvc.cloud.vehicle.api.param.MerchantPagingParam;
|
|
|
+import com.chelvc.cloud.vehicle.api.service.MerchantService;
|
|
|
+import com.chelvc.framework.base.annotation.UnifiedResponseBody;
|
|
|
+import com.chelvc.framework.base.model.Pagination;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import javax.validation.Valid;
|
|
|
+import javax.validation.constraints.Min;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 商家接口
|
|
|
+ *
|
|
|
+ * @author liude
|
|
|
+ * @Date 2023/8/24
|
|
|
+ **/
|
|
|
+@Validated
|
|
|
+@RestController
|
|
|
+@UnifiedResponseBody
|
|
|
+@PreAuthorize("isBusiness('MERCHANT')")
|
|
|
+public class MerchantController {
|
|
|
+ @DubboReference
|
|
|
+ private MerchantService merchantService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增商家
|
|
|
+ *
|
|
|
+ * @param param 新增参数
|
|
|
+ * @return 商家主键
|
|
|
+ */
|
|
|
+ @PostMapping("/merchant")
|
|
|
+ public Long addMerchant(@RequestBody @Valid MerchantModifyParam param) {
|
|
|
+ return this.merchantService.addMerchant(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改商家
|
|
|
+ *
|
|
|
+ * @param id 商家主键
|
|
|
+ * @param param 修改参数
|
|
|
+ */
|
|
|
+ @PutMapping("/category/{id}")
|
|
|
+ public void updateMerchant(@PathVariable("id") @Min(value = 1, message = "分类主键不能小于1") Long id,
|
|
|
+ @RequestBody @Valid MerchantModifyParam param) {
|
|
|
+ this.merchantService.updateMerchant(id, param);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询商家分页
|
|
|
+ *
|
|
|
+ * @param param 查询参数
|
|
|
+ * @return 商家分页信息
|
|
|
+ */
|
|
|
+ @GetMapping("/category/paging")
|
|
|
+ public Pagination<MerchantDTO> getMerchantPaging(@Valid MerchantPagingParam param) {
|
|
|
+ return this.merchantService.getMerchantPaging(param);
|
|
|
+ }
|
|
|
+}
|