Files
HTCloud/HT.Cloud.Service/SystemOrganize/NoticeService.cs

89 lines
2.7 KiB
C#
Raw Normal View History

2023-03-03 16:07:50 +08:00
//-----------------------------------------------------------------------
// <copyright file=" Notice.cs" company="JR">
// * Copyright (C) HT.Cloud.Framework All Rights Reserved
// * version : 1.0
// * author : HT.Cloud.Framework
// * FileName: Notice.cs
// * history : Created by T4 04/13/2020 16:51:21
// </copyright>
//-----------------------------------------------------------------------
using SqlSugar;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using HT.Cloud.Code;
using HT.Cloud.DataBase;
using HT.Cloud.Domain.SystemOrganize;
namespace HT.Cloud.Service.SystemOrganize
{
public class NoticeService : BaseService<NoticeEntity>, IDenpendency
{
public NoticeService(ISqlSugarClient context) : base(context)
{
}
public async Task<List<NoticeEntity>> GetList(string keyword)
{
var query = repository.IQueryable();
if (!string.IsNullOrEmpty(keyword))
{
query = query.Where(a => a.F_Title.Contains(keyword) || a.F_Content.Contains(keyword));
}
return await query.Where(a => a.F_DeleteMark == false).ToListAsync();
}
public async Task<List<NoticeEntity>> GetLookList(SoulPage<NoticeEntity> pagination, string keyword = "")
{
//<2F><><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ʾֻ<CABE><D6BB><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7>
Dictionary<string, Dictionary<string, string>> dic = new Dictionary<string, Dictionary<string, string>>();
Dictionary<string, string> enabledDic = new Dictionary<string, string>();
enabledDic.Add("1", "<22><>Ч");
enabledDic.Add("0", "<22><>Ч");
dic.Add("F_EnabledMark", enabledDic);
pagination = ChangeSoulData(dic, pagination);
var query = repository.IQueryable().Where(a => a.F_DeleteMark == false);
if (!string.IsNullOrEmpty(keyword))
{
query = query.Where(a => a.F_Title.Contains(keyword) || a.F_Content.Contains(keyword));
}
//Ȩ<>޹<EFBFBD><DEB9>ˣ<EFBFBD><CBA3><EFBFBD>֤<EFBFBD><D6A4>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
query = GetDataPrivilege("a", "", query);
return await query.ToPageListAsync(pagination);
}
public async Task<NoticeEntity> GetLookForm(string keyValue)
{
var data = await repository.FindEntity(keyValue);
return GetFieldsFilterData(data);
}
public async Task<NoticeEntity> GetForm(string keyValue)
{
var data = await repository.FindEntity(keyValue);
return data;
}
public async Task SubmitForm(NoticeEntity entity, string keyValue)
{
if (!string.IsNullOrEmpty(keyValue))
{
entity.Modify(keyValue);
await repository.Update(entity);
}
else
{
entity.F_CreatorUserName = currentuser.UserName;
entity.F_DeleteMark = false;
entity.Create();
await repository.Insert(entity);
}
}
public async Task DeleteForm(string keyValue)
{
var ids = keyValue.Split(',');
await repository.Delete(a => ids.Contains(a.F_Id));
}
}
}