| 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.config.exception.ValidationException; | 
| import com.mzl.flower.config.security.SecurityUtils; | 
| import com.mzl.flower.constant.Constants; | 
| import com.mzl.flower.dto.request.supplier.QuerySupplierDTO; | 
| import com.mzl.flower.dto.request.supplier.UpdateSupplierDTO; | 
| import com.mzl.flower.dto.response.supplier.SupplierDTO; | 
| import com.mzl.flower.entity.supplier.SupplierType; | 
| import com.mzl.flower.service.supplier.SupplierTypeService; | 
| 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.*; | 
|   | 
| @RestController | 
| @RequestMapping("/api/supplier/type") | 
| @Api(value = "运营-供应商类型管理", tags = "运营-供应商类型管理") | 
| @Validated | 
| @Slf4j | 
| public class SupplierTypeController extends BaseController { | 
|   | 
|     private final SupplierTypeService supplierTypeService; | 
|   | 
|     public SupplierTypeController(SupplierTypeService supplierTypeService) { | 
|         this.supplierTypeService = supplierTypeService; | 
|     } | 
|   | 
|   | 
|     @PostMapping("/add") | 
|     @ApiOperation(value = "新增", notes = "新增") | 
|     public ResponseEntity<ReturnDataDTO> add(@Validated @RequestBody SupplierType dto) { | 
|         supplierTypeService.add(dto); | 
|         return returnData(R.SUCCESS.getCode(),null); | 
|     } | 
|   | 
|     @PostMapping("/update") | 
|     @ApiOperation(value = "修改", notes = "修改") | 
|     public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody SupplierType dto) { | 
|         supplierTypeService.update(dto); | 
|         return returnData(R.SUCCESS.getCode(),null); | 
|     } | 
|   | 
|     @PostMapping("/delete/{id}") | 
|     @ApiOperation(value = "删除", notes = "删除") | 
|     public ResponseEntity<ReturnDataDTO> delete(@PathVariable("id") Long id) { | 
|         supplierTypeService.delete(id); | 
|         return returnData(R.SUCCESS.getCode(),null); | 
|     } | 
|   | 
|     @GetMapping("/detail/{id}") | 
|     @ApiOperation(value = "详情", notes = "详情") | 
|     public ResponseEntity<ReturnDataDTO<SupplierType>> detail(@PathVariable("id") Long id) { | 
|         return returnData(R.SUCCESS.getCode(),supplierTypeService.detail(id)); | 
|     } | 
|   | 
|     @GetMapping("/page") | 
|     @ApiOperation(value = "查询-分页", notes = "查询-分页") | 
|     public ResponseEntity<ReturnDataDTO<Page<SupplierType>>> queryPage(String name, Page page) { | 
|         return returnData(R.SUCCESS.getCode(), supplierTypeService.queryPage(name,page)); | 
|     } | 
|   | 
|     @GetMapping("/list") | 
|     @ApiOperation(value = "查询-全部", notes = "查询-全部") | 
|     public ResponseEntity<ReturnDataDTO<Page<SupplierType>>> queryList(String name) { | 
|         return returnData(R.SUCCESS.getCode(), supplierTypeService.queryList(name)); | 
|     } | 
|   | 
| } |