using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using Dapper;
|
using GasolineBlend.Entity;
|
|
namespace GasolineBlend.DAL
|
{
|
public class QccSearchInfoDAL:BaseDAL
|
{
|
public List<QccSearchInfo> GetQccSearchInfoDistinctList(int UserId)
|
{
|
var sql = $"select top 8 a.* from QccSearchInfo a inner join (select CompanyName,max(CreateTime) as CreateTime from QccSearchInfo where UserId={UserId} group by CompanyName) b on a.CreateTime=b.CreateTime and a.CompanyName=b.CompanyName where a.UserId={UserId} and a.SearchType>0 order by a.CreateTime desc";
|
return Conn.Query<QccSearchInfo>(sql).ToList();
|
}
|
|
public List<QccSearchInfo> GetSearchPolicyList()
|
{
|
var sql = $"SELECT TOP 8 * FROM QccSearchInfo WHERE SearchType = 9 ORDER BY CreateTime DESC";
|
return Conn.Query<QccSearchInfo>(sql).ToList();
|
}
|
|
|
public List<QccSearchInfo> GetQccSearchInfoDistinctList()
|
{
|
var sql = $"select top 5 a.* from QccSearchInfo a inner join (select CompanyName,max(CreateTime) as CreateTime from QccSearchInfo group by CompanyName) b on a.CreateTime=b.CreateTime and a.CompanyName=b.CompanyName where a.SearchType>0 order by a.CreateTime desc";
|
return Conn.Query<QccSearchInfo>(sql).ToList();
|
}
|
|
public int AddQccSearchInfo(QccSearchInfo QccSearchInfo)
|
{
|
var sql = $"insert into QccSearchInfo (UserId,CompanyName,SuccessFlag,Note,SearchType) Values(@UserId,@CompanyName,@SuccessFlag,@Note,@SearchType);select @@IDENTITY;";
|
return Conn.ExecuteScalar<int>(sql, QccSearchInfo);
|
}
|
}
|
}
|