| | |
| | | @Override |
| | | public void updateById(Sites sites) { |
| | | LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | QueryWrapper<Sites> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(Sites::getCode,sites.getCode()); |
| | | Sites count = sitesMapper.selectOne(wrapper); |
| | | if (Objects.nonNull(count) && !count.getId().equals(sites.getId())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"站点编号已存在"); |
| | | } |
| | | Sites update = new Sites(); |
| | | update.setId(sites.getId()); |
| | | update.setCreateDate(new Date()); |
| | | update.setEditor(principal.getId()); |
| | | update.setName(sites.getName()); |