質問編集履歴
5
修正依頼に基づき
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
初めて質問させていただきます。
|
2
|
+
至らない点がありましたら、どうかご指摘のほど、よろしくお願いいたします。
|
3
|
+
|
4
|
+
|
1
5
|
### 前提
|
2
6
|
環境
|
3
7
|
言語:Java
|
@@ -236,7 +240,5 @@
|
|
236
240
|
│ └─js
|
237
241
|
└─templates
|
238
242
|
|
239
|
-
|
243
|
+
|
240
|
-
|
244
|
+
|
241
|
-
至らない点がありましたら、どうかご指摘のほど、よろしくお願いいたします。
|
242
|
-
|
4
誤字の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
DB:MySQL8.0(Version:8.0.27)
|
6
6
|
|
7
7
|
### 実現したいこと
|
8
|
-
- [ ] MyBatisを使えるようにしたい
|
8
|
+
- [ ] MyBatisを使えるようにしたい
|
9
9
|
application.propertiesのDB接続の、ユーザーネームとパスワードには問題ありません
|
10
10
|
## エラー内容
|
11
11
|
```
|
3
javaコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
### 該当のソースコード
|
19
19
|
|
20
|
-
```
|
20
|
+
```application.properties
|
21
21
|
## MySQLの接続文字列
|
22
22
|
spring.datasource.url=jdbc:mysql://localhost:3306/todo_db?characterEncoding=UTF-8
|
23
23
|
## アクセスするためのユーザ名
|
@@ -68,17 +68,31 @@
|
|
68
68
|
|
69
69
|
```
|
70
70
|
|
71
|
-
```
|
71
|
+
```UserEntity.java
|
72
|
-
package com.example.todo.app.
|
72
|
+
package com.example.todo.app.entity;
|
73
|
+
|
74
|
+
import java.time.LocalDate;
|
73
75
|
|
74
76
|
import javax.persistence.Column;
|
77
|
+
import javax.persistence.Entity;
|
78
|
+
import javax.persistence.GeneratedValue;
|
79
|
+
import javax.persistence.GenerationType;
|
80
|
+
import javax.persistence.Id;
|
81
|
+
import javax.persistence.Table;
|
75
82
|
|
76
83
|
import lombok.Getter;
|
77
84
|
import lombok.Setter;
|
78
85
|
|
79
86
|
@Setter
|
80
87
|
@Getter
|
88
|
+
@Entity
|
89
|
+
@Table(name = "users")
|
81
|
-
public class User
|
90
|
+
public class UserEntity {
|
91
|
+
|
92
|
+
@Id
|
93
|
+
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
94
|
+
@Column(name = "user_id")
|
95
|
+
private int userId;
|
82
96
|
|
83
97
|
@Column(name = "for_search_id")
|
84
98
|
private String forSearchId;
|
@@ -107,10 +121,26 @@
|
|
107
121
|
@Column(name = "is_searchable")
|
108
122
|
private boolean isSearchable;
|
109
123
|
|
124
|
+
@Column(name = "delete_flg")
|
125
|
+
private String deleteFlg;
|
126
|
+
|
127
|
+
@Column(name = "created_at")
|
128
|
+
private LocalDate createdAt;
|
129
|
+
|
130
|
+
@Column(name = "updated_at")
|
131
|
+
private LocalDate updatedAt;
|
132
|
+
|
133
|
+
public UserEntity() {
|
134
|
+
// TODO 自動生成されたコンストラクター・スタブ
|
135
|
+
}
|
136
|
+
|
110
137
|
}
|
138
|
+
|
139
|
+
|
140
|
+
|
111
|
-
```
|
141
|
+
```
|
112
|
-
|
142
|
+
|
113
|
-
```
|
143
|
+
```UserMapper.java
|
114
144
|
package com.example.todo.domain.repository;
|
115
145
|
|
116
146
|
import java.util.List;
|
@@ -122,13 +152,61 @@
|
|
122
152
|
@Mapper
|
123
153
|
public interface UserMapper {
|
124
154
|
|
125
|
-
List<User
|
155
|
+
List<UserEntity> findOne(String mailAddress);
|
126
156
|
|
127
157
|
}
|
128
158
|
|
129
159
|
|
130
160
|
```
|
131
161
|
|
162
|
+
```AddAccountService.java
|
163
|
+
package com.example.todo.domain.service;
|
164
|
+
|
165
|
+
import java.util.List;
|
166
|
+
|
167
|
+
import javax.servlet.http.HttpSession;
|
168
|
+
|
169
|
+
import org.springframework.beans.factory.annotation.Autowired;
|
170
|
+
import org.springframework.stereotype.Service;
|
171
|
+
|
172
|
+
import com.example.todo.app.entity.UserEntity;
|
173
|
+
import com.example.todo.app.form.UserForm;
|
174
|
+
import com.example.todo.domain.repository.UserMapper;
|
175
|
+
|
176
|
+
@Service
|
177
|
+
public class AddAccountService implements IAddAccount {
|
178
|
+
|
179
|
+
@Autowired
|
180
|
+
HttpSession session;
|
181
|
+
|
182
|
+
@Autowired
|
183
|
+
UserMapper userMapper;
|
184
|
+
|
185
|
+
@Override
|
186
|
+
public void addAccoount() {
|
187
|
+
|
188
|
+
}
|
189
|
+
|
190
|
+
// 新規会員登録処理
|
191
|
+
// 入力チェックはFormクラスのアノテーションで対応
|
192
|
+
public boolean setAccountInfo(UserForm user) {
|
193
|
+
|
194
|
+
// メールアドレス既存チェック(存在していればfalse)
|
195
|
+
|
196
|
+
List<UserEntity> userList = userMapper.findOne(user.getMailAddress());
|
197
|
+
|
198
|
+
if (userList.size() > 0) {
|
199
|
+
return false;
|
200
|
+
}
|
201
|
+
|
202
|
+
return true;
|
203
|
+
|
204
|
+
}
|
205
|
+
|
206
|
+
}
|
207
|
+
|
208
|
+
|
209
|
+
```
|
132
210
|
|
133
211
|
### 試したこと
|
134
212
|
ディレクトリ構造が悪いのかと思い、ファイルの位置を変えてみたり、パスを確認したりしたのですが、どうにもうまくいきません
|
2
エラー内容の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,6 +8,10 @@
|
|
8
8
|
- [ ] MyBatisを使えるようにしたい![イメージ説明]
|
9
9
|
application.propertiesのDB接続の、ユーザーネームとパスワードには問題ありません
|
10
10
|
## エラー内容
|
11
|
+
```
|
12
|
+
Error parsing Mapper XML. The XML location is 'com/example/todo/domain/repository/UserMapper.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'UserEntity'. Cause: java.lang.ClassNotFoundException: Cannot find class: UserEntity
|
13
|
+
```
|
14
|
+
|
11
15
|
|
12
16
|
![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2022-08-09/92ce46a2-5a70-4918-be45-585402140946.jpeg)
|
13
17
|
|
1
試したことの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -127,7 +127,7 @@
|
|
127
127
|
|
128
128
|
|
129
129
|
### 試したこと
|
130
|
-
ディレクトリ構造が悪いのかと思い、ファイルの位置を変えてみたりしたのですが、どうにもうまくいきません
|
130
|
+
ディレクトリ構造が悪いのかと思い、ファイルの位置を変えてみたり、パスを確認したりしたのですが、どうにもうまくいきません
|
131
131
|
|
132
132
|
├─java
|
133
133
|
│ └─com
|