GeoCoder.classへの遷移を後に変更 #5

Merged
Utahshi merged 2 commits from CreateRoot2 into master 2024-06-19 05:49:49 +00:00
6 changed files with 100 additions and 41 deletions
Showing only changes of commit ab41832ebd - Show all commits

View File

@ -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();
}

View File

@ -39,7 +39,6 @@ public class MyDataClass {
", secondDay=" + secondDay +
'}';
}
//getter
public String getPatronName() {
return patronName;

View File

@ -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;
}

View File

@ -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);
}

View 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;
}
}

View 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);
}