企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
~~~ package com.zzzz.controller; import com.zzzz.dto.BranchParam; import com.zzzz.po.Branch; import com.zzzz.service.BranchService; import com.zzzz.service.BranchServiceException; import com.zzzz.vo.ListResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.sql.SQLException; @RestController @RequestMapping("/api/v1") public class BranchController { @Autowired private BranchService branchService; @PostMapping(value = "/course/{id}/branch") public ResponseEntity<Long> create(@PathVariable("id") String enterpriseId, @RequestBody BranchParam branchParam) throws BranchServiceException, SQLException { // TODO authentication not implemented yet long branchId = branchService.insert(enterpriseId, branchParam.getName(), branchParam.getAddress(), branchParam.getLatitude(), branchParam.getLongitude(), branchParam.getTelephone()); return ResponseEntity.ok(branchId); } @GetMapping(value = "/branch/{id}") public ResponseEntity<Branch> getById(@PathVariable("id") String branchId) throws BranchServiceException, SQLException { // TODO authentication not implemented yet Branch branch = branchService.getById(branchId); return ResponseEntity.ok(branch); } @PutMapping(value = "/branch/{id}") public ResponseEntity update(@PathVariable("id") String targetBranchId, @RequestBody BranchParam branchParam) throws BranchServiceException, SQLException { // TODO authentication not implemented yet branchService.update(targetBranchId, branchParam.getName(), branchParam.getAddress(), branchParam.getLatitude(), branchParam.getLongitude(), branchParam.getTelephone()); return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); } @GetMapping(value = "/enterprise/{id}/branch/list") public ResponseEntity<ListResult<Branch>> list(@PathVariable("id") String enterpriseId, String usePagination, String targetPage, String pageSize, String branchId, String nameContaining, String addressContaining) throws BranchServiceException, SQLException { // TODO authentication not implemented yet ListResult<Branch> result = branchService.list(usePagination, targetPage, pageSize, enterpriseId, branchId, nameContaining, addressContaining); return ResponseEntity.ok(result); } } ~~~