| | |
| | | * 新增保险职位 |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@Valid @RequestBody InsurancePositionDto dto) { |
| | | public AjaxResult add(InsurancePositionDto dto) { |
| | | try { |
| | | InsurancePosition insurancePosition = new InsurancePosition(); |
| | | insurancePosition.setPosition(dto.getPosition()); |
| | | insurancePosition.setNumberPeople(dto.getNumberPeople()); |
| | | insurancePosition.setRank(dto.getRank()); |
| | | insurancePosition.setSalary(dto.getSalary()); |
| | | insurancePosition.setCreatedAt(new Date()); |
| | | insurancePosition.setUpdatedAt(new Date()); |
| | | service.save(insurancePosition); |
| | | return AjaxResult.success("添加成功"); |
| | | }catch (Exception e){ |
| | | e.getMessage(); |
| | | e.printStackTrace(); |
| | | return AjaxResult.error("添加失败!"); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 删除产品 |
| | | * 删除保险职位 |
| | | */ |
| | | @DeleteMapping("/{id}") |
| | | public AjaxResult delete(@PathVariable Integer id) { |
| | | @GetMapping("/delete") |
| | | public AjaxResult delete(@RequestParam(value = "id") Integer id) { |
| | | InsurancePosition position = service.getById(id); |
| | | if (position == null) { |
| | | return AjaxResult.error("产品不存在"); |
| | | return AjaxResult.error("职位不存在"); |
| | | } |
| | | |
| | | boolean success = service.removeById(id); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 产品信息列表 |
| | | * 职位列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public TableDataInfo list() { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 新增保险职位 |
| | | * 修改保险职位 |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@Valid @RequestBody InsurancePositionDto dto) { |
| | | public AjaxResult update(InsurancePositionDto dto) { |
| | | try { |
| | | InsurancePosition position = service.getById(dto.getId()); |
| | | if(position == null){ |
| | |
| | | position.setPosition(dto.getPosition()); |
| | | position.setNumberPeople(dto.getNumberPeople()); |
| | | position.setRank(dto.getRank()); |
| | | position.setSalary(dto.getSalary()); |
| | | position.setUpdatedAt(new Date()); |
| | | service.updateById(position); |
| | | return AjaxResult.success("修改成功"); |
| | | }catch (Exception e){ |
| | | e.getMessage(); |
| | | e.printStackTrace(); |
| | | return AjaxResult.error("修改失败!"); |
| | | } |
| | | } |