From 9e095211c89c4705fc863b2219a149a392df3590 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 02 八月 2023 17:48:14 +0800 Subject: [PATCH] 1 --- ExportMap/db/TaskDBHelper.cs | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ ExportMap/ExportMap.csproj | 1 + 2 files changed, 56 insertions(+), 0 deletions(-) diff --git a/ExportMap/ExportMap.csproj b/ExportMap/ExportMap.csproj index 83ee9c9..7ecfc3f 100644 --- a/ExportMap/ExportMap.csproj +++ b/ExportMap/ExportMap.csproj @@ -162,6 +162,7 @@ <Compile Include="db\PostgreHelper.cs" /> <Compile Include="db\PubDBHelper.cs" /> <Compile Include="db\SQLiteHelper.cs" /> + <Compile Include="db\TaskDBHelper.cs" /> <Compile Include="Global.asax.cs"> <DependentUpon>Global.asax</DependentUpon> </Compile> diff --git a/ExportMap/db/TaskDBHelper.cs b/ExportMap/db/TaskDBHelper.cs new file mode 100644 index 0000000..62fc9ad --- /dev/null +++ b/ExportMap/db/TaskDBHelper.cs @@ -0,0 +1,55 @@ +锘縰sing ExportMap.cs; +using ExportMap.Models; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.Common; +using System.Linq; +using System.Web; + +namespace ExportMap.db +{ + public class TaskDBHelper + { + /// <summary> + /// 鏍规嵁ID闆嗗悎鏌ヨ + /// </summary> + public static List<SysTask> selectByIds(List<int> ids) + { + string sql = string.Format("select * from lf.sys_task where id in ({0}) order by id desc", string.Join(",", ids.ToArray())); + + DataTable dt = SQLiteHelper.GetDataTable(sql); + List<SysTask> list = ModelHandler.FillModel<SysTask>(dt); + + return list; + } + + /// <summary> + /// 鎻掑叆浠诲姟 + /// </summary> + public static int insert(SysTask task) + { + string sql = "insert into lf.sys_task (name, status, type, descr, err, ip, pid, gids, depcode, dircode, create_user) values (@name, @status, @type, @descr, @err, @ip, @pid, @gids, @depcode, @dircode, @create_user)"; + + List<DbParameter> list = Tools.GetParams<SysTask>(sql, task); + + object obj = Tools.DBHelper.GetScalar(sql, list.ToArray()); + + return obj == null ? 0 : Convert.ToInt32(obj); + } + + /// <summary> + /// 鏇存柊浠诲姟 + /// </summary> + public static int update(SysTask task) + { + string sql = "update lf.sys_task set name=@name, status=@status, type=@type, descr=@descr, err=@err, ip=@ip, pid=@pid, gids=@gids, depcode=@depcode, dircode=@dircode, update_user=@update_user, update_time=now() where id=@id"; + + List<DbParameter> list = Tools.GetParams<SysTask>(sql, task); + + object obj = Tools.DBHelper.GetScalar(sql, list.ToArray()); + + return obj == null ? 0 : Convert.ToInt32(obj); + } + } +} -- Gitblit v1.9.3