InventoryController.java
2.38 KB
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
package com.infoloop.tianting.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientDto;
import com.infoloop.tianting.model.dto.InventoryDbDTO.ClientTableCodeDto;
import com.infoloop.tianting.model.dto.InventoryDbDTO.TableCodeQueryConditionDto;
import com.infoloop.tianting.service.InventoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
@Api(tags = "院区")
@ApiSupport(order = -1)
@Slf4j
@Validated
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class InventoryController {
private final InventoryService inventoryService;
@SaIgnore
@ApiOperation(value = "根据Id获取Client")
@GetMapping("/enterprises/{enterpriseId}/clients/{clientId}")
@ResponseStatus(HttpStatus.OK)
public ClientDto getClientById(@PathVariable Integer enterpriseId, @PathVariable Integer clientId) {
return inventoryService.getClientById(enterpriseId, clientId);
}
@ApiOperation(value = "根据ClientId获取Stalls")
@GetMapping("/enterprises/{enterpriseId}/clients/{clientId}/stalls")
@ResponseStatus(HttpStatus.OK)
public List<ClientDto> getStallsByClientId(@PathVariable Integer enterpriseId, @PathVariable Integer clientId) {
return inventoryService.getStallsByClientId(enterpriseId, clientId);
}
@ApiOperation(value = "获取桌号")
@PostMapping("/tableCodes")
@ResponseStatus(HttpStatus.OK)
public List<ClientTableCodeDto> getTableCodes(@Valid @RequestBody TableCodeQueryConditionDto tableCodeQueryConditionDto) {
return inventoryService.queryClientTableCodesByCondition(tableCodeQueryConditionDto);
}
}