根据学号查失败项目表;再加上根据subject考场类型查询
| | |
| | | * 如果要添加 科目二II III类考场失败项目,需要建立相应的评判标准表数据表 |
| | | * @return |
| | | */ |
| | | @Query("SELECT emp_id,stu_id,deducting_reason,score_deducting,item_content from criteria_one INNER JOIN fail_projects ON criteria_one.item_id= fail_projects.emp_id") |
| | | LiveData<List<FailedProj_select>> getFailedProjects(); |
| | | @Query("SELECT emp_id,stu_id,deducting_reason,score_deducting,item_content from criteria_one INNER JOIN fail_projects ON criteria_one.item_id= fail_projects.emp_id where fail_projects.stu_id=:stu_id and fail_projects.subject=1") |
| | | LiveData<List<FailedProj_select>> getFailedProjectsForI(long stu_id); |
| | | /** |
| | | * 查询 科目二 II类考场的失败项目 (多表查询) |
| | | * 如果要添加 科目二II III类考场失败项目,需要建立相应的评判标准表数据表 |
| | | * @return |
| | | */ |
| | | @Query("SELECT emp_id,stu_id,deducting_reason,score_deducting,item_content from criteria_two INNER JOIN fail_projects ON criteria_two.item_id= fail_projects.emp_id where fail_projects.stu_id=:stu_id and fail_projects.subject=2") |
| | | LiveData<List<FailedProj_select>> getFailedProjectsForII(long stu_id); |
| | | |
| | | /** |
| | | * 获取失败项目条数 |
| | |
| | | }); |
| | | } |
| | | |
| | | public LiveData<List<FailedProj_select>> getFailedProjects() { |
| | | return failProjDao.getFailedProjects(); |
| | | public LiveData<List<FailedProj_select>> getFailedProjectsForI(long stu_id) { |
| | | return failProjDao.getFailedProjectsForI(stu_id); |
| | | } |
| | | } |
| | |
| | | failedProjRepository = new FailedProjRepository(application); |
| | | } |
| | | |
| | | public LiveData<List<FailedProj_select>> getFailedProjects(){ |
| | | return failedProjRepository.getFailedProjects(); |
| | | public LiveData<List<FailedProj_select>> getFailedProjectsForI(long stu_id){ |
| | | return failedProjRepository.getFailedProjectsForI(stu_id); |
| | | } |
| | | public void insert(FailedProj proj){ |
| | | failedProjRepository.insert(proj); |
| | |
| | | btn_send.setOnClickListener(this); |
| | | btn_connect.setOnClickListener(this); |
| | | } |
| | | int r ; |
| | | int r ; boolean flag; |
| | | @Override |
| | | public void onClick(View v) { |
| | | switch (v.getId()){ |
| | |
| | | @Override |
| | | public void run() { |
| | | |
| | | WorkRoomDataBase.getWorkRoomDataBase(getContext().getApplicationContext()).getFailProjDao().insert(new FailedProj(1, r,1001)); |
| | | WorkRoomDataBase.getWorkRoomDataBase(getContext().getApplicationContext()).getFailProjDao().insert(new FailedProj(1, r,flag?1001:1000)); |
| | | flag = !flag; |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | |
| | | FailedProjViewModel failedProjViewModel =ViewModelProviders.of(this).get(FailedProjViewModel.class); |
| | | failedProjViewModel.getFailedProjects().observe(this, new Observer<List<FailedProj_select>>() { |
| | | failedProjViewModel.getFailedProjectsForI(1001).observe(this, new Observer<List<FailedProj_select>>() { |
| | | @Override |
| | | public void onChanged(List<FailedProj_select> failedProj_selects) { |
| | | item_id = 0; |