| | |
| | | import com.tcm.training.admin.agent.vo.ProvincialAgentListItemVO; |
| | | import com.tcm.training.admin.common.ApiResponse; |
| | | import com.tcm.training.admin.common.PageResponse; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | } |
| | | |
| | | @GetMapping("/provincial-agents") |
| | | @SaCheckPermission("agent:provincial:view") |
| | | public ApiResponse<PageResponse<ProvincialAgentListItemVO>> page(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int pageSize, @RequestParam(required = false) String regionCode, @RequestParam(required = false) String clinicName, @RequestParam(required = false) String contactInfo, @RequestParam(required = false) Integer status) { |
| | | return ApiResponse.ok(service.page(page, pageSize, regionCode, clinicName, contactInfo, status)); |
| | | } |
| | | |
| | | @GetMapping("/provincial-agents/{id}") |
| | | @SaCheckPermission("agent:provincial:view") |
| | | public ApiResponse<ProvincialAgentDetailVO> detail(@PathVariable Long id) { |
| | | return ApiResponse.ok(service.detail(id)); |
| | | } |
| | | |
| | | @PostMapping("/provincial-agents") |
| | | @SaCheckPermission("agent:provincial:add") |
| | | public ApiResponse<ProvincialAgentDetailVO> create(@Valid @RequestBody ProvincialAgentSaveRequest r) { |
| | | return ApiResponse.ok(service.create(r)); |
| | | } |
| | | |
| | | @PutMapping("/provincial-agents/{id}") |
| | | @SaCheckPermission("agent:provincial:edit") |
| | | public ApiResponse<ProvincialAgentDetailVO> update(@PathVariable Long id, @Valid @RequestBody ProvincialAgentSaveRequest r) { |
| | | return ApiResponse.ok(service.update(id, r)); |
| | | } |
| | | |
| | | @DeleteMapping("/provincial-agents/{id}") |
| | | @SaCheckPermission("agent:provincial:delete") |
| | | public ApiResponse<Void> delete(@PathVariable Long id) { |
| | | service.delete(id); |
| | | return ApiResponse.ok(null); |