質問編集履歴
6
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -28,10 +28,6 @@
|
|
28
28
|
|
29
29
|
//登録画面の表示
|
30
30
|
$("#forRegister").on("click", function() {
|
31
|
-
if ($("#employee_code").val() === null || $("#employee_code").val() === "") {
|
32
|
-
alert("社員番号を入力してください。");
|
33
|
-
return;
|
34
|
-
}
|
35
31
|
$.ajax({
|
36
32
|
url: "/employee/select",
|
37
33
|
type: "GET",
|
@@ -60,7 +56,16 @@
|
|
60
56
|
$("#position").append($('<option>').html(user[1][j].name).val(user[1][j].value));
|
61
57
|
}
|
62
58
|
|
59
|
+
// if ($("#employee_code").val() === null || $("#employee_code").val() === "") {
|
60
|
+
// alert("社員番号を入力してください。");
|
63
61
|
|
62
|
+
// }
|
63
|
+
// if ($("#employee_code").val().length === 6) {
|
64
|
+
// alert("6文字で入力してください。");
|
65
|
+
|
66
|
+
// }
|
67
|
+
|
68
|
+
|
64
69
|
})
|
65
70
|
.fail(function(jqXHR, textStatus, errorThrown) {
|
66
71
|
$("#p1").text(jqXHR.status); //例:404
|
@@ -71,6 +76,10 @@
|
|
71
76
|
|
72
77
|
//登録する
|
73
78
|
$(document).on("click", "#register", function() {
|
79
|
+
if ($("#employee_code").val() === null || $("#employee_code").val() === "") {
|
80
|
+
alert("社員番号を入力してください。");
|
81
|
+
return;
|
82
|
+
}
|
74
83
|
var json1 = {
|
75
84
|
employee_code: $("#employee_code").val(),
|
76
85
|
employee_name: $("#employee_name").val(),
|
@@ -96,6 +105,8 @@
|
|
96
105
|
})
|
97
106
|
.always(function() {});
|
98
107
|
});
|
108
|
+
|
109
|
+
|
99
110
|
```
|
100
111
|
```java
|
101
112
|
@RestController
|
5
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -28,8 +28,12 @@
|
|
28
28
|
|
29
29
|
//登録画面の表示
|
30
30
|
$("#forRegister").on("click", function() {
|
31
|
+
if ($("#employee_code").val() === null || $("#employee_code").val() === "") {
|
32
|
+
alert("社員番号を入力してください。");
|
33
|
+
return;
|
34
|
+
}
|
31
35
|
$.ajax({
|
32
|
-
url: "/employee/
|
36
|
+
url: "/employee/select",
|
33
37
|
type: "GET",
|
34
38
|
contentType: "application/json",
|
35
39
|
})
|
@@ -38,15 +42,15 @@
|
|
38
42
|
$("#p1").append(
|
39
43
|
'<section><br><br><h2>社員登録</h2><br>' +
|
40
44
|
'<div><form id="form-name">' +
|
41
|
-
'<div class="form-group"><label> 社員番号 </label><input type="text" class="form-control" placeholder="例 : 000001" id="employee_code" name="employee_code"></div>' +
|
42
|
-
'<div class="form-group"><label> 氏名 </label><input type="text" class="form-control" placeholder="例 : 山田 太郎" id="employee_name" name="employee_name"></div>' +
|
43
|
-
'<div class="form-group"><label> ふりがな </label><input type="text" class="form-control" placeholder="例 : やまだ たろう" id="furigana" name="furigana"></div>' +
|
44
|
-
'<div class="form-group"><label> メールアドレス </label><input type=text class="form-control" placeholder="例 : example@upload-gp.co.jp" id="mail_address" name="mail_address"></div>' +
|
45
|
-
'<div class="form-group"><label> 電話番号 </label><input type=text class="form-control" placeholder="例 : 000-000-000" id="tel_no" name="tel_no"></div>' +
|
45
|
+
'<div class="form-group"><label> 社員番号 </label><input required type="text" class="form-control" placeholder="例 : 000001" id="employee_code" name="employee_code"></div>' +
|
46
|
+
'<div class="form-group"><label> 氏名 </label><input required type="text" class="form-control" placeholder="例 : 山田 太郎" id="employee_name" name="employee_name"></div>' +
|
47
|
+
'<div class="form-group"><label> ふりがな </label><input required type="text" class="form-control" placeholder="例 : やまだ たろう" id="furigana" name="furigana"></div>' +
|
48
|
+
'<div class="form-group"><label> メールアドレス </label><input required type="text" class="form-control" placeholder="例 : example@upload-gp.co.jp" id="mail_address" name="mail_address"></div>' +
|
49
|
+
'<div class="form-group"><label> 電話番号 </label><input required type="text" class="form-control" placeholder="例 : 000-000-000" id="tel_no" name="tel_no"></div>' +
|
46
50
|
'<div class="form-group"><label> 所属グループ </label><select class="form-control" id="affiliation_group" name="affiliation_group"><option value="">選択してください</option></select></div>' +
|
47
51
|
'<div class="form-group"><label> 役職 </label><select class="form-control" id="position" name="position"><option value="">選択してください</option></select></div>' +
|
48
52
|
'<div style="text-align: center; margin-top: 30px;">' +
|
49
|
-
'<button class="c" type="
|
53
|
+
'<button class="c" type="" id="register">登録する</button>' +
|
50
54
|
'</div></form></div></section>'
|
51
55
|
);
|
52
56
|
for (var j = 0; j < user[0].length; j++) {
|
@@ -56,16 +60,7 @@
|
|
56
60
|
$("#position").append($('<option>').html(user[1][j].name).val(user[1][j].value));
|
57
61
|
}
|
58
62
|
|
59
|
-
if ($("#employee_code").val() === null || $("#employee_code").val() === "") {
|
60
|
-
alert("社員番号を入力してください。");
|
61
|
-
|
62
|
-
}
|
63
|
-
if ($("#employee_code").val().length === 6) {
|
64
|
-
alert("6文字で入力してください。");
|
65
|
-
|
66
|
-
}
|
67
63
|
|
68
|
-
|
69
64
|
})
|
70
65
|
.fail(function(jqXHR, textStatus, errorThrown) {
|
71
66
|
$("#p1").text(jqXHR.status); //例:404
|
@@ -101,7 +96,6 @@
|
|
101
96
|
})
|
102
97
|
.always(function() {});
|
103
98
|
});
|
104
|
-
|
105
99
|
```
|
106
100
|
```java
|
107
101
|
@RestController
|
4
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
### 発生している問題・エラーメッセージ
|
18
18
|
|
19
19
|
```
|
20
|
-
(
|
20
|
+

|
21
21
|
```
|
22
22
|
|
23
23
|
|
3
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
### 発生している問題・エラーメッセージ
|
18
18
|
|
19
19
|
```
|
20
|
-
|
20
|
+
(e6dfe9599a700a292904991be1bd857c.png)
|
21
21
|
```
|
22
22
|
|
23
23
|
|
2
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,13 +14,26 @@
|
|
14
14
|
|
15
15
|
できれば、こういう感じ書くんだよみたいな感じで、コードを書いて送ってくれると嬉しいです。
|
16
16
|
|
17
|
+
### 発生している問題・エラーメッセージ
|
17
18
|
|
19
|
+
```
|
20
|
+

|
21
|
+
```
|
18
22
|
|
19
23
|
|
24
|
+
|
20
25
|
### 該当のソースコード
|
21
26
|
|
22
27
|
```JavaScript
|
28
|
+
|
29
|
+
//登録画面の表示
|
30
|
+
$("#forRegister").on("click", function() {
|
31
|
+
$.ajax({
|
32
|
+
url: "/employee/forSearch",
|
33
|
+
type: "GET",
|
34
|
+
contentType: "application/json",
|
35
|
+
})
|
23
|
-
.done(function(user, textStatus, jqXHR) {
|
36
|
+
.done(function(user, textStatus, jqXHR) {
|
24
37
|
$("#p1").empty();
|
25
38
|
$("#p1").append(
|
26
39
|
'<section><br><br><h2>社員登録</h2><br>' +
|
@@ -42,12 +55,104 @@
|
|
42
55
|
for (var j = 0; j < user[1].length; j++) {
|
43
56
|
$("#position").append($('<option>').html(user[1][j].name).val(user[1][j].value));
|
44
57
|
}
|
58
|
+
|
45
|
-
|
59
|
+
if ($("#employee_code").val() === null || $("#employee_code").val() === "") {
|
46
|
-
|
60
|
+
alert("社員番号を入力してください。");
|
47
61
|
|
48
62
|
}
|
63
|
+
if ($("#employee_code").val().length === 6) {
|
64
|
+
alert("6文字で入力してください。");
|
65
|
+
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
})
|
70
|
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
71
|
+
$("#p1").text(jqXHR.status); //例:404
|
72
|
+
})
|
73
|
+
.always(function() {});
|
74
|
+
});
|
75
|
+
|
76
|
+
|
77
|
+
//登録する
|
78
|
+
$(document).on("click", "#register", function() {
|
79
|
+
var json1 = {
|
80
|
+
employee_code: $("#employee_code").val(),
|
81
|
+
employee_name: $("#employee_name").val(),
|
82
|
+
furigana: $("#furigana").val(),
|
83
|
+
mail_address: $("#mail_address").val(),
|
84
|
+
tel_no: $("#tel_no").val(),
|
85
|
+
affiliation_group_code: $("#affiliation_group").val(),
|
86
|
+
position_code: $("#position").val(),
|
87
|
+
};
|
88
|
+
$.ajax({
|
89
|
+
url: "/employee/register",
|
90
|
+
type: "POST",
|
91
|
+
contentType: "application/json",
|
92
|
+
data: JSON.stringify(json1),
|
93
|
+
dataType: "json",
|
94
|
+
})
|
95
|
+
.done(function(userList, textStatus, jqXHR) {
|
96
|
+
$("#p1").empty()
|
97
|
+
$("#p1").append('<h4>登録が完了しました</h4>')
|
98
|
+
})
|
99
|
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
100
|
+
$("#p1").text(jqXHR.status);
|
101
|
+
})
|
102
|
+
.always(function() {});
|
103
|
+
});
|
104
|
+
|
49
105
|
```
|
106
|
+
```java
|
107
|
+
@RestController
|
108
|
+
@RequestMapping("/employee")
|
109
|
+
public class DBA_Employee_Controller {
|
50
110
|
|
111
|
+
private final Office_Worker_Service office_worker_service;
|
112
|
+
|
113
|
+
@Autowired
|
114
|
+
public DBA_Employee_Controller(Office_Worker_Service office_worker_service) {
|
115
|
+
|
116
|
+
this.office_worker_service = office_worker_service;
|
117
|
+
}
|
118
|
+
|
119
|
+
@PostMapping("/register")
|
120
|
+
@ResponseBody
|
121
|
+
public User register(@RequestBody UserForm userForm) {
|
122
|
+
|
123
|
+
User user = new User();
|
124
|
+
|
125
|
+
user.setEmployee_code(userForm.getEmployee_code());
|
126
|
+
user.setEmployee_name(userForm.getEmployee_name());
|
127
|
+
user.setFurigana(userForm.getFurigana());
|
128
|
+
user.setMail_address(userForm.getMail_address());
|
129
|
+
user.setTel_no(userForm.getTel_no());
|
130
|
+
user.setAffiliation_group_code(userForm.getAffiliation_group_code());
|
131
|
+
user.setPosition_code(userForm.getPosition_code());
|
132
|
+
|
133
|
+
office_worker_service.insert(user);
|
134
|
+
|
135
|
+
return user;
|
136
|
+
}
|
137
|
+
|
138
|
+
|
139
|
+
@GetMapping("/select")
|
140
|
+
@ResponseBody
|
141
|
+
public List<List<CodeMast>> select(){
|
142
|
+
|
143
|
+
List<CodeMast> AffiliationGroup = office_worker_service.AllAffiliationGroup();
|
144
|
+
List<CodeMast> Position = office_worker_service.AllPosition();
|
145
|
+
|
146
|
+
List<List<CodeMast>> list = new ArrayList<List<CodeMast>>();
|
147
|
+
|
148
|
+
list.add(AffiliationGroup);
|
149
|
+
list.add(Position);
|
150
|
+
|
151
|
+
return list;
|
152
|
+
}
|
153
|
+
|
154
|
+
```
|
155
|
+
|
51
156
|
### 試したこと
|
52
157
|
|
53
158
|
Validation-Engineやspringで作っているので、アノテーションなども使ってみたんですが、作り方の問題かうまくいきません。
|
1
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
みたいな感じでif文を使ってやりたいです。
|
13
13
|
|
14
14
|
|
15
|
-
できれば、こういう感じみたい
|
15
|
+
できれば、こういう感じ書くんだよみたいな感じで、コードを書いて送ってくれると嬉しいです。
|
16
16
|
|
17
17
|
|
18
18
|
|