|
@@ -986,7 +986,7 @@ namespace GxPress.Repository.Implement
|
|
|
foreach (var item in userIds)
|
|
|
sqlStr += $"{item},";
|
|
|
sqlStr = sqlStr.Remove(sqlStr.Length - 1, 1);
|
|
|
- var sql = $@"select * from tede_user where id in({sqlStr})";
|
|
|
+ var sql = $@"select * from tede_user where id in({sqlStr})";
|
|
|
if (!string.IsNullOrEmpty(keyWord))
|
|
|
sql += $@" and (Name like '%{keyWord}%' or phone like '%{keyWord}%' or Email like '%{keyWord}%')";
|
|
|
var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
@@ -1009,8 +1009,12 @@ namespace GxPress.Repository.Implement
|
|
|
var sqlStr = "";
|
|
|
foreach (var item in userIds)
|
|
|
sqlStr += $"{item},";
|
|
|
- sqlStr = sqlStr.Remove(sqlStr.Length - 1, 1);
|
|
|
- var sql = $@"select * from tede_user where id not in({sqlStr}) and (Name like '%{keyword}%' or phone like '%{keyword}%' or Email like '%{keyword}%')";
|
|
|
+ sqlStr = !string.IsNullOrEmpty(sqlStr) ? sqlStr.Remove(sqlStr.Length - 1, 1) : "";
|
|
|
+ var sql = $@"select * from tede_user where 1=1 ";
|
|
|
+ if (!string.IsNullOrEmpty(sqlStr))
|
|
|
+ sql += " and id not in({sqlStr})";
|
|
|
+ if (!string.IsNullOrEmpty(keyword))
|
|
|
+ sql += $@" and (Name like '%{keyword}%' or phone like '%{keyword}%' or Email like '%{keyword}%')";
|
|
|
var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
var database = new Database(databaseType, _connectionString);
|
|
|
var connection = database.GetConnection();
|
|
@@ -1032,8 +1036,12 @@ namespace GxPress.Repository.Implement
|
|
|
var sqlStr = "";
|
|
|
foreach (var item in userIds)
|
|
|
sqlStr += $"{item},";
|
|
|
- sqlStr = sqlStr.Remove(sqlStr.Length - 1, 1);
|
|
|
- var sql = $@"select * from tede_user where id in({sqlStr}) and (Name like '%{keyword}%' or phone like '%{keyword}%' or Email like '%{keyword}%')";
|
|
|
+ sqlStr = string.IsNullOrEmpty(sqlStr) ? "" : sqlStr.Remove(sqlStr.Length - 1, 1);
|
|
|
+ var sql = $@"select * from tede_user where 1=1 ";
|
|
|
+ if (!string.IsNullOrEmpty(sqlStr))
|
|
|
+ sql += " and id in({sqlStr})";
|
|
|
+ if (!string.IsNullOrEmpty(keyword))
|
|
|
+ sql += " and (Name like '%{keyword}%' or phone like '%{keyword}%' or Email like '%{keyword}%')";
|
|
|
var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
var database = new Database(databaseType, _connectionString);
|
|
|
var connection = database.GetConnection();
|