|
|
@@ -387,6 +387,92 @@ SELECT ruserid from [dbo].[LR_OA_NewsShouldRead] where newsid='{news.F_NewsId}' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public IEnumerable<NewsEntity> GetListOfSelf(string queryJson) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
var userinfo = LoginUserInfo.Get(); |
|
|
|
var userId = userinfo.userId; |
|
|
|
var deptId = userinfo.departmentId; |
|
|
|
var postIds = userinfo.postIds; |
|
|
|
var strSql = new StringBuilder(); |
|
|
|
strSql.Append("SELECT t.*,r.RNewsId,r.RTime FROM LR_OA_News t "); |
|
|
|
strSql.Append(" left join LR_OA_NewsRead r on t.F_NewsId = r.NewsId and r.RUserId=@userId "); |
|
|
|
strSql.Append(" left join lr_base_user u on u.F_UserId=@userId "); |
|
|
|
strSql.Append(" WHERE t.F_TypeId = 2 and t.F_DeleteMark=0 and t.F_EnabledMark=1 "); |
|
|
|
if (userinfo.account.Contains("20")) |
|
|
|
{ |
|
|
|
strSql.Append(" and t.F_ReleaseTime>CONVERT(datetime,SUBSTRING(u.F_Account,1,4)+'-08-31',120) "); |
|
|
|
} |
|
|
|
|
|
|
|
strSql.Append($@" and ( |
|
|
|
((t.F_SendDeptId is null or len(t.F_SendDeptId)=0) and (t.F_SendPostId is null or len(t.F_SendPostId)=0)) |
|
|
|
"); |
|
|
|
if (!string.IsNullOrEmpty(deptId)) |
|
|
|
{ |
|
|
|
strSql.Append($" or (t.F_SendDeptId is not null and t.F_SendDeptId like '%{deptId}%')"); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(postIds)) |
|
|
|
{ |
|
|
|
strSql.Append(" or (t.F_SendPostId is not null and "); |
|
|
|
if (postIds.Contains(",")) |
|
|
|
{ |
|
|
|
string postidSql = " ("; |
|
|
|
foreach (var postId in postIds) |
|
|
|
{ |
|
|
|
postidSql += $" t.F_SendPostId like '%{postId}%' or"; |
|
|
|
} |
|
|
|
|
|
|
|
postidSql = postidSql.Substring(0, postidSql.LastIndexOf("or")) + ")"; |
|
|
|
strSql.Append(postidSql); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
strSql.Append($" t.F_SendPostId like '%{postIds}%'"); |
|
|
|
} |
|
|
|
|
|
|
|
strSql.Append(")"); |
|
|
|
} |
|
|
|
|
|
|
|
strSql.Append(") "); |
|
|
|
var queryParam = queryJson.ToJObject(); |
|
|
|
// 虚拟参数 |
|
|
|
var dp = new DynamicParameters(new { }); |
|
|
|
if (!queryParam["keyword"].IsEmpty()) |
|
|
|
{ |
|
|
|
strSql.Append($" AND t.F_FullHead Like '{queryParam["keyword"].ToString()}' "); |
|
|
|
} |
|
|
|
if (!queryParam["categoryId"].IsEmpty()) |
|
|
|
{ |
|
|
|
strSql.Append($" AND t.F_CategoryId = '{queryParam["categoryId"].ToString()}'"); |
|
|
|
} |
|
|
|
if (!queryParam["IsRead"].IsEmpty()) |
|
|
|
{ |
|
|
|
var IsRead = queryParam["IsRead"].ToString().Trim(); |
|
|
|
if (IsRead == "1") |
|
|
|
{ |
|
|
|
strSql.Append($" AND (r.RNewsId is not null and len(r.RNewsId)>0)"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
strSql.Append($" AND (r.RNewsId is null or len(r.RNewsId)=0)"); |
|
|
|
} |
|
|
|
} |
|
|
|
strSql.Append(" ORDER BY t.F_ReleaseTime DESC "); |
|
|
|
return this.BaseRepository().FindList<NewsEntity>(strSql.ToString(), new { userId = userId }); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
if (ex is ExceptionEx) |
|
|
|
{ |
|
|
|
throw; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
throw ExceptionEx.ThrowServiceException(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
public void ChangeStatusById(string keyValue, int status, string processId) |
|
|
|