質問編集履歴
1
コントローラ、モデル、サービスクラスの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,39 +42,101 @@
|
|
42
42
|
|
43
43
|
import group.study.dev.dto.sample.SampleDto;
|
44
44
|
|
45
|
+
import group.study.dev.sample.search.model.UserModel;
|
46
|
+
|
47
|
+
import group.study.dev.sample.search.service.UserService;
|
48
|
+
|
49
|
+
import group.study.dev.web.common.controller.AbstractController;
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
@Controller
|
54
|
+
|
55
|
+
public class UserController extends AbstractController {
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
@Autowired
|
60
|
+
|
61
|
+
private UserService userService;
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
@RequestMapping("/search")
|
66
|
+
|
67
|
+
public void init(UserModel userModel, Model model) {
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
List<SampleDto> listAll = userService.selectAll();
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
model.addAttribute("listAll", listAll);
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
System.out.println("listAll=" + listAll);
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
```
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
### UserService
|
96
|
+
|
97
|
+
```ここに言語を入力
|
98
|
+
|
99
|
+
package group.study.dev.sample.sample001.service;
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
import java.util.List;
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
import org.springframework.beans.factory.annotation.Autowired;
|
108
|
+
|
109
|
+
import org.springframework.stereotype.Service;
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
import group.study.dev.dao.sample.SampleDao;
|
114
|
+
|
115
|
+
import group.study.dev.dto.sample.SampleDto;
|
116
|
+
|
45
117
|
import group.study.dev.sample.sample001.model.UserModel;
|
46
118
|
|
47
|
-
|
119
|
+
|
48
|
-
|
49
|
-
|
50
|
-
|
120
|
+
|
51
|
-
@
|
121
|
+
@Service
|
52
|
-
|
53
|
-
|
122
|
+
|
54
|
-
|
55
|
-
public class User
|
123
|
+
public class UserService {
|
56
|
-
|
57
|
-
|
58
124
|
|
59
125
|
@Autowired
|
60
126
|
|
61
|
-
private
|
127
|
+
private SampleDao sampleMapper;
|
128
|
+
|
129
|
+
|
130
|
+
|
62
|
-
|
131
|
+
public List<SampleDto> selectAll(){
|
63
|
-
|
64
|
-
|
132
|
+
|
65
|
-
|
133
|
+
UserModel userModel = new UserModel();
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
134
|
+
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
135
|
+
userModel.setSampleList(sampleMapper.selectAll());
|
74
|
-
|
75
|
-
|
76
|
-
|
136
|
+
|
137
|
+
|
138
|
+
|
77
|
-
|
139
|
+
return userModel.getSampleList();
|
78
140
|
|
79
141
|
}
|
80
142
|
|
@@ -82,62 +144,6 @@
|
|
82
144
|
|
83
145
|
}
|
84
146
|
|
85
|
-
|
86
|
-
|
87
|
-
```
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
### UserService
|
92
|
-
|
93
|
-
```ここに言語を入力
|
94
|
-
|
95
|
-
package group.study.dev.sample.sample001.service;
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
import java.util.List;
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
import org.springframework.beans.factory.annotation.Autowired;
|
104
|
-
|
105
|
-
import org.springframework.stereotype.Service;
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
import group.study.dev.dao.sample.SampleDao;
|
110
|
-
|
111
|
-
import group.study.dev.dto.sample.SampleDto;
|
112
|
-
|
113
|
-
import group.study.dev.sample.sample001.model.UserModel;
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
@Service
|
118
|
-
|
119
|
-
public class UserService {
|
120
|
-
|
121
|
-
@Autowired
|
122
|
-
|
123
|
-
private SampleDao sampleMapper;
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
public List<SampleDto> init(UserModel userModel){
|
128
|
-
|
129
|
-
List<SampleDto> sampleList = sampleMapper.selectAll();
|
130
|
-
|
131
|
-
System.out.println(sampleList);
|
132
|
-
|
133
|
-
return sampleList;
|
134
|
-
|
135
|
-
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
}
|
140
|
-
|
141
147
|
```
|
142
148
|
|
143
149
|
|
@@ -164,7 +170,7 @@
|
|
164
170
|
|
165
171
|
public class UserModel {
|
166
172
|
|
167
|
-
private List<SampleDto>
|
173
|
+
private List<SampleDto> sampleList;
|
168
174
|
|
169
175
|
}
|
170
176
|
|