示例#1
0
        public int SelectCount(VideoCondition videoCondition = null)
        {
            DynamicParameters parameters = new DynamicParameters();

            string where = Where(videoCondition, ref parameters);
            string sql = "SELECT COUNT(*) FROM T_Video WHERE " + where;

            return(base.SelectCount(sql, parameters));
        }
示例#2
0
        private VideoCondition ConvertCondition(VideoConditionModel conditionModel)
        {
            VideoCondition videoCondition = new VideoCondition();

            if (conditionModel == null)
            {
                return(videoCondition);
            }
            return(videoCondition);
        }
示例#3
0
        public IList <Video> SelectByPage(int pageSize, int pageIndex, VideoCondition condition = null)
        {
            int pageId = pageSize * (pageIndex - 1);
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("pageId", pageId, DbType.Int32);
            parameters.Add("pageSize", pageSize, DbType.Int32);
            string where = Where(condition, ref parameters);
            string sql = "SELECT * FROM T_Video WHERE " + where + " ORDER BY video_createtime limit @pageId,@pageSize";
            IEnumerable <dynamic> list = DbConnection.Query(sql, parameters);

            return(Map(list));
        }
示例#4
0
        private string Where(VideoCondition condition, ref DynamicParameters parameters)
        {
            IList <string> sqlList = new List <string>();

            if (condition == null)
            {
                return(" 1=1 ");
            }
            sqlList.Add(" 1=1 ");
            string sql = string.Join(" AND ", sqlList);

            return(sql);
        }