|
|
@@ -65,17 +65,19 @@ public class FosterwxStationController extends BaseController<FosterwxStation> {
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
}
|
|
|
+ FosterwxStation oldVO = fosterwxStationService.getById(editHandle.getRaw().getId());
|
|
|
|
|
|
// 判断站点名是否存在
|
|
|
LambdaQueryWrapper<FosterwxStation> fosterwxStationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
fosterwxStationLambdaQueryWrapper.eq(FosterwxStation::getStationName, editHandle.getRaw().getStationName());
|
|
|
- if (fosterwxStationService.count(fosterwxStationLambdaQueryWrapper) > 0) {
|
|
|
+ if (!editHandle.getRaw().getStationName().equals(oldVO.getStationName()) &&
|
|
|
+ fosterwxStationService.count(fosterwxStationLambdaQueryWrapper) > 0) {
|
|
|
return AjaxResult.error("站点名重复");
|
|
|
}
|
|
|
//判断用户名是否存在
|
|
|
fosterwxStationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
fosterwxStationLambdaQueryWrapper.eq(FosterwxStation::getLoginUsername, editHandle.getRaw().getLoginUsername());
|
|
|
- if (fosterwxStationService.count(fosterwxStationLambdaQueryWrapper) > 0) {
|
|
|
+ if (!editHandle.getRaw().getLoginUsername().equals(oldVO.getLoginUsername()) && fosterwxStationService.count(fosterwxStationLambdaQueryWrapper) > 0) {
|
|
|
return AjaxResult.error("用户名重复");
|
|
|
}
|
|
|
|