| | |
| | | */ |
| | | package org.springblade.modules.experience.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * 用户从业控制器 |
| | | * |
| | | * @author BladeX |
| | | * @since 2021-07-08 |
| | |
| | | return R.status(experienceService.save(experience)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增或修改 |
| | | */ |
| | | @PostMapping("/saveOrUpdate") |
| | | public R save(@Valid @RequestBody Map<String,Object> experience ) { |
| | | String cardid = experience.get("cardid").toString(); |
| | | //先删除原有的从业信息 |
| | | experienceService.delbyCardId(cardid); |
| | | //重新新增从业信息 |
| | | List<Experience> experiences = (List<Experience>)experience.get("userPractitionersInfo"); |
| | | int count = 0; |
| | | if (experiences.size()>0){ |
| | | for(int i = 0;i<experiences.size();i++){ |
| | | Experience e = JSON.parseObject(JSON.toJSONString(experiences.get(i)),Experience.class); |
| | | experienceService.save(e); |
| | | count++; |
| | | } |
| | | if(count<1){ |
| | | return R.status(false); |
| | | } |
| | | } |
| | | return R.status(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | |
| | | * @param cardid 身份证 |
| | | * @return |
| | | */ |
| | | @PostMapping("/selectExperienceInfo") |
| | | @GetMapping("/selectExperienceInfo") |
| | | public R selectExperienceInfo(String cardid) { |
| | | return R.data(experienceService.selectExperienceInfo(cardid)); |
| | | } |