Browse Source

feat : 修正sql

dev
徐振升 3 days ago
parent
commit
86b99328b6
  1. 5
      lib/app/core/utils/constants/globals.dart
  2. 5
      lib/app/features/enterprise/data/datasources/enterprise_local_data_source.dart
  3. 1
      lib/app/features/enterprise/presentation/pages/enterprise_info_page.dart
  4. 3
      lib/app/features/navigation/presentation/controllers/navigation_controller.dart
  5. 2
      lib/app/features/problem/presentation/pages/problem_form_page.dart

5
lib/app/core/utils/constants/globals.dart

@ -0,0 +1,5 @@
// globals.dart
library my_globals;
//
bool isShowAddEnterprise = false;

5
lib/app/features/enterprise/data/datasources/enterprise_local_data_source.dart

@ -74,6 +74,7 @@ class EnterpriseLocalDataSourceImpl implements EnterpriseLocalDataSource {
// pendingCreate 0
final int syncedIndex = SyncStatus.synced.index;
final String syncedName = SyncStatus.synced.name;
// WHERE
final List<String> whereClauses = [];
@ -129,8 +130,8 @@ class EnterpriseLocalDataSourceImpl implements EnterpriseLocalDataSource {
SELECT
e.*,
COUNT(p.id) AS totalProblems,
COUNT(CASE WHEN p.syncStatus == $syncedIndex THEN 1 ELSE NULL END) AS uploadedProblems,
COUNT(CASE WHEN p.syncStatus != $syncedIndex THEN 1 ELSE NULL END) AS pendingProblems
COUNT(CASE WHEN p.syncStatus == '$syncedName' THEN 1 ELSE NULL END) AS uploadedProblems,
COUNT(CASE WHEN p.syncStatus != '$syncedName' THEN 1 ELSE NULL END) AS pendingProblems
FROM
$_tableName e
LEFT JOIN

1
lib/app/features/enterprise/presentation/pages/enterprise_info_page.dart

@ -6,7 +6,6 @@ import 'package:problem_check_system/app/features/enterprise/presentation/contro
import 'package:problem_check_system/app/features/enterprise/presentation/pages/widgets/enterprise_form_view.dart';
import 'package:problem_check_system/app/features/problem/presentation/pages/problem_list_page.dart';
//
class EnterpriseInfoPage extends GetView<EnterpriseInfoController> {
const EnterpriseInfoPage({super.key});

3
lib/app/features/navigation/presentation/controllers/navigation_controller.dart

@ -9,6 +9,7 @@ import 'package:problem_check_system/app/features/home/pages/home_page.dart';
import 'package:problem_check_system/app/features/my/views/my_page.dart';
import 'package:problem_check_system/app/features/problem/presentation/controllers/problem_list_controller.dart';
import 'package:problem_check_system/app/features/problem/presentation/pages/problem_list_page.dart';
import 'package:problem_check_system/app/core/utils/constants/globals.dart';
class NavigationController extends GetxController {
var selectedIndex = 0.obs;
@ -59,9 +60,11 @@ class NavigationController extends GetxController {
switch (selectedIndex.value) {
case 1: //
enterpriseListController.search();
isShowAddEnterprise = false;
break;
case 2: //
problemListController.search();
isShowAddEnterprise = true;
break;
default:
break;

2
lib/app/features/problem/presentation/pages/problem_form_page.dart

@ -6,6 +6,7 @@ import 'package:image_picker/image_picker.dart';
import 'package:problem_check_system/app/core/pages/widgets/custom_app_bar.dart';
import 'package:problem_check_system/app/features/enterprise/domain/entities/enterprise.dart';
import 'package:problem_check_system/app/features/problem/presentation/controllers/problem_form_controller.dart';
import 'package:problem_check_system/app/core/utils/constants/globals.dart';
class ProblemFormPage extends GetView<ProblemFormController> {
//
@ -510,6 +511,7 @@ class ProblemFormPage extends GetView<ProblemFormController> {
),
),
),
if (isShowAddEnterprise)
//
ElevatedButton(
onPressed: () {

Loading…
Cancel
Save