feat:告警处理增加一键修改处理状态

haikang
郭承 8 months ago
parent 2e2a7e3e98
commit 0df252fae8

@ -64,4 +64,14 @@ public class WarningController extends BasicController {
return Response.success("OK");
}
@PostMapping("oneKeyUpdateState")
@ApiOperation("一键修改处理状态")
public Response<String> oneKeyUpdateState() throws Exception {
ConditionModel condition = new ConditionModel();
condition.setState("1");
List<Warning> warnings = service.listAll(condition);
service.oneKeyUpdateState(warnings);
return Response.success("OK");
}
}

@ -14,4 +14,6 @@ public interface WarningService {
List<Warning> listAll(ConditionModel condition) throws Exception;
void updateState(Warning warning) throws Exception;
void oneKeyUpdateState(List<Warning> warnings);
}

@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.persistence.criteria.Predicate;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@ -101,4 +102,16 @@ public class WarningServiceImpl implements WarningService {
war.setState(warning.getState());
repository.save(war);
}
@Override
public void oneKeyUpdateState(List<Warning> warnings) {
for (Warning warning : warnings) {
warning.setState("0");
}
if (null != warnings && warnings.size() > 0) {
repository.saveAll(warnings);
}
}
}

Loading…
Cancel
Save