Пример #1
0
        /// <summary>
        /// 获取资讯的评论未读信息数列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public PagerList <dynamic> GetMaterialCommentPageList(CmsMaterialMstrQuery query)
        {
            return(_sqlQuery.Select(@"
                mstr.MATERIAL_ID,
	            mstr.MATERIAL_TITLE,
	            mstr.MATERIAL_AUTHOR,
	            mstr.COMMENT_RULE,
	            mstr.CREATE_DATE,
	            mstr.CREATE_ORG_NO,
	                CASE
                WHEN com1.SUMCOUNT IS NULL THEN
	                0
                ELSE
	                com1.SUMCOUNT
                END AS SUMCOUNT,
                 CASE
                WHEN com2.READCOUNT IS NULL THEN
	                0
                ELSE
	                com2.READCOUNT
                END AS READCOUNT,
                com.COMMENT_DATE")
                   .Filter("mstr.DEL_FLAG", 1)
                   .Filter("mstr.CREATE_ORG_NO", AbpSession.ORG_NO)
                   .Filter("ctype.MATERIAL_ATTR", query.MATERIAL_ATTR)
                   .Filter("mstr.MATERIAL_TITLE", query.MATERIAL_TITLE, Operator.Contains)
                   .Filter("mstr.MATERIAL_TYPE_ID", query.MATERIAL_TYPE_ID)
                   .OrderBy("com.COMMENT_DATE desc nulls last")
                   .GetPageList <dynamic>(@"CMS_MATERIAL_MSTR mstr  
                left join CMS_MATERIAL_TYPE ctype on ctype.MATERIAL_TYPE_ID=mstr.MATERIAL_TYPE_ID
                left join (select MATERIAL_ID,max(COMMENT_DATE) COMMENT_DATE from wct_comment_mstr group by MATERIAL_ID) com on mstr.MATERIAL_ID=com.MATERIAL_ID
                left join (select MATERIAL_ID,count(MATERIAL_ID) as SUMCOUNT from wct_comment_mstr where del_flag=1 group by MATERIAL_ID)com1 on com1.MATERIAL_ID=mstr.MATERIAL_ID
                left join (select MATERIAL_ID,count(MATERIAL_ID) as READCOUNT from wct_comment_mstr where del_flag=1 and IS_READ=1 group by MATERIAL_ID)com2 
                on com2.MATERIAL_ID=mstr.MATERIAL_ID", Context.Database.GetDbConnection(), query));
        }
Пример #2
0
        /// <summary>
        /// 获取素材分页列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public PagerList <dynamic> GetMaterialMstrPageList(CmsMaterialMstrQuery query)
        {
            var perssion = _permissionHelper.GetCondition(AbpSession.USR_TYPE, AbpSession.USR_SCOPE, "a.CREATE_ORG_NO", AbpSession.ORG_NO, AbpSession.BG_NO);

            return(_sqlQuery.Select(@"
                a.MATERIAL_ID,
                a.MATERIAL_COVER_URL,
                a.MATERIAL_TITLE,
                a.CREATE_DATE,
                a.UPDATE_DATE,
                a.MATERIAL_STATUS,
                a.MATERIAL_AUTHOR,
                b.MATERIAL_TYPE_NAME,
                c.BU_NAME")
                   .Filter("b.MATERIAL_ATTR", query.MATERIAL_ATTR)
                   .Filter("a.MATERIAL_TYPE_ID", query.MATERIAL_TYPE_ID)
                   .Filter("a.MATERIAL_TITLE", query.MATERIAL_TITLE, Operator.Contains)
                   .Filter("a.UDF2", query.UDF2)
                   .Filter("a.DEL_FLAG", 1)
                   .In("a.MATERIAL_ID", query.MATERIAL_IDS)
                   //.Filter("b.DEL_FLAG", 1)
                   .Filter("c.DEL_FLAG", 1)
                   .And(perssion)
                   .OrderBy("a.UPDATE_DATE desc")
                   .GetPageList <dynamic>(@"CMS_MATERIAL_MSTR a
                LEFT JOIN CMS_MATERIAL_TYPE b ON a.MATERIAL_TYPE_ID = b.MATERIAL_TYPE_ID
                LEFT JOIN MDM_BU_MSTR c ON a.CREATE_ORG_NO=c.BU_NO", Context.Database.GetDbConnection(), query));
        }
 public ActionResult GetMaterialMstrPageList(CmsMaterialMstrQuery query)
 {
     try
     {
         var result = _cmsMaterialMstrRepository.GetMaterialMstrPageList(query);
         return(Page(result.Data, result.Page));
     }
     catch (Exception ex)
     {
         return(Fail(ex.Message));
     }
 }
Пример #4
0
        /// <summary>
        /// 更改资讯状态/轮播
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ReturnMsg UpdateMaterialInfoStatus(CmsMaterialMstrQuery query)
        {
            var rm = new ReturnMsg();

            if (string.IsNullOrEmpty(query.MATERIAL_ID))
            {
                rm.IsSuccess = false;
                rm.msg       = "请选择要操作的资讯";
                return(rm);
            }
            var materialInfo = _cmsMaterialMstrRepository.FirstOrDefault(c => c.Id == query.MATERIAL_ID && c.DEL_FLAG == 1);

            if (materialInfo == null)
            {
                rm.IsSuccess = false;
                rm.msg       = "该资讯不存在";
                return(rm);
            }
            if (query.ExcuteType == 1)
            {
                if (query.IS_ROUND == 1)
                {
                    var materialList = _cmsMaterialMstrRepository.GetAllList(c => c.IS_ROUND == 1 && c.MATERIAL_STATUS == "在线" && c.MATERIAL_TYPE_ID == materialInfo.MATERIAL_TYPE_ID && c.CREATE_ORG_NO == AbpSession.ORG_NO);
                    if (materialList.Count >= 5)
                    {
                        rm.IsSuccess = false;
                        rm.msg       = "同类型资讯已达最大轮播数,请取消后再试";
                        return(rm);
                    }
                }
                materialInfo.IS_ROUND = query.IS_ROUND;
                _initHelper.InitUpdate(materialInfo, AbpSession.USR_ID);
                _cmsMaterialMstrRepository.Update(materialInfo);
            }
            else if (query.ExcuteType == 2)
            {
                materialInfo.MATERIAL_STATUS = query.MATERIAL_STATUS;
                _initHelper.InitUpdate(materialInfo, AbpSession.USR_ID);
                _cmsMaterialMstrRepository.Update(materialInfo);
            }
            else
            {
                rm.IsSuccess = false;
                rm.msg       = "请选择操作类型";
                return(rm);
            }
            rm.IsSuccess = true;

            return(rm);
        }
 public ActionResult UpdateMaterialInfoStatus([FromBody] CmsMaterialMstrQuery query)
 {
     try
     {
         var result = _cmsMaterialMstrService.UpdateMaterialInfoStatus(query);
         if (!result.IsSuccess)
         {
             return(Fail(result.msg));
         }
         return(Success("操作成功"));
     }
     catch (Exception ex)
     {
         return(Fail(ex.Message));
     }
 }