Selaa lähdekoodia

去除登录账户和密码默认值,添加样张提示信息,删除样张文字,添加默认用户信息

zhangxike 1 viikko sitten
vanhempi
commit
ccec9a3269

+ 3 - 3
pages/login.uvue

@@ -61,9 +61,9 @@
         register: false as boolean,
         globalConfig: getApp().globalData.config as UTSJSONObject,
         loginForm: {
-          username: "admin",
-          name: "管理员",
-          password: "admin123",
+          username: "",
+          name: "",
+          password: "",
           code: "",
           uuid: ''
         } as UTSJSONObject

+ 8 - 5
pages/work/download/PhotoRecord.uvue

@@ -64,7 +64,7 @@
 						</view>
 					</swiper-item>
 				</swiper>
-
+				<view v-if="item.exampleurlSpl.length>0"><text class="info-tips">—— 以下为示例图像 ——</text></view>
 				<swiper class="swiper-box my-swiper mg-top" :current="0" :indicator-dots="true"
 					v-if="item.exampleurlSpl.length>0" :key="'example-'+item.sxid">
 					<swiper-item v-for="(url, index) in item.exampleurlSpl" :key="index" @tap="preview(url)">
@@ -73,10 +73,6 @@
 						</view>
 					</swiper-item>
 				</swiper>
-
-				<view v-if="item.exampleurl">
-					<text class="demo-view-label">样张</text>
-				</view>
 			</view>
 
 		</view>
@@ -560,4 +556,11 @@
 	.mg-top {
 		margin-top: 20rpx;
 	}
+	
+	.info-tips {
+		text-align: center;
+		color: #999;
+		font-size: 20rpx;
+		margin-top: 20rpx;
+	}
 </style>

+ 9 - 1
pages/work/process/ProcessList.uvue

@@ -109,7 +109,7 @@
 
 <script setup>
 	import { ref, computed } from 'vue' // 1. 引入 computed(计算属性核心)
-	import { getListByOrder, TaskKeyProcess, recordStatusDict, updateData } from '@/api/work';
+	import { getListByOrder, TaskKeyProcess, recordStatusDict, updateData, addOperateLog } from '@/api/work';
 	import { getCurrentUserSync } from '@/utils/auth';
 
 	// 存储页面参数
@@ -215,6 +215,8 @@
 					});
 				}
 			});
+			addOperateLog({ module: '关键工序记录', title: '更新关键工序记录', content: `更新了关键工序记录信息,产品码:${currentItem.prodno}, 序号为:${currentItem.sxid}`, msg: null, createuser: getCurrentUserSync()??'' })
+			
 		}
 	}
 	
@@ -237,6 +239,8 @@
 					});
 				}
 			});
+			addOperateLog({ module: '关键工序记录', title: '更新关键工序记录', content: `更新了关键工序记录信息,产品码:${currentItem.prodno}, 序号为:${currentItem.sxid}`, msg: null, createuser: getCurrentUserSync()??'' })
+			
 		}
 	}
 	
@@ -257,6 +261,8 @@
 					});
 				}
 			});
+			addOperateLog({ module: '关键工序记录', title: '更新关键工序记录', content: `更新了关键工序记录信息,产品码:${currentItem.prodno}, 序号为:${currentItem.sxid}`, msg: null, createuser: getCurrentUserSync()??'' })
+			
 		}
 	}
 	
@@ -276,6 +282,8 @@
 					});
 				}
 			});
+			addOperateLog({ module: '关键工序记录', title: '更新关键工序记录', content: `更新了关键工序记录信息,产品码:${currentItem.prodno}, 序号为:${currentItem.sxid}`, msg: null, createuser: getCurrentUserSync()??'' })
+			
 		}
 	}
 	

+ 8 - 5
pages/work/record/RecordList.uvue

@@ -77,7 +77,7 @@
 						</view>
 					</swiper-item>
 				</swiper>
-
+				<view v-if="item.urlspl.length>0"><text class="info-tips">—— 以下为示例图像 ——</text></view>
 				<swiper class="swiper-box my-swiper mg-top" :current="0" :indicator-dots="true"
 					v-if="item.urlspl.length>0" :key="'example-'+item.sxid">
 					<swiper-item v-for="(url, index) in item.urlspl" :key="index" @tap="preview(url)" >
@@ -86,10 +86,6 @@
 						</view>
 					</swiper-item>
 				</swiper>
-
-				<view v-if="item.urlspl">
-					<text class="demo-view-label">样张</text>
-				</view>
 			</view>
 
 		</view>
@@ -592,4 +588,11 @@
 		border-radius: 10rpx;
 		text-align: center;
 	}
+	
+	.info-tips {
+		text-align: center;
+		color: #999;
+		font-size: 20rpx;
+		margin-top: 20rpx;
+	}
 </style>

+ 8 - 1
pages/work/report/InspectionList.uvue

@@ -113,7 +113,7 @@
 
 <script setup>
 	import { ref, computed } from 'vue' // 1. 引入 computed(计算属性核心)
-	import { getJoinList, QcRecord, recordStatusDict, updateData } from '@/api/work';
+	import { getJoinList, QcRecord, recordStatusDict, updateData, addOperateLog } from '@/api/work';
 	import { getCurrentUserSync } from '@/utils/auth';
 
 	// 存储页面参数
@@ -239,6 +239,7 @@
 					});
 				}
 			});
+			addOperateLog({ module: '检验任务', title: '更新检验任务', content: `更新了检验任务信息,产品码:${currentItem.prodno}, 序号为:${currentItem.sxid}`, msg: null, createuser: getCurrentUserSync()??'' })
 		}
 	}
 	
@@ -286,6 +287,8 @@
 					});
 				}
 			});
+			addOperateLog({ module: '检验任务', title: '更新检验任务', content: `更新了检验任务信息,产品码:${currentItem.prodno}, 序号为:${currentItem.sxid}`, msg: null, createuser: getCurrentUserSync()??'' })
+			
 		}
 	}
 	
@@ -334,6 +337,8 @@
 					});
 				}
 			});
+			addOperateLog({ module: '检验任务', title: '更新检验任务', content: `更新了检验任务信息,产品码:${currentItem.prodno}, 序号为:${currentItem.sxid}`, msg: null, createuser: getCurrentUserSync()??'' })
+			
 		}
 	}
 	
@@ -353,6 +358,8 @@
 					});
 				}
 			});
+			addOperateLog({ module: '检验任务', title: '更新检验任务', content: `更新了检验任务信息,产品码:${currentItem.prodno}, 序号为:${currentItem.sxid}`, msg: null, createuser: getCurrentUserSync()??'' })
+			
 		}
 	}
 	

+ 250 - 239
uni_modules/uni-sqlContext/utssdk/app-android/index.uts

@@ -8,42 +8,42 @@ import { createSQLiteContextOptions, executeSqlOptions, selectSqlOptions, execut
 import { createSQLiteContextFailImpl } from '../unierror.uts';
 
 class SQLiteContext extends SQLiteOpenHelper {
-  private dbName: string | null;
-  private forceRecreateTables: boolean;
-  
-  constructor(name: string, forceRecreate: boolean = false) {
-    // 使用应用内部存储路径而不是静态资源路径
-    const context = UTSAndroid.getAppContext()!!;
-    // 版本号 - 必须在super调用前定义
-    
-    const dbPath = context.getDatabasePath(name).getAbsolutePath();
-    console.log("Creating database at: " + dbPath);    
-    
-    // 只有在明确需要强制重新创建表时,才删除现有数据库
-    if (forceRecreate) {
-      console.log("Force recreating tables requested, deleting existing database if exists");
-      context.deleteDatabase(name);
-    }
-    
-	//1版本号
-    super(UTSAndroid.getAppContext()!!, name, null, 1);
-    this.dbName = name;
-    this.forceRecreateTables = forceRecreate;
-    
-    // 立即获取可写数据库以触发初始化
-    console.log("Initializing database connection");
-    this.getWritableDatabase();
-  }
-  
-    
-  override onCreate(db: SQLiteDatabase):void {
-	  console.log("SQLiteContext onCreate() called - creating database tables");
-    
-    // 创建表结构的DDL语句
-    // 这里可以根据实际需要添加更多的CREATE TABLE语句
-    const createTableSQLs = [
-      // app_user表结构
-      `CREATE TABLE IF NOT EXISTS app_user (
+	private dbName : string | null;
+	private forceRecreateTables : boolean;
+
+	constructor(name : string, forceRecreate : boolean = false) {
+		// 使用应用内部存储路径而不是静态资源路径
+		const context = UTSAndroid.getAppContext()!!;
+		// 版本号 - 必须在super调用前定义
+
+		const dbPath = context.getDatabasePath(name).getAbsolutePath();
+		console.log("Creating database at: " + dbPath);
+
+		// 只有在明确需要强制重新创建表时,才删除现有数据库
+		if (forceRecreate) {
+			console.log("Force recreating tables requested, deleting existing database if exists");
+			context.deleteDatabase(name);
+		}
+
+		//1版本号
+		super(UTSAndroid.getAppContext()!!, name, null, 1);
+		this.dbName = name;
+		this.forceRecreateTables = forceRecreate;
+
+		// 立即获取可写数据库以触发初始化
+		console.log("Initializing database connection");
+		this.getWritableDatabase();
+	}
+
+
+	override onCreate(db : SQLiteDatabase) : void {
+		console.log("SQLiteContext onCreate() called - creating database tables");
+
+		// 创建表结构的DDL语句
+		// 这里可以根据实际需要添加更多的CREATE TABLE语句
+		const createTableSQLs = [
+			// app_user表结构
+			`CREATE TABLE IF NOT EXISTS app_user (
           id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
           username TEXT NOT NULL,
           name TEXT,
@@ -60,9 +60,9 @@ class SQLiteContext extends SQLiteOpenHelper {
           UNIQUE (username ASC),
           UNIQUE (userno ASC)
         )`,
-      
-      // 日志表
-      `CREATE TABLE "app_log" ( 
+
+			// 日志表
+			`CREATE TABLE "app_log" ( 
        "id" INTEGER NOT NULL UNIQUE, 
        "module" text, 
        "dataid" INTEGER, 
@@ -75,9 +75,9 @@ class SQLiteContext extends SQLiteOpenHelper {
        "updateuser" integer, 
        PRIMARY KEY("id" AUTOINCREMENT) 
       )`,
-      
-      // 媒体信息表
-      `CREATE TABLE "app_media_info" ( 
+
+			// 声像记录信息表
+			`CREATE TABLE "app_media_info" ( 
         "pdid" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
         "workorder" TEXT, 
         "invname" TEXT, 
@@ -98,9 +98,9 @@ class SQLiteContext extends SQLiteOpenHelper {
         "uploadtime" text, 
         UNIQUE ("pdid" ASC) 
       )`,
-      
-      // 媒体记录表
-      `CREATE TABLE "app_media_record" ( 
+
+			// 声像记录记录表
+			`CREATE TABLE "app_media_record" ( 
         "sxid" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
         "senum" TEXT, 
         "photoitem" TEXT, 
@@ -124,9 +124,9 @@ class SQLiteContext extends SQLiteOpenHelper {
         "uploadFlag" integer NOT NULL DEFAULT 0, 
         UNIQUE ("sxid" ASC) 
       )`,
-      
-      // 媒体任务表
-      `CREATE TABLE "app_media_task" ( 
+
+			// 声像记录任务表
+			`CREATE TABLE "app_media_task" ( 
        "id" INTEGER NOT NULL UNIQUE, 
        "pid" INTEGER NOT NULL, 
        "name" TEXT, 
@@ -139,9 +139,9 @@ class SQLiteContext extends SQLiteOpenHelper {
        "updateuser" INTEGER DEFAULT 1, 
        PRIMARY KEY("id" AUTOINCREMENT) 
       )`,
-      
-      // 操作日志表
-      `CREATE TABLE "app_operate_log" ( 
+
+			// 操作日志表
+			`CREATE TABLE "app_operate_log" ( 
         "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
         "module" text, 
         "title" text, 
@@ -151,9 +151,9 @@ class SQLiteContext extends SQLiteOpenHelper {
         "createuser" text, 
         UNIQUE ("id" ASC) 
       )`,
-      
-      // 产品表
-      `CREATE TABLE "app_product" ( 
+
+			// 产品表
+			`CREATE TABLE "app_product" ( 
        "pdid" integer NOT NULL UNIQUE, 
        "productno" text, 
        "cardno" text, 
@@ -172,9 +172,9 @@ class SQLiteContext extends SQLiteOpenHelper {
        "updateuser" integer NOT NULL DEFAULT 1, 
        PRIMARY KEY("pdid" AUTOINCREMENT) 
       )`,
-      
-      // 产品点位表
-      `CREATE TABLE "app_product_points" ( 
+
+			// 产品点位表
+			`CREATE TABLE "app_product_points" ( 
        "sxid" INTEGER NOT NULL UNIQUE, 
        "pid" INTEGER NOT NULL, 
        "senum" INTEGER, 
@@ -193,9 +193,9 @@ class SQLiteContext extends SQLiteOpenHelper {
        "updateuser" integer, 
        PRIMARY KEY("sxid" AUTOINCREMENT) 
       )`,
-      
-      // 产品任务表
-      `CREATE TABLE "app_product_task" ( 
+
+			// 产品任务表
+			`CREATE TABLE "app_product_task" ( 
        "id" INTEGER NOT NULL UNIQUE, 
        "pid" INTEGER NOT NULL, 
        "name" TEXT, 
@@ -208,9 +208,9 @@ class SQLiteContext extends SQLiteOpenHelper {
        "updateuser" INTEGER DEFAULT 1, 
        PRIMARY KEY("id" AUTOINCREMENT) 
       )`,
-      
-      // 任务信息表
-      `CREATE TABLE "app_task_info" ( 
+
+			// 检验信息表
+			`CREATE TABLE "app_task_info" ( 
         "pdid" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
         "gxpk" text, 
         "pk_serial" text, 
@@ -228,9 +228,9 @@ class SQLiteContext extends SQLiteOpenHelper {
         "uploadFlag" integer DEFAULT 0, 
         "uploadtime" text 
       )`,
-      
-      // 任务关键工序表
-      `CREATE TABLE "app_task_keyprocess" ( 
+
+			// 检验任务关键工序表
+			`CREATE TABLE "app_task_keyprocess" ( 
         "sxid" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
         "pdid" INTEGER, 
         "pk" text, 
@@ -257,9 +257,9 @@ class SQLiteContext extends SQLiteOpenHelper {
         "ts" text, 
         "operator" TEXT 
       )`,
-      
-      // 任务照片表
-      `CREATE TABLE "app_task_photo" ( 
+
+			// 检验任务拍照点
+			`CREATE TABLE "app_task_photo" ( 
         "sxid" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
         "pdid" INTEGER, 
         "pk" text, 
@@ -281,9 +281,9 @@ class SQLiteContext extends SQLiteOpenHelper {
         "ts" text, 
         "uploadFlag" integer NOT NULL DEFAULT 0 
       )`,
-      
-      // 任务记录表
-      `CREATE TABLE "app_task_record" ( 
+
+			// 检验任务记录
+			`CREATE TABLE "app_task_record" ( 
         "sxid" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
         "pdid" INTEGER, 
        "pk" text, 
@@ -304,9 +304,9 @@ class SQLiteContext extends SQLiteOpenHelper {
        "cs" text, 
         "ts" text 
       )`,
-      
-      // 任务记录明细表
-      `CREATE TABLE "app_task_record_item" ( 
+
+			// 检验任务任务记录项
+			`CREATE TABLE "app_task_record_item" ( 
         "sxid" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
         "psxid" INTEGER, 
         "pk" text, 
@@ -328,174 +328,185 @@ class SQLiteContext extends SQLiteOpenHelper {
         "ts" text, 
         "recorder" TEXT 
       )`
-      
-    ];
-    
-    // 执行所有建表语句
-    for (const sql of createTableSQLs) {
-      try {
-        db.execSQL(sql);
-        console.log("Created table with SQL: " + sql.substring(0, 50) + "...");
-      } catch (e) {
-        console.error("Error creating table: " + e);
-      }
-    }
-    
-    // 插入初始数据
-    console.log("Inserting initial data into app_user table");
-    const insertDataSQLs = [
-      `INSERT INTO "app_user" ("id", "username", "name", "userno", "password", "token", "status", "avatar", "createtime", "createuser", "updatetime", "updateuser", "role") 
+
+		];
+
+		// 执行所有建表语句
+		for (const sql of createTableSQLs) {
+			try {
+				db.execSQL(sql);
+				console.log("Created table with SQL: " + sql.substring(0, 50) + "...");
+			} catch (e) {
+				console.error("Error creating table: " + e);
+			}
+		}
+
+		// 插入初始数据
+		console.log("Inserting initial data into app_user table");
+		const insertDataSQLs = [
+			`INSERT INTO "app_user" ("id", "username", "name", "userno", "password", "token", "status", "avatar", "createtime", "createuser", "updatetime", "updateuser", "role") 
        VALUES (1, 'admin', '管理员', 1, 'admin123', 'token1', 1, NULL, NULL, 1, NULL, 1, 'admin');`,
-      
-      `INSERT INTO "app_user" ("id", "username", "name", "userno", "password", "token", "status", "avatar", "createtime", "createuser", "updatetime", "updateuser", "role") 
-       VALUES (2, 'xuyunliang', '许运良', 2, '123456', 'token1', 1, NULL, NULL, 1, NULL, 1, 'user');`
-    ];
-    
-    for (const sql of insertDataSQLs) {
-      try {
-        // 使用INSERT OR IGNORE避免重复插入
-        const safeSql = sql.replace("INSERT INTO", "INSERT OR IGNORE INTO");
-        db.execSQL(safeSql);
-        console.log("Inserted initial data successfully");
-      } catch (e) {
-        console.error("Error inserting initial data: " + e);
-      }
-    }
-  }
-  
-  override onUpgrade(db: SQLiteDatabase, oldVersion:Int, newVersion:Int):void {
-   	console.log("Upgrading database from version " + oldVersion + " to " + newVersion);
-    // 数据库版本升级逻辑
-    if (oldVersion < 2) {
-      // 版本2的升级操作
-    }
-    // 可以添加更多版本升级逻辑
-  }
-
-  public executeSql(options: executeSqlOptions) {
-    const database: SQLiteDatabase = this.getWritableDatabase();
-    const SqlArray = options.sql.split(';');
-    let result: executeSqlOptionsResult = {
-		data: [] as boolean[],
-		errMsg: 'ok'
+
+			`INSERT INTO "app_user" ("id", "username", "name", "userno", "password", "token", "status", "avatar", "createtime", "createuser", "updatetime", "updateuser", "role") 
+       VALUES (2, 'xuyunliang', '许运良', 2, '123456', 'token1', 1, NULL, NULL, 1, NULL, 1, 'user');`,
+
+			`INSERT INTO "app_user" ("id", "username", "name", "userno", "password", "token", "status", "avatar", "createtime", "createuser", "updatetime", "updateuser", "role")
+	    VALUES (3, 'chenpeng', '陈朋', 3, '123456', 'token1', 1, NULL, NULL, 1, NULL, 1, 'user');`,
+
+			`INSERT INTO "app_user" ("id", "username", "name", "userno", "password", "token", "status", "avatar", "createtime", "createuser", "updatetime", "updateuser", "role")
+		 VALUES (4, 'lubing', '鲁兵', 4, '123456', 'token1', 1, NULL, NULL, 1, NULL, 1, 'user');`,
+
+			`INSERT INTO "app_user" ("id", "username", "name", "userno", "password", "token", "status", "avatar", "createtime", "createuser", "updatetime", "updateuser", "role")
+		  VALUES (5, 'tianzhenyou', '田振友', 5, '123456', 'token1', 1, NULL, NULL, 1, NULL, 1, 'user');` ,
+
+			`INSERT INTO "app_user" ("id", "username", "name", "userno", "password", "token", "status", "avatar", "createtime", "createuser", "updatetime", "updateuser", "role")
+		   VALUES (6, 'luyongjun', '陆永俊', 6, '123456', 'token1', 1, NULL, NULL, 1, NULL, 1, 'user');`
+		];
+
+		for (const sql of insertDataSQLs) {
+			try {
+				// 使用INSERT OR IGNORE避免重复插入
+				const safeSql = sql.replace("INSERT INTO", "INSERT OR IGNORE INTO");
+				db.execSQL(safeSql);
+				console.log("Inserted initial data successfully");
+			} catch (e) {
+				console.error("Error inserting initial data: " + e);
+			}
+		}
 	}
-		
-    try {
-      for (let i = 0; i < SqlArray.length; i++) {
-        if (SqlArray[i].length > 0) {
-          const sql = SqlArray[i].replace(/^\s+/, '');
-          try {
-            database.execSQL(sql);
-            result.data.push(true);
-          } catch(e:Error) {
-            result.data.push(false);
-          }
-        }
-      }
-      options.success?.(result);
-    } catch (e) {      
-      const err = new createSQLiteContextFailImpl(1000002);
-      result.errMsg = err.errMsg;
-      options.fail?.(result);
-    }
-    options.complete?.(result);
-    return result;
-  }
-
-  public selectSql(options: selectSqlOptions) {
-    const database: SQLiteDatabase = this.getReadableDatabase();
-    const SqlArray = options.sql.split(';');
-    let result: selectSqlOptionsResult = {
-		data: [] as UTSJSONObject[],
-		errMsg: 'ok',		
+
+	override onUpgrade(db : SQLiteDatabase, oldVersion : Int, newVersion : Int) : void {
+		console.log("Upgrading database from version " + oldVersion + " to " + newVersion);
+		// 数据库版本升级逻辑
+		if (oldVersion < 2) {
+			// 版本2的升级操作
+		}
+		// 可以添加更多版本升级逻辑
 	}
-		
-    try {
-      for (let i = 0; i < SqlArray.length; i++) {
-        if (SqlArray[i].length > 0) {
-          const sql = SqlArray[i].replace(/^\s+/, '');
-          try {
-            const cursor: Cursor = database.rawQuery(sql, null);
-            //获取查询结果的字符串并push到result.data中
-            if (cursor.moveToFirst()) {
-              do {
-                const row = cursor.getColumnCount();
-                const utsJsonObject = {} as UTSJSONObject;
-                for (let j:Int = 0; j < row; j++) {
-                  //rowArray.push(cursor.getString(j)!=null? cursor.getString(j):'');
-				  //let obj = {cursor.getColumnName(j):cursor.getString(j)!=null? cursor.getString(j):''}
-				  //rowArray.push(obj)
-				  utsJsonObject.set(cursor.getColumnName(j).toString(), cursor.getString(j)!=null? cursor.getString(j):'')
-                }
-                result.data.push(utsJsonObject);
-              } while (cursor.moveToNext());
-            }
-            cursor.close();
-          } catch(e:Error) {
-			console.log(e)			
-            result.data.push({});
-          }
-        }
-      }
-      options.success?.(result);
-    } catch (e) {      
-      const err = new createSQLiteContextFailImpl(1000003);
-      result.errMsg = err.errMsg;
-      options.fail?.(result);
-    }
-    options.complete?.(result);
-    return result;
-  }
-  /*
-  public close(){
-	  const database: SQLiteDatabase = this.getReadableDatabase();
-	  database.close();
-  } */
-
-  public transaction(options: transactionOptions) {
-    const database: SQLiteDatabase = this.getReadableDatabase();
-    const transaction = options.operation;
-    let result: transactionResult = {
-		errMsg: 'transaction:ok',
+
+	public executeSql(options : executeSqlOptions) {
+		const database : SQLiteDatabase = this.getWritableDatabase();
+		const SqlArray = options.sql.split(';');
+		let result : executeSqlOptionsResult = {
+			data: [] as boolean[],
+			errMsg: 'ok'
+		}
+
+		try {
+			for (let i = 0; i < SqlArray.length; i++) {
+				if (SqlArray[i].length > 0) {
+					const sql = SqlArray[i].replace(/^\s+/, '');
+					try {
+						database.execSQL(sql);
+						result.data.push(true);
+					} catch (e : Error) {
+						result.data.push(false);
+					}
+				}
+			}
+			options.success?.(result);
+		} catch (e) {
+			const err = new createSQLiteContextFailImpl(1000002);
+			result.errMsg = err.errMsg;
+			options.fail?.(result);
+		}
+		options.complete?.(result);
+		return result;
 	}
-    try {
-      if (transaction == 'begin') {
-        //开启事务
-        database.execSQL('BEGIN TRANSACTION');
-      } else if (transaction == 'commit') {
-        //提交事务
-        database.execSQL('COMMIT');
-      } else if (transaction == 'rollback') {
-        //回滚事务
-        database.execSQL('ROLLBACK');
-      }
-      options.success?.(result);
-    } catch (e) {
-      let errCode = 1000008;
-      if (transaction == 'begin') {
-        errCode = 1000004;
-      } else if (transaction == 'commit') {
-        errCode = 1000005;
-      } else if (transaction == 'rollback') {
-        errCode = 1000006;
-      }
-      const err = new createSQLiteContextFailImpl(errCode);
-	  const errInfo = {errMsg:err.errMsg } as  transactionResult ;	
-      options.fail?.(errInfo);
-    }    
-	let ret = {		
-		errMsg: result.errMsg as string
-	} as UTSJSONObject
-	options.complete?.(result);
-    return ret;
-  }
-}
 
-export const createSQLiteContext = function (dbName: string): SQLiteContext {
-  // 确保数据库名称包含.db后缀
-  const name = dbName.endsWith('.db') ? dbName : dbName + '.db';
-  
-  // 注意:根据接口定义,只接受一个参数,默认不强制重新创建表
-  return new SQLiteContext(name, false);
+	public selectSql(options : selectSqlOptions) {
+		const database : SQLiteDatabase = this.getReadableDatabase();
+		const SqlArray = options.sql.split(';');
+		let result : selectSqlOptionsResult = {
+			data: [] as UTSJSONObject[],
+			errMsg: 'ok',
+		}
+
+		try {
+			for (let i = 0; i < SqlArray.length; i++) {
+				if (SqlArray[i].length > 0) {
+					const sql = SqlArray[i].replace(/^\s+/, '');
+					try {
+						const cursor : Cursor = database.rawQuery(sql, null);
+						//获取查询结果的字符串并push到result.data中
+						if (cursor.moveToFirst()) {
+							do {
+								const row = cursor.getColumnCount();
+								const utsJsonObject = {} as UTSJSONObject;
+								for (let j : Int = 0; j < row; j++) {
+									//rowArray.push(cursor.getString(j)!=null? cursor.getString(j):'');
+									//let obj = {cursor.getColumnName(j):cursor.getString(j)!=null? cursor.getString(j):''}
+									//rowArray.push(obj)
+									utsJsonObject.set(cursor.getColumnName(j).toString(), cursor.getString(j) != null ? cursor.getString(j) : '')
+								}
+								result.data.push(utsJsonObject);
+							} while (cursor.moveToNext());
+						}
+						cursor.close();
+					} catch (e : Error) {
+						console.log(e)
+						result.data.push({});
+					}
+				}
+			}
+			options.success?.(result);
+		} catch (e) {
+			const err = new createSQLiteContextFailImpl(1000003);
+			result.errMsg = err.errMsg;
+			options.fail?.(result);
+		}
+		options.complete?.(result);
+		return result;
+	}
+	/*
+	public close(){
+		const database: SQLiteDatabase = this.getReadableDatabase();
+		database.close();
+	} */
+
+	public transaction(options : transactionOptions) {
+		const database : SQLiteDatabase = this.getReadableDatabase();
+		const transaction = options.operation;
+		let result : transactionResult = {
+			errMsg: 'transaction:ok',
+		}
+		try {
+			if (transaction == 'begin') {
+				//开启事务
+				database.execSQL('BEGIN TRANSACTION');
+			} else if (transaction == 'commit') {
+				//提交事务
+				database.execSQL('COMMIT');
+			} else if (transaction == 'rollback') {
+				//回滚事务
+				database.execSQL('ROLLBACK');
+			}
+			options.success?.(result);
+		} catch (e) {
+			let errCode = 1000008;
+			if (transaction == 'begin') {
+				errCode = 1000004;
+			} else if (transaction == 'commit') {
+				errCode = 1000005;
+			} else if (transaction == 'rollback') {
+				errCode = 1000006;
+			}
+			const err = new createSQLiteContextFailImpl(errCode);
+			const errInfo = { errMsg: err.errMsg } as transactionResult;
+			options.fail?.(errInfo);
+		}
+		let ret = {
+			errMsg: result.errMsg as string
+		} as UTSJSONObject
+		options.complete?.(result);
+		return ret;
+	}
 }
 
+export const createSQLiteContext = function (dbName : string) : SQLiteContext {
+	// 确保数据库名称包含.db后缀
+	const name = dbName.endsWith('.db') ? dbName : dbName + '.db';
+
+	// 注意:根据接口定义,只接受一个参数,默认不强制重新创建表
+	return new SQLiteContext(name, false);
+}