質問編集履歴
1
エンティティクラス、サービスクラスを追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -356,6 +356,148 @@
|
|
356
356
|
|
357
357
|
```
|
358
358
|
|
359
|
+
```
|
360
|
+
|
361
|
+
サービスクラス
|
362
|
+
|
363
|
+
package com.example.demo.model;
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
import org.springframework.beans.factory.annotation.Autowired;
|
368
|
+
|
369
|
+
import org.springframework.stereotype.Service;
|
370
|
+
|
371
|
+
import org.springframework.transaction.annotation.Transactional;
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
import com.example.demo.entity.LoginEntity;
|
376
|
+
|
377
|
+
import com.example.demo.repository.LoginRepository;
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
@Service
|
384
|
+
|
385
|
+
@Transactional
|
386
|
+
|
387
|
+
public class LoginModel {
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
@Autowired
|
392
|
+
|
393
|
+
LoginRepository LoginRepository;
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
public LoginEntity findLogin(String id,String password){
|
400
|
+
|
401
|
+
return LoginRepository.findLogin(id,password);//リポジトリクラスからログイン用の処理の呼び出し
|
402
|
+
|
403
|
+
}
|
404
|
+
|
405
|
+
}
|
406
|
+
|
407
|
+
```
|
408
|
+
|
409
|
+
```
|
410
|
+
|
411
|
+
エンティティクラス
|
412
|
+
|
413
|
+
package com.example.demo.entity;
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
import javax.persistence.Column;
|
418
|
+
|
419
|
+
import javax.persistence.Entity;
|
420
|
+
|
421
|
+
import javax.persistence.Id;
|
422
|
+
|
423
|
+
import javax.persistence.Table;
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
import lombok.AllArgsConstructor;
|
428
|
+
|
429
|
+
import lombok.Builder;
|
430
|
+
|
431
|
+
import lombok.Data;
|
432
|
+
|
433
|
+
import lombok.NoArgsConstructor;
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
@Entity
|
438
|
+
|
439
|
+
@Table(name = "M_EMPLOYEE")//DBから参照するテーブル名
|
440
|
+
|
441
|
+
//ログイン用エンティティクラス
|
442
|
+
|
443
|
+
public class LoginEntity {
|
444
|
+
|
445
|
+
@Id
|
446
|
+
|
447
|
+
private String emp_id;
|
448
|
+
|
449
|
+
@Column(nullable = false)
|
450
|
+
|
451
|
+
private String login_pass;
|
452
|
+
|
453
|
+
private String delete_flg;
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
public String getEmp_id() {
|
460
|
+
|
461
|
+
return emp_id;
|
462
|
+
|
463
|
+
}
|
464
|
+
|
465
|
+
public void setEmp_id(String emp_id) {
|
466
|
+
|
467
|
+
this.emp_id = emp_id;
|
468
|
+
|
469
|
+
}
|
470
|
+
|
471
|
+
public String getLogin_pass() {
|
472
|
+
|
473
|
+
return login_pass;
|
474
|
+
|
475
|
+
}
|
476
|
+
|
477
|
+
public void setLogin_pass(String login_pass) {
|
478
|
+
|
479
|
+
this.login_pass = login_pass;
|
480
|
+
|
481
|
+
}
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
public String getDelete_flg() {
|
486
|
+
|
487
|
+
return delete_flg;
|
488
|
+
|
489
|
+
}
|
490
|
+
|
491
|
+
public void setDelete_flg(String delete_flg) {
|
492
|
+
|
493
|
+
this.delete_flg = delete_flg;
|
494
|
+
|
495
|
+
}
|
496
|
+
|
497
|
+
}
|
498
|
+
|
499
|
+
```
|
500
|
+
|
359
501
|
|
360
502
|
|
361
503
|
### 試したこと
|