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 addOrUpdateSupplier(@Validated @RequestBody SupplierSubDTO dto) { supplierSubService.addOrUpdateSupplier(dto); return returnData(R.SUCCESS.getCode(), null); } @GetMapping("/page") @ApiOperation(value = "运营端-供应商子账号分页查询", notes = "运营端-供应商子账号分页查询") public ResponseEntity>> querySupplier(QuerySupplierSubDTO dto, Page page) { return returnData(R.SUCCESS.getCode(), supplierSubService.querySupplier(dto, page)); } @GetMapping("/page/isEnable") @ApiOperation(value = "子账号启用/禁用", notes = "子账号启用/禁用") public ResponseEntity> isEnable(@NotNull(message = "id不能为空") Long id) { supplierSubService.isEnable(id); return returnData(R.SUCCESS.getCode(), null); } @PostMapping("/delete/{id}") @ApiOperation(value = "子账号删除", notes = "子账号删除") public ResponseEntity delete(@PathVariable("id") Long id) { supplierSubService.delete(id); return returnData(R.SUCCESS.getCode(), null); } }