| | |
| | | import com.panzhihua.common.utlis.RSAUtils; |
| | | import com.panzhihua.service_property.entity.ComPropertyRepair; |
| | | import com.panzhihua.service_property.service.ComPropertyRepairService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import static java.util.Objects.nonNull; |
| | | |
| | | /** |
| | | * (ComPropertyRepair)表控制层 |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("comPropertyRepair") |
| | | @Slf4j |
| | | public class ComPropertyRepairApi { |
| | | /** |
| | | * 服务对象 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 分页查询所有数据 脱敏 |
| | | * @return 所有数据 |
| | | */ |
| | | @PostMapping("queryAllDesensitize") |
| | | public R selectAllDesensitize(@RequestBody CommonPage commonPage) { |
| | | return this.comPropertyRepairService.pageListDesensitize(commonPage); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 通过主键查询单条数据 |
| | | * |
| | | * @param id 主键 |
| | |
| | | public R selectOne(@PathVariable("id") Long id) { |
| | | return this.comPropertyRepairService.selectDetail(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过主键查询单条数据 脱敏 |
| | | * |
| | | * @param id 主键 |
| | | * @return 单条数据 |
| | | */ |
| | | @GetMapping("desensitize/{id}") |
| | | public R selectOneDesensitize(@PathVariable("id") Long id) { |
| | | return this.comPropertyRepairService.selectDetailDesensitize(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增数据 |
| | |
| | | if(comPropertyRepairVO!=null){ |
| | | BeanUtils.copyProperties(comPropertyRepairVO,comPropertyRepair); |
| | | } |
| | | ComPropertyRepairVO vo=comPropertyRepairVO; |
| | | try { |
| | | comPropertyRepairVO.setRepairName(RSAUtils.decrypt(comPropertyRepairVO.getRepairName(), Constants.PRIVATE_KEY)); |
| | | comPropertyRepairVO.setRepairPhone(RSAUtils.decrypt(comPropertyRepairVO.getRepairPhone(), Constants.PRIVATE_KEY)); |
| | | comPropertyRepair.setRepairName(RSAUtils.decrypt(comPropertyRepairVO.getRepairName(), Constants.PRIVATE_KEY)); |
| | | comPropertyRepair.setRepairPhone(RSAUtils.decrypt(comPropertyRepairVO.getRepairPhone(), Constants.PRIVATE_KEY)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | comPropertyRepair.setRepairName(comPropertyRepairVO.getRepairName()); |
| | | comPropertyRepair.setRepairPhone(comPropertyRepairVO.getRepairPhone()); |
| | | } |
| | | return R.ok(this.comPropertyRepairService.save(comPropertyRepair)); |
| | | } |