parent
90612356eb
commit
26a590030a
|
|
@ -38,7 +38,8 @@ public class AlarmSetController {
|
|||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<AlarmSet> update(@Validated(Update.class) @RequestBody AlarmSet dto) {
|
||||
boolean result = service.updateById(dto);
|
||||
boolean result = service.updateInfo(dto);
|
||||
//boolean result = service.updateById(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ public class AlarmSetPageSo {
|
|||
@Schema(description = "分页参数")
|
||||
private PageSo pageSo;
|
||||
|
||||
@Schema(description = "测点名称")
|
||||
private String name;
|
||||
@Schema(description = "测点编号")
|
||||
private String stcd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ public class WaterAlarmPageSo {
|
|||
@Schema(description = "分页参数")
|
||||
private PageSo pageSo;
|
||||
|
||||
@Schema(description = "测点名称")
|
||||
private String name;
|
||||
@Schema(description = "测点编号")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "告警类型")
|
||||
private Integer type;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ import java.util.List;
|
|||
public class AlarmSetService extends ServiceImpl<AlarmSetMapper, AlarmSet> {
|
||||
public Page<AlarmSet> queryPage(AlarmSetPageSo page) {
|
||||
LambdaQueryWrapper<AlarmSet> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (page.getName() != null) {
|
||||
queryWrapper.like(AlarmSet::getStcd, page.getName());
|
||||
if (page.getStcd() != null) {
|
||||
queryWrapper.eq(AlarmSet::getStcd, page.getStcd());
|
||||
}
|
||||
queryWrapper.orderByDesc(AlarmSet::getCreateDate);
|
||||
Page<AlarmSet> alarmSetPage = this.baseMapper.selectPage(page.getPageSo().toPage(), queryWrapper);
|
||||
|
|
@ -44,4 +44,15 @@ public class AlarmSetService extends ServiceImpl<AlarmSetMapper, AlarmSet> {
|
|||
public List<StStbprpB> listStation() {
|
||||
return this.baseMapper.listStation();
|
||||
}
|
||||
|
||||
public boolean updateInfo(AlarmSet dto) {
|
||||
LambdaQueryWrapper<AlarmSet> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.ne(AlarmSet::getId, dto.getId());
|
||||
queryWrapper.eq(AlarmSet::getStcd, dto.getStcd());
|
||||
AlarmSet alarmSet = this.baseMapper.selectOne(queryWrapper);
|
||||
if(alarmSet != null){
|
||||
throw new IllegalArgumentException("对不起站点:" + dto.getStcd() +"已存在");
|
||||
}
|
||||
return updateById(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ public class WaterAlarmService extends ServiceImpl<WaterAlarmMapper, WaterAlarm>
|
|||
|
||||
public Page<WaterAlarm> queryPage(WaterAlarmPageSo pageSo) {
|
||||
LambdaQueryWrapper<WaterAlarm> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (pageSo.getName() != null) {
|
||||
queryWrapper.like(WaterAlarm::getStnm,pageSo.getName());
|
||||
if (pageSo.getStcd() != null) {
|
||||
queryWrapper.eq(WaterAlarm::getStcd,pageSo.getStcd());
|
||||
}
|
||||
if(pageSo.getType() != null){
|
||||
queryWrapper.eq(WaterAlarm::getAlarmType,pageSo.getType());
|
||||
|
|
|
|||
Loading…
Reference in New Issue