/// <summary> /// 根据Id查询打包资源 /// </summary> /// <param name="contentId"></param> /// <returns></returns> public WorkResourceContract GetWorkResource(long contentId) { string sql = "SELECT * FROM workResource WHERE ContentId = @ContentId"; WorkResourceContract model = null; using (var dr = MySqlHelper.ExecuteReader(ReadConnectionString, sql, new MySqlParameter("@ContentId", contentId))) { if (dr.Read()) { model = new WorkResourceContract() { ContentId = dr.GetInt64("ContentId"), RecordId = dr.GetInt64("RecordId"), PackageId = dr.GetInt64("PackageId"), TaskId = dr.GetString("TaskId"), ModuleId = dr.GetInt32("ModuleId"), VersionId = dr.GetInt64("VersionId"), RelationPath = dr.GetString("RelationPath"), SonModuleId = dr.GetString("SonModuleId"), ResourceName = dr.GetString("ResourceName"), ResourceType = dr.GetString("ResourceType"), RequirementContent = dr.GetString("RequirementContent"), IsFull = dr.GetBoolean("IsFull") }; } } return(model); }
/// <summary> /// 添加打包资源 /// </summary> /// <param name="model"></param> /// <returns></returns> public long InsertWorkResource(WorkResourceContract model) { var bulider = new InsertBuilder("workResource") .RegisterField("RecordId", model.RecordId) .RegisterField("PackageId", model.PackageId) .RegisterField("TaskId", model.TaskId) .RegisterField("ModuleId", model.ModuleId) .RegisterField("VersionId", model.VersionId) .RegisterField("RelationPath", model.RelationPath ?? model.VersionId.ToString()) .RegisterField("SonModuleId", model.SonModuleId ?? string.Empty) .RegisterField("ResourceName", model.ResourceName ?? string.Empty) .RegisterField("ResourceType", model.ResourceType ?? string.Empty) .RegisterField("RequirementContent", model.RequirementContent ?? string.Empty) .RegisterField("IsFull", model.IsFull); model.ContentId = AdoProvide.ExecuteScalar <long>(WriteConnectionString, bulider); return(model.ContentId); }