Merge branch 'master' into CreateRoot2
# Conflicts: # app/src/main/java/com/example/oplogy/MyDataClass.java
This commit is contained in:
commit
ab41832ebd
|
@ -3,9 +3,8 @@ import androidx.room.Database;
|
|||
import androidx.room.RoomDatabase;
|
||||
import androidx.room.TypeConverters;
|
||||
|
||||
@Database(entities = {QuestionnaireForm.class}, version = 1)
|
||||
@TypeConverters({Converters.class})
|
||||
@Database(entities = {SetUpTable.class}, version = 1)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
// データベースにアクセスするためのメソッドを提供する
|
||||
public abstract QuestionnaireFormDao questionnaireFormDao();
|
||||
public abstract SetUpTableDao setUpTableDao();
|
||||
}
|
|
@ -39,7 +39,6 @@ public class MyDataClass {
|
|||
", secondDay=" + secondDay +
|
||||
'}';
|
||||
}
|
||||
|
||||
//getter
|
||||
public String getPatronName() {
|
||||
return patronName;
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package com.example.oplogy;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@Entity
|
||||
public class QuestionnaireForm {
|
||||
//主キー
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
public int id;
|
||||
|
||||
//その他フィールド
|
||||
public int classId;
|
||||
public String patronName;
|
||||
public String address;
|
||||
public String firstDay;
|
||||
public int studentNumber;
|
||||
public String childName;
|
||||
public String thirdDay;
|
||||
public String secondDay;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.example.oplogy;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface QuestionnaireFormDao {
|
||||
|
||||
@Query("SELECT * FROM QuestionnaireForm")
|
||||
List<QuestionnaireForm> getAll();
|
||||
|
||||
// このメソッドは、QuestionnaireFormのリストを受け取り、それらをデータベースに挿入します。
|
||||
@Insert
|
||||
void insertAll(QuestionnaireForm... questionnaireForms);
|
||||
}
|
86
app/src/main/java/com/example/oplogy/SetUpTable.java
Normal file
86
app/src/main/java/com/example/oplogy/SetUpTable.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
package com.example.oplogy;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@Entity
|
||||
public class SetUpTable {
|
||||
//主キー
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
public int id;
|
||||
public String teacherName;
|
||||
public String startPoint;
|
||||
public String endPoint;
|
||||
public String startTime;
|
||||
public String endTime;
|
||||
public String breakStartTime;
|
||||
public String breakEndTime;
|
||||
public int totalStudent;
|
||||
|
||||
//コンストラクタ
|
||||
public SetUpTable(String teacherName, String startPoint, String endPoint, String startTime, String endTime, String breakStartTime,String breakEndTime, int totalStudent) {
|
||||
this.teacherName = teacherName;
|
||||
this.startPoint = startPoint;
|
||||
this.endPoint = endPoint;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.breakStartTime = breakStartTime;
|
||||
this.breakEndTime = breakEndTime;
|
||||
this.totalStudent = totalStudent;
|
||||
}
|
||||
//getter
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
public String getTeacherName() {
|
||||
return teacherName;
|
||||
}
|
||||
public String getStartPoint() {
|
||||
return startPoint;
|
||||
}
|
||||
public String getEndPoint() {
|
||||
return endPoint;
|
||||
}
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
public String getBreakStartTime() {
|
||||
return breakStartTime;
|
||||
}
|
||||
public String getBreakEndTime() {
|
||||
return breakEndTime;
|
||||
}
|
||||
public int getTotalStudent() {
|
||||
return totalStudent;
|
||||
}
|
||||
//setter
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setTeacherName(String teacherName) {
|
||||
this.teacherName = teacherName;
|
||||
}
|
||||
public void setStartPoint(String startPoint) {
|
||||
this.startPoint = startPoint;
|
||||
}
|
||||
public void setEndPoint(String endPoint) {
|
||||
this.endPoint = endPoint;
|
||||
}
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
public void setBreakStartTime(String breakStartTime) {
|
||||
this.breakStartTime = breakStartTime;
|
||||
}
|
||||
public void setBreakEndTime(String breakEndTime) {
|
||||
this.breakEndTime = breakEndTime;
|
||||
}
|
||||
public void setTotalStudent(int totalStudent) {
|
||||
this.totalStudent = totalStudent;
|
||||
}
|
||||
}
|
12
app/src/main/java/com/example/oplogy/SetUpTableDao.java
Normal file
12
app/src/main/java/com/example/oplogy/SetUpTableDao.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package com.example.oplogy;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface SetUpTableDao {
|
||||
@Insert
|
||||
void insertAll(SetUpTable... setUpTables);
|
||||
}
|
Loading…
Reference in New Issue
Block a user