| | |
| | | @ApiOperation(value = "编辑或更新数据") |
| | | public Result<Fingerprint> saveOrUpdate(Fingerprint fingerprint) { |
| | | if(StrUtil.isNotEmpty(fingerprint.getUserId())){ |
| | | |
| | | QueryWrapper<Fingerprint> wrapper = new QueryWrapper<Fingerprint>(); |
| | | wrapper.eq("code",fingerprint.getCode()); |
| | | wrapper.isNotNull("user_id"); |
| | | Fingerprint one = iFingerprintService.getOne(wrapper); |
| | | if(one!=null){ |
| | | return ResultUtil.error("code重复了,请重新获取"); |
| | | } |
| | | |
| | | User user = userService.get(fingerprint.getUserId()); |
| | | fingerprint.setUsername(user.getUsername()); |
| | | fingerprint.setPassword(user.getDescription()); |
| | |
| | | if(StrUtil.isNotEmpty(fingerprint.getCustomerId())){ |
| | | Customer byId = iCustomerService.getById(fingerprint.getCustomerId()); |
| | | fingerprint.setAreaId(byId.getAreaId()); |
| | | |
| | | QueryWrapper<Fingerprint> wrapper = new QueryWrapper<Fingerprint>(); |
| | | wrapper.eq("code",fingerprint.getCode()); |
| | | wrapper.eq("area_id",byId.getAreaId()); |
| | | wrapper.isNotNull("customer_id"); |
| | | Fingerprint one = iFingerprintService.getOne(wrapper); |
| | | if(one!=null){ |
| | | return ResultUtil.error("code重复了,请重新获取"); |
| | | } |
| | | } |
| | | |
| | | if(StrUtil.isNotEmpty(fingerprint.getCustomerReceiveId())){ |