参考文章
参考样例:
// 注册到swagger上的tags标签下
@Api(tags = SwaggerApiConfig.DELIVERY_ORDER)
// 组合注解 @@Controller和@ResponseBody
@RestController
// 映射访问路径
@RequestMapping("/v1/{organizationId}/DeliveryOrder")
public class DeliveryOrderController {
// 自动装配
@Autowired
private DeliveryOrderService deliveryOrderService;
// rest风格注解,相当于 @RequestMapping(method = RequestMethod.GET)
@GetMapping()
// swagger 标识 无标识将显示方法名称
@ApiOperation(value = "查询运货单列表")
// 标识权限,只适用于hzero框架
@Permission(level = ResourceLevel.ORGANIZATION)
// @PathVariable 代表路径参数
public ResponseEntity<Page<DeliveryOrderHeader>> selectDeliveryOrder(@PathVariable("organizationId") Long tenantId, PageRequest pageRequest,String orderNum){
return Results.success(deliveryOrderService.selectDeliveryOrder(pageRequest,orderNum));
}
// post代表新增
@PostMapping("create")
@ApiOperation(value = "新增发货单")
@Permission(level = ResourceLevel.ORGANIZATION)
// @RequestParam 代表请求参数
public ResponseEntity<DeliveryOrderHeader> createOrder(@PathVariable("organizationId") Long tenantId,@RequestParam List<Long> purLineIds){
return Results.success(deliveryOrderService.createOrder(purLineIds));
}
}