|
@@ -0,0 +1,40 @@
|
|
|
|
|
+package com.yami.shop.platform.controller;
|
|
|
|
|
+
|
|
|
|
|
+import com.yami.shop.bean.model.Transport2;
|
|
|
|
|
+import com.yami.shop.common.util.R;
|
|
|
|
|
+import com.yami.shop.delivery.comment.service.Transport2Service;
|
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/platform/transport2")
|
|
|
|
|
+public class Transport2Controller {
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private Transport2Service transportService;
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/queryTransport2ByChannelId/{channelId}")
|
|
|
|
|
+ @ApiOperation(value = "企业ID查询运费模板")
|
|
|
|
|
+ public R<Transport2> queryTransport2ByChannelId(@PathVariable("channelId") Long channelId) {
|
|
|
|
|
+ return R.SUCCESS(transportService.queryTransport2ByChannelId(channelId));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/addOrEdit")
|
|
|
|
|
+ @ApiOperation(value = "新增或更新运费模板")
|
|
|
|
|
+ public R<Void> addOrEdit(Transport2 transport) {
|
|
|
|
|
+ if (transport.getChannelId() != null) {
|
|
|
|
|
+ Transport2 transport2 = transportService.queryTransport2ByChannelId(transport.getChannelId());
|
|
|
|
|
+ if (transport2 != null) {
|
|
|
|
|
+ transport.setTransportId(transport2.getTransportId());
|
|
|
|
|
+ transportService.updateById(transport);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ transportService.save(transport);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ transportService.save(transport);
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.SUCCESS();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|