@RequestMapping(value = "/core/department/{id}", method = RequestMethod.GET) public ResponseEntity<ResponseEnvelope<DepartmentVO>> getDepartmentById(@PathVariable String id) { DepartmentModel departmentModel = departmentService.findByPrimaryKey(id); DepartmentVO departmentVO = beanMapper.map(departmentModel, DepartmentVO.class); ResponseEnvelope<DepartmentVO> responseEnv = new ResponseEnvelope<DepartmentVO>(departmentVO); return new ResponseEntity<>(responseEnv, HttpStatus.OK); }
@RequestMapping(value = "/core/department", method = RequestMethod.POST) public ResponseEntity<ResponseEnvelope<Integer>> createDepartment( @RequestBody DepartmentVO departmentVO) { DepartmentModel departmentModel = beanMapper.map(departmentVO, DepartmentModel.class); Integer result = departmentService.create(departmentModel); ResponseEnvelope<Integer> responseEnv = new ResponseEnvelope<Integer>(result); return new ResponseEntity<>(responseEnv, HttpStatus.OK); }
@RequestMapping(value = "/core/department/{id}", method = RequestMethod.PUT) public ResponseEntity<ResponseEnvelope<Integer>> updateDepartmentByPrimaryKeySelective( @PathVariable String id, @RequestBody DepartmentVO departmentVO) { DepartmentModel departmentModel = beanMapper.map(departmentVO, DepartmentModel.class); departmentModel.setGuid(id); Integer result = departmentService.updateByPrimaryKeySelective(departmentModel); ResponseEnvelope<Integer> responseEnv = new ResponseEnvelope<Integer>(result); return new ResponseEntity<>(responseEnv, HttpStatus.OK); }