commit
079babdf9c
@ -0,0 +1,63 @@
|
|||||||
|
package ru.ulstu.extractor.model.mvc;
|
||||||
|
|
||||||
|
public class AddRuleForm {
|
||||||
|
private Integer firstAntecedentValueId;
|
||||||
|
private Integer firstAntecedentId;
|
||||||
|
private Integer secondAntecedentValueId;
|
||||||
|
private Integer secondAntecedentId;
|
||||||
|
private String consequent;
|
||||||
|
|
||||||
|
public AddRuleForm() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getFirstAntecedentValueId() {
|
||||||
|
return firstAntecedentValueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstAntecedentValueId(Integer firstAntecedentValueId) {
|
||||||
|
this.firstAntecedentValueId = firstAntecedentValueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getFirstAntecedentId() {
|
||||||
|
return firstAntecedentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstAntecedentId(Integer firstAntecedentId) {
|
||||||
|
this.firstAntecedentId = firstAntecedentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSecondAntecedentValueId() {
|
||||||
|
return secondAntecedentValueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecondAntecedentValueId(Integer secondAntecedentValueId) {
|
||||||
|
this.secondAntecedentValueId = secondAntecedentValueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSecondAntecedentId() {
|
||||||
|
return secondAntecedentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecondAntecedentId(Integer secondAntecedentId) {
|
||||||
|
this.secondAntecedentId = secondAntecedentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConsequent() {
|
||||||
|
return consequent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConsequent(String consequent) {
|
||||||
|
this.consequent = consequent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AddRuleForm{" +
|
||||||
|
"firstAntecedentValueId=" + firstAntecedentValueId +
|
||||||
|
", firstAntecedentId=" + firstAntecedentId +
|
||||||
|
", secondAntecedentValueId=" + secondAntecedentValueId +
|
||||||
|
", secondAntecedentId=" + secondAntecedentId +
|
||||||
|
", consequent='" + consequent + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package ru.ulstu.extractor.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import ru.ulstu.extractor.model.AntecedentValue;
|
||||||
|
|
||||||
|
public interface AntecedentValueRepository extends JpaRepository<AntecedentValue, Integer> {
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package ru.ulstu.extractor.service;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import ru.ulstu.extractor.model.AntecedentValue;
|
||||||
|
import ru.ulstu.extractor.repository.AntecedentValueRepository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AntecedentValueService {
|
||||||
|
private final AntecedentValueRepository antecedentValueRepository;
|
||||||
|
|
||||||
|
public AntecedentValueService(AntecedentValueRepository antecedentValueRepository) {
|
||||||
|
this.antecedentValueRepository = antecedentValueRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AntecedentValue> getList() {
|
||||||
|
return antecedentValueRepository.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AntecedentValue getById(Integer antecedentValueId) {
|
||||||
|
return antecedentValueRepository.findById(antecedentValueId)
|
||||||
|
.orElseThrow(() -> new RuntimeException("Antecedent value not found by id " + antecedentValueId));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
|
||||||
|
<html
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.w3.org/1999/xhtml"
|
||||||
|
layout:decorate="~{default}">
|
||||||
|
<head>
|
||||||
|
<title>Простая обработка формы на Spring MVC</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||||
|
</head>
|
||||||
|
<div class="container" layout:fragment="content">
|
||||||
|
<form action="/listRule" th:action="${@route.ADD_RULE}" th:object="${addRuleForm}" method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2 col-sm-12">
|
||||||
|
Если
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 col-sm-12">
|
||||||
|
<select id="select-measures" class="selectpicker" data-live-search="true"
|
||||||
|
th:field="*{firstAntecedentValueId}"
|
||||||
|
data-width="100%">
|
||||||
|
<option th:each="antecedentValue : ${antecedentValues}"
|
||||||
|
th:value="${antecedentValue.id}"
|
||||||
|
th:utext="${antecedentValue.antecedentValue}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 col-sm-12">
|
||||||
|
временной ряд
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 col-sm-12">
|
||||||
|
<select id="select-antecedent" class="selectpicker" data-live-search="true"
|
||||||
|
th:field="*{firstAntecedentId}"
|
||||||
|
data-width="90%">
|
||||||
|
<option th:each="antecedent : ${antecedents}"
|
||||||
|
th:value="${antecedent.id}"
|
||||||
|
th:utext="${antecedent.name}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 col-sm-12">
|
||||||
|
и
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 col-sm-12">
|
||||||
|
<select id="select-second-measures" class="selectpicker" data-live-search="true"
|
||||||
|
th:field="*{secondAntecedentValueId}"
|
||||||
|
data-width="100%">
|
||||||
|
<option th:each="antecedentValue : ${antecedentValues}"
|
||||||
|
th:value="${antecedentValue.id}"
|
||||||
|
th:utext="${antecedentValue.antecedentValue}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 col-sm-12">
|
||||||
|
временной ряд
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 col-sm-12">
|
||||||
|
<select id="select-second-antecedent" class="selectpicker" data-live-search="true"
|
||||||
|
th:field="*{secondAntecedentId}"
|
||||||
|
data-width="90%">
|
||||||
|
<option th:each="antecedent : ${antecedents}"
|
||||||
|
th:value="${antecedent.id}"
|
||||||
|
th:utext="${antecedent.name}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 col-sm-12">
|
||||||
|
то:
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 col-sm-12">
|
||||||
|
<input type="text" class="form-control" th:field="*{consequent}">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8 col-sm-12">
|
||||||
|
<input type="submit" class="btn btn-outline-success" value="Создать правило"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</html>
|
@ -1,49 +0,0 @@
|
|||||||
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
|
|
||||||
<html
|
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
|
||||||
layout:decorate="~{default}">
|
|
||||||
<head>
|
|
||||||
<title>Простая обработка формы на Spring MVC</title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
||||||
</head>
|
|
||||||
<div class="container" layout:fragment="content">
|
|
||||||
<!-- <form action="#" th:action="${@route.STATISTIC}" th:object="${filterForm}" method="get">-->
|
|
||||||
<form>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-2 col-sm-12">
|
|
||||||
Если
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2 col-sm-12">
|
|
||||||
<select id="select-measures" class="selectpicker" data-live-search="true"
|
|
||||||
data-width="90%">
|
|
||||||
<option value="">много</option>
|
|
||||||
<option value="">мало</option>
|
|
||||||
<option value="">средне</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1 col-sm-12">
|
|
||||||
времянной ряд
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6 col-sm-12">
|
|
||||||
<select id="select-ts" class="selectpicker" data-live-search="true"
|
|
||||||
data-width="90%">
|
|
||||||
<option value="">авторов</option>
|
|
||||||
<option value="">коммитов</option>
|
|
||||||
<option value="">веток</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-2 col-sm-12">
|
|
||||||
то:
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3 col-sm-12">
|
|
||||||
<input type="text" class="form-control" size="40">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 col-sm-12">
|
|
||||||
<input type="submit" class="btn btn-outline-success w-50" value="Создать правило"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue