在FailedProj增加对科目二 II类考场标准表的查询
| | |
| | | import androidx.room.PrimaryKey; |
| | | |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForI; |
| | | import safeluck.drive.evaluation.DB.criterias.CriteriaForII; |
| | | |
| | | import static androidx.room.ForeignKey.CASCADE; |
| | | |
| | |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | @Entity(tableName = "fail_projects",foreignKeys = @ForeignKey(entity = CriteriaForI.class, |
| | | parentColumns = "item_id",childColumns = "emp_id",onDelete = CASCADE),indices = @Index(value = {"emp_id"})) |
| | | @Entity(tableName = "fail_projects",foreignKeys = {@ForeignKey(entity = CriteriaForI.class, |
| | | parentColumns = "item_id",childColumns = "emp_id",onDelete = CASCADE),@ForeignKey(entity = CriteriaForII.class, |
| | | parentColumns = "item_id",childColumns = "emp_id")},indices = @Index(value = {"emp_id"})) |
| | | public class FailedProj { |
| | | @PrimaryKey(autoGenerate = true) |
| | | private int id; |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 获得科目二 I类考场失败项目扣分项 |
| | | * @param stu_id |
| | | * @return |
| | | */ |
| | | public LiveData<List<FailedProj_select>> getFailedProjectsForI(long stu_id) { |
| | | return failProjDao.getFailedProjectsForI(stu_id); |
| | | } |
| | | |
| | | /** |
| | | * 获得科目二 II类考场失败项目扣分项 |
| | | * @param stu_id |
| | | * @return |
| | | */ |
| | | public LiveData<List<FailedProj_select>> getFailedProjectsForII(long stu_id) { |
| | | return failProjDao.getFailedProjectsForII(stu_id); |
| | | } |
| | | } |
| | |
| | | public LiveData<List<FailedProj_select>> getFailedProjectsForI(long stu_id){ |
| | | return failedProjRepository.getFailedProjectsForI(stu_id); |
| | | } |
| | | public LiveData<List<FailedProj_select>> getFailedProjectsForII(long stu_id){ |
| | | return failedProjRepository.getFailedProjectsForII(stu_id); |
| | | } |
| | | public void insert(FailedProj proj){ |
| | | failedProjRepository.insert(proj); |
| | | } |
| | |
| | | @Override |
| | | public void run() { |
| | | |
| | | WorkRoomDataBase.getWorkRoomDataBase(getContext().getApplicationContext()).getFailProjDao().insert(new FailedProj(1, r,flag?1001:1000)); |
| | | WorkRoomDataBase.getWorkRoomDataBase(getContext().getApplicationContext()).getFailProjDao().insert(new FailedProj(flag?1:2, r,flag?1001:1000)); |
| | | flag = !flag; |
| | | } |
| | | }); |
| | |
| | | |
| | | |
| | | FailedProjViewModel failedProjViewModel =ViewModelProviders.of(this).get(FailedProjViewModel.class); |
| | | failedProjViewModel.getFailedProjectsForI(1001).observe(this, new Observer<List<FailedProj_select>>() { |
| | | failedProjViewModel.getFailedProjectsForI(1000).observe(this, new Observer<List<FailedProj_select>>() { |
| | | @Override |
| | | public void onChanged(List<FailedProj_select> failedProj_selects) { |
| | | item_id = 0; |