| | |
| | | Date date =new Date(); |
| | | //检查站点信息,不存在则新增 |
| | | Sites sites = sitesMapper.selectById(locks.getSiteId()); |
| | | |
| | | if(sites == null){ |
| | | sites = new Sites(); |
| | | sites.setIsdeleted(Constants.ZERO); |
| | |
| | | //新增锁头 |
| | | sitesMapper.insert(sites); |
| | | } |
| | | if(StringUtils.isNotBlank(locks.getBikeCode())){ |
| | | UpdateWrapper<Locks> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.lambda().set(Locks::getBikeCode, null ); |
| | | updateWrapper.lambda().set(Locks::getEditDate, new Date() ); |
| | | updateWrapper.lambda().eq(Locks::getBikeCode, locks.getBikeCode() ); |
| | | //清空原来的自行车绑定关系 |
| | | locksMapper.update(null, updateWrapper); |
| | | } |
| | | |
| | | if(model == null){ |
| | | //如果锁头不存在,判断存储 |
| | | model = new Locks(); |