diff --git a/Infrastructure/CustomException/ResultCode.cs b/Infrastructure/CustomException/ResultCode.cs index 4c670da..d459ae9 100644 --- a/Infrastructure/CustomException/ResultCode.cs +++ b/Infrastructure/CustomException/ResultCode.cs @@ -19,6 +19,7 @@ namespace Infrastructure [Description("NO_DATA")] NODATA = 106, + [Description("操作失败")] FAIL = 1, [Description("服务端出错啦")] diff --git a/ZR.Admin.WebApi/Controllers/BaseController.cs b/ZR.Admin.WebApi/Controllers/BaseController.cs index 6ee924d..5565b2d 100644 --- a/ZR.Admin.WebApi/Controllers/BaseController.cs +++ b/ZR.Admin.WebApi/Controllers/BaseController.cs @@ -15,8 +15,6 @@ namespace ZR.Admin.WebApi.Controllers [LogActionFilter] public class BaseController : ControllerBase { - private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); - public static string TIME_FORMAT_FULL = "yyyy-MM-dd HH:mm:ss"; public static string TIME_FORMAT_FULL_2 = "MM-dd HH:mm:ss"; diff --git a/ZR.Admin.WebApi/Controllers/System/SysPostController.cs b/ZR.Admin.WebApi/Controllers/System/SysPostController.cs index b87ebfa..5deb34a 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysPostController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysPostController.cs @@ -95,7 +95,7 @@ namespace ZR.Admin.WebApi.Controllers.System throw new CustomException($"修改岗位{post.PostName}失败,岗位编码已存在"); } post.Update_by = User.Identity.Name; - return ToResponse(ToJson(PostService.Update(post) ? 1 : 0)); + return ToResponse(PostService.Update(post)); } /// diff --git a/ZR.Admin.WebApi/Controllers/System/TasksController.cs b/ZR.Admin.WebApi/Controllers/System/TasksController.cs index d2d8148..c3cb393 100644 --- a/ZR.Admin.WebApi/Controllers/System/TasksController.cs +++ b/ZR.Admin.WebApi/Controllers/System/TasksController.cs @@ -141,7 +141,7 @@ namespace ZR.Admin.WebApi.Controllers Update_by = User.Identity.Name, Update_time = DateTime.Now }); - if (response) + if (response > 0) { //先暂停原先的任务 var respon = await _schedulerServer.UpdateTaskScheduleAsync(tasksQz, tasksQz.JobGroup); diff --git a/ZR.Admin.WebApi/Properties/launchSettings.json b/ZR.Admin.WebApi/Properties/launchSettings.json index 8fd0a5e..7fb9b62 100644 --- a/ZR.Admin.WebApi/Properties/launchSettings.json +++ b/ZR.Admin.WebApi/Properties/launchSettings.json @@ -4,7 +4,7 @@ "commandName": "Project", "launchBrowser": false, "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Production" + "ASPNETCORE_ENVIRONMENT": "Stage" }, "applicationUrl": "http://localhost:8888" } diff --git a/ZR.Repository/BaseRepository.cs b/ZR.Repository/BaseRepository.cs index 71dc86a..a1ff09c 100644 --- a/ZR.Repository/BaseRepository.cs +++ b/ZR.Repository/BaseRepository.cs @@ -121,24 +121,24 @@ namespace ZR.Repository #region update - public bool Update(T entity, bool ignoreNullColumns = false) + public int Update(T entity, bool ignoreNullColumns = false) { - return Context.Updateable(entity).IgnoreColumns(ignoreNullColumns).ExecuteCommand() > 0; + return Context.Updateable(entity).IgnoreColumns(ignoreNullColumns).ExecuteCommand(); } - public bool Update(T entity, Expression> expression, bool ignoreAllNull = false) + public int Update(T entity, Expression> expression, bool ignoreAllNull = false) { - return Context.Updateable(entity).UpdateColumns(expression).IgnoreColumns(ignoreAllNull).ExecuteCommand() > 0; + return Context.Updateable(entity).UpdateColumns(expression).IgnoreColumns(ignoreAllNull).ExecuteCommand(); } - public bool Update(T entity, Expression> expression, Expression> where) + public int Update(T entity, Expression> expression, Expression> where) { - return Context.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand() > 0; + return Context.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand(); } - public bool Update(SqlSugarClient client, T entity, Expression> expression, Expression> where) + public int Update(SqlSugarClient client, T entity, Expression> expression, Expression> where) { - return client.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand() > 0; + return client.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand(); } /// @@ -148,7 +148,7 @@ namespace ZR.Repository /// /// 默认为true /// - public bool Update(T entity, List list = null, bool isNull = true) + public int Update(T entity, List list = null, bool isNull = true) { if (list == null) { @@ -158,7 +158,7 @@ namespace ZR.Repository "Create_time" }; } - return Context.Updateable(entity).IgnoreColumns(isNull).IgnoreColumns(list.ToArray()).ExecuteCommand() > 0; + return Context.Updateable(entity).IgnoreColumns(isNull).IgnoreColumns(list.ToArray()).ExecuteCommand(); } //public bool Update(List entity) @@ -169,9 +169,9 @@ namespace ZR.Repository // }); // return result.IsSuccess; //} - public bool Update(Expression> where, Expression> columns) + public int Update(Expression> where, Expression> columns) { - return Context.Updateable().SetColumns(columns).Where(where).RemoveDataCache().ExecuteCommand() > 0; + return Context.Updateable().SetColumns(columns).Where(where).RemoveDataCache().ExecuteCommand(); } #endregion update @@ -218,9 +218,9 @@ namespace ZR.Repository { return Context.Deleteable(id).ExecuteCommand(); } - public bool DeleteTable() + public int DeleteTable() { - return Context.Deleteable().ExecuteCommand() > 0; + return Context.Deleteable().ExecuteCommand(); } #endregion delete diff --git a/ZR.Repository/IBaseRepository.cs b/ZR.Repository/IBaseRepository.cs index 90ca56e..0dedf0f 100644 --- a/ZR.Repository/IBaseRepository.cs +++ b/ZR.Repository/IBaseRepository.cs @@ -44,7 +44,7 @@ namespace ZR.Repository #region update - bool Update(T entity, bool ignoreNullColumns = false); + int Update(T entity, bool ignoreNullColumns = false); /// /// 只更新表达式的值 @@ -52,13 +52,13 @@ namespace ZR.Repository /// /// /// - bool Update(T entity, Expression> expression, bool ignoreAllNull = false); + int Update(T entity, Expression> expression, bool ignoreAllNull = false); - bool Update(T entity, Expression> expression, Expression> where); + int Update(T entity, Expression> expression, Expression> where); - bool Update(SqlSugarClient client, T entity, Expression> expression, Expression> where); + int Update(SqlSugarClient client, T entity, Expression> expression, Expression> where); - bool Update(Expression> where, Expression> columns); + int Update(Expression> where, Expression> columns); #endregion update @@ -73,7 +73,7 @@ namespace ZR.Repository int Delete(Expression> expression); int Delete(object[] obj); int Delete(object id); - bool DeleteTable(); + int DeleteTable(); #endregion delete diff --git a/ZR.Service/BaseService.cs b/ZR.Service/BaseService.cs index 0b68a66..9c109fc 100644 --- a/ZR.Service/BaseService.cs +++ b/ZR.Service/BaseService.cs @@ -122,24 +122,24 @@ namespace ZR.Service #region update - public bool Update(T entity, bool ignoreNullColumns = false) + public int Update(T entity, bool ignoreNullColumns = false) { return baseRepository.Update(entity, ignoreNullColumns); } - public bool Update(T entity, Expression> expression, bool ignoreAllNull = false) + public int Update(T entity, Expression> expression, bool ignoreAllNull = false) { return baseRepository.Update(entity, expression, ignoreAllNull); } - public bool Update(T entity, Expression> expression, Expression> where) + public int Update(T entity, Expression> expression, Expression> where) { return baseRepository.Update(entity, expression, where); } - public bool Update(SqlSugarClient client, T entity, Expression> expression, Expression> where) + public int Update(SqlSugarClient client, T entity, Expression> expression, Expression> where) { - return client.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand() > 0; + return client.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand(); } ///// @@ -171,7 +171,7 @@ namespace ZR.Service // }); // return result.IsSuccess; //} - public bool Update(Expression> where, Expression> columns) + public int Update(Expression> where, Expression> columns) { return baseRepository.Update(where, columns); } @@ -220,7 +220,7 @@ namespace ZR.Service { return baseRepository.Delete(id); } - public bool DeleteTable() + public int DeleteTable() { return baseRepository.DeleteTable(); } diff --git a/ZR.Service/IBaseService.cs b/ZR.Service/IBaseService.cs index a4354f0..569e101 100644 --- a/ZR.Service/IBaseService.cs +++ b/ZR.Service/IBaseService.cs @@ -46,7 +46,7 @@ namespace ZR.Service #region update - bool Update(T entity, bool ignoreNullColumns = false); + int Update(T entity, bool ignoreNullColumns = false); /// /// 只更新表达式的值 @@ -54,11 +54,11 @@ namespace ZR.Service /// /// /// - bool Update(T entity, Expression> expression, bool ignoreAllNull = false); + int Update(T entity, Expression> expression, bool ignoreAllNull = false); - bool Update(T entity, Expression> expression, Expression> where); + int Update(T entity, Expression> expression, Expression> where); - bool Update(SqlSugarClient client, T entity, Expression> expression, Expression> where); + int Update(SqlSugarClient client, T entity, Expression> expression, Expression> where); /// /// @@ -70,7 +70,7 @@ namespace ZR.Service //bool Update(T entity, List list = null, bool isNull = true); //bool Update(List entity); - bool Update(Expression> where, Expression> columns); + int Update(Expression> where, Expression> columns); #endregion update @@ -85,7 +85,7 @@ namespace ZR.Service int Delete(Expression> expression); int Delete(object[] obj); int Delete(object id); - bool DeleteTable(); + int DeleteTable(); #endregion delete