chenzx
2024-11-25 68f761dcdef9149f148508e5df8f1c2970934f15
GasolineBlend.DAL/ArticleDataDAL.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
@@ -92,24 +93,29 @@
                return Count;
            }
        }
        public int GetDeclarationtimeCount(string Keyword, int Time)
        public int GetDeclarationtimeCount(string Keyword, int Time, string Region)
        {
            using (IDbConnection connection = new MySqlConnection(connectionString))
            {
                var sql = $"SELECT  COUNT(*)  from articledata WHERE articletype='申报通知' AND declarationtime IS NOT NULL  ";
                var sql = $"SELECT  COUNT(*)   from articledata a JOIN departmentdata d ON a.platform = d.department WHERE a.articletype='申报通知' AND a.declarationtime IS NOT NULL ";
                if (!string.IsNullOrEmpty(Region))
                {
                    sql += $" and a.region = '{Region}' ";
                }
                if (!string.IsNullOrEmpty(Keyword))
                {
                    sql += $" AND articletitle like '%{Keyword.Trim()}%' ";
                    sql += $" AND a.articletitle like '%{Keyword.Trim()}%' ";
                }
                if (Time != 0)
                {
                    if (Time == 7)
                    {
                        sql += $" AND declarationtime IS NOT NULL AND deadline BETWEEN CURDATE() AND CURDATE() + INTERVAL 7 DAY ";
                        sql += $" AND a.declarationtime IS NOT NULL AND a.deadline BETWEEN CURDATE() AND CURDATE() + INTERVAL 7 DAY ";
                    }
                    else if(Time == 30){
                        sql += $" AND declarationtime IS NOT NULL AND deadline BETWEEN CURDATE() AND CURDATE() + INTERVAL 30 DAY ";
                        sql += $" AND a.declarationtime IS NOT NULL AND a.deadline BETWEEN CURDATE() AND CURDATE() + INTERVAL 30 DAY ";
                    }    
                }
                int Count = connection.Query<int>(sql).FirstOrDefault();
@@ -117,11 +123,15 @@
            }
        }
        public List<ArticleDataPage> GetDeclarationtimeList( string Keyword,int Time, int PageNumber, int PageSize)
        public List<ArticleDataPage> GetDeclarationtimeList( string Keyword,int Time, int PageNumber, int PageSize ,string Region)
        {
            using (IDbConnection connection = new MySqlConnection(connectionString))
            {
                var sql = $"SELECT  *, d.region  from articledata a JOIN departmentdata d ON a.platform = d.department WHERE a.articletype='申报通知' AND a.declarationtime IS NOT NULL  ";
                if (!string.IsNullOrEmpty(Region))
                {
                    sql += $" and a.region = '{Region}' ";
                }
                if (!string.IsNullOrEmpty(Keyword))
                {