|
@@ -429,6 +429,12 @@ namespace GxPress.Repository.Implement
|
|
|
var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
var database = new Database(databaseType, _connectionString);
|
|
|
var connection = database.GetConnection();
|
|
|
+ // var userIds = new List<int>();
|
|
|
+ // if (request.TopicGroupIds != null && request.TopicGroupIds.Contains(-1))
|
|
|
+ // {
|
|
|
+ // //获取部门下面的员工
|
|
|
+ // var users = await _userRepository.GetUserByDepartmentIdAsync(department.Id);
|
|
|
+ // }
|
|
|
result.Items = await connection.QueryAsync<TopicListPageResult, User, TopicListPageResult>(AssembleSql(request), (topicListPageResult, user) =>
|
|
|
{
|
|
|
topicListPageResult.UserName = user != null ? user.Name : "";
|
|
@@ -444,7 +450,7 @@ namespace GxPress.Repository.Implement
|
|
|
|
|
|
public async Task<PagedList<TopicListPageResult>> GetTopicByGroupAsync(TopicPageSearchRequest request)
|
|
|
{
|
|
|
- var topicConstValue=AllTypeConst.Topic.GetHashCode();
|
|
|
+ var topicConstValue = AllTypeConst.Topic.GetHashCode();
|
|
|
var sql = $@"SELECT
|
|
|
a.*,
|
|
|
(SELECT
|
|
@@ -693,15 +699,20 @@ namespace GxPress.Repository.Implement
|
|
|
var topicGroupId = "";
|
|
|
foreach (var item in request.TopicGroupIds)
|
|
|
{
|
|
|
+ if (item <= 0)
|
|
|
+ continue;
|
|
|
topicGroupId += $"{item},";
|
|
|
}
|
|
|
- topicGroupId = topicGroupId.Remove(topicGroupId.Length - 1, 1);
|
|
|
- sql += $@" AND a.UserId IN (SELECT
|
|
|
+ if (!string.IsNullOrEmpty(topicGroupId))
|
|
|
+ {
|
|
|
+ topicGroupId = topicGroupId.Remove(topicGroupId.Length - 1, 1);
|
|
|
+ sql += $@" AND a.UserId IN (SELECT
|
|
|
UserId
|
|
|
FROM
|
|
|
tede_topic_group_user
|
|
|
WHERE
|
|
|
TopicGroupId IN ({topicGroupId}))";
|
|
|
+ }
|
|
|
}
|
|
|
if (!string.IsNullOrWhiteSpace(request.Keyword))
|
|
|
{
|
|
@@ -747,15 +758,20 @@ namespace GxPress.Repository.Implement
|
|
|
var topicGroupId = "";
|
|
|
foreach (var item in request.TopicGroupIds)
|
|
|
{
|
|
|
+ if (item <= 0)
|
|
|
+ continue;
|
|
|
topicGroupId += $"{item},";
|
|
|
}
|
|
|
- topicGroupId = topicGroupId.Remove(topicGroupId.Length - 1, 1);
|
|
|
- sql += $@" AND a.UserId IN (SELECT
|
|
|
+ if (!string.IsNullOrEmpty(topicGroupId))
|
|
|
+ {
|
|
|
+ topicGroupId = topicGroupId.Remove(topicGroupId.Length - 1, 1);
|
|
|
+ sql += $@" AND a.UserId IN (SELECT
|
|
|
UserId
|
|
|
FROM
|
|
|
tede_topic_group_user
|
|
|
WHERE
|
|
|
TopicGroupId IN ({topicGroupId}))";
|
|
|
+ }
|
|
|
}
|
|
|
if (!string.IsNullOrWhiteSpace(request.Keyword))
|
|
|
{
|