cloudroam
2024-12-09 96abc87da07408ef817d9086ea71ba4c287aa474
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package com.mzl.flower.web.supplier;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.base.BaseController;
import com.mzl.flower.base.R;
import com.mzl.flower.base.ReturnDataDTO;
import com.mzl.flower.dto.request.supplier.*;
import com.mzl.flower.service.supplier.SupplierSubService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.constraints.NotNull;
 
@RestController
@RequestMapping("/api/supplierSub")
@Api(value = "供应商子账号管理", tags = "供应商子账号管理")
@Validated
@Slf4j
public class SupplierSubController extends BaseController {
 
    private final SupplierSubService supplierSubService;
 
    public SupplierSubController(SupplierSubService supplierSubService) {
        this.supplierSubService = supplierSubService;
    }
 
 
    @PostMapping("/addOrUpdate")
    @ApiOperation(value = "供应商子账号信息登记、修改", notes = "供应商信息子账号登记、修改")
    public ResponseEntity<ReturnDataDTO> addOrUpdateSupplier(@Validated @RequestBody SupplierSubDTO dto) {
        supplierSubService.addOrUpdateSupplier(dto);
        return returnData(R.SUCCESS.getCode(), null);
    }
 
 
    @GetMapping("/page")
    @ApiOperation(value = "运营端-供应商子账号分页查询", notes = "运营端-供应商子账号分页查询")
    public ResponseEntity<ReturnDataDTO<Page<SupplierSubDTO>>> querySupplier(QuerySupplierSubDTO dto, Page page) {
        return returnData(R.SUCCESS.getCode(), supplierSubService.querySupplier(dto, page));
    }
 
 
    @GetMapping("/page/isEnable")
    @ApiOperation(value = "子账号启用/禁用", notes = "子账号启用/禁用")
    public ResponseEntity<ReturnDataDTO<String>> isEnable(@NotNull(message = "id不能为空") Long id) {
        supplierSubService.isEnable(id);
        return returnData(R.SUCCESS.getCode(), null);
    }
 
    @PostMapping("/delete/{id}")
    @ApiOperation(value = "子账号删除", notes = "子账号删除")
    public ResponseEntity<ReturnDataDTO> delete(@PathVariable("id") Long id) {
        supplierSubService.delete(id);
        return returnData(R.SUCCESS.getCode(), null);
    }
}