| | |
| | | import java.util.Map; |
| | | import com.kidgrow.common.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * @Description: 签约医生信息表-未完待续 |
| | | * @Project: 用户中心 |
| | | * @CreateDate: Created in 2020-04-01 09:37:05 <br> |
| | | * @Project: 运营中心 |
| | | * @CreateDate: Created in 2020-04-02 18:25:34 <br> |
| | | * @Author: <a href="4345453@kidgrow.com">liuke</a> |
| | | * @version: 1.0 |
| | | */ |
| | |
| | | @ApiImplicitParam(name = "limit", value = "分页结束位置", required = true, dataType = "Integer") |
| | | }) |
| | | @GetMapping |
| | | public PageResult list(@RequestParam Map<String, Object> params) { |
| | | public ResultBody<PageResult> list(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | } |
| | | return doctorSigningService.findList(params); |
| | | return ResultBody.ok().data(doctorSigningService.findList(params)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "保存") |
| | | @PostMapping |
| | | public ResultBody save(@Valid @RequestBody DoctorSigning doctorSigning, BindingResult bindingResult) { |
| | | List<String> errMsg= new ArrayList<>(); |
| | | if (bindingResult.hasErrors()) { |
| | | return ResultBody.failed().msg(bindingResult.getFieldError().getDefaultMessage()); |
| | | } else { |
| | | doctorSigningService.saveOrUpdate(doctorSigning); |
| | | return ResultBody.ok().data(doctorSigning).msg("保存成功"); |
| | | for (ObjectError error : bindingResult.getAllErrors()) { |
| | | errMsg.add(error.getDefaultMessage()); |
| | | } |
| | | return ResultBody.failed().msg(errMsg.toString()); |
| | | } else { |
| | | boolean v= doctorSigningService.saveOrUpdate(doctorSigning); |
| | | if(v) { |
| | | return ResultBody.ok().data(doctorSigning).msg("保存成功"); |
| | | } |
| | | else { |
| | | return ResultBody.failed().msg("保存失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "删除") |
| | | @DeleteMapping("/{id}") |
| | | public ResultBody delete(@PathVariable Long id) { |
| | | doctorSigningService.removeById(id); |
| | | return ResultBody.ok().msg("删除成功"); |
| | | boolean v= doctorSigningService.removeById(id); |
| | | if(v) { |
| | | return ResultBody.ok().msg("删除成功"); |
| | | } |
| | | else { |
| | | return ResultBody.failed().msg("删除失败"); |
| | | } |
| | | } |
| | | } |